@veramo/credential-ld 6.0.1-next.5 → 6.0.1-next.52

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 (57) hide show
  1. package/build/CredentialProviderLD.d.ts +42 -0
  2. package/build/CredentialProviderLD.d.ts.map +1 -0
  3. package/build/{action-handler.js → CredentialProviderLD.js} +38 -25
  4. package/build/CredentialProviderLD.js.map +1 -0
  5. package/build/index.d.ts +3 -4
  6. package/build/index.d.ts.map +1 -1
  7. package/build/index.js +3 -4
  8. package/build/index.js.map +1 -1
  9. package/build/ld-credential-module.d.ts +4 -4
  10. package/build/ld-credential-module.d.ts.map +1 -1
  11. package/build/ld-credential-module.js.map +1 -1
  12. package/build/ld-default-contexts.d.ts +1 -1
  13. package/build/ld-default-contexts.js +18 -18
  14. package/build/ld-default-contexts.js.map +1 -1
  15. package/build/ld-suites.d.ts +1 -0
  16. package/build/ld-suites.d.ts.map +1 -1
  17. package/build/ld-suites.js.map +1 -1
  18. package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts +1 -0
  19. package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts.map +1 -1
  20. package/build/suites/EcdsaSecp256k1RecoverySignature2020.js +3 -0
  21. package/build/suites/EcdsaSecp256k1RecoverySignature2020.js.map +1 -1
  22. package/build/suites/Ed25519Signature2018.d.ts +1 -0
  23. package/build/suites/Ed25519Signature2018.d.ts.map +1 -1
  24. package/build/suites/Ed25519Signature2018.js +3 -0
  25. package/build/suites/Ed25519Signature2018.js.map +1 -1
  26. package/build/suites/Ed25519Signature2020.d.ts +1 -0
  27. package/build/suites/Ed25519Signature2020.d.ts.map +1 -1
  28. package/build/suites/Ed25519Signature2020.js +3 -0
  29. package/build/suites/Ed25519Signature2020.js.map +1 -1
  30. package/build/suites/JsonWebSignature2020.d.ts +1 -0
  31. package/build/suites/JsonWebSignature2020.d.ts.map +1 -1
  32. package/build/suites/JsonWebSignature2020.js +3 -0
  33. package/build/suites/JsonWebSignature2020.js.map +1 -1
  34. package/build/tsdoc-metadata.json +1 -1
  35. package/build/types.d.ts +0 -220
  36. package/build/types.d.ts.map +1 -1
  37. package/package.json +8 -12
  38. package/src/{action-handler.ts → CredentialProviderLD.ts} +61 -40
  39. package/src/__tests__/issue-verify-ed25519-2020.test.ts +122 -122
  40. package/src/__tests__/{issue-verify-flow.test.ts → issue-verify-flow-ld.test.ts} +26 -11
  41. package/src/index.ts +3 -4
  42. package/src/ld-credential-module.ts +4 -3
  43. package/src/ld-default-contexts.ts +18 -18
  44. package/src/ld-suites.ts +2 -0
  45. package/src/suites/EcdsaSecp256k1RecoverySignature2020.ts +6 -1
  46. package/src/suites/Ed25519Signature2018.ts +5 -0
  47. package/src/suites/Ed25519Signature2020.ts +5 -1
  48. package/src/suites/JsonWebSignature2020.ts +5 -1
  49. package/src/types.ts +0 -265
  50. package/build/action-handler.d.ts +0 -461
  51. package/build/action-handler.d.ts.map +0 -1
  52. package/build/action-handler.js.map +0 -1
  53. package/build/plugin.schema.d.ts +0 -430
  54. package/build/plugin.schema.d.ts.map +0 -1
  55. package/build/plugin.schema.js +0 -477
  56. package/build/plugin.schema.js.map +0 -1
  57. package/src/plugin.schema.ts +0 -476
