Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(WIP): anoncreds updates #2191

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
19d6fc4
chore: add anoncreds-rs deps
dbluhm Feb 22, 2023
7b0cb6c
refactor: rename indy package to anoncreds
dbluhm Feb 22, 2023
ee3d40a
refactor: rename Indy* to AnonCreds*
dbluhm Feb 22, 2023
e4c986a
feat: add anoncreds concrete classes, copyied from credx
dbluhm Feb 22, 2023
c24af8e
fix: import anoncreds rather than indy_credx
cjhowland Feb 22, 2023
795cd8f
fix: update imports to use aries_cloudagent.anoncreds
cjhowland Feb 22, 2023
df66bc9
fix: add requirements.anoncreds.txt to Dockerfile.indy
cjhowland Feb 22, 2023
d7d895f
fix: mount libanoncreds.so in volume
cjhowland Feb 23, 2023
ede5803
fix: pull binaries from a temporary location
dbluhm Feb 23, 2023
f8c7ca2
fix: add anoncreds deps to gha
dbluhm Feb 24, 2023
60973f4
removed volume from run test script
burdettadam Feb 24, 2023
fc59336
Merge pull request #17 from burdettadam/fix/temporary-binaries
dbluhm Feb 24, 2023
49a66f4
fix: library path for anoncreds bin
dbluhm Feb 24, 2023
dd7268b
fix: library path for test dockerfile for anoncreds bin
dbluhm Feb 24, 2023
d9f95cc
fix: redefine schema id
cjhowland Feb 24, 2023
2621224
start of anoncreds admin api
burdettadam Feb 24, 2023
2e68381
empty methods for anoncreds admin routes
burdettadam Feb 27, 2023
1025b91
Merge pull request #106 from dbluhm/fix/temporary-binaries
dbluhm Feb 28, 2023
e21cdce
start of openapi schemas
burdettadam Mar 1, 2023
be553cc
use anoncreds issuer to create id
burdettadam Mar 1, 2023
3d62cc6
fix: pass in cred def id in CredentialOffer and RevocationRegistryDef…
cjhowland Mar 2, 2023
bdd3752
schema route details
burdettadam Mar 3, 2023
871a8b2
empty vars for cred def validation
burdettadam Mar 6, 2023
9067fd1
anoncreds admin routes without expected return schemas
burdettadam Mar 7, 2023
9612213
fix: remove unused import
cjhowland Mar 7, 2023
4ed41c3
feat: add plugin structure
cjhowland Mar 8, 2023
0f59de8
fix: flake8
cjhowland Mar 8, 2023
4f96ed2
routes response schemas
burdettadam Mar 9, 2023
c56ac54
happy flake8 doc strings
burdettadam Mar 9, 2023
d42dfb9
Apple silicon support
burdettadam Mar 9, 2023
33e77fa
fix: file naming and structure
cjhowland Mar 10, 2023
ec4a1e3
less dry-ness
burdettadam Mar 10, 2023
b3a6944
fix: AnonCredsRegistry inherits from BaseRegistry
cjhowland Mar 10, 2023
420aba6
feat: add legacy indy registry plugin structure
cjhowland Mar 10, 2023
9ca2d92
feat: create default directory for registries
cjhowland Mar 10, 2023
dc01703
fix: flake8
cjhowland Mar 10, 2023
96d3fd0
Merge pull request #108 from Indicio-tech/feature/anoncreds-plugin-st…
dbluhm Mar 10, 2023
6783b87
Merge branch 'feature/anoncreds' of github.com:Indicio-tech/aries-clo…
burdettadam Mar 10, 2023
f9de57f
basemodel schema bug
burdettadam Mar 14, 2023
e491f35
feat: some refinements on models
dbluhm Mar 14, 2023
4d6fa86
removed old openapi schema
burdettadam Mar 15, 2023
c0097c7
feat: split interface, basic impl of core registry
dbluhm Mar 15, 2023
b7df825
get schema admin api, injection.
burdettadam Mar 15, 2023
3eb0336
more model work
burdettadam Mar 15, 2023
3cab55f
cred_def models
burdettadam Mar 15, 2023
22dc4ce
models work
burdettadam Mar 16, 2023
2f5bc91
fixed import
burdettadam Mar 16, 2023
092b2f4
Merge pull request #110 from Indicio-tech/feature/anoncreds-split-res…
dbluhm Mar 16, 2023
22f92a1
Merge branch 'feature/anoncreds' of github.com:Indicio-tech/aries-clo…
burdettadam Mar 16, 2023
18d2231
start up bug
burdettadam Mar 16, 2023
162ca2d
running code
burdettadam Mar 16, 2023
5271e1c
Merge pull request #109 from Indicio-tech/feature/anoncreds-admin-api
dbluhm Mar 16, 2023
a7d9d05
post schema
burdettadam Mar 16, 2023
410a740
routes logic
burdettadam Mar 17, 2023
75d41c2
deserialize
burdettadam Mar 17, 2023
07375a6
Merge pull request #111 from Indicio-tech/feature/anoncreds-admin-api…
dbluhm Mar 17, 2023
9a47e67
feat: registry method logic (WIP)
cjhowland Mar 16, 2023
06d7181
fix: imports
cjhowland Mar 16, 2023
14d3991
fix: pass options, schema to AnonCredsRegistry.register_schema
cjhowland Mar 17, 2023
0d028e8
feat: define supported_identifiers_regex on registries
cjhowland Mar 17, 2023
4539efc
fix: register_schema signature
cjhowland Mar 17, 2023
e77122d
feat: did:indy register_schema response
cjhowland Mar 17, 2023
6b93a5d
Merge pull request #112 from Indicio-tech/feature/anoncreds-did-indy-…
burdettadam Mar 17, 2023
fed1b47
fix: await and pass profile to register_schema()
cjhowland Mar 17, 2023
5ae0acb
get resources models and interface
burdettadam Mar 20, 2023
8b0d25c
get credential definitions
burdettadam Mar 21, 2023
732d01b
Merge pull request #113 from Indicio-tech/feature/anoncreds_gets_inte…
dbluhm Mar 21, 2023
48bd5a0
chore: update anoncreds python wrapper
dbluhm Mar 22, 2023
09b6490
Merge pull request #114 from dbluhm/feature/anoncreds-update-deps
dbluhm Mar 22, 2023
49596ad
style: formatting fixes
dbluhm Mar 22, 2023
e8cd404
feat: unskip buggy tests
dbluhm Mar 22, 2023
0763fec
fix: update get_schema signature
cjhowland Mar 18, 2023
0ee0769
fix: credential_definition method signatures
cjhowland Mar 21, 2023
e415799
fix: did:web method signatures
cjhowland Mar 21, 2023
6d88667
feat: legacy indy schema, cred def logic
cjhowland Mar 21, 2023
f43f669
fix: anon_creds_registry credential definition arguments
cjhowland Mar 21, 2023
0014205
fix: serialize schema_get result
cjhowland Mar 22, 2023
6e41a06
fix: merge cleanup
cjhowland Mar 22, 2023
52342c0
feat: error reporting
cjhowland Mar 22, 2023
2039b66
fix: serialize cred_def_get result
cjhowland Mar 22, 2023
88b25f4
feat: get_schemas and get_credential_definitions implementations
cjhowland Mar 22, 2023
a609352
fix: several small adjustments
dbluhm Mar 23, 2023
2a7d929
Merge branch 'feature/anoncreds' into feature/anoncreds-legacy-indy-i…
dbluhm Mar 23, 2023
af06852
feat: updates to register_schema
dbluhm Mar 24, 2023
75df783
fix: typos and imports
dbluhm Mar 25, 2023
10d7972
feat: clean up models
dbluhm Mar 25, 2023
6f86a44
fix: schemas and flake8 errors
dbluhm Mar 25, 2023
b6c3073
fix: mismatched parameter expectations
dbluhm Mar 25, 2023
8d28760
fix: incorrect schema name in model, field names
dbluhm Mar 25, 2023
833bc7b
feat(WIP): credential definitions
dbluhm Mar 27, 2023
ec4bac3
feat: credential definitions completed
dbluhm Mar 28, 2023
eb8d978
feat: implement revocation registry methods in issuer
dbluhm Mar 29, 2023
faa53f9
refactor: move anoncreds revocation models
dbluhm Mar 29, 2023
9be889e
fix: imports and abstract methods
dbluhm Mar 29, 2023
ae2f64d
fix: issues with cred issuance and verification flows
dbluhm Mar 29, 2023
f2738ee
test: add simple test scripts for anoncreds
dbluhm Mar 29, 2023
f578660
feat: verification through anoncreds interface
dbluhm Mar 29, 2023
27596c9
refactor: split up indy pres exch handler return_presentation
dbluhm Mar 29, 2023
ab81356
feat: use anoncreds holder
dbluhm Mar 29, 2023
74043f5
feat: restore indy package
cjhowland Mar 30, 2023
170f215
feat: remove sdk and credx packages
cjhowland Mar 30, 2023
343fa08
feat: drop registry from default registry folder names
cjhowland Mar 30, 2023
2dae060
refactor: rename registry and base
cjhowland Mar 30, 2023
b155cda
refactor: remove abstract AnonCreds* classes, rename AnonCredsRs* cla…
cjhowland Mar 30, 2023
95aa5fa
platform in docker compose file
burdettadam Mar 30, 2023
c5a4826
Merge branch 'refactor/anoncreds' of github.com:Indicio-tech/aries-cl…
burdettadam Mar 30, 2023
63dc426
fix: circular dependency issues
cjhowland Mar 30, 2023
a21d73a
fix: remove inner anoncreds directory
cjhowland Mar 30, 2023
f4ba884
fix: revocation registry size circular dep
dbluhm Mar 31, 2023
1861971
Merge pull request #116 from Indicio-tech/refactor/anoncreds
dbluhm Mar 31, 2023
ccbcfcf
feat: revocation updates
dbluhm Mar 31, 2023
452515b
refactor: drop indy reqs on rev objects
dbluhm Mar 31, 2023
76a6c15
refactor: rename IndyRevocation -> AnonCredsRevocation
dbluhm Mar 31, 2023
a4e2a69
refactor: de-indy-ify AnonCredsRevocation
dbluhm Mar 31, 2023
d277ecc
refactor: issuer rev reg record usage from anoncreds
dbluhm Mar 31, 2023
195fe02
start of updating send_entry+
burdettadam Apr 3, 2023
c35b488
fix: send_entry logic moved to legacy indy
dbluhm Apr 4, 2023
895ae08
feat: register rev status list on legacy indy
dbluhm Apr 4, 2023
d68b805
fix(anoncreds): legacy regex matching
burdettadam Apr 5, 2023
f233098
feat: revoke_credentials returns rev lists
dbluhm Apr 6, 2023
c690405
fix: raise not imp
burdettadam Apr 6, 2023
224b4fb
fix(anoncreds): did indy regtistry cleanup
burdettadam Apr 6, 2023
c3ff93f
fix: clean up did web registry
cjhowland Apr 6, 2023
5288253
fix(anoncreds): did indy update_revocation_status_list
burdettadam Apr 6, 2023
8e3e585
fix(anoncreds): did:web regex
burdettadam Apr 6, 2023
a044fe1
Merge pull request #118 from Indicio-tech/feature/anoncreds-cleanup
dbluhm Apr 6, 2023
c7b8dc9
Merge pull request #117 from Indicio-tech/feature/anoncreds-regex
dbluhm Apr 6, 2023
f384f9f
refactor: rename revocation status list ot revocation list
cjhowland Apr 6, 2023
1f67c1b
Merge pull request #119 from Indicio-tech/refactor/anoncreds-revocati…
dbluhm Apr 6, 2023
02f1b82
fix(flake8): made flake8 happier
burdettadam Apr 6, 2023
9ffe2c4
Merge pull request #120 from Indicio-tech/feature/anoncreds-test-cleanup
dbluhm Apr 7, 2023
af733b8
test: rev reg def and rev reg list posts in test
dbluhm Apr 27, 2023
c422b2f
fix: rev reg def models
dbluhm Apr 27, 2023
96ccbe9
fix: anoncreds issuer specifies tails dir
dbluhm Apr 27, 2023
6043173
feat: initial pass at rev list register endpoint
dbluhm Apr 27, 2023
1178edf
fix: rev status list to rev list
dbluhm Apr 27, 2023
cfcd24b
fix: remove status from anoncreds/revocation-list endpoint
cjhowland Apr 27, 2023
6ef08dd
Merge pull request #121 from Indicio-tech/feature/rev-status-list-reg…
dbluhm Apr 27, 2023
2fcd5f1
fix: remove url check for tails_public_uri
cjhowland May 2, 2023
a2bb0c2
fix: update init_issuer_registry calls to include issuer_id argument
cjhowland May 3, 2023
2736000
feat: add generic tails file upload
dbluhm May 4, 2023
6c9dc1a
feat: update anoncreds-rs build
cjhowland May 5, 2023
40f065b
feat: update image for tails-server
cjhowland May 5, 2023
aa56931
fix: remove status list from revocation-list endpoint
cjhowland May 5, 2023
bad0784
fix: remove url check
cjhowland May 5, 2023
4c1f36b
fix: pass issuer_id into init_issuer_registry()
cjhowland May 5, 2023
44ed2c3
fix: update MasterSecret references
cjhowland May 5, 2023
c45170b
fix: remove RevocationRegistryDelta references
cjhowland May 5, 2023
56640e0
Merge pull request #122 from Indicio-tech/fix/anoncreds-build-adjustm…
dbluhm May 5, 2023
0eb5ac4
fix: object ids not necessarily known until finished
dbluhm May 5, 2023
57d1e4b
feat(tailsfile): generic tails file upload
burdettadam May 19, 2023
d5135c4
fix(tailsfile): generic tails file upload
burdettadam May 19, 2023
674c8da
refactor: shorten get rev reg def result object name
dbluhm May 22, 2023
5ff529e
fix: get rev reg def in legacy indy registry
dbluhm May 22, 2023
7d2e573
feat: use issuer create and register upgrade
dbluhm May 22, 2023
ac2776a
fix: tails location mismatch
dbluhm May 22, 2023
81ab818
feat: issue revocable creds using anoncreds interface
dbluhm May 23, 2023
34a67bc
Merge pull request #126 from Indicio-tech/feature/anoncreds-revocable…
dbluhm May 23, 2023
52e12ff
fix(anoncreds): proof, rev reg def id
burdettadam May 24, 2023
bfacecd
fix: remove redundant get_revocation_registry_definitions() function …
cjhowland May 26, 2023
08056f8
Merge pull request #127 from Indicio-tech/fix/anoncreds-proof-request
dbluhm May 26, 2023
8a699bc
refactor: use anoncreds models in get_ledger_objects
dbluhm May 26, 2023
aa87a45
refactor: split rev methods from issuer
dbluhm May 29, 2023
ff62b91
feat: update to use tails server image with backwards compatible put,…
cjhowland May 30, 2023
958cc7b
feat(revocation): update revocation to track pending state
burdettadam May 31, 2023
5aebbd8
fix(revocation): pr feed back changes
burdettadam May 31, 2023
6dc5971
fix: store states for rev reg def and rev list
dbluhm Jun 1, 2023
298790c
feat: mark pending on rev list, set active registry
dbluhm Jun 1, 2023
d14199d
Merge pull request #130 from Indicio-tech/feature/anoncreds-pending-r…
dbluhm Jun 1, 2023
e3ff931
feat: implement update_revocation_list
dbluhm Jun 7, 2023
524a89b
feat: implement get revocation list on legacy indy
dbluhm Jun 12, 2023
d964672
fix: revocation errors
dbluhm Jun 13, 2023
3ae503b
fix: missing error info
dbluhm Jun 21, 2023
2e2833a
Merge pull request #132 from Indicio-tech/feature/anoncreds-revocatio…
dbluhm Jun 21, 2023
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
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
-r requirements.txt \
-r requirements.askar.txt \
-r requirements.bbs.txt \
-r requirements.dev.txt
-r requirements.dev.txt \
-r requirements.anoncreds.txt
- name: Tests
run: |
pytest
226 changes: 226 additions & 0 deletions anoncreds_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
import os
import time

