From 811ac68c99821dcfd3e2f599dcce040e925853f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emiliano=20Su=C3=B1=C3=A9?= Date: Mon, 25 Mar 2024 10:42:40 -0700 Subject: [PATCH] Tweaks to DID fetching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Emiliano Suñé --- docker/manage | 4 ++-- docs/ConfigurationGuide.md | 2 +- oidc-controller/api/routers/oidc.py | 15 +++++---------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/docker/manage b/docker/manage index d37e8fbe..832aa427 100755 --- a/docker/manage +++ b/docker/manage @@ -174,8 +174,8 @@ configureEnvironment() { #controller app settings export SET_NON_REVOKED="True" - export USE_OOB_PRESENT_PROOF=${USE_OOB_PRESENT_PROOF:-"True"} - export USE_OOB_LOCAL_DID_SERVICE=${USE_OOB_LOCAL_DID_SERVICE:-"True"} + export USE_OOB_PRESENT_PROOF=${USE_OOB_PRESENT_PROOF:-"false"} + export USE_OOB_LOCAL_DID_SERVICE=${USE_OOB_LOCAL_DID_SERVICE:-"true"} # agent export AGENT_TENANT_MODE="${AGENT_TENANT_MODE:-single}" diff --git a/docs/ConfigurationGuide.md b/docs/ConfigurationGuide.md index 7378e7d3..c358cbd2 100644 --- a/docs/ConfigurationGuide.md +++ b/docs/ConfigurationGuide.md @@ -78,7 +78,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, useful if 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_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. | | 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 | diff --git a/oidc-controller/api/routers/oidc.py b/oidc-controller/api/routers/oidc.py index 27407808..da141841 100644 --- a/oidc-controller/api/routers/oidc.py +++ b/oidc-controller/api/routers/oidc.py @@ -1,9 +1,9 @@ import base64 import io import json -from typing import cast import uuid from datetime import datetime +from typing import cast from urllib.parse import urlencode import qrcode @@ -116,11 +116,9 @@ async def get_authorize(request: Request, db: Database = Depends(get_db)): response = client.create_presentation_request(ver_config.generate_proof_request()) pres_exch_dict = response.dict() - # Prepeare the presentation request + # Prepeare the presentation request client = AcapyClient() - use_public_did = ( - not settings.USE_OOB_PRESENT_PROOF - ) and settings.USE_OOB_LOCAL_DID_SERVICE + use_public_did = not settings.USE_OOB_LOCAL_DID_SERVICE wallet_did = client.get_wallet_did(public=use_public_did) byo_attachment = PresentProofv10Attachment.build( @@ -135,7 +133,6 @@ async def get_authorize(request: Request, db: Database = Depends(get_db)): recipient_keys=[wallet_did.verkey], ).dict() else: - wallet_did = client.get_wallet_did(public=True) oob_s_d = wallet_did.verkey msg = PresentationRequestMessage( @@ -163,9 +160,8 @@ async def get_authorize(request: Request, db: Database = Depends(get_db)): service=s_d, ) msg_contents = msg - - - # Create and save OIDC AuthSession + + # Create and save OIDC AuthSession new_auth_session = AuthSessionCreate( response_url=authn_response.request(auth_req["redirect_uri"]), pyop_auth_code=authn_response["code"], @@ -195,7 +191,6 @@ async def get_authorize(request: Request, db: Database = Depends(get_db)): base64_msg = base64.b64encode(formated_msg.encode("utf-8")).decode("utf-8") wallet_deep_link = f"bcwallet://aries_proof-request?c_i={base64_msg}" - # This is the payload to send to the template data = { "image_contents": image_contents,