diff --git a/acapy_agent/messaging/tests/test_valid.py b/acapy_agent/messaging/tests/test_valid.py index b99737c4a8..65d8986e8a 100644 --- a/acapy_agent/messaging/tests/test_valid.py +++ b/acapy_agent/messaging/tests/test_valid.py @@ -12,7 +12,7 @@ CREDENTIAL_TYPE_VALIDATE, DID_KEY_VALIDATE, DID_POSTURE_VALIDATE, - DID_TDW_VALIDATE, + DID_WEBVH_VALIDATE, ENDPOINT_TYPE_VALIDATE, ENDPOINT_VALIDATE, INDY_CRED_DEF_ID_VALIDATE, @@ -115,23 +115,23 @@ def test_indy_did(self): INDY_DID_VALIDATE("Q4zqM7aXqm7gDQkUVLng9h") INDY_DID_VALIDATE("did:sov:Q4zqM7aXqm7gDQkUVLng9h") - def test_tdw_did(self): - valid_tdw_dids = [ - "did:tdw:QmUchSB5f5DJQks9CeyLJjhAy4iKJcYzRyiuYq3sjV13px:example.com", - "did:tdw:QmZiKXwQVfyZVuvCsuHpQh4arSUpEmeVVRvSfv3uiEycSr:example.com%3A5000", + def test_webvh_did(self): + valid_webvh_dids = [ + "did:webvh:QmUchSB5f5DJQks9CeyLJjhAy4iKJcYzRyiuYq3sjV13px:example.com", + "did:webvh:QmZiKXwQVfyZVuvCsuHpQh4arSUpEmeVVRvSfv3uiEycSr:example.com%3A5000", ] - for valid_tdw_did in valid_tdw_dids: - DID_TDW_VALIDATE(valid_tdw_did) + for valid_webvh_did in valid_webvh_dids: + DID_WEBVH_VALIDATE(valid_webvh_did) - non_valid_tdw_dids = [ + non_valid_webvh_dids = [ "did:web:QmUchSB5f5DJQks9CeyLJjhAy4iKJcYzRyiuYq3sjV13px", # Did urls are not allowed - "did:tdw:QmP9VWaTCHcyztDpRj9XSHvZbmYe3m9HZ61KoDtZgWaXVU:example.com%3A5000#z6MkkzY9skorPaoEbCJFKUo7thD8Yb8MBs28aJRopf1TUo9V", - "did:tdw:QmZiKXwQVfyZVuvCsuHpQh4arSUpEmeVVRvSfv3uiEycSr:example.com%3A5000/whois", + "did:webvh:QmP9VWaTCHcyztDpRj9XSHvZbmYe3m9HZ61KoDtZgWaXVU:example.com%3A5000#z6MkkzY9skorPaoEbCJFKUo7thD8Yb8MBs28aJRopf1TUo9V", + "did:webvh:QmZiKXwQVfyZVuvCsuHpQh4arSUpEmeVVRvSfv3uiEycSr:example.com%3A5000/whois", ] - for non_valid_tdw_did in non_valid_tdw_dids: + for non_valid_webvh_did in non_valid_webvh_dids: with self.assertRaises(ValidationError): - DID_TDW_VALIDATE(non_valid_tdw_did) + DID_WEBVH_VALIDATE(non_valid_webvh_did) def test_indy_raw_public_key(self): non_indy_raw_public_keys = [ diff --git a/acapy_agent/messaging/valid.py b/acapy_agent/messaging/valid.py index 3089fd25ff..879a0bd255 100644 --- a/acapy_agent/messaging/valid.py +++ b/acapy_agent/messaging/valid.py @@ -319,17 +319,19 @@ def __init__(self): ) -class DIDTdw(Regexp): - """Validate value against did:tdw specification.""" +class DIDWebvh(Regexp): + """Validate value against did:webvh specification.""" - EXAMPLE = "did:tdw:QmP9VWaTCHcyztDpRj9XSHvZbmYe3m9HZ61KoDtZgWaXVU:example.com%3A5000" - PATTERN = re.compile(r"^(did:tdw:)([a-zA-Z0-9%._-]*:)*[a-zA-Z0-9%._-]+$") + EXAMPLE = ( + "did:webvh:QmP9VWaTCHcyztDpRj9XSHvZbmYe3m9HZ61KoDtZgWaXVU:example.com%3A5000" + ) + PATTERN = re.compile(r"^(did:webvh:)([a-zA-Z0-9%._-]*:)*[a-zA-Z0-9%._-]+$") def __init__(self): """Initialize the instance.""" super().__init__( - DIDTdw.PATTERN, error="Value {input} is not in W3C did:tdw format" + DIDWebvh.PATTERN, error="Value {input} is not in W3C did:webvh format" ) @@ -1017,8 +1019,8 @@ def __init__( DID_WEB_VALIDATE = DIDWeb() DID_WEB_EXAMPLE = DIDWeb.EXAMPLE -DID_TDW_VALIDATE = DIDTdw() -DID_TDW_EXAMPLE = DIDTdw.EXAMPLE +DID_WEBVH_VALIDATE = DIDWebvh() +DID_WEBVH_EXAMPLE = DIDWebvh.EXAMPLE ROUTING_KEY_VALIDATE = RoutingKey() ROUTING_KEY_EXAMPLE = RoutingKey.EXAMPLE diff --git a/acapy_agent/resolver/__init__.py b/acapy_agent/resolver/__init__.py index 3998b3da1c..8ebc39028b 100644 --- a/acapy_agent/resolver/__init__.py +++ b/acapy_agent/resolver/__init__.py @@ -49,11 +49,11 @@ async def setup(context: InjectionContext): await web_resolver.setup(context) registry.register_resolver(web_resolver) - tdw_resolver = ClassProvider( - "acapy_agent.resolver.default.tdw.TdwDIDResolver" + webvh_resolver = ClassProvider( + "acapy_agent.resolver.default.webvh.WebvhDIDResolver" ).provide(context.settings, context.injector) - await tdw_resolver.setup(context) - registry.register_resolver(tdw_resolver) + await webvh_resolver.setup(context) + registry.register_resolver(webvh_resolver) if context.settings.get("resolver.universal"): universal_resolver = ClassProvider( diff --git a/acapy_agent/resolver/default/tests/test_tdw.py b/acapy_agent/resolver/default/tests/test_webvh.py similarity index 56% rename from acapy_agent/resolver/default/tests/test_tdw.py rename to acapy_agent/resolver/default/tests/test_webvh.py index 8829b9f031..878843efc1 100644 --- a/acapy_agent/resolver/default/tests/test_tdw.py +++ b/acapy_agent/resolver/default/tests/test_webvh.py @@ -1,17 +1,17 @@ import pytest from ....core.profile import Profile -from ....messaging.valid import DIDTdw +from ....messaging.valid import DIDWebvh from ....utils.testing import create_test_profile -from ..tdw import TdwDIDResolver +from ..webvh import WebvhDIDResolver -TEST_DID = "did:tdw:Qma6mc1qZw3NqxwX6SB5GPQYzP4pGN2nXD15Jwi4bcDBKu:domain.example" +TEST_DID = "did:webvh:Qma6mc1qZw3NqxwX6SB5GPQYzP4pGN2nXD15Jwi4bcDBKu:domain.example" @pytest.fixture def resolver(): """Resolver fixture.""" - yield TdwDIDResolver() + yield WebvhDIDResolver() @pytest.fixture @@ -21,9 +21,9 @@ async def profile(): @pytest.mark.asyncio -async def test_supported_did_regex(profile, resolver: TdwDIDResolver): +async def test_supported_did_regex(profile, resolver: WebvhDIDResolver): """Test the supported_did_regex.""" - assert resolver.supported_did_regex == DIDTdw.PATTERN + assert resolver.supported_did_regex == DIDWebvh.PATTERN assert await resolver.supports( profile, TEST_DID, @@ -31,6 +31,6 @@ async def test_supported_did_regex(profile, resolver: TdwDIDResolver): @pytest.mark.asyncio -async def test_resolve(resolver: TdwDIDResolver, profile: Profile): +async def test_resolve(resolver: WebvhDIDResolver, profile: Profile): """Test resolve method.""" assert await resolver.resolve(profile, TEST_DID) diff --git a/acapy_agent/resolver/default/tdw.py b/acapy_agent/resolver/default/webvh.py similarity index 60% rename from acapy_agent/resolver/default/tdw.py rename to acapy_agent/resolver/default/webvh.py index 4aabd198e8..de4f72e64b 100644 --- a/acapy_agent/resolver/default/tdw.py +++ b/acapy_agent/resolver/default/webvh.py @@ -1,38 +1,38 @@ -"""TDW DID Resolver. +"""WEBVH DID Resolver. -Resolution is performed by the did_tdw library. +Resolution is performed by the did_webvh library. """ from re import Pattern from typing import Optional, Sequence, Text -from did_tdw.resolver import ResolutionResult, resolve_did +from did_webvh.resolver import ResolutionResult, resolve_did from ...config.injection_context import InjectionContext from ...core.profile import Profile -from ...messaging.valid import DIDTdw +from ...messaging.valid import DIDWebvh from ..base import BaseDIDResolver, ResolverType -class TdwDIDResolver(BaseDIDResolver): - """TDW DID Resolver.""" +class WebvhDIDResolver(BaseDIDResolver): + """WEBVH DID Resolver.""" def __init__(self): - """Initialize the TDW DID Resolver.""" + """Initialize the WEBVH DID Resolver.""" super().__init__(ResolverType.NATIVE) async def setup(self, context: InjectionContext): - """Perform required setup for TDW DID resolution.""" + """Perform required setup for WEBVH DID resolution.""" @property def supported_did_regex(self) -> Pattern: - """Return supported DID regex of TDW DID Resolver.""" - return DIDTdw.PATTERN + """Return supported DID regex of WEBVH DID Resolver.""" + return DIDWebvh.PATTERN async def _resolve( self, profile: Profile, did: str, service_accept: Optional[Sequence[Text]] = None ) -> dict: - """Resolve DID using TDW.""" + """Resolve DID using WEBVH.""" response: ResolutionResult = await resolve_did(did) if response.resolution_metadata and response.resolution_metadata.get("error"): return response.resolution_metadata diff --git a/acapy_agent/wallet/did_method.py b/acapy_agent/wallet/did_method.py index 2acf670837..d117d563ab 100644 --- a/acapy_agent/wallet/did_method.py +++ b/acapy_agent/wallet/did_method.py @@ -90,8 +90,8 @@ def holder_defined_did(self) -> HolderDefinedDid: holder_defined_did=HolderDefinedDid.NO, ) -TDW = DIDMethod( - name="tdw", +WEBVH = DIDMethod( + name="webvh", key_types=[ED25519, X25519], rotation=False, holder_defined_did=HolderDefinedDid.NO, @@ -109,7 +109,7 @@ def __init__(self) -> None: WEB.method_name: WEB, PEER2.method_name: PEER2, PEER4.method_name: PEER4, - TDW.method_name: TDW, + WEBVH.method_name: WEBVH, } def registered(self, method: str) -> bool: diff --git a/poetry.lock b/poetry.lock index 55d250637b..8ac51d3cb0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.5 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "aiofiles" @@ -673,6 +673,7 @@ files = [ {file = "cryptography-44.0.0-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:761817a3377ef15ac23cd7834715081791d4ec77f9297ee694ca1ee9c2c7e5eb"}, {file = "cryptography-44.0.0-cp37-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:3c672a53c0fb4725a29c303be906d3c1fa99c32f58abe008a82705f9ee96f40b"}, {file = "cryptography-44.0.0-cp37-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:4ac4c9f37eba52cb6fbeaf5b59c152ea976726b865bd4cf87883a7e7006cc543"}, + {file = "cryptography-44.0.0-cp37-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:60eb32934076fa07e4316b7b2742fa52cbb190b42c2df2863dbc4230a0a9b385"}, {file = "cryptography-44.0.0-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:ed3534eb1090483c96178fcb0f8893719d96d5274dfde98aa6add34614e97c8e"}, {file = "cryptography-44.0.0-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:f3f6fdfa89ee2d9d496e2c087cebef9d4fcbb0ad63c40e821b39f74bf48d9c5e"}, {file = "cryptography-44.0.0-cp37-abi3-win32.whl", hash = "sha256:eb33480f1bad5b78233b0ad3e1b0be21e8ef1da745d8d2aecbb20671658b9053"}, @@ -683,6 +684,7 @@ files = [ {file = "cryptography-44.0.0-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:c5eb858beed7835e5ad1faba59e865109f3e52b3783b9ac21e7e47dc5554e289"}, {file = "cryptography-44.0.0-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:f53c2c87e0fb4b0c00fa9571082a057e37690a8f12233306161c8f4b819960b7"}, {file = "cryptography-44.0.0-cp39-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:9e6fc8a08e116fb7c7dd1f040074c9d7b51d74a8ea40d4df2fc7aa08b76b9e6c"}, + {file = "cryptography-44.0.0-cp39-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:9abcc2e083cbe8dde89124a47e5e53ec38751f0d7dfd36801008f316a127d7ba"}, {file = "cryptography-44.0.0-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:d2436114e46b36d00f8b72ff57e598978b37399d2786fd39793c36c6d5cb1c64"}, {file = "cryptography-44.0.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a01956ddfa0a6790d594f5b34fc1bfa6098aca434696a03cfdbe469b8ed79285"}, {file = "cryptography-44.0.0-cp39-abi3-win32.whl", hash = "sha256:eca27345e1214d1b9f9490d200f9db5a874479be914199194e746c893788d417"}, @@ -885,14 +887,14 @@ files = [ base58 = ">=2.1.1" [[package]] -name = "did-tdw" +name = "did-webvh" version = "0.2.1" -description = "This repository includes Python libraries for working with `did:tdw` (Trust DID Web) DID documents and the underlying log format." +description = "This repository includes Python libraries for working with `did:webvh` (did:web + Verified History) DID documents and the underlying log format." optional = false python-versions = "<4.0,>=3.10" files = [ - {file = "did_tdw-0.2.1-py3-none-any.whl", hash = "sha256:80c727d0bef37e2211d3caddb97ba3c4aa508c67d4ef502da5f326d9bf4c3ffb"}, - {file = "did_tdw-0.2.1.tar.gz", hash = "sha256:a61ed9f49369ea4c365e5e380431feae8cb3988375de37f73be2abe15d0bfde6"}, + {file = "did_webvh-0.2.1-py3-none-any.whl", hash = "sha256:4c4a84d3c7bda8d82eed1cb181dea1fc0fe4c23d6fe65e3622ff7f61dd7688a3"}, + {file = "did_webvh-0.2.1.tar.gz", hash = "sha256:2e731a594d9b7ff509f70d2595f1435873985b29ce2a489e98ead1a872264892"}, ] [package.dependencies] @@ -3083,4 +3085,4 @@ didcommv2 = ["didcomm-messaging"] [metadata] lock-version = "2.0" python-versions = "^3.12" -content-hash = "e29accbd2ad4dfd1363cab3b4b35fafdef5f3759e58e8e0623a5eac9eed6f276" +content-hash = "f0850ad971a9428d888a656db1bef42a91e195e4fd02973cd82df6239d246f46" diff --git a/pyproject.toml b/pyproject.toml index fa6b1e4141..90e3ec4941 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ uuid_utils = "^0.10.0" # did libraries did-peer-2 = "^0.1.2" did-peer-4 = "^0.1.4" -did-tdw = "^0.2.1" +did-webvh = "^0.2.1" # Verifiable Credentials indy-credx = "~1.1.1"