from controller.controller import Controller
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this controller package, does it need to be added?
This demo might be better placed under examples/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the confusion, this is part of a quick test script that I intend to remove before merging to main, replacing it with some proper testing. This script is run by a container built from docker/Dockerfile.anoncreds-test, which does a quick pip install of the needed library. This gets run by the tests service in docker-compose.yml (which will also be removed before merging). We just found having a quick high-level test helpful while things are in flight.

from controller.protocols import (
indy_anoncred_onboard,
didexchange,
indy_issue_credential_v2,
indy_present_proof_v2,
)
from controller.logging import logging_to_stdout

ALICE = os.getenv("ALICE", "http://alice:3001")
BOB = os.getenv("BOB", "http://bob:3005")


async def main():
logging_to_stdout()
async with Controller(base_url=ALICE) as alice, Controller(base_url=BOB) as bob:
# DID Setup
public_did = await indy_anoncred_onboard(alice)

# Register a Schema using legacy Indy
response = await alice.post(
"/anoncreds/schema",
json={
"schema": {
"attrNames": ["name", "age"],
"issuerId": public_did.did,
"name": "anoncreds-testing",
"version": "0.1",
},
"options": {},
},
)
schema_id = response["schema_state"]["schema_id"]
schema = await alice.get(f"/anoncreds/schema/{schema_id}")
schemas = await alice.get("/anoncreds/schemas")

