Skip to content

Commit

Permalink
Merge pull request #2144 from sicpa-dlab/feature/allow-non-sov-public…
Browse files Browse the repository at this point in the history
…ation

feat: allow marking non-SOV DIDs as public
  • Loading branch information
ianco authored Mar 1, 2023
2 parents c450a92 + 172b6f5 commit 9300ac9
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 33 deletions.
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

0 comments on commit 9300ac9

Please sign in to comment.