Skip to content

Commit

Permalink
Merge pull request hyperledger#2737 from OpSecId/pstlouis/bump-pydid-…
Browse files Browse the repository at this point in the history
…version

bump pydid to v 0.4.3
  • Loading branch information
dbluhm committed Jan 29, 2024
2 parents 8a449a8 + d68105d commit b8fbb81
Show file tree
Hide file tree
Showing 129 changed files with 302 additions and 220 deletions.
1 change: 0 additions & 1 deletion aries_cloudagent/admin/base_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Abstract admin server interface."""


from abc import ABC, abstractmethod


Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/anoncreds/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base Registry."""

from abc import ABC, abstractmethod
from typing import Generic, Optional, Pattern, Sequence, TypeVar

Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/anoncreds/default/did_indy/registry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""DID Indy Registry."""

import logging
import re
from typing import Optional, Pattern, Sequence
Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/anoncreds/default/did_web/registry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""DID Web Registry."""

import re
from typing import Optional, Pattern, Sequence

Expand Down
13 changes: 8 additions & 5 deletions aries_cloudagent/anoncreds/default/legacy_indy/registry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Legacy Indy Registry."""

import json
import logging
import re
Expand Down Expand Up @@ -649,11 +650,13 @@ async def register_revocation_list(
revocation_list=rev_list,
),
registration_metadata={},
revocation_list_metadata={}
if seq_no is None
else {
"seqNo": seq_no,
},
revocation_list_metadata=(
{}
if seq_no is None
else {
"seqNo": seq_no,
}
),
)

async def update_revocation_list(
Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/anoncreds/models/anoncreds_cred_def.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Anoncreds cred def OpenAPI validators."""

from typing import Optional

from anoncreds import CredentialDefinition
Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/anoncreds/models/anoncreds_revocation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Anoncreds cred def OpenAPI validators."""

from typing import Any, Dict, List, Optional

from anoncreds import RevocationRegistryDefinition, RevocationStatusList
Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/anoncreds/registry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""AnonCreds Registry."""

import logging
from typing import List, Optional, Sequence