cred_def = await alice.post(
"/anoncreds/credential-definition",
json={
"credential_definition": {
"tag": "default",
"schemaId": schema_id,
"issuerId": public_did.did,
},
"options": {
"support_revocation": True,
},
},
)
cred_def_id = cred_def["credential_definition_state"][
"credential_definition_id"
]
cred_def = await alice.get(f"/anoncreds/credential-definition/{cred_def_id}")
cred_defs = await alice.get("/anoncreds/credential-definitions")

rev_reg_def = await alice.post(
"/anoncreds/revocation-registry-definition",
json={
"issuerId": public_did.did,
"credDefId": cred_def_id,
"tag": "default",
"maxCredNum": 10,
},
)
rev_reg_def_id = rev_reg_def["revocation_registry_definition_state"][
"revocation_registry_definition_id"
]
tails = await alice.put(
f"/anoncreds/registry/{rev_reg_def_id}/tails-file",
)
active = await alice.put(
f"/anoncreds/registry/{rev_reg_def_id}/active",
)
rev_status_list = await alice.post(
"/anoncreds/revocation-list",
json={
"revRegDefId": rev_reg_def["revocation_registry_definition_state"][
"revocation_registry_definition_id"
]
},
)
alice_conn, bob_conn = await didexchange(alice, bob)
alice_cred_ex, bob_cred_ex = await indy_issue_credential_v2(
alice,
bob,
alice_conn.connection_id,
bob_conn.connection_id,
cred_def_id,
{"name": "Bob", "age": "42"},
)
bob_pres, alice_pres = await indy_present_proof_v2(
bob,
alice,
bob_conn.connection_id,
alice_conn.connection_id,
name="proof-1",
version="0.1",
comment="testing",
requested_attributes=[
{"name": "name", "restrictions": [{"cred_def_id": cred_def_id}]},
{"name": "age", "restrictions": [{"cred_def_id": cred_def_id}]},
],
)
print("Before revocation")
print(alice_pres.verified, "should be true")
before_revoking_time = int(time.time())