@@ -1,143 +1,143 @@
1
1
  import {
2
- createAgent,
3
- CredentialPayload,
4
- ICredentialPlugin,
5
- IDIDManager,
6
- IIdentifier,
7
- IKeyManager,
8
- IResolver,
9
- TAgent,
10
- } from '../../../core/src'
11
- import { CredentialPlugin } from '../../../credential-w3c/src'
12
- import { DIDManager, MemoryDIDStore } from '../../../did-manager/src'
13
- import { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'
14
- import { KeyManagementSystem } from '../../../kms-local/src'
15
- import { DIDResolverPlugin } from '../../../did-resolver/src'
16
- import { ContextDoc } from '../types'
17
- import { CredentialIssuerLD } from '../action-handler'
18
- import { LdDefaultContexts } from '../ld-default-contexts'
19
- import { VeramoEd25519Signature2020 } from '../suites/Ed25519Signature2020'
20
- import { Resolver } from 'did-resolver'
21
- import { FakeDidProvider, FakeDidResolver } from '../../../test-utils/src/fake-did'
22
- import { jest } from '@jest/globals'
2
+ createAgent,
3
+ CredentialPayload,
4
+ ICredentialPlugin,
5
+ IDIDManager,
6
+ IIdentifier,
7
+ IKeyManager,
8
+ IResolver,
9
+ TAgent,
10
+ } from '../../../core/src'
11
+ import { CredentialPlugin } from '../../../credential-w3c/src'
12
+ import { DIDManager, MemoryDIDStore } from '../../../did-manager/src'
13
+ import { KeyManager, MemoryKeyStore, MemoryPrivateKeyStore } from '../../../key-manager/src'
14
+ import { KeyManagementSystem } from '../../../kms-local/src'
15
+ import { DIDResolverPlugin } from '../../../did-resolver/src'
16
+ import { ContextDoc } from '../types'
17
+ import { CredentialProviderLD } from '../CredentialProviderLD'
18
+ import { LdDefaultContexts } from '../ld-default-contexts'
19
+ import { VeramoEd25519Signature2020 } from '../suites/Ed25519Signature2020'
20
+ import { Resolver } from 'did-resolver'
21
+ import { FakeDidProvider, FakeDidResolver } from '../../../test-utils/src/fake-did'
22
+ import { jest } from '@jest/globals'
23
23
 
24
- jest.setTimeout(300000)
24
+ jest.setTimeout(300000)
25
25
 
