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: add dynamic suite and signing provider #949

Conversation

TimoGlastra
Copy link
Contributor

Extends the SignatureSuiteRegistry and adds a SigningProviderRegistry that allows to dynamically register signers for key types and signature suites. This is needed in preparation of #948, so we can extract the bbs signing provider and signature suites to it's own package.

Extracting into a separate package will be done in a separate PR.

BbsService has been moved into the generic SigningProvider interface. I've removed support for Bls12381g1 keys for now as they're not really used for anything. It will be easy to add back in.

Signed-off-by: Timo Glastra <timo@animo.id>
@TimoGlastra TimoGlastra requested a review from a team as a code owner July 14, 2022 13:24
@TimoGlastra TimoGlastra added modularization Tasks related to modularization of the framework 0.3.0 Changes for the 0.3.0 release labels Jul 14, 2022
Signed-off-by: Timo Glastra <timo@animo.id>
Copy link
Contributor

@berendsliedrecht berendsliedrecht left a comment

Choose a reason for hiding this comment

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

Nice abstraction. Just left small comments.

export interface SigningProvider {
readonly keyType: KeyType

createKey(options: CreateKeyOptions): Promise<KeyPair>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
createKey(options: CreateKeyOptions): Promise<KeyPair>
createKeyPair(options: CreateKeyPairOptions): Promise<KeyPair>

For createKey I would expect a symmetric key.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense 👍


const LinkedDataSignature = suites.LinkedDataSignature

export const SignatureSuiteToken = Symbol('SignatureSuiteToken')
export interface SuiteInfo {
suiteClass: typeof LinkedDataSignature
Copy link
Contributor

Choose a reason for hiding this comment

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

I would assume this is correct, but if is supposed to be generic between, for now, ed25519 and BBS+ then the LinkedDataSignature is not really a good name I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the bbs suites also extend linked data signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope it extends LinkedDataProof, and LinkedDataSignature also extends LinkedDataProof.

@karimStekelenburg any reason you used LinkedDataSignature instead of LinkedDataProof?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm not sure tbh. Probably by accident

packages/core/src/wallet/IndyWallet.ts Show resolved Hide resolved
Signed-off-by: Timo Glastra <timo@animo.id>
@codecov-commenter
Copy link

Codecov Report

Merging #949 (c71a77e) into 0.3.0-pre (df1ed92) will decrease coverage by 1.89%.
The diff coverage is 58.69%.

@@              Coverage Diff              @@
##           0.3.0-pre     #949      +/-   ##
=============================================
- Coverage      87.09%   85.20%   -1.90%     
=============================================
  Files            536      539       +3     
  Lines          13050    13086      +36     
  Branches        2244     2244              
=============================================
- Hits           11366    11150     -216     
- Misses          1588     1805     +217     
- Partials          96      131      +35     
Impacted Files Coverage Δ
...ypto/signing-provider/Bls12381g2SigningProvider.ts 25.80% <25.80%> (ø)
packages/core/src/wallet/IndyWallet.ts 56.76% <31.81%> (-5.79%) ⬇️
...rc/crypto/signing-provider/SigningProviderError.ts 100.00% <100.00%> (ø)
...crypto/signing-provider/SigningProviderRegistry.ts 100.00% <100.00%> (ø)
packages/core/src/crypto/signing-provider/index.ts 100.00% <100.00%> (ø)
...ages/core/src/modules/vc/SignatureSuiteRegistry.ts 70.58% <100.00%> (ø)
...ckages/core/src/modules/vc/W3cCredentialService.ts 71.85% <100.00%> (-4.09%) ⬇️
packages/core/src/modules/vc/module.ts 100.00% <100.00%> (ø)
packages/core/src/plugins/index.ts 100.00% <100.00%> (ø)
packages/core/src/wallet/WalletModule.ts 94.64% <100.00%> (+0.19%) ⬆️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df1ed92...c71a77e. Read the comment docs.

Signed-off-by: Timo Glastra <timo@animo.id>
@TimoGlastra
Copy link
Contributor Author

Merging as only failing test is the BBS test.

@TimoGlastra TimoGlastra merged commit d8ec58b into openwallet-foundation:0.3.0-pre Jul 19, 2022
@TimoGlastra TimoGlastra deleted the feat/dynamic-signing-suite-provider branch July 19, 2022 08:30
TimoGlastra added a commit that referenced this pull request Aug 11, 2022
Signed-off-by: Timo Glastra <timo@animo.id>
TimoGlastra added a commit that referenced this pull request Aug 26, 2022
Signed-off-by: Timo Glastra <timo@animo.id>
TimoGlastra added a commit that referenced this pull request Aug 26, 2022
Signed-off-by: Timo Glastra <timo@animo.id>
genaris pushed a commit to 2060-io/aries-framework-javascript that referenced this pull request Sep 16, 2022
Signed-off-by: Timo Glastra <timo@animo.id>
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.3.0 Changes for the 0.3.0 release modularization Tasks related to modularization of the framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants