Skip to content

Commit 35d6369

Browse files
authored
Merge pull request openwallet-foundation#2089 from ianco/master
Multitenancy demo (docker-compose with postgres and ngrok)
2 parents cbcaa7d + 7edd417 commit 35d6369

79 files changed

Lines changed: 292 additions & 321 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

aries_cloudagent/admin/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ async def start(self) -> None:
491491

492492
def sort_dict(raw: dict) -> dict:
493493
"""Order (JSON, string keys) dict asciibetically by key, recursively."""
494-
for (k, v) in raw.items():
494+
for k, v in raw.items():
495495
if isinstance(v, dict):
496496
raw[k] = sort_dict(v)
497497
return dict(sorted([item for item in raw.items()], key=lambda x: x[0]))

aries_cloudagent/askar/didcomm/v2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def ecdh_es_encrypt(to_verkeys: Mapping[str, Key], message: bytes) -> bytes:
3333
except AskarError:
3434
raise DidcommEnvelopeError("Error creating content encryption key")
3535

36-
for (kid, recip_key) in to_verkeys.items():
36+
for kid, recip_key in to_verkeys.items():
3737
try:
3838
epk = Key.generate(recip_key.algorithm, ephemeral=True)
3939
except AskarError:
@@ -145,7 +145,7 @@ def ecdh_1pu_encrypt(
145145

146146
apu = b64url(sender_kid)
147147
apv = []
148-
for (kid, recip_key) in to_verkeys.items():
148+
for kid, recip_key in to_verkeys.items():
149149
if agree_alg:
150150
if agree_alg != recip_key.algorithm:
151151
raise DidcommEnvelopeError("Recipient key types must be consistent")
@@ -173,7 +173,7 @@ def ecdh_1pu_encrypt(
173173
raise DidcommEnvelopeError("Error encrypting message payload")
174174
wrapper.set_payload(payload.ciphertext, payload.nonce, payload.tag)
175175

176-
for (kid, recip_key) in to_verkeys.items():
176+
for kid, recip_key in to_verkeys.items():
177177
enc_key = ecdh.Ecdh1PU(alg_id, apu, apv).sender_wrap_key(
178178
wrap_alg, epk, sender_key, recip_key, cek, cc_tag=payload.tag
179179
)

aries_cloudagent/config/tests/test_wallet.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ async def test_wallet_config_bad_seed_x(self):
187187
) as mock_seed_to_did, async_mock.patch.object(
188188
test_module, "add_or_update_version_to_storage", async_mock.CoroutineMock()
189189
):
190-
191190
with self.assertRaises(test_module.ConfigError):
192191
await test_module.wallet_config(self.context, provision=True)
193192

aries_cloudagent/connections/base_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ async def create_did_document(
150150
routing_keys = [*routing_keys, *mediator_routing_keys]
151151
svc_endpoints = [mediation_record.endpoint]
152152

153-
for (endpoint_index, svc_endpoint) in enumerate(svc_endpoints or []):
153+
for endpoint_index, svc_endpoint in enumerate(svc_endpoints or []):
154154
endpoint_ident = "indy" if endpoint_index == 0 else f"indy{endpoint_index}"
155155
service = Service(
156156
did_info.did,

aries_cloudagent/connections/models/diddoc/diddoc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ def add_service_pubkeys(
176176

177177
rv = []
178178
for tag in [tags] if isinstance(tags, str) else list(tags):
179-
180179
for svc_key in service.get(tag, {}):
181180
canon_key = canon_ref(self.did, svc_key)
182181
pubkey = None

aries_cloudagent/connections/models/diddoc/tests/test_diddoc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
class TestDIDDoc(AsyncTestCase):
2828
async def test_basic(self):
29-
3029
# One authn key by reference
3130
dd_in = {
3231
"@context": "https://w3id.org/did/v1",

aries_cloudagent/core/conductor.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,9 @@ async def start(self) -> None:
455455
auto_accept=True,
456456
)
457457
async with self.root_profile.session() as session:
458-
await (
459-
MediationInviteStore(
460-
session.context.inject(BaseStorage)
461-
).mark_default_invite_as_used()
462-
)
458+
await MediationInviteStore(
459+
session.context.inject(BaseStorage)
460+
).mark_default_invite_as_used()
463461

464462
await record.metadata_set(
465463
session, MediationManager.SEND_REQ_AFTER_CONNECTION, True

aries_cloudagent/core/in_memory/didcomm/tests/test_1pu.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77

88
def test_1pu_hex_example():
9-
109
# Previously randomly generated 3 sets of keys
1110
aliceSecretKey = "23832cbef38641b8754a35f1f79bbcbc248e09ac93b01c2eaf12474f2ac406b6"
1211
alicePublicKey = "04fd4ca9eb7954a03517ac8249e6070aa3112e582f596b10f0d45d757b56d5dc0395a7d207d06503a4d6ad6e2ad3a1fd8cc233c072c0dc0f32213deb712c32cbdf"
@@ -41,7 +40,6 @@ def test_1pu_hex_example():
4140

4241
# Example key exchange in https://tools.ietf.org/id/draft-madden-jose-ecdh-1pu-03.html#rfc.appendix.A
4342
def test_1pu_appendix_example():
44-
4543
# Convert the three JWK keys into hex encoded byte format
4644

4745
# Alice Key
@@ -106,7 +104,6 @@ def test_1pu_appendix_example():
106104

107105

108106
def main():
109-
110107
test_1pu_hex_example()
111108
test_1pu_appendix_example()
112109

aries_cloudagent/core/in_memory/didcomm/tests/test_ecdh.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
from ..derive_ecdh import *
44

5+
56
# Generate the same shared secret from imported generated keys
67
def test_ecdh_derive_shared_secret():
7-
88
# Import keys for two participating users
99
aliceSecretKey = "23832cbef38641b8754a35f1f79bbcbc248e09ac93b01c2eaf12474f2ac406b6"
1010
alicePublicKey = "04fd4ca9eb7954a03517ac8249e6070aa3112e582f596b10f0d45d757b56d5dc0395a7d207d06503a4d6ad6e2ad3a1fd8cc233c072c0dc0f32213deb712c32cbdf"
@@ -23,7 +23,6 @@ def test_ecdh_derive_shared_secret():
2323

2424
# Generate the same shared secret from random keys
2525
def test_ecdh_derive_shared_secret_random():
26-
2726
# Generate random keys for the two participating users
2827
aliceSecretKey = SigningKey.generate(curve=NIST256p)
2928
alice = ECDH(curve=NIST256p)
@@ -46,7 +45,6 @@ def test_ecdh_derive_shared_secret_random():
4645

4746
# Test the entire key generation flow, DeriveECDHSecret() into ConcatKDF()
4847
def test_ecdh_generate_key():
49-
5048
aliceSecretKey = "23832cbef38641b8754a35f1f79bbcbc248e09ac93b01c2eaf12474f2ac406b6"
5149
alicePublicKey = "04fd4ca9eb7954a03517ac8249e6070aa3112e582f596b10f0d45d757b56d5dc0395a7d207d06503a4d6ad6e2ad3a1fd8cc233c072c0dc0f32213deb712c32cbdf"
5250

@@ -78,7 +76,6 @@ def test_ecdh_generate_key():
7876

7977
# Test the entire key generation flow, derive_shared_secret() into concat_kdf()
8078
def test_ecdh_generate_key_random():
81-
8279
aliceSecretKey = SigningKey.generate(curve=NIST256p)
8380
alice = ECDH(curve=NIST256p)
8481
alice.load_private_key(aliceSecretKey)
@@ -113,7 +110,6 @@ def test_ecdh_generate_key_random():
113110

114111

115112
def main():
116-
117113
test_ecdh_derive_shared_secret()
118114
test_ecdh_derive_shared_secret_random()
119115
test_ecdh_generate_key()

aries_cloudagent/core/tests/test_conductor.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ async def test_stats(self):
222222
) as mock_outbound_mgr, async_mock.patch.object(
223223
test_module, "LoggingConfigurator", autospec=True
224224
) as mock_logger:
225-
226225
mock_inbound_mgr.return_value.sessions = ["dummy"]
227226
mock_outbound_mgr.return_value.outbound_buffer = [
228227
async_mock.MagicMock(state=QueuedOutboundMessage.STATE_ENCODE),
@@ -263,7 +262,6 @@ async def test_inbound_message_handler(self):
263262
with async_mock.patch.object(
264263
conductor.dispatcher, "queue_message", autospec=True
265264
) as mock_dispatch_q:
266-
267265
message_body = "{}"
268266
receipt = MessageReceipt(direct_response_mode="snail mail")
269267
message = InboundMessage(message_body, receipt)

0 commit comments

Comments
 (0)