@veramo/credential-ld 3.1.5-next.119 → 3.1.5-next.122

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/build/contexts/did_v0.11.json +55 -0
  2. package/build/contexts/ed25519-signature-2018-v1.json +91 -0
  3. package/build/contexts/kyc-v1.json +8 -0
  4. package/build/contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json +21 -0
  5. package/build/contexts/socialmedia-v1.json +7 -0
  6. package/build/contexts/transmute_v1.json +20 -0
  7. package/build/contexts/veramo.io_contexts_profile_v1.json +8 -0
  8. package/build/contexts/w3id.org_security_suites_ed25519-2018_v1.json +58 -0
  9. package/build/contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json +87 -0
  10. package/build/contexts/w3id.org_security_suites_x25519-2019_v1.json +26 -0
  11. package/build/contexts/w3id.org_security_v1.json +47 -0
  12. package/build/contexts/w3id.org_security_v2.json +58 -0
  13. package/build/contexts/w3id.org_security_v3-unstable.json +710 -0
  14. package/build/contexts/www.w3.org_2018_credentials_v1.json +195 -0
  15. package/build/contexts/www.w3.org_ns_did_v1.json +57 -0
  16. package/build/ld-credential-module.d.ts.map +1 -1
  17. package/build/ld-credential-module.js +5 -9
  18. package/build/ld-credential-module.js.map +1 -1
  19. package/build/ld-suites.js +1 -1
  20. package/build/ld-suites.js.map +1 -1
  21. package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts +2 -2
  22. package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts.map +1 -1
  23. package/build/suites/EcdsaSecp256k1RecoverySignature2020.js +9 -13
  24. package/build/suites/EcdsaSecp256k1RecoverySignature2020.js.map +1 -1
  25. package/package.json +12 -12
  26. package/src/__tests__/issue-verify-flow.test.ts +3 -1
  27. package/src/ld-credential-module.ts +5 -10
  28. package/src/ld-suites.ts +1 -1
  29. package/src/module-types/jsonld/index.d.ts +9 -0
  30. package/src/suites/EcdsaSecp256k1RecoverySignature2020.ts +12 -15
@@ -1,5 +1,5 @@
1
1
  import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites'
2
- import { CredentialPayload, DIDDocument, IAgentContext, IKey, PresentationPayload, TKeyType } from '@veramo/core'
2
+ import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core'
3
3
  import {
4
4
  EcdsaSecp256k1RecoveryMethod2020,
5
5
  EcdsaSecp256k1RecoverySignature2020,
@@ -45,7 +45,7 @@ export class VeramoEcdsaSecp256k1RecoverySignature2020 extends VeramoLdSignature
45
45
  },
46
46
  }
47
47
 
48
- return new EcdsaSecp256k1RecoverySignature2020({
48
+ const suite = new EcdsaSecp256k1RecoverySignature2020({
49
49
  // signer,
50
50
  key: new EcdsaSecp256k1RecoveryMethod2020({
51
51
  publicKeyHex: key.publicKeyHex,
@@ -55,6 +55,12 @@ export class VeramoEcdsaSecp256k1RecoverySignature2020 extends VeramoLdSignature
55
55
  id: verifiableMethodId,
56
56
  }),
57
57
  })
58
+
59
+ suite.ensureSuiteContext = ({ document }: { document: any, addSuiteContext: boolean }) => {
60
+ document['@context'] = [...asArray(document['@context'] || []), this.getContext()]
61
+ }
62
+
63
+ return suite
58
64
  }
59
65
 
60
66
  getSuiteForVerification(): any {
@@ -62,25 +68,13 @@ export class VeramoEcdsaSecp256k1RecoverySignature2020 extends VeramoLdSignature
62
68
  }
63
69
 
64
70
  preSigningCredModification(credential: CredentialPayload): void {
65
- credential['@context'] = [
66
- ...asArray(credential['@context'] || []),
67
- 'https://w3id.org/security/suites/secp256k1recovery-2020/v2',
68
- ]
69
- }
70
-
71
- preSigningPresModification(presentation: PresentationPayload): void {
72
- super.preSigningPresModification(presentation)
73
- presentation['@context'] = [
74
- ...asArray(presentation['@context'] || []),
75
- 'https://w3id.org/security/suites/secp256k1recovery-2020/v2',
76
- ]
77
71
  }
78
72
 
79
73
  preDidResolutionModification(didUrl: string, didDoc: DIDDocument): void {
80
74
  // did:ethr
81
75
  const idx = didDoc['@context']?.indexOf('https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld') || -1
82
76
  if (Array.isArray(didDoc['@context']) && idx !== -1) {
83
- didDoc['@context'][idx] = "https://w3id.org/security/suites/secp256k1recovery-2020/v2"
77
+ didDoc['@context'][idx] = this.getContext()
84
78
  }
85
79
 
86
80
  if (didUrl.toLowerCase().startsWith('did:ethr')) {
@@ -95,4 +89,7 @@ export class VeramoEcdsaSecp256k1RecoverySignature2020 extends VeramoLdSignature
95
89
  })
96
90
  }
97
91
  }
92
+ getContext(): string {
93
+ return 'https://w3id.org/security/suites/secp256k1recovery-2020/v2'
94
+ }
98
95
  }