Skip to content

Commit

Permalink
Merge pull request openwallet-foundation#109 from Indicio-tech/featur…
Browse files Browse the repository at this point in the history
…e/anoncreds-admin-api

anoncreds admin api
  • Loading branch information
dbluhm authored Mar 16, 2023
2 parents 092b2f4 + 162ca2d commit 5271e1c
Show file tree
Hide file tree
Showing 16 changed files with 981 additions and 145 deletions.
18 changes: 9 additions & 9 deletions aries_cloudagent/anoncreds/anoncreds/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ async def setup(context: InjectionContext):
indy_registry = ClassProvider(
"aries_cloudagent.anoncreds.anoncreds.default.did_indy_registry.registry"
".DIDIndyRegistry",
supported_identifiers=[],
method_name="did:indy",
#supported_identifiers=[],
#method_name="did:indy",
).provide(context.settings, context.injector)
await indy_registry.setup(context)
registry.register_registry(indy_registry)
registry.register(indy_registry)

web_registry = ClassProvider(
"aries_cloudagent.anoncreds.anoncreds.default.did_web_registry.registry"
".DIDWebRegistry",
supported_identifiers=[],
method_name="did:web",
#supported_identifiers=[],
#method_name="did:web",
).provide(context.settings, context.injector)
await web_registry.setup(context)
registry.register_registry(web_registry)
registry.register(web_registry)

legacy_indy_registry = ClassProvider(
"aries_cloudagent.anoncreds.anoncreds.default.legacy_indy_registry.registry"
".LegacyIndyRegistry",
supported_identifiers=[],
method_name="",
#supported_identifiers=[],
#method_name="",
).provide(context.settings, context.injector)
await legacy_indy_registry.setup(context)
registry.register_registry(legacy_indy_registry)
registry.register(legacy_indy_registry)

# TODO: add context.settings
27 changes: 13 additions & 14 deletions aries_cloudagent/anoncreds/anoncreds/anoncreds_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@
from typing import List, Optional

from ...config.injection_context import InjectionContext
from .base_registry import (
AnonCredsObjectNotFound,
AnonCredsRegistrationFailed,
BaseAnonCredsError,
BaseAnonCredsHandler,
BaseAnonCredsRegistrar,
BaseAnonCredsResolver,
)
from .models import (
from ..models.anoncreds_cred_def import (
AnonCredsRegistryGetCredentialDefinition,
AnonCredsRegistryGetRevocationList,
AnonCredsRegistryGetRevocationRegistryDefinition,
AnonCredsRegistryGetSchema,
)

AnonCredsRegistryGetRevocationRegistryDefinition)
from ..models.anoncreds_schema import AnonCredsRegistryGetSchema
from .base_registry import (AnonCredsObjectNotFound,
AnonCredsRegistrationFailed, BaseAnonCredsError,
BaseAnonCredsHandler, BaseAnonCredsRegistrar,
BaseAnonCredsResolver)

LOGGER = logging.getLogger(__name__)

Expand All @@ -32,7 +26,12 @@ def __init__(self, registries: Optional[List[BaseAnonCredsHandler]] = None):
if registries:
for registry in registries:
self.register(registry)


@property
def supported_identifiers_regex(self):
"""Return supported identifiers."""
return "" #TODO: implement me

def register(self, registry: BaseAnonCredsHandler):
"""Register a new registry."""
if isinstance(registry, BaseAnonCredsResolver):
Expand Down
10 changes: 5 additions & 5 deletions aries_cloudagent/anoncreds/anoncreds/base_registry.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""Base Registry"""
from abc import ABC, abstractmethod, abstractproperty
from abc import ABC, abstractmethod
from typing import Pattern

from ...config.injection_context import InjectionContext
from .models import (
from ..models.anoncreds_cred_def import (
AnonCredsRegistryGetCredentialDefinition,
AnonCredsRegistryGetRevocationList,
AnonCredsRegistryGetRevocationRegistryDefinition,
AnonCredsRegistryGetSchema,
)
from ..models.anoncreds_schema import AnonCredsRegistryGetSchema


class BaseAnonCredsError(Exception):
Expand All @@ -24,10 +24,10 @@ class AnonCredsRegistrationFailed(BaseAnonCredsError):


class BaseAnonCredsHandler(ABC):
@abstractproperty
@property
@abstractmethod
def supported_identifiers_regex(self) -> Pattern:
"""Regex to match supported identifiers."""
...

async def supports(self, identifier: str) -> bool:
"""Determine whether this registry supports the given identifier."""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
"""DID Indy Registry"""
from ...models import (
from ....models.anoncreds_cred_def import (
AnonCredsRegistryGetCredentialDefinition,
AnonCredsRegistryGetRevocationList,
AnonCredsRegistryGetRevocationRegistryDefinition,
AnonCredsRegistryGetSchema,
)
from ....models.anoncreds_schema import AnonCredsRegistryGetSchema
from .....config.injection_context import InjectionContext
from ...base_registry import BaseAnonCredsResolver, BaseAnonCredsRegistrar


class DIDIndyRegistry(BaseAnonCredsResolver, BaseAnonCredsRegistrar):
"""DIDIndyRegistry"""

@property
def supported_identifiers_regex(self):
return "" # TODO: implement me

async def setup(self, context: InjectionContext):
"""Setup."""
print("Successfully registered DIDIndyRegistry")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
"""DID Web Registry"""
from ...models import (
from ....models.anoncreds_cred_def import (
AnonCredsRegistryGetCredentialDefinition,
AnonCredsRegistryGetRevocationList,
AnonCredsRegistryGetRevocationRegistryDefinition,
AnonCredsRegistryGetSchema,
)
from ....models.anoncreds_schema import AnonCredsRegistryGetSchema
from .....config.injection_context import InjectionContext
from ...base_registry import BaseAnonCredsResolver, BaseAnonCredsRegistrar


class DIDWebRegistry(BaseAnonCredsResolver, BaseAnonCredsRegistrar):
"""DIDWebRegistry"""

@property
def supported_identifiers_regex(self):
return "" # TODO: implement me

async def setup(self, context: InjectionContext):
"""Setup."""
print("Successfully registered DIDWebRegistry")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
"""Legacy Indy Registry"""
from ...models import (
from ....models.anoncreds_cred_def import (
AnonCredsRegistryGetCredentialDefinition,
AnonCredsRegistryGetRevocationList,
AnonCredsRegistryGetRevocationRegistryDefinition,
AnonCredsRegistryGetSchema,
)
from ....models.anoncreds_schema import AnonCredsRegistryGetSchema
from .....config.injection_context import InjectionContext
from ...base_registry import BaseAnonCredsResolver, BaseAnonCredsRegistrar


class LegacyIndyRegistry(BaseAnonCredsResolver, BaseAnonCredsRegistrar):
"""LegacyIndyRegistry"""

@property
def supported_identifiers_regex(self):
return "" # TODO: implement me

async def setup(self, context: InjectionContext):
"""Setup."""
print("Successfully registered LegacyIndyRegistry")
Expand Down
99 changes: 0 additions & 99 deletions aries_cloudagent/anoncreds/anoncreds/models.py

This file was deleted.

Loading

0 comments on commit 5271e1c

Please sign in to comment.