await asyncio.sleep(5)

result = await alice.post(
"/anoncreds/revoke",
json={
"cred_ex_id": alice_cred_ex.cred_ex_id,
"connection_id": alice_conn.connection_id,
"notify": True,
},
)
result = await alice.post(
"/anoncreds/publish-revocations",
)
await asyncio.sleep(3)

# Request proof from holder again after revoking
revoked_time = int(time.time())
bob_pres, alice_pres = await indy_present_proof_v2(
bob,
alice,
bob_conn.connection_id,
alice_conn.connection_id,
requested_attributes=[
{
"name": "name",
"restrictions": [{"cred_def_id": cred_def_id}],
}
],
non_revoked={"from": revoked_time, "to": revoked_time},
)
print("Interval after revocation")
print(alice_pres.verified, "should be false")

# Request proof from holder again after revoking,
# using the interval before cred revoked
# (non_revoked interval/when cred was valid)
bob_pres, alice_pres = await indy_present_proof_v2(
bob,
alice,
bob_conn.connection_id,
alice_conn.connection_id,
requested_attributes=[
{
"name": "name",
"restrictions": [{"cred_def_id": cred_def_id}],
}
],
non_revoked={"from": before_revoking_time, "to": before_revoking_time},
)
print("Interval before revocation")
print(alice_pres.verified, "should be true")