26
- const customContext: Record<string, ContextDoc> = {
27
- 'custom:example.context': {
28
- '@context': {
29
- nothing: 'custom:example.context#blank',
30
- },
26
+ const customContext: Record<string, ContextDoc> = {
27
+ 'custom:example.context': {
28
+ '@context': {
29
+ nothing: 'custom:example.context#blank',
31
30
  },
32
- }
31
+ },
32
+ }
33
33
 
34
- describe('credential-LD full flow', () => {
35
- let didFakeIdentifier: IIdentifier
36
- let agent: TAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>
34
+ describe('credential-LD full flow', () => {
35
+ let didFakeIdentifier: IIdentifier
36
+ let agent: TAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>
37
37
 
38
- beforeAll(async () => {
39
- agent = createAgent({
40
- plugins: [
41
- new KeyManager({
42
- store: new MemoryKeyStore(),
43
- kms: {
44
- local: new KeyManagementSystem(new MemoryPrivateKeyStore()),
45
- },
46
- }),
47
- new DIDManager({
48
- providers: {
49
- 'did:fake': new FakeDidProvider(),
50
- },
51
- store: new MemoryDIDStore(),
52
- defaultProvider: 'did:fake',
53
- }),
54
- new DIDResolverPlugin({
55
- resolver: new Resolver({
56
- ...new FakeDidResolver(() => agent, true).getDidFakeResolver(),
57
- }),
58
- }),
59
- new CredentialPlugin(),
60
- new CredentialIssuerLD({
61
- contextMaps: [LdDefaultContexts, customContext],
62
- suites: [new VeramoEd25519Signature2020()],
63
- }),
64
- ],
65
- })
66
- didFakeIdentifier = await agent.didManagerImport({
67
- did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',
68
- keys: [
69
- {
70
- type: 'Ed25519',
71
- kid: 'didcomm-senderKey-1',
72
- publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',
73
- privateKeyHex:
74
- 'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',
75
- kms: 'local',
38
+ beforeAll(async () => {
39
+ const ld = new CredentialProviderLD({
40
+ contextMaps: [LdDefaultContexts, customContext],
41
+ suites: [new VeramoEd25519Signature2020()],
42
+ })
43
+ agent = createAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>({
44
+ plugins: [
45
+ new KeyManager({
46
+ store: new MemoryKeyStore(),
47
+ kms: {
48
+ local: new KeyManagementSystem(new MemoryPrivateKeyStore()),
76
49
  },
77
- ],
78
- services: [
79
- {
80
- id: 'msg1',
81
- type: 'DIDCommMessaging',
82
- serviceEndpoint: 'http://localhost:3002/messaging',
50
+ }),
51
+ new DIDManager({
52
+ providers: {
53
+ 'did:fake': new FakeDidProvider(),
83
54
  },
84
- ],
85
- provider: 'did:fake',
86
- alias: 'sender',
87
- })
55
+ store: new MemoryDIDStore(),
56
+ defaultProvider: 'did:fake',
57
+ }),
58
+ new DIDResolverPlugin({
59
+ resolver: new Resolver({
60
+ ...new FakeDidResolver(() => agent, true).getDidFakeResolver(),
61
+ }),
62
+ }),
63
+ new CredentialPlugin({ issuers: [ld] }),
64
+ ],
88
65
  })
89
-
90
- it('works with Ed25519Signature2020 credential', async () => {
91
- const credential: CredentialPayload = {
92
- issuer: didFakeIdentifier.did,
93
- '@context': ['custom:example.context'],
94
- credentialSubject: {
95
- nothing: 'else matters',
66
+ didFakeIdentifier = await agent.didManagerImport({
67
+ did: 'did:fake:z6MkgbqNU4uF9NKSz5BqJQ4XKVHuQZYcUZP8pXGsJC8nTHwo',
68
+ keys: [
69
+ {
70
+ type: 'Ed25519',
71
+ kid: 'didcomm-senderKey-1',
72
+ publicKeyHex: '1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',
73
+ privateKeyHex:
74
+ 'b57103882f7c66512dc96777cbafbeb2d48eca1e7a867f5a17a84e9a6740f7dc1fe9b397c196ab33549041b29cf93be29b9f2bdd27322f05844112fad97ff92a',
75
+ kms: 'local',
76
+ },
77
+ ],
78
+ services: [
79
+ {
80
+ id: 'msg1',
81
+ type: 'DIDCommMessaging',
82
+ serviceEndpoint: 'http://localhost:3002/messaging',
96
83
  },
97
- }
98
- const verifiableCredential = await agent.createVerifiableCredential({
99
- credential,
100
- proofFormat: 'lds',
101
- })
84
+ ],
85
+ provider: 'did:fake',
86
+ alias: 'sender',
87
+ })
88
+ })
102
89
 
103
- expect(verifiableCredential).toBeDefined()
90
+ it('works with Ed25519Signature2020 credential', async () => {
91
+ const credential: CredentialPayload = {
92
+ issuer: didFakeIdentifier.did,
93
+ '@context': ['custom:example.context'],
94
+ credentialSubject: {
95
+ nothing: 'else matters',
96
+ },
97
+ }
98
+ const verifiableCredential = await agent.createVerifiableCredential({
99
+ credential,
100
+ proofFormat: 'lds',
101
+ })
104
102
 
105
- const result = await agent.verifyCredential({
106
- credential: verifiableCredential,
107
- })
103
+ expect(verifiableCredential).toBeDefined()
108
104
 
109
- expect(result.verified).toBe(true)
105
+ const result = await agent.verifyCredential({
106
+ credential: verifiableCredential,
110
107
  })
111
108
 
112
- it('works with Ed25519Signature2020 credential and presentation', async () => {
113
- const credential: CredentialPayload = {
114
- issuer: didFakeIdentifier.did,
115
- '@context': ['custom:example.context'],
116
- credentialSubject: {
117
- nothing: 'else matters',
118
- },
119
- }
120
- const verifiableCredential1 = await agent.createVerifiableCredential({
121
- credential,
122
- proofFormat: 'lds',
123
- })
109
+ expect(result.verified).toBe(true)
110
+ })
124
111
 
125
- const verifiablePresentation = await agent.createVerifiablePresentation({
126
- presentation: {
127
- verifiableCredential: [verifiableCredential1],
128
- holder: didFakeIdentifier.did,
129
- },
130
- challenge: 'VERAMO',
131
- proofFormat: 'lds',
132
- })
112
+ it('works with Ed25519Signature2020 credential and presentation', async () => {
113
+ const credential: CredentialPayload = {
114
+ issuer: didFakeIdentifier.did,
115
+ '@context': ['custom:example.context'],
116
+ credentialSubject: {
117
+ nothing: 'else matters',
118
+ },
119
+ }
120
+ const verifiableCredential1 = await agent.createVerifiableCredential({
121
+ credential,
122
+ proofFormat: 'lds',
123
+ })
133
124
 
134
- expect(verifiablePresentation).toBeDefined()
125
+ const verifiablePresentation = await agent.createVerifiablePresentation({
126
+ presentation: {
127
+ verifiableCredential: [verifiableCredential1],
128
+ holder: didFakeIdentifier.did,
129
+ },
130
+ challenge: 'VERAMO',
131
+ proofFormat: 'lds',
132
+ })
135
133
 
136
- const result = await agent.verifyPresentation({
137
- presentation: verifiablePresentation,
138
- challenge: 'VERAMO',
139
- })
134
+ expect(verifiablePresentation).toBeDefined()
140
135
 
141
- expect(result.verified).toBe(true)
136
+ const result = await agent.verifyPresentation({
137
+ presentation: verifiablePresentation,
138
+ challenge: 'VERAMO',
142
139
  })
140
+
141
+ expect(result.verified).toBe(true)
143
142
  })
143
+ })
@@ -16,7 +16,7 @@ import { getDidKeyResolver, KeyDIDProvider } from '../../../did-provider-key/src
16
16
  import { DIDResolverPlugin } from '../../../did-resolver/src'
17
17
  import { EthrDIDProvider } from '../../../did-provider-ethr/src'
18
18
  import { ContextDoc } from '../types.js'
19
- import { CredentialIssuerLD } from '../action-handler.js'
19
+ import { CredentialProviderLD } from '../CredentialProviderLD.js'
20
20
  import { LdDefaultContexts } from '../ld-default-contexts.js'
21
21
  import { VeramoEd25519Signature2018 } from '../suites/Ed25519Signature2018.js'
22
22
  import { Resolver } from 'did-resolver'
@@ -25,6 +25,7 @@ import { VeramoEcdsaSecp256k1RecoverySignature2020 } from '../suites/EcdsaSecp25
25
25
  import { jest } from '@jest/globals'
26
26
 
27
27
  import 'cross-fetch/polyfill'
28
+ import { createGanacheProvider } from '../../../test-react-app/src/test-utils/ganache-provider'
28
29
 
29
30
  jest.setTimeout(300000)
30
31
 
@@ -36,14 +37,18 @@ const customContext: Record<string, ContextDoc> = {
36
37
  },
37
38
  }
38
39
 
39
- const infuraProjectId = '3586660d179141e3801c3895de1c2eba'
40
-
41
40
  describe('credential-LD full flow', () => {
42
41
  let didKeyIdentifier: IIdentifier
43
42
  let didEthrIdentifier: IIdentifier
44
43
  let agent: TAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>
45
44
 
45
+ const ld = new CredentialProviderLD({
46
+ contextMaps: [LdDefaultContexts, customContext],
47
+ suites: [new VeramoEd25519Signature2018(), new VeramoEcdsaSecp256k1RecoverySignature2020()],
48
+ })
49
+
46
50
  beforeAll(async () => {
51
+ const { provider, registry } = await createGanacheProvider()
47
52
  agent = createAgent<IResolver & IKeyManager & IDIDManager & ICredentialPlugin>({
48
53
  plugins: [
49
54
  new KeyManager({
@@ -57,7 +62,14 @@ describe('credential-LD full flow', () => {
57
62
  'did:key': new KeyDIDProvider({ defaultKms: 'local' }),
58
63
  'did:ethr': new EthrDIDProvider({
59
64
  defaultKms: 'local',
60
- network: 'mainnet',
65
+ networks: [
66
+ {
67
+ chainId: 1337,
68
+ name: 'ganache',
69
+ provider,
70
+ registry,
71
+ },
72
+ ],
61
73
  }),
62
74
  },
63
75
  store: new MemoryDIDStore(),
@@ -66,18 +78,21 @@ describe('credential-LD full flow', () => {
66
78
  new DIDResolverPlugin({
67
79
  resolver: new Resolver({
68
80
  ...getDidKeyResolver(),
69
- ...ethrDidResolver({ infuraProjectId }),
81
+ ...ethrDidResolver({ networks: [
82
+ {
83
+ chainId: 1337,
84
+ name: 'ganache',
85
+ provider,
86
+ registry,
87
+ },
88
+ ], }),
70
89
  }),
71
90
  }),
72
- new CredentialPlugin(),
73
- new CredentialIssuerLD({
74
- contextMaps: [LdDefaultContexts, customContext],
75
- suites: [new VeramoEd25519Signature2018(), new VeramoEcdsaSecp256k1RecoverySignature2020()],
76
- }),
91
+ new CredentialPlugin({ issuers: [ld] }),
77
92
  ],
78
93
  })
79
94
  didKeyIdentifier = await agent.didManagerCreate()
80
- didEthrIdentifier = await agent.didManagerCreate({ provider: 'did:ethr' })
95
+ didEthrIdentifier = await agent.didManagerCreate({ provider: 'did:ethr:ganache' })
81
96
  })
82
97
 
83
98
  it('create credential with inline context', async () => {
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Provides a {@link @veramo/credential-ld#CredentialIssuerLD | plugin} for the {@link @veramo/core#Agent} that
2
+ * Provides a {@link @veramo/credential-ld#CredentialProviderLD | handler} for the {@link @veramo/credential-w3c#CredentialPlugin} that
3
3
  * implements
4
- * {@link @veramo/credential-ld#ICredentialIssuerLD} interface.
4
+ * {@link @veramo/core-types#AbstractCredentialProvider} interface.
5
5
  *
6
6
  * This plugin adds support for working with JSON-LD credentials.
7
7
  * When installed, this plugin will be automatically used by
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * @packageDocumentation
12
12
  */
13
- export { CredentialIssuerLD } from './action-handler.js'
13
+ export { CredentialProviderLD } from './CredentialProviderLD.js'
14
14
  export * from './types.js'
15
15
  export { LdDefaultContexts } from './ld-default-contexts.js'
16
16
  export { VeramoLdSignature } from './ld-suites.js'
@@ -18,4 +18,3 @@ export * from './suites/EcdsaSecp256k1RecoverySignature2020.js'
18
18
  export * from './suites/Ed25519Signature2018.js'
19
19
  export * from './suites/Ed25519Signature2020.js'
20
20
  export * from './suites/JsonWebSignature2020.js'
21
- export { schema } from './plugin.schema.js'
@@ -3,6 +3,7 @@ import {
3
3
  IAgentContext,
4
4
  IKey,
5
5
  IResolver,
6
+ IVerifyResult,
6
7
  PresentationPayload,
7
8
  UsingResolutionOptions,
8
9
  VerifiableCredential,
@@ -22,7 +23,7 @@ const debug = Debug('veramo:w3c:ld-credential-module')
22
23
 
23
24
  type ForwardedOptions = UsingResolutionOptions & {
24
25
  fetchRemoteContexts?: boolean // defaults to false
25
- now?: number // defaults to Date.now()
26
+ now?: Date // defaults to Date.now()
26
27
  }
27
28
 
28
29
  export class LdCredentialModule {
@@ -170,7 +171,7 @@ export class LdCredentialModule {
170
171
  credential: VerifiableCredential,
171
172
  options: ForwardedOptions,
172
173
  context: IAgentContext<IResolver>,
173
- ): Promise<boolean> {
174
+ ): Promise<IVerifyResult> {
174
175
  const fetchRemoteContexts = options.fetchRemoteContexts ?? false
175
176
  const result = await vc.verifyCredential({
176
177
  ...options,
@@ -195,7 +196,7 @@ export class LdCredentialModule {
195
196
  domain: string | undefined,
196
197
  options: ForwardedOptions,
197
198
  context: IAgentContext<IResolver>,
198
- ): Promise<boolean> {
199
+ ): Promise<IVerifyResult> {
199
200
  const fetchRemoteContexts = options.fetchRemoteContexts ?? false
200
201
  const result = await vc.verify({
201
202
  ...options,
@@ -1,26 +1,26 @@
1
- import contextCredentialV1 from './contexts/www.w3.org_2018_credentials_v1.json' assert { type: 'json' }
2
- import contextCredentialExamplesV1 from './contexts/www.w3.org_2018_credentials_examples_v1.json' assert { type: 'json' }
3
- import contextDidV1 from './contexts/www.w3.org_ns_did_v1.json' assert { type: 'json' }
4
- import contextSecurityV1 from './contexts/w3id.org_security_v1.json' assert { type: 'json' }
5
- import contextSecurityV2 from './contexts/w3id.org_security_v2.json' assert { type: 'json' }
6
- import contextSecurityV3 from './contexts/w3id.org_security_v3-unstable.json' assert { type: 'json' }
7
- import contextSecurityBBSV1 from './contexts/w3id.org_security_bbs_v1.json' assert { type: 'json' }
8
- import contextSuitesEd25519 from './contexts/w3id.org_security_suites_ed25519-2018_v1.json' assert { type: 'json' }
9
- import contextSuitesX25519 from './contexts/w3id.org_security_suites_x25519-2019_v1.json' assert { type: 'json' }
10
- import contextVeramoProfile from './contexts/veramo.io_contexts_profile_v1.json' assert { type: 'json' }
11
- import contextLdsEcdsaSecpRecovery2020_0 from './contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json' assert { type: 'json' }
12
- import contextSuitesSecp256k1Recovery2020 from './contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json' assert { type: 'json' }
13
- import contextSuitesEd25519_2020 from './contexts/w3id.org_security_suites_ed25519-2020-v1.json' assert { type: 'json' }
14
- import contextSuitesX25519_2020 from './contexts/w3id.org_security_suites_x25519-2020_v1.json' assert { type: 'json' }
15
- import contextSuitesJws_2020 from './contexts/w3id.org_security_suites_jws-2020_v1.json' assert { type: 'json' }
16
- import contextSuiteEip712 from './contexts/w3id.org_security_suites_eip712sig-2021_v1.json' assert { type: 'json' }
17
- import schema_org from './contexts/schema.org.json' assert { type: 'json' }
1
+ import contextCredentialV1 from './contexts/www.w3.org_2018_credentials_v1.json' with { type: 'json' }
2
+ import contextCredentialExamplesV1 from './contexts/www.w3.org_2018_credentials_examples_v1.json' with { type: 'json' }
3
+ import contextDidV1 from './contexts/www.w3.org_ns_did_v1.json' with { type: 'json' }
4
+ import contextSecurityV1 from './contexts/w3id.org_security_v1.json' with { type: 'json' }
5
+ import contextSecurityV2 from './contexts/w3id.org_security_v2.json' with { type: 'json' }
6
+ import contextSecurityV3 from './contexts/w3id.org_security_v3-unstable.json' with { type: 'json' }
7
+ import contextSecurityBBSV1 from './contexts/w3id.org_security_bbs_v1.json' with { type: 'json' }
8
+ import contextSuitesEd25519 from './contexts/w3id.org_security_suites_ed25519-2018_v1.json' with { type: 'json' }
9
+ import contextSuitesX25519 from './contexts/w3id.org_security_suites_x25519-2019_v1.json' with { type: 'json' }
10
+ import contextVeramoProfile from './contexts/veramo.io_contexts_profile_v1.json' with { type: 'json' }
11
+ import contextLdsEcdsaSecpRecovery2020_0 from './contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json' with { type: 'json' }
12
+ import contextSuitesSecp256k1Recovery2020 from './contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json' with { type: 'json' }
13
+ import contextSuitesEd25519_2020 from './contexts/w3id.org_security_suites_ed25519-2020-v1.json' with { type: 'json' }
14
+ import contextSuitesX25519_2020 from './contexts/w3id.org_security_suites_x25519-2020_v1.json' with { type: 'json' }
15
+ import contextSuitesJws_2020 from './contexts/w3id.org_security_suites_jws-2020_v1.json' with { type: 'json' }
16
+ import contextSuiteEip712 from './contexts/w3id.org_security_suites_eip712sig-2021_v1.json' with { type: 'json' }
17
+ import schema_org from './contexts/schema.org.json' with { type: 'json' }
18
18
 
19
19
  /**
20
20
  * Provides a hardcoded map of common Linked Data `@context` definitions.
21
21
  *
22
22
  * You can use this to bootstrap the `@context` definitions used by
23
- * {@link @veramo/credential-ld#CredentialIssuerLD | CredentialIssuerLD} with these common context definitions.
23
+ * {@link @veramo/credential-ld#CredentialProviderLD | CredentialProviderLD} with these common context definitions.
24
24
  *
25
25
  * @beta This API may change without a BREAKING CHANGE notice.
26
26
  */
package/src/ld-suites.ts CHANGED
@@ -25,6 +25,8 @@ export abstract class VeramoLdSignature {
25
25
 
26
26
  abstract getSupportedVerificationType(): string | string[]
27
27
 
28
+ abstract getSupportedProofType(): string
29
+
28
30
  abstract getSupportedVeramoKeyType(): TKeyType
29
31
 
30
32
  abstract getSuiteForSigning(
@@ -17,6 +17,11 @@ export class VeramoEcdsaSecp256k1RecoverySignature2020 extends VeramoLdSignature
17
17
  // 'JsonWebKey2020', 'Multikey']
18
18
  }
19
19
 
20
+ getSupportedProofType(): string {
21
+ return 'EcdsaSecp256k1RecoverySignature2020'
22
+ }
23
+
24
+
20
25
  getSupportedVeramoKeyType(): TKeyType {
21
26
  return 'Secp256k1'
22
27
  }
@@ -71,7 +76,7 @@ export class VeramoEcdsaSecp256k1RecoverySignature2020 extends VeramoLdSignature
71
76
  return new EcdsaSecp256k1RecoverySignature2020()
72
77
  }
73
78
 
74
- preSigningCredModification(credential: CredentialPayload): void {}
79
+ preSigningCredModification(credential: CredentialPayload): void { }
75
80
 
76
81
  async preDidResolutionModification(didUrl: string, didDoc: DIDDocument): Promise<DIDDocument> {
77
82
  const ctx = asArray(didDoc['@context'])
@@ -14,6 +14,11 @@ export class VeramoEd25519Signature2018 extends VeramoLdSignature {
14
14
  // TODO: add support for ['Ed25519VerificationKey2020', 'Multikey']
15
15
  }
16
16
 
17
+ getSupportedProofType(): string {
18
+ return 'Ed25519Signature2018'
19
+ }
20
+
21
+
17
22
  getSupportedVeramoKeyType(): TKeyType {
18
23
  return 'Ed25519'
19
24
  }
@@ -35,6 +35,10 @@ export class VeramoEd25519Signature2020 extends VeramoLdSignature {
35
35
  // TODO: add support for ['JsonWebKey2020', 'Multikey']
36
36
  }
37
37
 
38
+ getSupportedProofType(): string {
39
+ return 'Ed25519Signature2020'
40
+ }
41
+
38
42
  getSupportedVeramoKeyType(): TKeyType {
39
43
  return 'Ed25519'
40
44
  }
@@ -136,7 +140,7 @@ export class VeramoEd25519Signature2020 extends VeramoLdSignature {
136
140
 
137
141
  private transformVerificationMethod(vm: VerificationMethod): VerificationMethod {
138
142
  if (vm.type === 'Ed25519VerificationKey2020') {
139
- ;(vm as any)['@context'] = 'https://w3id.org/security/suites/ed25519-2020/v1'
143
+ ; (vm as any)['@context'] = 'https://w3id.org/security/suites/ed25519-2020/v1'
140
144
  // publicKeyMultibase is required by this suite
141
145
  if (!vm.publicKeyMultibase) {
142
146
  const { publicKeyHex } = extractPublicKeyHex(vm)
@@ -19,7 +19,11 @@ import {
19
19
  export class VeramoJsonWebSignature2020 extends VeramoLdSignature {
20
20
  getSupportedVerificationType(): string {
21
21
  return 'JsonWebKey2020'
22
- // TODO: add support for ['Ed25519VerificationKey2018', 'Ed25519VerificationKey2020', 'Multikey'] and others
22
+ // TODO: add support for ['Ed25519VerificationKey2018', 'Ed25519VerificationKey2020', 'Multikey'] and others
23
+ }
24
+
25
+ getSupportedProofType(): string {
26
+ return 'JsonWebSignature2020'
23
27
  }
24
28
 
25
29
  getSupportedVeramoKeyType(): TKeyType {