Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow marking non-SOV DIDs as public #2144

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions aries_cloudagent/wallet/askar.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,6 @@ async def set_public_did(self, did: Union[str, DIDInfo]) -> DIDInfo:
info = did
item = None

if info.method != SOV:
raise WalletError("Setting public DID is only allowed for did:sov DIDs")

public = await self.get_public_did()
if not public or public.did != info.did:
storage = AskarStorage(self._session)
Expand Down
5 changes: 1 addition & 4 deletions aries_cloudagent/wallet/in_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
)
from .did_info import KeyInfo, DIDInfo
from .did_posture import DIDPosture
from .did_method import SOV, DIDMethod, DIDMethods
from .did_method import DIDMethod, DIDMethods
from .error import WalletError, WalletDuplicateError, WalletNotFoundError
from .key_type import KeyType
from .util import b58_to_bytes, bytes_to_b58, random_seed
Expand Down Expand Up @@ -383,9 +383,6 @@ async def set_public_did(self, did: Union[str, DIDInfo]) -> DIDInfo:
info = did
did = info.did

if info.method != SOV:
raise WalletError("Setting public DID is only allowed for did:sov DIDs")

public = await self.get_public_did()
if public and public.did == did:
info = public
Expand Down
3 changes: 0 additions & 3 deletions aries_cloudagent/wallet/indy.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,6 @@ async def set_public_did(self, did: Union[str, DIDInfo]) -> DIDInfo:
else:
info = did

if info.method != SOV:
raise WalletError("Setting public DID is only allowed for did:sov DIDs")

public = await self.get_public_did()
if not public or public.did != info.did:
if not info.metadata.get("posted"):
Expand Down
23 changes: 0 additions & 23 deletions aries_cloudagent/wallet/tests/test_in_memory_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,17 +346,6 @@ async def test_create_public_did(self, wallet: InMemoryWallet):
info_replace.did,
}

@pytest.mark.asyncio
async def test_create_public_did_x_not_sov(self, wallet: InMemoryWallet):
with pytest.raises(WalletError) as context:
await wallet.create_public_did(
KEY,
ED25519,
)
assert "Setting public DID is only allowed for did:sov DIDs" in str(
context.value
)

@pytest.mark.asyncio
async def test_create_public_did_x_unsupported_key_type_method(
self, wallet: InMemoryWallet
Expand Down Expand Up @@ -400,18 +389,6 @@ async def test_set_public_did(self, wallet: InMemoryWallet):
assert info_final.did == info_new.did
assert info_final.metadata.get("posted")

@pytest.mark.asyncio
async def test_set_public_did_x_not_sov(self, wallet: InMemoryWallet):
info = await wallet.create_local_did(
KEY,
ED25519,
)
with pytest.raises(WalletError) as context:
await wallet.set_public_did(info.did)
assert "Setting public DID is only allowed for did:sov DIDs" in str(
context.value
)

@pytest.mark.asyncio
async def test_sign_verify(self, wallet: InMemoryWallet):
info = await wallet.create_local_did(
Expand Down