Skip to content

Commit bfd920e

Browse files
authored
Merge branch 'main' into feat/public-did-multi-use
2 parents 6072830 + aedcbd3 commit bfd920e

31 files changed

Lines changed: 279 additions & 184 deletions

File tree

.github/workflows/blackformat.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ jobs:
1010
name: lint
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-python@v2
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-python@v4
15+
with:
16+
python-version: "3.9"
1517
- name: Black Code Formatter Check
1618
uses: psf/black@stable

.github/workflows/codeql.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@ jobs:
1212
runs-on: ubuntu-latest
1313
if: (github.event_name == 'pull_request' && github.repository == 'hyperledger/aries-cloudagent-python') || (github.event_name != 'pull_request')
1414

15+
permissions:
16+
security-events: write
17+
1518
steps:
1619
- name: Checkout repository
17-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
1821

1922
# Initializes the CodeQL tools for scanning.
2023
- name: Initialize CodeQL
21-
uses: github/codeql-action/init@v1
24+
uses: github/codeql-action/init@v2
2225
with:
2326
languages: python
2427

2528
- name: Perform CodeQL Analysis
26-
uses: github/codeql-action/analyze@v1
29+
uses: github/codeql-action/analyze@v2

.github/workflows/integrationtests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
if: (github.event_name == 'pull_request' && github.repository == 'hyperledger/aries-cloudagent-python') || (github.event_name != 'pull_request')
1414
steps:
1515
- name: checkout-acapy
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1717
with:
1818
path: acapy
1919
#- name: run-von-network
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Nightly Tests
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
tests:
10+
name: Tests
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: ["ubuntu-latest"]
15+
python-version: ["3.7", "3.8", "3.9", "3.10"]
16+
include:
17+
- os: "ubuntu-20.04"
18+
python-version: "3.6"
19+
uses: ./.github/workflows/tests.yml
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
os: ${{ matrix.os }}
23+
24+
tests-indy:
25+
name: Tests (Indy)
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
os: ["ubuntu-latest"]
30+
python-version: ["3.7", "3.8", "3.9", "3.10"]
31+
include:
32+
- os: "ubuntu-20.04"
33+
python-version: "3.6"
34+
35+
uses: ./.github/workflows/tests-indy.yml
36+
with:
37+
python-version: ${{ matrix.python-version }}
38+
os: ${{ matrix.os }}
39+
indy-version: "1.16.0"