Expand Down
36 changes: 22 additions & 14 deletions aries_cloudagent/anoncreds/revocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,17 @@ async def create_and_register_revocation_list(

if not rev_reg_def_entry or not rev_reg_def_private_entry:
raise AnonCredsRevocationError(
"Missing required revocation registry data: "
"revocation registry definition"
if not rev_reg_def_entry
else "",
"revocation registry private definition"
if not rev_reg_def_private_entry
else "",
(
"Missing required revocation registry data: "
"revocation registry definition"
if not rev_reg_def_entry
else ""
),
(
"revocation registry private definition"
if not rev_reg_def_private_entry
else ""
),
)

try:
Expand Down Expand Up @@ -1114,14 +1118,18 @@ async def revoke_pending_credentials(
or not rev_reg_def_private_entry
):
raise AnonCredsRevocationError(
"Missing required revocation registry data: "
"revocation registry definition"
if not rev_reg_def_entry
else "",
(
"Missing required revocation registry data: "
"revocation registry definition"
if not rev_reg_def_entry
else ""
),
"revocation list" if not rev_list_entry else "",
"revocation registry private definition"
if not rev_reg_def_private_entry
else "",
(
"revocation registry private definition"
if not rev_reg_def_private_entry
else ""
),
)

try:
Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/anoncreds/routes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Anoncreds admin routes."""

import logging
from asyncio import shield

Expand Down
10 changes: 5 additions & 5 deletions aries_cloudagent/anoncreds/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ def indy_client_dir(subpath: str = None, create: bool = False) -> str:
home = Path.home()
target_dir = join(
home,
"Documents"
if isdir(join(home, "Documents"))
else getenv("EXTERNAL_STORAGE", "")
if system() == "Linux"
else "",
(
"Documents"
if isdir(join(home, "Documents"))
else getenv("EXTERNAL_STORAGE", "") if system() == "Linux" else ""
),
".indy_client",
subpath if subpath else "",
"", # set trailing separator
Expand Down
6 changes: 3 additions & 3 deletions aries_cloudagent/commands/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def setup_version_upgrade_config(self, path: str):
except KeyError:
pass
if "explicit_upgrade" in provided_config:
tagged_config_dict[config_id][
"explicit_upgrade"
] = provided_config.get("explicit_upgrade")
tagged_config_dict[config_id]["explicit_upgrade"] = (
provided_config.get("explicit_upgrade")
)
try:
config_key_set.remove("explicit_upgrade")
except KeyError:
Expand Down
24 changes: 12 additions & 12 deletions aries_cloudagent/config/argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,13 +783,13 @@ def get_settings(self, args: Namespace) -> dict:
if args.notify_revocation:
settings["revocation.notify"] = args.notify_revocation
if args.monitor_revocation_notification:
settings[
"revocation.monitor_notification"
] = args.monitor_revocation_notification
settings["revocation.monitor_notification"] = (
args.monitor_revocation_notification
)
if args.anoncreds_legacy_revocation:
settings[
"revocation.anoncreds_legacy_support"
] = args.anoncreds_legacy_revocation
settings["revocation.anoncreds_legacy_support"] = (
args.anoncreds_legacy_revocation
)
return settings


Expand Down Expand Up @@ -1818,9 +1818,9 @@ def get_settings(self, args: Namespace):
)

if multitenancy_config.get("key_derivation_method"):
settings[
"multitenant.key_derivation_method"
] = multitenancy_config.get("key_derivation_method")
settings["multitenant.key_derivation_method"] = (
multitenancy_config.get("key_derivation_method")
)

else:
for value_str in args.multitenancy_config:
Expand Down Expand Up @@ -1968,9 +1968,9 @@ def get_settings(self, args: Namespace):

if args.endorser_endorse_with_did:
if settings["endorser.endorser"]:
settings[
"endorser.endorser_endorse_with_did"
] = args.endorser_endorse_with_did
settings["endorser.endorser_endorse_with_did"] = (
args.endorser_endorse_with_did
)
else:
raise ArgsParseError(
"Parameter --endorser-endorse-with-did should only be set for "
Expand Down
1 change: 0 additions & 1 deletion aries_cloudagent/config/banner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Module to contain logic to generate the banner for ACA-py."""


from contextlib import contextmanager
from enum import Enum, auto
import sys
Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/config/logging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities related to logging."""

import configparser
import io
import logging
Expand Down
4 changes: 1 addition & 3 deletions aries_cloudagent/connections/models/conn_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,7 @@ def __init__(
self.their_role = (
ConnRecord.Role.get(their_role).rfc160
if isinstance(their_role, str)
else None
if their_role is None
else their_role.rfc160
else None if their_role is None else their_role.rfc160
)
self.invitation_key = invitation_key
self.invitation_msg_id = invitation_msg_id
Expand Down
9 changes: 5 additions & 4 deletions aries_cloudagent/connections/models/diddoc/diddoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
limitations under the License.
"""


import json
import logging

Expand Down Expand Up @@ -130,9 +129,11 @@ def _normalize_routing_keys(service: dict) -> dict:
routing_keys = service.get("routingKeys")
if routing_keys:
routing_keys = [
DIDKey.from_did(key).public_key_b58
if key.startswith("did:key:")
else key
(
DIDKey.from_did(key).public_key_b58
if key.startswith("did:key:")
else key
)
for key in routing_keys
]
service["routingKeys"] = routing_keys
Expand Down
1 change: 0 additions & 1 deletion aries_cloudagent/connections/models/diddoc/publickey.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
limitations under the License.
"""


from collections import namedtuple
from enum import Enum

Expand Down
5 changes: 1 addition & 4 deletions aries_cloudagent/connections/models/diddoc/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
limitations under the License.
"""


from typing import List, Sequence, Union

from .util import canon_did, canon_ref
Expand Down Expand Up @@ -65,9 +64,7 @@ def __init__(
self._recip_keys = (
[recip_keys]
if isinstance(recip_keys, PublicKey)
else list(recip_keys)
if recip_keys
else None
else list(recip_keys) if recip_keys else None
)
self._routing_keys = routing_keys or []
self._endpoint = endpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
limitations under the License.
"""


from unittest import IsolatedAsyncioTestCase

from .. import DIDDoc, PublicKey, PublicKeyType, Service
Expand Down
1 change: 0 additions & 1 deletion aries_cloudagent/connections/models/diddoc/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
limitations under the License.
"""


from base58 import b58decode
from urllib.parse import urlparse

Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/core/in_memory/profile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Manage in-memory profile interaction."""

from collections import OrderedDict
from typing import Any, Mapping, Type
from weakref import ref
Expand Down
24 changes: 12 additions & 12 deletions aries_cloudagent/indy/models/tests/test_pres_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,14 @@ async def test_to_indy_proof_request_revo_default_interval(self):

for uuid, attr_spec in indy_proof_req_revo["requested_attributes"].items():
assert set(attr_spec.get("non_revoked", {}).keys()) == {"from", "to"}
copy_indy_proof_req["requested_attributes"][uuid][
"non_revoked"
] = attr_spec["non_revoked"]
copy_indy_proof_req["requested_attributes"][uuid]["non_revoked"] = (
attr_spec["non_revoked"]
)
for uuid, pred_spec in indy_proof_req_revo["requested_predicates"].items():
assert set(pred_spec.get("non_revoked", {}).keys()) == {"from", "to"}
copy_indy_proof_req["requested_predicates"][uuid][
"non_revoked"
] = pred_spec["non_revoked"]
copy_indy_proof_req["requested_predicates"][uuid]["non_revoked"] = (
pred_spec["non_revoked"]
)

assert copy_indy_proof_req == indy_proof_req_revo

Expand Down Expand Up @@ -471,14 +471,14 @@ async def test_to_indy_proof_request_revo(self):

for uuid, attr_spec in indy_proof_req_revo["requested_attributes"].items():
assert set(attr_spec.get("non_revoked", {}).keys()) == {"from", "to"}
copy_indy_proof_req["requested_attributes"][uuid][
"non_revoked"
] = attr_spec["non_revoked"]
copy_indy_proof_req["requested_attributes"][uuid]["non_revoked"] = (
attr_spec["non_revoked"]
)
for uuid, pred_spec in indy_proof_req_revo["requested_predicates"].items():
assert set(pred_spec.get("non_revoked", {}).keys()) == {"from", "to"}
copy_indy_proof_req["requested_predicates"][uuid][
"non_revoked"
] = pred_spec["non_revoked"]
copy_indy_proof_req["requested_predicates"][uuid]["non_revoked"] = (
pred_spec["non_revoked"]
)

assert copy_indy_proof_req == indy_proof_req_revo

Expand Down
6 changes: 3 additions & 3 deletions aries_cloudagent/indy/sdk/tests/test_verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ async def test_check_pred_names_tamper_pred_req_attr(self, mock_verify):
@mock.patch("indy.anoncreds.verifier_verify_proof")
async def test_check_pred_names_tamper_attr_groups(self, mock_verify):
INDY_PROOF_X = deepcopy(INDY_PROOF_PRED_NAMES)
INDY_PROOF_X["requested_proof"]["revealed_attr_groups"][
"x_uuid"
] = INDY_PROOF_X["requested_proof"]["revealed_attr_groups"].pop("18_uuid")
INDY_PROOF_X["requested_proof"]["revealed_attr_groups"]["x_uuid"] = (
INDY_PROOF_X["requested_proof"]["revealed_attr_groups"].pop("18_uuid")
)
with mock.patch.object(
IndyLedgerRequestsExecutor, "get_ledger_for_identifier"
) as mock_get_ledger:
Expand Down
10 changes: 5 additions & 5 deletions aries_cloudagent/indy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ def indy_client_dir(subpath: str = None, create: bool = False) -> str:
home = Path.home()
target_dir = join(
home,
"Documents"
if isdir(join(home, "Documents"))
else getenv("EXTERNAL_STORAGE", "")
if system() == "Linux"
else "",
(
"Documents"
if isdir(join(home, "Documents"))
else getenv("EXTERNAL_STORAGE", "") if system() == "Linux" else ""
),
".indy_client",
subpath if subpath else "",
"", # set trailing separator
Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/ledger/merkel_validation/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constants for State Proof and LeafHash Inclusion Verification."""

ALL_ATR_KEYS = ["raw", "enc", "hash"]
LAST_SEQ_NO = "lsn"
VALUE = "value"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for Processing Replies to Domain Read Requests."""

import base58
import base64
import hashlib
Expand Down
1 change: 1 addition & 0 deletions aries_cloudagent/ledger/merkel_validation/hasher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Merkle tree hasher for leaf and children nodes."""

import hashlib

from binascii import hexlify, unhexlify
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Verify Leaf Inclusion."""

from .hasher import TreeHasher


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for Domain Txn Handling Utils."""

import base58
import json

Expand Down
Loading

0 comments on commit b8fbb81

Please sign in to comment.