Skip to content

Commit

Permalink
Merge pull request #557 from bcgov/feature/deepLinkUrl
Browse files Browse the repository at this point in the history
Support upcoming ?_url handler in wallet
  • Loading branch information
loneil authored Jun 21, 2024
2 parents 44b9ad3 + 1ce1acf commit 545aad8
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 42 deletions.
1 change: 1 addition & 0 deletions charts/vc-authn-oidc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ kubectl delete secret,pvc --selector "app.kubernetes.io/instance"=my-release
| `setNonRevoked` | if True, the `non_revoked` attributed will be added to each of the present-proof request `requested_attribute` and `requested_predicate` with 'from=0' and'to=`int(time.time())` | `true` |
| `useOobPresentProof` | if True, the present-proof request will be provided as a an [out of band](https://github.com/hyperledger/aries-rfcs/tree/main/features/0434-outofband) invitation with a [present-proof](https://github.com/hyperledger/aries-rfcs/tree/main/features/0037-present-proof) request inside. If False, the present-proof request will be use the [service-decorator](https://github.com/hyperledger/aries-rfcs/tree/main/features/0056-service-decorator) | `false` |
| `useOobLocalDIDService` | | `false` |
| `useUrlDeepLink` | if True, will use the new encoded URL (`didcomm://?_url={redirect URL}`) redirect form of the deep link | `false` |
| `controllerCameraRedirectUrl` | The redirect url can be a web link or the name of a template | `wallet_howto` |
| `controllerPresentationExpireTime` | The number of time in seconds a proof request will be valid for | `300` |
| `useHTTPS` | Prepend Agent and Admin URLs with `https` | `true` |
Expand Down
2 changes: 2 additions & 0 deletions charts/vc-authn-oidc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ spec:
value: {{ include "acapy.internal.admin.url" . }}
- name: USE_OOB_PRESENT_PROOF
value: {{ .Values.useOobPresentProof | quote }}
- name: USE_URL_DEEP_LINK
value: {{ .Values.useUrlDeepLink | quote }}
- name: SET_NON_REVOKED
value: {{ .Values.setNonRevoked | quote }}
- name: ACAPY_TENANCY
Expand Down
2 changes: 2 additions & 0 deletions charts/vc-authn-oidc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ setNonRevoked: true
useOobPresentProof: false
## @param useOobLocalDIDService
useOobLocalDIDService: false
## @param useUrlDeepLink if True, will use the new encoded URL (didcomm://?_url={redirect URL}) redirect form of the deep link
useUrlDeepLink: false
## @param controllerCameraRedirectUrl The redirect url can be a web link or the name of a template
controllerCameraRedirectUrl: wallet_howto
## @param controllerPresentationExpireTime The number of time in seconds a proof request will be valid for
Expand Down
42 changes: 21 additions & 21 deletions demo/vue/app/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions demo/vue/app/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"eslint-plugin-vue": "^9.26.0",
"eslint-plugin-vuetify": "^1.1.0",
"lodash": "^4.17.21",
"prettier": "^3.3.1",
"sass": "^1.77.4",
"prettier": "^3.3.2",
"sass": "^1.77.6",
"sass-loader": "^14.2.1",
"vue-cli-plugin-vuetify": "^2.5.8",
"vue-template-compiler": "^2.7.16",
Expand Down
22 changes: 11 additions & 11 deletions demo/vue/app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion demo/vue/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"fs-extra": "^11.2.0",
"js-yaml": "^4.1.0",
"jsonwebtoken": "^9.0.2",
"keycloak-connect": "^24.0.5",
"keycloak-connect": "^25.0.0",
"winston": "^3.13.0",
"winston-transport": "^4.7.0"
},
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ services:
- ST_ACAPY_ADMIN_API_KEY_NAME=${ST_ACAPY_ADMIN_API_KEY_NAME}
- USE_OOB_PRESENT_PROOF=${USE_OOB_PRESENT_PROOF}
- USE_OOB_LOCAL_DID_SERVICE=${USE_OOB_LOCAL_DID_SERVICE}
- USE_URL_DEEP_LINK=${USE_URL_DEEP_LINK}
ports:
- ${CONTROLLER_SERVICE_PORT}:5000
- 5678:5678
Expand Down
1 change: 1 addition & 0 deletions docker/manage
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ configureEnvironment() {
export SET_NON_REVOKED="True"
export USE_OOB_PRESENT_PROOF=${USE_OOB_PRESENT_PROOF:-"false"}
export USE_OOB_LOCAL_DID_SERVICE=${USE_OOB_LOCAL_DID_SERVICE:-"true"}
export USE_URL_DEEP_LINK=${USE_URL_DEEP_LINK:-"false"}

# agent
export AGENT_TENANT_MODE="${AGENT_TENANT_MODE:-single}"
Expand Down
1 change: 1 addition & 0 deletions docs/ConfigurationGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Several functions in VC-AuthN can be tweaked by using the following environment
| SET_NON_REVOKED | bool | if True, the `non_revoked` attributed will be added to each of the present-proof request `requested_attribute` and `requested_predicate` with 'from=0' and'to=`int(time.time())` | |
| USE_OOB_PRESENT_PROOF | bool | if True, the present-proof request will be provided as a an [out of band](https://github.com/hyperledger/aries-rfcs/tree/main/features/0434-outofband) invitation with a [present-proof](https://github.com/hyperledger/aries-rfcs/tree/main/features/0037-present-proof) request inside. If False, the present-proof request will be use the [service-decorator](https://github.com/hyperledger/aries-rfcs/tree/main/features/0056-service-decorator) | **TRUE:** BC Wallet supports our OOB Message with a minor glitch, BiFold, Lissi, Trinsic, and Estatus all read the QR code as 'Invalid' |
| USE_OOB_LOCAL_DID_SERVICE | bool | Instructs VC-AuthN to use a local DID, it must be used when the agent service is not registered on the ledger with a public DID | Use this when `ACAPY_WALLET_LOCAL_DID` is set to `true` in the agent. |
| USE_URL_DEEP_LINK | bool | If True, in Mobile mode the BC Wallet deep link will use an encoded URL (`didcomm://?_url={redirect URL}`), otherwise will use the encoded connection (`bcwallet://aries_proof-request?c_i={connection payload}`) | Default False/.. To control using the new `?_url` handler, which is not in a public release of BC Wallet yet |
| LOG_WITH_JSON | bool | If True, logging output should printed as JSON if False it will be pretty printed. | Default behavior will print as JSON. |
| LOG_TIMESTAMP_FORMAT | string | determines the timestamp formatting used in logs | Default is "iso" |
| LOG_LEVEL | "DEBUG", "INFO", "WARNING", or "ERROR" | sets the minimum log level that will be printed to standard out | Defaults to DEBUG |
Expand Down
1 change: 1 addition & 0 deletions oidc-controller/api/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class GlobalConfig(BaseSettings):
USE_OOB_LOCAL_DID_SERVICE: bool = strtobool(
os.environ.get("USE_OOB_LOCAL_DID_SERVICE", True)
)
USE_URL_DEEP_LINK: bool = strtobool(os.environ.get("USE_URL_DEEP_LINK", False))
SET_NON_REVOKED: bool = strtobool(os.environ.get("SET_NON_REVOKED", True))

model_config = ConfigDict(case_sensitive=True)
Expand Down
10 changes: 7 additions & 3 deletions oidc-controller/api/routers/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,13 @@ async def get_authorize(request: Request, db: Database = Depends(get_db)):
callback_url = f"""{controller_host}{AuthorizeCallbackUri}?pid={auth_session.id}"""

# BC Wallet deep link
# base64 encode the formated_msg
base64_msg = base64.b64encode(formated_msg.encode("utf-8")).decode("utf-8")
wallet_deep_link = f"bcwallet://aries_proof-request?c_i={base64_msg}"
if settings.USE_URL_DEEP_LINK:
suffix = (
f'_url={base64.b64encode(url_to_message.encode("utf-8")).decode("utf-8")}'
)
else:
suffix = f'c_i={base64.b64encode(formated_msg.encode("utf-8")).decode("utf-8")}'
wallet_deep_link = f"bcwallet://aries_proof-request?{suffix}"

# This is the payload to send to the template
data = {
Expand Down
6 changes: 5 additions & 1 deletion oidc-controller/api/templates/verified_credentials.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@
<div id="app">
<div v-cloak class="d-flex flex-column vh-100">
<nav class="navbar">
<img src="static/img/header-logo.svg" alt="Logo" />
<img
src="static/img/header-logo.svg"
alt="Logo"
v-on:click="bcIdClicks++"
/>
</nav>

<main class="container flex-fill mt-4 text-center">
Expand Down
4 changes: 2 additions & 2 deletions oidc-controller/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
black==24.4.2
flake8==7.0.0
flake8==7.1.0
mock==5.1.0
mongomock==4.1.2
pytest-asyncio==0.23.7
pytest-cov==5.0.0
pytest==8.2.2
requests-mock==1.12.1
setuptools==70.0.0
setuptools==70.1.0
2 changes: 1 addition & 1 deletion oidc-controller/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ structlog==24.2.0
uvicorn[standard]==0.30.1
python-socketio==5.11.2 # required to run websockets
canonicaljson==2.0.0 # used to provide unique consistent user identifiers
pydantic-settings==2.3.1
pydantic-settings==2.3.3

0 comments on commit 545aad8

Please sign in to comment.