Skip to content

Commit

Permalink
Track indy-sdk 1.9.0. Allow free HolderProver without nym on ledger. …
Browse files Browse the repository at this point in the history
…Touch up comments and return types in a2a.

Signed-off-by: sklump <[email protected]>
  • Loading branch information
sklump committed May 31, 2019
1 parent 35be2b7 commit 36f4f6a
Show file tree
Hide file tree
Showing 14 changed files with 465 additions and 103 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.8.28
1.9.0
Binary file modified docs/source/pic/class.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 8 additions & 9 deletions docs/source/pic/src/class.puml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ class NodePool {
+handle
+config
+protocol
+cache_id
+open()
+close()
+refresh()
Expand Down Expand Up @@ -364,11 +363,11 @@ class NominalAnchor {
{static} +least_role()
}

class SRIAnchor {
class ProctorAnchor {
{static} +least_role()
}

class BCRegistrarAnchor {
class RegistrarAnchor {
}

class OrgBookAnchor {
Expand Down Expand Up @@ -460,12 +459,12 @@ BaseAnchor <|-down- RevRegBuilder
BaseAnchor <-- Issuer
Issuer *- RevRegBuilder

Origin <|-left- SRIAnchor
Issuer <|-left- SRIAnchor
Verifier <|-right- SRIAnchor
Origin <|-left- ProctorAnchor
Issuer <|-left- ProctorAnchor
Verifier <|-right- ProctorAnchor

Issuer <|-up- BCRegistrarAnchor
Origin <|-up- BCRegistrarAnchor
Issuer <|-up- RegistrarAnchor
Origin <|-up- RegistrarAnchor

HolderProver <|-down- OrgBookAnchor

Expand All @@ -486,7 +485,7 @@ AnchorSmith ..> Role
Verifier ..> Role
NominalAnchor ..> Role
OrgHubAnchor ..> Role
SRIAnchor ..> Role
ProctorAnchor ..> Role

PublicKey "1" *-- "1" PublicKeyType
DIDDoc "1" *-- "n" PublicKey
Expand Down
14 changes: 12 additions & 2 deletions docs/source/von_anchor/anchors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ A credentials (in indy-sdk, "credentials for proof request") structure, is a dic
Methods Implementing Operations with Credential-Like Data
==============================================================

Its ``create_cred_req()`` method creates a credential request for an input credential offer and credential definition. It returns the credential request and its associated metadata.
Its ``create_cred_req()`` method creates a credential request for an input credential offer and credential definition, using a specified local DID (from a pairwise relation) or defaulting to the anchor DID. It returns the credential request and its associated metadata.

Its ``store_cred()`` method stores a credential in the wallet. It returns the credential identifier as it appears in the wallet. Note that the credential attribute tagging policy :ref:`catpol` specifies the credential attributes for which the indy-sdk builds WQL searchable tags in the wallet on storage.

Expand Down Expand Up @@ -320,4 +320,14 @@ Because these operations could monopolize the (shared) caches, it is best for an
Demonstration Anchor Classes
****************************************************

The ``TrusteeAnchor``, ``SRIAnchor``, ``OrgBookAnchor``, ``OrgHubAnchor``, ``BCRegistrarAnchor``, and ``NominalAnchor`` demonstration anchors of file ``von_anchor/anchor/demo.py`` use the derived mixins above to create their respective demonstration VON anchor classes.
The ``TrusteeAnchor``, ``ProctorAnchor``, ``OrgBookAnchor``, ``OrgHubAnchor``, ``RegistrarAnchor``, and ``NominalAnchor`` demonstration anchors of file ``von_anchor/anchor/demo.py`` use the derived mixins above to create their respective demonstration VON anchor classes:

.. csv-table::
:header: "Demonstration Class", "Roles", "Notes"

"TrusteeAnchor", "Trustee", "Writes nyms to ledger"
"ProctorAnchor", "Origin, Issuer, Verifier", "Originates schemata, issues credentials, and verifies presentations"
"OrgBookAnchor", "Holder-Prover", "Stores credentials"
"OrgHubAnchor", "Origin, Issuer, Holder-Prover, Verifier", "Acts as both OrgBook for community and Proctor for its own program"
"RegistrarAnchor", "Origin, Issuer", "Originates schemata, issues credentials"
"NominalAnchor", "Base", "Uses ledger primarily for cryptonym access to perform cryptographic operations"
5 changes: 2 additions & 3 deletions docs/source/von_anchor/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ Exceptions
This section outlines the Exception descendants that the von_anchor package defines. Each exception class descends from VonAnchorError, which itself inherits Exception, and each exception class encapsulates a simple error code and message as per the table.

.. csv-table::
:header: "Exception Class", "Error Code", "Semantics", "Example"
:widths: 20, 15, 50, 50

:header: "Exception Class", "Error Code", "Semantics", "Example"
:widths: 20, 15, 50, 50

"CredentialFocus", "1003", "Anchor attempting to prove zero credentials, or more than one credentials per cred def", "Actuator posts a get-proof form with credential filter resolving to multiple credentials for a single credential definition, or to no credentials at all"
"AbsentLinkSecret", "1005", "Anchor attempts to perform operation requiring link secret which is not set", "Actuator calls holder-prover anchor to create credential request, but anchor has no link secret set"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
base58
python3-indy==1.8.3-dev-1109
python3-indy==1.9.0
jsonschema>=2.6.0
32 changes: 16 additions & 16 deletions test/op/test_setnym.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import pytest

from von_anchor import NominalAnchor, TrusteeAnchor, SRIAnchor
from von_anchor import NominalAnchor, TrusteeAnchor, ProctorAnchor
from von_anchor.error import AbsentPool, ErrorCode, ExtantWallet
from von_anchor.frill import Ink, inis2dict, ppjson
from von_anchor.indytween import Role
Expand Down Expand Up @@ -310,18 +310,18 @@ async def test_setnym(

# Exercise reseed, ensure no side effect to role on ledger
await pool.open()
san = SRIAnchor(wallets[cfg['VON Anchor']['name']], pool, rrbx=False)
await san.open()
pan = ProctorAnchor(wallets[cfg['VON Anchor']['name']], pool, rrbx=False)
await pan.open()
next_seed = '{}000000000000VonAnchor1'.format(int(time()) + 1)
await san.reseed(next_seed)
nym = json.loads(await san.get_nym(noman.did))
san_role = await san.get_nym_role()
await pan.reseed(next_seed)
nym = json.loads(await pan.get_nym(noman.did))
pan_role = await pan.get_nym_role()
await pool.close()
assert nym and nym['seqNo'] != last_nym_seqno
assert san_role == noman_role
print('\n\n== 16 == As SRI Anchor, reseeded, then got nym transaction from ledger for DID {} ({}): {}'.format(
san.did,
san.wallet.name,
assert pan_role == noman_role
print('\n\n== 16 == As Proctor Anchor, reseeded, then got nym transaction from ledger for DID {} ({}): {}'.format(
pan.did,
pan.wallet.name,
ppjson(nym)))
last_nym_seqno = nym['seqNo']

Expand Down Expand Up @@ -388,15 +388,15 @@ async def test_setnym(
unlink(genesis_tmp.name)
await p_mgr.remove(pool_copy)
await pool.open()
await san.open()
nym = json.loads(await san.get_nym(san.did))
await pan.open()
nym = json.loads(await pan.get_nym(pan.did))
assert nym and Role.get(nym['role']) == Role.TRUST_ANCHOR
assert nym and nym['seqNo'] != last_nym_seqno
print('\n\n== 21 == Got nym transaction from ledger for DID {} ({}): {}'.format(
san.did,
san.wallet.name,
pan.did,
pan.wallet.name,
ppjson(nym)))
await san.close()
await pan.close()
await pool.close()

# Run setnym on configuration with wrong genesis transaction path
Expand Down Expand Up @@ -493,6 +493,6 @@ async def test_setnym(
await noman.close()
await pool.close()

await san.close()
await pan.close()
for name in wallets:
await wallets[name].close()
12 changes: 9 additions & 3 deletions test/test_a2a.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,13 @@ async def test_a2a():
'publicKeyBase58': '~YYYYYYYYYYYYYYYY'
},
{
'id': 'did:sov:LjgpST2rjsoxYegQDRm7EL#keys-3',
'id': 'LjgpST2rjsoxYegQDRm7EL#keys-3',
'type': 'Secp256k1VerificationKey2018',
'controller': 'LjgpST2rjsoxYegQDRm7EL',
'publicKeyHex': '02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71'
},
{
'id': 'did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4',
'type': 'RsaVerificationKey2018',
'controller': 'did:sov:LjgpST2rjsoxYegQDRm7EL',
'publicKeyPem': '-----BEGIN PUBLIC A...'
Expand All @@ -289,7 +295,7 @@ async def test_a2a():
'did:sov:LjgpST2rjsoxYegQDRm7EL#keys-1'
],
'routingKeys': [
'did:sov:LjgpST2rjsoxYegQDRm7EL#keys-3'
'did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4'
],
'serviceEndpoint': 'LjgpST2rjsoxYegQDRm7EL;2'
},
Expand All @@ -302,7 +308,7 @@ async def test_a2a():
'did:sov:LjgpST2rjsoxYegQDRm7EL#keys-1'
],
'routingKeys': [
'did:sov:LjgpST2rjsoxYegQDRm7EL#keys-3'
'did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4'
],
'serviceEndpoint': 'https://www.two.ca/two'
}
Expand Down
Loading

0 comments on commit 36f4f6a

Please sign in to comment.