# Request proof, no interval
bob_pres, alice_pres = await indy_present_proof_v2(
bob,
alice,
bob_conn.connection_id,
alice_conn.connection_id,
requested_attributes=[
{
"name": "name",
"restrictions": [{"cred_def_id": cred_def_id}],
}
],
)
print("No interval")
print(alice_pres.verified, "should be true")

# Request proof, using invalid/revoked interval but using
# local non_revoked override (in requsted attrs)
# ("LOCAL"-->requested attrs)
bob_pres, alice_pres = await indy_present_proof_v2(
bob,
alice,
bob_conn.connection_id,
alice_conn.connection_id,
requested_attributes=[
{
"name": "name",
"restrictions": [{"cred_def_id": cred_def_id}],
"non_revoked": {
"from": before_revoking_time,
"to": before_revoking_time,
},
}
],
non_revoked={"from": revoked_time, "to": revoked_time},
)
print("Local interval overriding global?")
print(alice_pres.verified, "should be true")

# Request proof, just local invalid interval
bob_pres, alice_pres = await indy_present_proof_v2(
bob,
alice,
bob_conn.connection_id,
alice_conn.connection_id,
requested_attributes=[
{
"name": "name",
"restrictions": [{"cred_def_id": cred_def_id}],
"non_revoked": {
"from": revoked_time,
"to": revoked_time,
},
}
],
)
print("Local interval")
print(alice_pres.verified, "should be false")


if __name__ == "__main__":
import asyncio

asyncio.run(main())
42 changes: 42 additions & 0 deletions aries_cloudagent/anoncreds/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import logging

from ..config.injection_context import InjectionContext
from ..config.provider import ClassProvider

from .registry import AnonCredsRegistry

LOGGER = logging.getLogger(__name__)


async def setup(context: InjectionContext):
"""Set up default resolvers."""
registry = context.inject_or(AnonCredsRegistry)
if not registry:
LOGGER.warning("No AnonCredsRegistry instance found in context")
return

indy_registry = ClassProvider(
"aries_cloudagent.anoncreds.default.did_indy.registry.DIDIndyRegistry",
# supported_identifiers=[],
# method_name="did:indy",
).provide(context.settings, context.injector)
await indy_registry.setup(context)
registry.register(indy_registry)

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

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

# TODO: add context.settings
Loading