Skip to content
Draft
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
198 changes: 187 additions & 11 deletions webvh/README.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions webvh/webvh/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
async def setup(context: InjectionContext):
"""Setup."""
LOGGER.info("webvh plugin setup...")
LOGGER.warning("=" * 70)
LOGGER.warning("WebVH Plugin: Starting setup")
LOGGER.warning("=" * 70)

# AnonCreds Registry
anoncreds_registry = context.inject_or(AnonCredsRegistry)
Expand Down
2 changes: 1 addition & 1 deletion webvh/webvh/anoncreds/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
from ..protocols.attested_resource.record import PendingAttestedResourceRecord
from ..protocols.states import WitnessingState
from ..did.witness import WitnessManager
from ..did.manager import ControllerManager
from ..did.controller import ControllerManager
from ..did.utils import add_proof

# from ..models.resources import AttestedResource
Expand Down
2 changes: 1 addition & 1 deletion webvh/webvh/anoncreds/tests/test_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
TEST_WITNESS_SEED,
TEST_RESOLVER,
)
from ...did.manager import ControllerManager
from ...did.controller import ControllerManager
from ..registry import DIDWebVHRegistry

test_domain = "sandbox.bcvh.vonx.io"
Expand Down
21 changes: 16 additions & 5 deletions webvh/webvh/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import copy
import json

from operator import itemgetter

from acapy_agent.core.profile import Profile
from acapy_agent.storage.base import BaseStorage
from acapy_agent.storage.error import StorageNotFoundError
Expand All @@ -22,6 +20,11 @@ def _get_wallet_identifier(profile: Profile):
return profile.settings.get(WALLET_ID) or profile.settings.get(WALLET_NAME)


def get_global_plugin_config(profile: Profile):
"""Get the global plugin settings."""
return copy.deepcopy(profile.settings.get("plugin_config", {}).get("webvh", {}))


async def get_plugin_config(profile: Profile):
"""Get the plugin settings."""
wallet_id = _get_wallet_identifier(profile)
Expand All @@ -38,9 +41,14 @@ async def get_plugin_config(profile: Profile):
pass

if stored_config_record:
return json.loads(stored_config_record.value)["config"]
config = json.loads(stored_config_record.value)["config"]
else:
config = get_global_plugin_config(profile)

return copy.deepcopy(profile.settings.get("plugin_config", {}).get("webvh", {}))
if config is None:
config = {}

return config


async def set_config(profile: Profile, config: dict):
Expand Down Expand Up @@ -127,7 +135,10 @@ async def use_strict_ssl(profile: Profile):

async def add_scid_mapping(profile: Profile, did: str):
"""Add a scid mapping."""
scid = itemgetter(2)(did.split(":"))
from ..did.utils import parse_webvh

parsed = parse_webvh(did)
scid = parsed.scid
async with profile.session() as session:
storage = session.inject(BaseStorage)
stored_config_record = await storage.get_record(
Expand Down
11 changes: 11 additions & 0 deletions webvh/webvh/config/webvh_config_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ class Meta:
required=False, description="Auto attest requests", default=False
)

witness_id = fields.Str(
required=False,
description="Preferred witness identifier",
)

auto_config = fields.Bool(
required=False,
description="Automatically configure controller and witness resources",
default=False,
)

notify_watchers = fields.Bool(
required=False, description="Notify watchers", default=False
)
Expand Down
Loading
Loading