@veramo/credential-ld 3.1.5-next.115 → 3.1.5-next.119
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/ld-credential-module.js +1 -1
- package/build/ld-credential-module.js.map +1 -1
- package/build/ld-default-contexts.d.ts.map +1 -1
- package/build/ld-default-contexts.js +18 -14
- package/build/ld-default-contexts.js.map +1 -1
- package/build/ld-suites.js +2 -1
- package/build/ld-suites.js.map +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts +2 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.d.ts.map +1 -1
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js +20 -7
- package/build/suites/EcdsaSecp256k1RecoverySignature2020.js.map +1 -1
- package/package.json +8 -8
- package/src/__tests__/issue-verify-flow.test.ts +106 -3
- package/{contexts → src/contexts}/did_v0.11.json +0 -0
- package/{contexts → src/contexts}/ed25519-signature-2018-v1.json +0 -0
- package/{contexts → src/contexts}/kyc-v1.json +0 -0
- package/src/contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json +21 -0
- package/{contexts → src/contexts}/socialmedia-v1.json +0 -0
- package/{contexts → src/contexts}/transmute_v1.json +0 -0
- package/{contexts/profile-v1.json → src/contexts/veramo.io_contexts_profile_v1.json} +0 -0
- package/src/contexts/w3id.org_security_suites_ed25519-2018_v1.json +59 -0
- package/src/contexts/w3id.org_security_suites_secp256k1recovery-2020_v2.json +87 -0
- package/{contexts/X25519KeyAgreementKey2019.json → src/contexts/w3id.org_security_suites_x25519-2019_v1.json} +0 -0
- package/src/contexts/w3id.org_security_v1.json +50 -0
- package/src/contexts/w3id.org_security_v2.json +59 -0
- package/src/contexts/w3id.org_security_v3-unstable.json +720 -0
- package/{contexts/w3_2018_credentials_v1.json → src/contexts/www.w3.org_2018_credentials_v1.json} +0 -0
- package/{contexts/security_context_v1.json → src/contexts/www.w3.org_ns_did_v1.json} +0 -0
- package/src/ld-credential-module.ts +1 -1
- package/src/ld-default-contexts.ts +18 -15
- package/src/ld-suites.ts +1 -1
- package/src/suites/EcdsaSecp256k1RecoverySignature2020.ts +21 -6
- package/contexts/lds-ecdsa-secp256k1-recovery2020-0.0.json +0 -60
package/{contexts/w3_2018_credentials_v1.json → src/contexts/www.w3.org_2018_credentials_v1.json}
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import fetch from 'cross-fetch'
|
|
11
11
|
import Debug from 'debug'
|
|
12
12
|
import { extendContextLoader, purposes } from 'jsonld-signatures'
|
|
13
|
-
import * as vc from 'vc
|
|
13
|
+
import * as vc from '@digitalbazaar/vc'
|
|
14
14
|
import { LdContextLoader } from './ld-context-loader'
|
|
15
15
|
import { LdSuiteLoader } from './ld-suite-loader'
|
|
16
16
|
import { RequiredAgentMethods } from './ld-suites'
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import { ContextDoc } from './types'
|
|
2
2
|
|
|
3
3
|
async function _read(_path: string): Promise<ContextDoc> {
|
|
4
|
-
return await import('
|
|
4
|
+
return await import('./contexts/' + _path);
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Provides a hardcoded map of common context definitions
|
|
9
9
|
*/
|
|
10
10
|
export const LdDefaultContexts = new Map([
|
|
11
|
-
['https://www.w3.org/2018/credentials/v1', _read('
|
|
12
|
-
['https://www.w3.org/ns/did/v1', _read('
|
|
13
|
-
['https://w3id.org/
|
|
14
|
-
|
|
15
|
-
['https://
|
|
16
|
-
['https://
|
|
17
|
-
['https://
|
|
18
|
-
['https://
|
|
19
|
-
[
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
],
|
|
23
|
-
['https://
|
|
24
|
-
['https://
|
|
11
|
+
['https://www.w3.org/2018/credentials/v1', _read('www.w3.org_2018_credentials_v1.json')],
|
|
12
|
+
['https://www.w3.org/ns/did/v1', _read('www.w3.org_ns_did_v1.json')],
|
|
13
|
+
['https://w3id.org/security/v1', _read('w3id.org_security_v1.json')],
|
|
14
|
+
['https://w3id.org/security/v2', _read('w3id.org_security_v2.json')],
|
|
15
|
+
['https://w3id.org/security/v3-unstable', _read('w3id.org_security_v3-unstable.json')],
|
|
16
|
+
['https://w3id.org/security/suites/ed25519-2018/v1', _read('w3id.org_security_suites_ed25519-2018_v1.json')],
|
|
17
|
+
['https://w3id.org/security/suites/x25519-2019/v1', _read('w3id.org_security_suites_x25519-2019_v1.json')],
|
|
18
|
+
// ['https://w3id.org/did/v0.11', _read('did_v0.11.json')],
|
|
19
|
+
// ['https://veramo.io/contexts/socialmedia/v1', _read('socialmedia-v1.json')],
|
|
20
|
+
// ['https://veramo.io/contexts/kyc/v1', _read('kyc-v1.json')],
|
|
21
|
+
['https://veramo.io/contexts/profile/v1', _read('veramo.io_contexts_profile_v1.json')],
|
|
22
|
+
// ['https://ns.did.ai/transmute/v1', _read('transmute_v1.json')],
|
|
23
|
+
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld', _read('lds-ecdsa-secp256k1-recovery2020-0.0.json')],
|
|
24
|
+
['https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-2.0.jsonld', _read('w3id.org_security_suites_secp256k1recovery-2020_v2.json')],
|
|
25
|
+
['https://w3id.org/security/suites/secp256k1recovery-2020/v2', _read('w3id.org_security_suites_secp256k1recovery-2020_v2.json')],
|
|
26
|
+
// ['https://w3id.org/security/suites/ed25519-2018/v1', _read('ed25519-signature-2018-v1.json')],
|
|
27
|
+
// ['https://w3id.org/security/suites/x25519-2019/v1', _read('X25519KeyAgreementKey2019.json')],
|
|
25
28
|
])
|
package/src/ld-suites.ts
CHANGED
|
@@ -38,7 +38,7 @@ export abstract class VeramoLdSignature {
|
|
|
38
38
|
// TODO: Remove invalid field 'verifiers' from Presentation. Needs to be adapted for LD credentials
|
|
39
39
|
// Only remove empty array (vc.signPresentation will throw then)
|
|
40
40
|
const sanitizedPresentation = presentation as any
|
|
41
|
-
if (sanitizedPresentation.verifier
|
|
41
|
+
if (sanitizedPresentation.verifier?.length == 0) {
|
|
42
42
|
delete sanitizedPresentation.verifier
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RequiredAgentMethods, VeramoLdSignature } from '../ld-suites'
|
|
2
|
-
import { CredentialPayload, DIDDocument, IAgentContext, IKey, TKeyType } from '@veramo/core'
|
|
2
|
+
import { CredentialPayload, DIDDocument, IAgentContext, IKey, PresentationPayload, TKeyType } from '@veramo/core'
|
|
3
3
|
import {
|
|
4
4
|
EcdsaSecp256k1RecoveryMethod2020,
|
|
5
5
|
EcdsaSecp256k1RecoverySignature2020,
|
|
@@ -64,18 +64,33 @@ export class VeramoEcdsaSecp256k1RecoverySignature2020 extends VeramoLdSignature
|
|
|
64
64
|
preSigningCredModification(credential: CredentialPayload): void {
|
|
65
65
|
credential['@context'] = [
|
|
66
66
|
...asArray(credential['@context'] || []),
|
|
67
|
-
'https://
|
|
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',
|
|
68
76
|
]
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
preDidResolutionModification(didUrl: string, didDoc: DIDDocument): void {
|
|
72
|
-
|
|
80
|
+
// did:ethr
|
|
81
|
+
const idx = didDoc['@context']?.indexOf('https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld') || -1
|
|
82
|
+
if (Array.isArray(didDoc['@context']) && idx !== -1) {
|
|
83
|
+
didDoc['@context'][idx] = "https://w3id.org/security/suites/secp256k1recovery-2020/v2"
|
|
84
|
+
}
|
|
85
|
+
|
|
73
86
|
if (didUrl.toLowerCase().startsWith('did:ethr')) {
|
|
74
|
-
//
|
|
75
|
-
// blockchainAccountId to ethereumAddress
|
|
87
|
+
//EcdsaSecp256k1RecoveryMethod2020 does not support older format blockchainAccountId
|
|
76
88
|
didDoc.verificationMethod?.forEach((x) => {
|
|
77
89
|
if (x.blockchainAccountId) {
|
|
78
|
-
|
|
90
|
+
if (x.blockchainAccountId.lastIndexOf('@eip155:') !== -1) {
|
|
91
|
+
const [ address, chain ] = x.blockchainAccountId.split("@eip155:")
|
|
92
|
+
x.blockchainAccountId = `eip155:${chain}:${address}`
|
|
93
|
+
}
|
|
79
94
|
}
|
|
80
95
|
})
|
|
81
96
|
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"@context": {
|
|
3
|
-
"@version": 1.1,
|
|
4
|
-
"id": "@id",
|
|
5
|
-
"type": "@type",
|
|
6
|
-
"esrs2020": "https://identity.foundation/EcdsaSecp256k1RecoverySignature2020#",
|
|
7
|
-
|
|
8
|
-
"EcdsaSecp256k1RecoverySignature2020": {
|
|
9
|
-
"@id": "https://w3id.org/security#EcdsaSecp256k1RecoverySignature2020",
|
|
10
|
-
"@context": {
|
|
11
|
-
"@version": 1.1,
|
|
12
|
-
"@protected": true,
|
|
13
|
-
|
|
14
|
-
"id": "@id",
|
|
15
|
-
"type": "@type",
|
|
16
|
-
|
|
17
|
-
"sec": "https://w3id.org/security#",
|
|
18
|
-
"xsd": "http://www.w3.org/2001/XMLSchema#",
|
|
19
|
-
|
|
20
|
-
"challenge": "sec:challenge",
|
|
21
|
-
"created": {"@id": "http://purl.org/dc/terms/created", "@type": "xsd:dateTime"},
|
|
22
|
-
"domain": "sec:domain",
|
|
23
|
-
"expires": {"@id": "sec:expiration", "@type": "xsd:dateTime"},
|
|
24
|
-
"jws": "sec:jws",
|
|
25
|
-
"nonce": "sec:nonce",
|
|
26
|
-
"proofPurpose": {
|
|
27
|
-
"@id": "sec:proofPurpose",
|
|
28
|
-
"@type": "@vocab",
|
|
29
|
-
"@context": {
|
|
30
|
-
"@version": 1.1,
|
|
31
|
-
"@protected": true,
|
|
32
|
-
|
|
33
|
-
"id": "@id",
|
|
34
|
-
"type": "@type",
|
|
35
|
-
|
|
36
|
-
"sec": "https://w3id.org/security#",
|
|
37
|
-
|
|
38
|
-
"assertionMethod": {"@id": "sec:assertionMethod", "@type": "@id", "@container": "@set"},
|
|
39
|
-
"authentication": {"@id": "sec:authenticationMethod", "@type": "@id", "@container": "@set"}
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
"proofValue": "sec:proofValue",
|
|
43
|
-
"verificationMethod": {"@id": "sec:verificationMethod", "@type": "@id"}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
"EcdsaSecp256k1RecoveryMethod2020": "esrs2020:EcdsaSecp256k1RecoveryMethod2020",
|
|
48
|
-
"publicKeyJwk": {
|
|
49
|
-
"@id": "esrs2020:publicKeyJwk",
|
|
50
|
-
"@type": "@json"
|
|
51
|
-
},
|
|
52
|
-
"privateKeyJwk": {
|
|
53
|
-
"@id": "esrs2020:privateKeyJwk",
|
|
54
|
-
"@type": "@json"
|
|
55
|
-
},
|
|
56
|
-
"publicKeyHex": "esrs2020:publicKeyHex",
|
|
57
|
-
"privateKeyHex": "esrs2020:privateKeyHex",
|
|
58
|
-
"ethereumAddress": "esrs2020:ethereumAddress"
|
|
59
|
-
}
|
|
60
|
-
}
|