.github/workflows/pythonpublish.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ jobs:
88
deploy:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v1
12-
- name: Set up Python
13-
uses: actions/setup-python@v1
14-
with:
15-
python-version: '3.x'
16-
- name: Install dependencies
17-
run: |
18-
python -m pip install --upgrade pip
19-
pip install setuptools wheel twine
20-
- name: Build and publish
21-
env:
22-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
23-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
24-
run: |
25-
python setup.py sdist bdist_wheel
26-
twine upload dist/*
11+
- uses: actions/checkout@v3
12+
- name: Set up Python
13+
uses: actions/setup-python@v4
14+
with:
15+
python-version: "3.x"
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install setuptools wheel twine
20+
- name: Build and publish
21+
env:
22+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
23+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
24+
run: |
25+
python setup.py sdist bdist_wheel
26+
twine upload dist/*

.github/workflows/tests-indy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
${{ runner.os }}-buildx-test-
3030
3131
- name: Set up Docker Buildx
32-
uses: docker/setup-buildx-action@v1
32+
uses: docker/setup-buildx-action@v2
3333

3434
- name: Build test image
3535
uses: docker/build-push-action@v3

Mediation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
* `--open-mediation` - Instructs mediators to automatically grant all incoming mediation requests.
1717
* `--mediator-invitation` - Receive invitation, send mediation request and set as default mediator.
18+
* `--mediator-connections-invite` - Connect to mediator through a connection invitation. If not specified, connect using an OOB invitation.
1819
* `--default-mediator-id` - Set pre-existing mediator as default mediator.
1920
* `--clear-default-mediator` - Clear the stored default mediator.
2021

@@ -72,4 +73,4 @@ See [Aries RFC 0211: Coordinate Mediation Protocol](https://github.com/hyperledg
7273
## Using a Mediator
7374

7475
After establishing a connection with a mediator also having mediation granted, you can use that mediator id for future did_comm connections.
75-
When creating, receiving or accepting a invitation intended to be Mediated, you provide `mediation_id` with the desired mediator id. if using a single mediator for all future connections, You can set a default mediation id. If no mediation_id is provided the default mediation id will be used instead.
76+
When creating, receiving or accepting a invitation intended to be Mediated, you provide `mediation_id` with the desired mediator id. if using a single mediator for all future connections, You can set a default mediation id. If no mediation_id is provided the default mediation id will be used instead.

aries_cloudagent/connections/base_manager.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,16 +269,18 @@ async def resolve_invitation(
269269

270270
endpoint = first_didcomm_service.service_endpoint
271271
recipient_keys: List[VerificationMethod] = [
272-
doc.dereference(url) for url in first_didcomm_service.recipient_keys
272+
await resolver.dereference(self._profile, url, document=doc)
273+
for url in first_didcomm_service.recipient_keys
273274
]
274275
routing_keys: List[VerificationMethod] = [
275-
doc.dereference(url) for url in first_didcomm_service.routing_keys
276+
await resolver.dereference(self._profile, url, document=doc)
277+
for url in first_didcomm_service.routing_keys
276278
]
277279

278280
for key in [*recipient_keys, *routing_keys]:
279281
if not isinstance(key, self.SUPPORTED_KEY_TYPES):
280282
raise BaseConnectionManagerError(
281-
f"Key type {key.type} is not supported"
283+
f"Key type {type(key).__name__} is not supported"
282284
)
283285

284286
return (

aries_cloudagent/connections/models/conn_record.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -677,11 +677,7 @@ class Meta:
677677
required=False,
678678
description="Routing state of connection",
679679
validate=validate.OneOf(
680-
[
681-
getattr(ConnRecord, m)
682-
for m in vars(ConnRecord)
683-
if m.startswith("ROUTING_STATE_")
684-
]
680+
ConnRecord.get_attributes_by_prefix("ROUTING_STATE_", walk_mro=False)
685681
),
686682
example=ConnRecord.ROUTING_STATE_ACTIVE,
687683
)
@@ -690,11 +686,7 @@ class Meta:
690686
description="Connection acceptance: manual or auto",
691687
example=ConnRecord.ACCEPT_AUTO,
692688
validate=validate.OneOf(
693-
[
694-
getattr(ConnRecord, a)
695-
for a in vars(ConnRecord)
696-
if a.startswith("ACCEPT_")
697-
]
689+
ConnRecord.get_attributes_by_prefix("ACCEPT_", walk_mro=False)
698690
),
699691
)
700692
error_msg = fields.Str(
@@ -707,11 +699,7 @@ class Meta:
707699
description="Invitation mode",
708700
example=ConnRecord.INVITATION_MODE_ONCE,
709701
validate=validate.OneOf(
710-
[
711-
getattr(ConnRecord, i)
712-
for i in vars(ConnRecord)
713-
if i.startswith("INVITATION_MODE_")
714-
]
702+
ConnRecord.get_attributes_by_prefix("INVITATION_MODE_", walk_mro=False)
715703
),
716704
)
717705
alias = fields.Str(

aries_cloudagent/ledger/multiple_ledger/indy_manager.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from ...cache.base import BaseCache
1111
from ...core.profile import Profile
12+
from ...ledger.base import BaseLedger
1213
from ...ledger.error import LedgerError
1314
from ...wallet.crypto import did_is_self_certified
1415

@@ -53,7 +54,11 @@ def __init__(
5354

5455
async def get_write_ledger(self) -> Optional[Tuple[str, IndySdkLedger]]:
5556
"""Return the write IndySdkLedger instance."""
56-
return self.write_ledger_info
57+
# return self.write_ledger_info
58+
if self.write_ledger_info:
59+
return (self.write_ledger_info[0], self.profile.inject_or(BaseLedger))
60+
else:
61+
return None
5762

5863
async def get_prod_ledgers(self) -> Mapping:
5964
"""Return production ledgers mapping."""
@@ -83,7 +88,11 @@ async def _get_ledger_by_did(
8388
"""
8489
try:
8590
indy_sdk_ledger = None
86-
if ledger_id in self.production_ledgers:
91+
if self.write_ledger_info and ledger_id == self.write_ledger_info[0]:
92+
indy_sdk_ledger = await self.get_write_ledger()
93+
if indy_sdk_ledger:
94+
indy_sdk_ledger = indy_sdk_ledger[1]
95+
elif ledger_id in self.production_ledgers:
8796
indy_sdk_ledger = self.production_ledgers.get(ledger_id)
8897
else:
8998
indy_sdk_ledger = self.non_production_ledgers.get(ledger_id)
@@ -134,7 +143,9 @@ async def lookup_did_in_configured_ledgers(
134143
cache_key = f"did_ledger_id_resolver::{did}"
135144
if bool(cache_did and self.cache and await self.cache.get(cache_key)):
136145
cached_ledger_id = await self.cache.get(cache_key)
137-
if cached_ledger_id in self.production_ledgers:
146+
if self.write_ledger_info and cached_ledger_id == self.write_ledger_info[0]:
147+
return self.get_write_ledger()
148+
elif cached_ledger_id in self.production_ledgers:
138149
return (cached_ledger_id, self.production_ledgers.get(cached_ledger_id))
139150
elif cached_ledger_id in self.non_production_ledgers:
140151
return (

0 commit comments

Comments
 (0)