-
Notifications
You must be signed in to change notification settings - Fork 204
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: add indynamespace for ledger id for anoncreds #965
feat: add indynamespace for ledger id for anoncreds #965
Conversation
Codecov Report
@@ Coverage Diff @@
## 0.3.0-pre #965 +/- ##
=============================================
+ Coverage 88.27% 88.28% +0.01%
=============================================
Files 639 640 +1
Lines 15170 15202 +32
Branches 2566 2467 -99
=============================================
+ Hits 13391 13421 +30
- Misses 1681 1776 +95
+ Partials 98 5 -93
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great @morrieinmaas! I'm not sure on the direction of adding the unqualified identifiers and methods to the repositories and records. As descried in #944 the records would be stored with the qualified indy dids that would overwrite the unqualified indy dids:
add fully qualified identifier to the anon creds (schema|credential definition) records (replace the non qualified identifier before storing and after retrieving it). For indy we use the did:indy spec identifiers to store.
- Note: Records stores fully qualified identifier as identifier.
- Need to transform unqualified to qualified before storing or querying
- Need to transform qualified to unqualified after retrieving
Was there a specific reason why you deviated from the described approach?
packages/core/src/modules/indy/repository/AnonCredsCredentialDefinitionRecord.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/indy/repository/AnonCredsCredentialDefinitionRepository.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/ledger/__tests__/IndyPoolService.test.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/ledger/__tests__/IndyPoolService.test.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/ledger/__tests__/IndyLedgerService.test.ts
Outdated
Show resolved
Hide resolved
I am partly to blame for this and I am certain that there is a better way to do it but here was my reasoning:
Swapping the identifier to qualified before storing and after retrieving I think comes with inherent issues. Every possible way of updating/adding/getting in the repository has to be checked and changed and will cause "weird" code. I am 10000% open for better implementations. This to me however looked like the quickest way to later convert to |
Also after thinking about it a bit more this doesn't seem to follow the indy did method specification for schema / credentials definitions ids: |
@blu3beri I'm not on the same page with you on this one. The goal of the AnonCreds records is to make them generic already, so we can get away from the endless unqualified legacy indy dids issues. By replacing the id before storing on the object itself, we make the id already follow the did:indy specification. The nice thing is, once we add support for did:indy it will just work and we won't have to transform the records anymore because we're already following the spec. So I would argue strongly against any tags or properties that have to do with unqualified dids. If we have the unqualified schema/cred def id and the namespace we can transform that into the did:indy qualified shcema/cred def id and find it by the qualified id. if we have the qualified id we can reduce it to an unqualified id. As an example the steps of creating / retrieving a schema:
Maybe I'm not fully understanding what you're saying, but I don't see the need for these properties? |
Yeah I agree with you. I could not really find a way to retrieve a anoncredsrecord ONLY via the qualified identifier when we do not know the namespace (if this is even required). If, in every context, we are aware of the namespace, 100% remove every reference to unqualified identifiers.
Where do we get these input parameters from?
Yeah I don't think it was the best explanation, and I probably don't understand the exact situation we are in. Where we use unqualified or qualified and what we get back from the ledger. |
From the api, except for the pool, currently that is always the first one. Later on we can allow to specify the qualified did you'd like to use to register it and we can extract it from the qualified did |
Ahh okay now I think I fully understand it. I assume with first one you mean ledger in your configuration? |
wow. thx for all the feedback guys🙏🚀. Really nice to have hit some hot topic that triggered a good discussion. I'll have a proper read through and will reply more in depth tomorrow |
Ahh thx for the exmaple @TimoGlastra - I was missing some info there which is also why you correctly were puzzled about this part. I was following this instead but I get it now |
packages/core/src/modules/indy/repository/AnonCredsCredentialDefinitionRecord.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/indy/repository/AnonCredsCredentialDefinitionRecord.ts
Outdated
Show resolved
Hide resolved
packages/core/src/modules/indy/repository/AnonCredsCredentialDefinitionRecord.ts
Show resolved
Hide resolved
packages/core/src/modules/indy/repository/AnonCredsCredentialDefinitionRecord.ts
Outdated
Show resolved
Hide resolved
Thanks for the feedback @TimoGlastra |
d92fdd4
to
78e6123
Compare
f2e61d8
to
f38ac05
Compare
TODO: * fix tests Signed-off-by: Moriarty <[email protected]>
Signed-off-by: Moriarty <[email protected]>
adds refactor and addresses discussion/code review feedback Signed-off-by: Moriarty <[email protected]>
refactor and fix a few debugged issues Signed-off-by: Moriarty <[email protected]>
Signed-off-by: Moriarty <[email protected]>
Signed-off-by: Moriarty <[email protected]>
Signed-off-by: Moriarty <[email protected]>
Signed-off-by: Moriarty <[email protected]>
Ah damnit, the Github UI signoff feature is broken. S |
packages/core/src/modules/indy/repository/AnonCredsSchemaRecord.ts
Outdated
Show resolved
Hide resolved
Not sure why it resubmitted my previous comments... |
Thanks for the feedback @TimoGlastra 🙏 (and sorry for this being less straight-forward than could be 😅) |
Signed-off-by: Moriarty <[email protected]>
…ries-framework-javascript into feat/indyNameSpace Signed-off-by: Moriarty <[email protected]>
} else if ('schemaSeqNo' in credDef) { | ||
seqNo = credDef.schemaSeqNo | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does schemaSeqNo
come from? I don't think this is still used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is used to create the anonCreds trunk ${did}/anoncreds/v0/CLAIM_DEF/${seqNo}/${credDef.tag}
so that's needed I reckon. Maybe I'm missing sth here though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the schemaSeqNo is defined anywhere? It's added to the signature of this method, but I think we shouldn't add custom properties to existing objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm ok fair enough. was thinking to do it this way to safe a call to getSchema but rather just have it at hand directly. Maybe you have another/better idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do we get the scheqSeqNo from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it can be a separate property that we pass separately to this method and store separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we get it from CredentialDefinitionTemplate.schema.seqno which is the type in ledgerApi registerCredentialDefinition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it can be a separate property that we pass separately to this method and store separately?
yeah that might be possible. Unsure right now where to store that then tho -I'll have a think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TimoGlastra this is the one bit I'm actually unsure how to do better. Happy to implement suggestions.
Otherwise all feedback addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TimoGlastra if you have some time maybe we can work this out (together) and get this merged
Signed-off-by: Moriarty <[email protected]>
Signed-off-by: Moriarty <[email protected]>
6a42596
to
cb449c1
Compare
Signed-off-by: Moriarty <[email protected]>
Signed-off-by: Timo Glastra <[email protected]>
@morrieinmaas added a PR to resolve my comment. It seems DCO is failing. Could you squash all commits into one so we can merge? |
We can use the "set dco to pass" and squash when we merge. No need to squash before hand. |
Yes that makes sense @blu3beri :-) |
Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>
ALright, thx. Anything else that needs doing then? |
…ation#965) Signed-off-by: Moriarty <[email protected]>
Signed-off-by: Moriarty [email protected]