@veramo/credential-ld 4.2.1-next.6 → 4.2.1-unstable.9
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.
- package/build/action-handler.d.ts +389 -3
- package/build/action-handler.d.ts.map +1 -1
- package/build/action-handler.js +118 -136
- package/build/action-handler.js.map +1 -1
- package/build/index.d.ts +8 -16
- package/build/index.d.ts.map +1 -1
- package/build/index.js +8 -36
- package/build/index.js.map +1 -1
- package/build/ld-context-loader.d.ts +1 -1
- package/build/ld-context-loader.d.ts.map +1 -1
- package/build/ld-context-loader.js +6 -20
- package/build/ld-context-loader.js.map +1 -1
- package/build/ld-credential-module.d.ts +3 -3
- package/build/ld-credential-module.d.ts.map +1 -1
- package/build/ld-credential-module.js +72 -85
- package/build/ld-credential-module.js.map +1 -1
- package/build/ld-default-contexts.d.ts +315 -1
- package/build/ld-default-contexts.d.ts.map +1 -1
- package/build/ld-default-contexts.js +28 -17
- package/build/ld-default-contexts.js.map +1 -1
- package/build/ld-suite-loader.d.ts +1 -1
- package/build/ld-suite-loader.d.ts.map +1 -1
- package/build/ld-suite-loader.js +4 -9
- package/build/ld-suite-loader.js.map +1 -1
- package/build/ld-suites.js +2 -7
- package/build/ld-suites.js.map +1 -1
- package/build/plugin.schema.json +430 -0
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts.map +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js +16 -52
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js.map +1 -1
- package/build/suites/Ed25519Signature2018.d.ts +1 -1
- package/build/suites/Ed25519Signature2018.d.ts.map +1 -1
- package/build/suites/Ed25519Signature2018.js +12 -48
- package/build/suites/Ed25519Signature2018.js.map +1 -1
- package/build/suites/Ed25519Signature2020.d.ts +1 -1
- package/build/suites/Ed25519Signature2020.d.ts.map +1 -1
- package/build/suites/Ed25519Signature2020.js +16 -54
- package/build/suites/Ed25519Signature2020.js.map +1 -1
- package/build/suites/JsonWebSignature2020.d.ts +1 -1
- package/build/suites/JsonWebSignature2020.d.ts.map +1 -1
- package/build/suites/JsonWebSignature2020.js +44 -82
- package/build/suites/JsonWebSignature2020.js.map +1 -1
- package/build/tsdoc-metadata.json +1 -1
- package/build/types.js +1 -2
- package/package.json +20 -9
- package/src/__tests__/context.loader.test.ts +3 -3
- package/src/__tests__/issue-verify-flow.test.ts +7 -5
- package/src/action-handler.ts +8 -7
- package/src/index.ts +8 -17
- package/src/ld-context-loader.ts +1 -1
- package/src/ld-credential-module.ts +5 -4
- package/src/ld-default-contexts.ts +27 -14
- package/src/ld-suite-loader.ts +1 -1
- package/src/module-types/jsonld/index.d.ts +0 -1
- package/{plugin.schema.json → src/plugin.schema.json} +0 -0
- package/src/suites/EcdsaSecp256k1RecoverySignature2020.ts +4 -4
- package/src/suites/Ed25519Signature2018.ts +1 -1
- package/src/suites/Ed25519Signature2020.ts +4 -3
- package/src/suites/JsonWebSignature2020.ts +1 -1
package/src/index.ts
CHANGED
|
@@ -10,20 +10,11 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @packageDocumentation
|
|
12
12
|
*/
|
|
13
|
-
export { CredentialIssuerLD } from './action-handler'
|
|
14
|
-
export * from './types'
|
|
15
|
-
export { LdDefaultContexts } from './ld-default-contexts'
|
|
16
|
-
export { VeramoLdSignature } from './ld-suites'
|
|
17
|
-
export * from './suites/EcdsaSecp256k1RecoverySignature2020'
|
|
18
|
-
export * from './suites/Ed25519Signature2018'
|
|
19
|
-
export * from './suites/Ed25519Signature2020'
|
|
20
|
-
export * from './suites/JsonWebSignature2020'
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The parameter and return types schemas for the {@link @veramo/credential-ld#CredentialIssuerLD | CredentialIssuerLD}
|
|
24
|
-
* plugin methods.
|
|
25
|
-
*
|
|
26
|
-
* @beta This API may change without a BREAKING CHANGE notice.
|
|
27
|
-
*/
|
|
28
|
-
const schema = require('../plugin.schema.json')
|
|
29
|
-
export { schema }
|
|
13
|
+
export { CredentialIssuerLD } from './action-handler.js'
|
|
14
|
+
export * from './types.js'
|
|
15
|
+
export { LdDefaultContexts } from './ld-default-contexts.js'
|
|
16
|
+
export { VeramoLdSignature } from './ld-suites.js'
|
|
17
|
+
export * from './suites/EcdsaSecp256k1RecoverySignature2020.js'
|
|
18
|
+
export * from './suites/Ed25519Signature2018.js'
|
|
19
|
+
export * from './suites/Ed25519Signature2020.js'
|
|
20
|
+
export * from './suites/JsonWebSignature2020.js'
|
package/src/ld-context-loader.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* the w3c credential module.
|
|
5
5
|
*/
|
|
6
6
|
import { isIterable, OrPromise, RecordLike } from '@veramo/utils'
|
|
7
|
-
import { ContextDoc } from './types'
|
|
7
|
+
import { ContextDoc } from './types.js'
|
|
8
8
|
|
|
9
9
|
export class LdContextLoader {
|
|
10
10
|
private readonly contexts: Record<string, OrPromise<ContextDoc>>
|
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
} from '@veramo/core'
|
|
10
10
|
import fetch from 'cross-fetch'
|
|
11
11
|
import Debug from 'debug'
|
|
12
|
-
import
|
|
12
|
+
import jsonldSignatures from '@digitalcredentials/jsonld-signatures'
|
|
13
|
+
const { extendContextLoader } = jsonldSignatures
|
|
13
14
|
import * as vc from '@digitalcredentials/vc'
|
|
14
|
-
import { LdContextLoader } from './ld-context-loader'
|
|
15
|
-
import { LdSuiteLoader } from './ld-suite-loader'
|
|
16
|
-
import { RequiredAgentMethods } from './ld-suites'
|
|
15
|
+
import { LdContextLoader } from './ld-context-loader.js'
|
|
16
|
+
import { LdSuiteLoader } from './ld-suite-loader.js'
|
|
17
|
+
import { RequiredAgentMethods } from './ld-suites.js'
|
|
17
18
|
|
|
18
19
|
const debug = Debug('veramo:w3c:ld-credential-module')
|
|
19
20
|
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import contextCredentialV1 from "./contexts/www.w3.org_2018_credentials_v1.json" assert { type: 'json' }
|
|
2
|
+
import contextDidV1 from "./contexts/www.w3.org_ns_did_v1.json" assert { type: 'json' }
|
|
3
|
+
import contextSecurityV1 from "./contexts/w3id.org_security_v1.json" assert { type: 'json' }
|
|
4
|
+
import contextSecurityV2 from "./contexts/w3id.org_security_v2.json" assert { type: 'json' }
|
|
5
|
+
import contextSecurityV3 from "./contexts/w3id.org_security_v3-unstable.json" assert { type: 'json' }
|
|
6
|
+
import contextSuitesEd25519 from "./contexts/w3id.org_security_suites_ed25519-2018_v1.json" assert { type: 'json' }
|
|
7
|
+
import contextSuitesX25519 from "./contexts/w3id.org_security_suites_x25519-2019_v1.json" assert { type: 'json' }
|
|
8
|
+
import contextProfile from "./contexts/veramo.io_contexts_profile_v1.json" assert { type: 'json' }
|
|
9
|
+
import contextLdsEcdsaSecpRecovery2020_0 from "./contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json" assert { type: 'json' }
|
|
10
|
+
import contextLdsEcdsaSecpRecovery2020_2 from "./contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json" assert { type: 'json' }
|
|
11
|
+
import contextSuitesSecp from "./contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json" assert { type: 'json' }
|
|
12
|
+
import contextSuitesEd25519_2020 from './contexts/ed25519-signature-2020-v1.json' assert { type: 'json' }
|
|
13
|
+
import contextSuitesJws_2020 from './contexts/json-web-signature-2020-v1.json' assert { type: 'json' }
|
|
2
14
|
|
|
3
15
|
/**
|
|
4
16
|
* Provides a hardcoded map of common Linked Data `@context` definitions.
|
|
@@ -8,24 +20,25 @@ import { ContextDoc } from './types'
|
|
|
8
20
|
*
|
|
9
21
|
* @beta This API may change without a BREAKING CHANGE notice.
|
|
10
22
|
*/
|
|
23
|
+
// @ts-ignore
|
|
11
24
|
export const LdDefaultContexts = new Map([
|
|
12
|
-
['https://www.w3.org/2018/credentials/v1',
|
|
13
|
-
['https://www.w3.org/ns/did/v1',
|
|
14
|
-
['https://w3id.org/security/v1',
|
|
15
|
-
['https://w3id.org/security/v2',
|
|
16
|
-
['https://w3id.org/security/v3-unstable',
|
|
17
|
-
['https://w3id.org/security/suites/ed25519-2018/v1',
|
|
18
|
-
['https://w3id.org/security/suites/x25519-2019/v1',
|
|
19
|
-
['https://w3id.org/security/suites/ed25519-2020/v1',
|
|
20
|
-
['https://w3id.org/security/suites/jws-2020/v1',
|
|
25
|
+
['https://www.w3.org/2018/credentials/v1', contextCredentialV1],
|
|
26
|
+
['https://www.w3.org/ns/did/v1', contextDidV1],
|
|
27
|
+
['https://w3id.org/security/v1', contextSecurityV1],
|
|
28
|
+
['https://w3id.org/security/v2', contextSecurityV2],
|
|
29
|
+
['https://w3id.org/security/v3-unstable', contextSecurityV3],
|
|
30
|
+
['https://w3id.org/security/suites/ed25519-2018/v1', contextSuitesEd25519],
|
|
31
|
+
['https://w3id.org/security/suites/x25519-2019/v1', contextSuitesX25519],
|
|
32
|
+
['https://w3id.org/security/suites/ed25519-2020/v1', contextSuitesEd25519_2020],
|
|
33
|
+
['https://w3id.org/security/suites/jws-2020/v1', contextSuitesJws_2020],
|
|
21
34
|
// ['https://w3id.org/did/v0.11', require('./contexts/did_v0.11.json')],
|
|
22
35
|
// ['https://veramo.io/contexts/socialmedia/v1', require('./contexts/socialmedia-v1.json')],
|
|
23
36
|
// ['https://veramo.io/contexts/kyc/v1', require('./contexts/kyc-v1.json')],
|
|
24
|
-
['https://veramo.io/contexts/profile/v1',
|
|
37
|
+
['https://veramo.io/contexts/profile/v1', contextProfile],
|
|
25
38
|
// ['https://ns.did.ai/transmute/v1', require('./contexts/transmute_v1.json')],
|
|
26
|
-
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld',
|
|
27
|
-
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-2.0.jsonld',
|
|
28
|
-
['https://w3id.org/security/suites/secp256k1recovery-2020/v2',
|
|
39
|
+
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld', contextLdsEcdsaSecpRecovery2020_0],
|
|
40
|
+
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-2.0.jsonld', contextLdsEcdsaSecpRecovery2020_2],
|
|
41
|
+
['https://w3id.org/security/suites/secp256k1recovery-2020/v2', contextSuitesSecp]
|
|
29
42
|
// ['https://w3id.org/security/suites/ed25519-2018/v1', require('./contexts/ed25519-signature-2018-v1.json')],
|
|
30
43
|
// ['https://w3id.org/security/suites/x25519-2019/v1', require('./contexts/X25519KeyAgreementKey2019.json')],
|
|
31
44
|
])
|
package/src/ld-suite-loader.ts
CHANGED
|
@@ -2,7 +2,6 @@ declare module '@digitalcredentials/jsonld'
|
|
|
2
2
|
declare module '@digitalcredentials/jsonld-signatures'
|
|
3
3
|
declare module '@digitalcredentials/vc'
|
|
4
4
|
declare module '@digitalcredentials/ed25519-signature-2020'
|
|
5
|
-
declare module '@digitalcredentials/ed25519-verification-key-2020'
|
|
6
5
|
declare module '@veramo-community/lds-ecdsa-secp256k1-recovery2020'
|
|
7
6
|
|
|
8
7
|
declare module "*.json" {
|
|
File without changes
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites'
|
|
1
|
+
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites.js'
|
|
2
2
|
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core'
|
|
3
|
-
import
|
|
3
|
+
import ldsEcdsa from '@veramo-community/lds-ecdsa-secp256k1-recovery2020'
|
|
4
|
+
const {
|
|
4
5
|
EcdsaSecp256k1RecoveryMethod2020,
|
|
5
6
|
EcdsaSecp256k1RecoverySignature2020,
|
|
6
|
-
}
|
|
7
|
-
|
|
7
|
+
} = ldsEcdsa
|
|
8
8
|
import * as u8a from 'uint8arrays'
|
|
9
9
|
import { asArray, encodeJoseBlob } from '@veramo/utils'
|
|
10
10
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { encodeJoseBlob } from '@veramo/utils'
|
|
2
|
-
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites'
|
|
2
|
+
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites.js'
|
|
3
3
|
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core'
|
|
4
4
|
import * as u8a from 'uint8arrays'
|
|
5
5
|
import { Ed25519Signature2018, Ed25519VerificationKey2018 } from '@transmute/ed25519-signature-2018'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites'
|
|
1
|
+
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites.js'
|
|
2
2
|
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core'
|
|
3
3
|
import * as u8a from 'uint8arrays'
|
|
4
4
|
import { Ed25519Signature2020 } from '@digitalcredentials/ed25519-signature-2020'
|
|
@@ -49,11 +49,12 @@ export class VeramoEd25519Signature2020 extends VeramoLdSignature {
|
|
|
49
49
|
id,
|
|
50
50
|
controller,
|
|
51
51
|
publicKeyMultibase: this.preSigningKeyModification(u8a.fromString(key.publicKeyHex, 'hex')),
|
|
52
|
-
signer: () => signer,
|
|
53
|
-
type: this.getSupportedVerificationType(),
|
|
52
|
+
// signer: () => signer,
|
|
53
|
+
// type: this.getSupportedVerificationType(),
|
|
54
54
|
})
|
|
55
55
|
// overwrite the signer since we're not passing the private key
|
|
56
56
|
verificationKey.signer = () => signer as any
|
|
57
|
+
verificationKey.type = this.getSupportedVerificationType()
|
|
57
58
|
return new Ed25519Signature2020({
|
|
58
59
|
key: verificationKey,
|
|
59
60
|
signer: signer,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from "@veramo/core";
|
|
2
|
-
import { RequiredAgentMethods, VeramoLdSignature } from "../ld-suites";
|
|
2
|
+
import { RequiredAgentMethods, VeramoLdSignature } from "../ld-suites.js";
|
|
3
3
|
import * as u8a from "uint8arrays";
|
|
4
4
|
import { JsonWebKey, JsonWebSignature } from "@transmute/json-web-signature";
|
|
5
5
|
import { encodeJoseBlob } from "@veramo/utils";
|