Skip to content

Commit e3dcabf

Browse files
ff137swcurran
andauthored
🐛 Fix reading expected key in TAA (openwallet-foundation#3693)
* 🎨 Fix type hints Signed-off-by: ff137 <[email protected]> * 🐛 Handle TAA response missing expected key Signed-off-by: ff137 <[email protected]> --------- Signed-off-by: ff137 <[email protected]> Co-authored-by: Stephen Curran <[email protected]>
1 parent e20a860 commit e3dcabf

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

acapy_agent/config/ledger.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ async def ledger_config(
158158
if taa_info["taa_required"] and public_did:
159159
LOGGER.debug("TAA acceptance required")
160160
taa_accepted = await ledger.get_latest_txn_author_acceptance()
161-
digest_match = taa_info["taa_record"]["digest"] == taa_accepted["digest"]
161+
162+
taa_record_digest = taa_info["taa_record"]["digest"] # keys exist
163+
taa_accepted_digest = taa_accepted.get("digest") # key might not exist
164+
165+
digest_match = taa_record_digest == taa_accepted_digest
162166
if not taa_accepted or not digest_match:
163167
LOGGER.info("TAA acceptance needed - performing acceptance")
164168
if not await accept_taa(ledger, profile, taa_info, provision):

acapy_agent/ledger/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ async def get_wallet_public_did(self) -> DIDInfo:
179179
"""Fetch the public DID from the wallet."""
180180

181181
@abstractmethod
182-
async def get_txn_author_agreement(self, reload: bool = False):
182+
async def get_txn_author_agreement(self, reload: bool = False) -> dict:
183183
"""Get the current transaction author agreement, fetching it if necessary."""
184184

185185
@abstractmethod
186-
async def fetch_txn_author_agreement(self):
186+
async def fetch_txn_author_agreement(self) -> dict:
187187
"""Fetch the current AML and TAA from the ledger."""
188188

189189
@abstractmethod
@@ -193,7 +193,7 @@ async def accept_txn_author_agreement(
193193
"""Save a new record recording the acceptance of the TAA."""
194194

195195
@abstractmethod
196-
async def get_latest_txn_author_acceptance(self):
196+
async def get_latest_txn_author_acceptance(self) -> dict:
197197
"""Look up the latest TAA acceptance."""
198198

199199
def taa_digest(self, version: str, text: str):

acapy_agent/ledger/indy_vdr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def __init__(
101101
self.genesis_hash_cache: Optional[str] = None
102102
self.genesis_txns_cache = genesis_transactions
103103
self.init_config = bool(genesis_transactions)
104-
self.taa_cache: Optional[str] = None
104+
self.taa_cache: Optional[dict] = None
105105
self.read_only: bool = read_only
106106
self.socks_proxy: str = socks_proxy
107107

0 commit comments

Comments
 (0)