@twin.org/standards-w3c-did 0.0.1-next.26 → 0.0.1-next.28
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/dist/cjs/index.cjs +3 -15
- package/dist/esm/index.mjs +3 -15
- package/dist/types/index.d.ts +2 -1
- package/dist/types/models/IDidLabel.d.ts +17 -0
- package/dist/types/models/IDidVerifiableCredential.d.ts +5 -11
- package/dist/types/utils/proofHelper.d.ts +1 -5
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/ProofHelper.md +1 -1
- package/docs/reference/index.md +1 -0
- package/docs/reference/interfaces/IDidLabel.md +27 -0
- package/docs/reference/interfaces/IDidVerifiableCredential.md +3 -3
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -467,22 +467,10 @@ class ProofHelper {
|
|
|
467
467
|
static async verifyProof(securedDocument, signedProof, verifyKey) {
|
|
468
468
|
core.Guards.object(this.CLASS_NAME, "securedDocument", securedDocument);
|
|
469
469
|
core.Guards.object(this.CLASS_NAME, "signedProof", signedProof);
|
|
470
|
+
core.Guards.stringValue(this.CLASS_NAME, "signedProof.type", signedProof.type);
|
|
470
471
|
core.Guards.object(this.CLASS_NAME, "verifyKey", verifyKey);
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
const proofs = core.Is.array(securedDocument.proof)
|
|
475
|
-
? securedDocument.proof
|
|
476
|
-
: [securedDocument.proof];
|
|
477
|
-
let verified = false;
|
|
478
|
-
for (const proof of proofs) {
|
|
479
|
-
const signerVerifier = ProofHelper.createSignerVerifier(proof.type);
|
|
480
|
-
verified = await signerVerifier.verifyProof(securedDocument, proof, verifyKey);
|
|
481
|
-
if (!verified) {
|
|
482
|
-
return false;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
return verified;
|
|
472
|
+
const signerVerifier = ProofHelper.createSignerVerifier(signedProof.type);
|
|
473
|
+
return signerVerifier.verifyProof(securedDocument, signedProof, verifyKey);
|
|
486
474
|
}
|
|
487
475
|
}
|
|
488
476
|
|
package/dist/esm/index.mjs
CHANGED
|
@@ -465,22 +465,10 @@ class ProofHelper {
|
|
|
465
465
|
static async verifyProof(securedDocument, signedProof, verifyKey) {
|
|
466
466
|
Guards.object(this.CLASS_NAME, "securedDocument", securedDocument);
|
|
467
467
|
Guards.object(this.CLASS_NAME, "signedProof", signedProof);
|
|
468
|
+
Guards.stringValue(this.CLASS_NAME, "signedProof.type", signedProof.type);
|
|
468
469
|
Guards.object(this.CLASS_NAME, "verifyKey", verifyKey);
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
const proofs = Is.array(securedDocument.proof)
|
|
473
|
-
? securedDocument.proof
|
|
474
|
-
: [securedDocument.proof];
|
|
475
|
-
let verified = false;
|
|
476
|
-
for (const proof of proofs) {
|
|
477
|
-
const signerVerifier = ProofHelper.createSignerVerifier(proof.type);
|
|
478
|
-
verified = await signerVerifier.verifyProof(securedDocument, proof, verifyKey);
|
|
479
|
-
if (!verified) {
|
|
480
|
-
return false;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
return verified;
|
|
470
|
+
const signerVerifier = ProofHelper.createSignerVerifier(signedProof.type);
|
|
471
|
+
return signerVerifier.verifyProof(securedDocument, signedProof, verifyKey);
|
|
484
472
|
}
|
|
485
473
|
}
|
|
486
474
|
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,11 +7,12 @@ export * from "./models/IDidCredentialSchema";
|
|
|
7
7
|
export * from "./models/IDidCredentialStatus";
|
|
8
8
|
export * from "./models/IDidDocument";
|
|
9
9
|
export * from "./models/IDidDocumentVerificationMethod";
|
|
10
|
+
export * from "./models/IDidLabel";
|
|
10
11
|
export * from "./models/IDidPresentationVerification";
|
|
11
|
-
export * from "./models/IJsonWebSignature2020Proof";
|
|
12
12
|
export * from "./models/IDidService";
|
|
13
13
|
export * from "./models/IDidVerifiableCredential";
|
|
14
14
|
export * from "./models/IDidVerifiablePresentation";
|
|
15
|
+
export * from "./models/IJsonWebSignature2020Proof";
|
|
15
16
|
export * from "./models/IMultikey";
|
|
16
17
|
export * from "./models/IProofSignerVerifier";
|
|
17
18
|
export * from "./models/proofTypes";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface describing a DID Label.
|
|
3
|
+
*/
|
|
4
|
+
export interface IDidLabel {
|
|
5
|
+
/**
|
|
6
|
+
* The value for the label.
|
|
7
|
+
*/
|
|
8
|
+
"@value": string;
|
|
9
|
+
/**
|
|
10
|
+
* The language for the label.
|
|
11
|
+
*/
|
|
12
|
+
"@language": string;
|
|
13
|
+
/**
|
|
14
|
+
* The direction of the label.
|
|
15
|
+
*/
|
|
16
|
+
"@direction"?: string;
|
|
17
|
+
}
|
|
@@ -3,6 +3,7 @@ import type { DidContexts } from "./didContexts";
|
|
|
3
3
|
import type { IDataIntegrityProof } from "./IDataIntegrityProof";
|
|
4
4
|
import type { IDidCredentialSchema } from "./IDidCredentialSchema";
|
|
5
5
|
import type { IDidCredentialStatus } from "./IDidCredentialStatus";
|
|
6
|
+
import type { IDidLabel } from "./IDidLabel";
|
|
6
7
|
import type { IJsonWebSignature2020Proof } from "./IJsonWebSignature2020Proof";
|
|
7
8
|
/**
|
|
8
9
|
* Interface describing a verifiable credential.
|
|
@@ -38,8 +39,9 @@ export interface IDidVerifiableCredential {
|
|
|
38
39
|
* The issuing identity.
|
|
39
40
|
*/
|
|
40
41
|
issuer?: string | {
|
|
41
|
-
[key: string]: unknown;
|
|
42
42
|
id: string;
|
|
43
|
+
name?: string | IDidLabel[];
|
|
44
|
+
description?: string | IDidLabel[];
|
|
43
45
|
};
|
|
44
46
|
/**
|
|
45
47
|
* The date the verifiable credential was issued.
|
|
@@ -48,19 +50,11 @@ export interface IDidVerifiableCredential {
|
|
|
48
50
|
/**
|
|
49
51
|
* The name of the credential.
|
|
50
52
|
*/
|
|
51
|
-
name?: string |
|
|
52
|
-
"@value": string;
|
|
53
|
-
"@language": string;
|
|
54
|
-
"@direction"?: string;
|
|
55
|
-
}[];
|
|
53
|
+
name?: string | IDidLabel[];
|
|
56
54
|
/**
|
|
57
55
|
* The description of the credential.
|
|
58
56
|
*/
|
|
59
|
-
description?: string |
|
|
60
|
-
"@value": string;
|
|
61
|
-
"@language": string;
|
|
62
|
-
"@direction"?: string;
|
|
63
|
-
}[];
|
|
57
|
+
description?: string | IDidLabel[];
|
|
64
58
|
/**
|
|
65
59
|
* The date the verifiable credential is valid from.
|
|
66
60
|
*/
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
2
|
import type { IJwk } from "@twin.org/web";
|
|
3
|
-
import type { IDataIntegrityProof } from "../models/IDataIntegrityProof";
|
|
4
|
-
import type { IJsonWebSignature2020Proof } from "../models/IJsonWebSignature2020Proof";
|
|
5
3
|
import type { IProofSignerVerifier } from "../models/IProofSignerVerifier";
|
|
6
4
|
import { ProofTypes } from "../models/proofTypes";
|
|
7
5
|
/**
|
|
@@ -35,7 +33,5 @@ export declare class ProofHelper {
|
|
|
35
33
|
* @param verifyKey The public key to verify the proof with.
|
|
36
34
|
* @returns True if the credential was verified.
|
|
37
35
|
*/
|
|
38
|
-
static verifyProof(securedDocument: IJsonLdNodeObject
|
|
39
|
-
proof: IDataIntegrityProof | IJsonWebSignature2020Proof | (IDataIntegrityProof | IJsonWebSignature2020Proof)[];
|
|
40
|
-
}, signedProof: IJsonLdNodeObject, verifyKey: IJwk): Promise<boolean>;
|
|
36
|
+
static verifyProof(securedDocument: IJsonLdNodeObject, signedProof: IJsonLdNodeObject, verifyKey: IJwk): Promise<boolean>;
|
|
41
37
|
}
|
package/docs/changelog.md
CHANGED
package/docs/reference/index.md
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
- [IDidCredentialStatus](interfaces/IDidCredentialStatus.md)
|
|
15
15
|
- [IDidDocument](interfaces/IDidDocument.md)
|
|
16
16
|
- [IDidDocumentVerificationMethod](interfaces/IDidDocumentVerificationMethod.md)
|
|
17
|
+
- [IDidLabel](interfaces/IDidLabel.md)
|
|
17
18
|
- [IDidPresentationVerification](interfaces/IDidPresentationVerification.md)
|
|
18
19
|
- [IDidService](interfaces/IDidService.md)
|
|
19
20
|
- [IDidVerifiableCredential](interfaces/IDidVerifiableCredential.md)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Interface: IDidLabel
|
|
2
|
+
|
|
3
|
+
Interface describing a DID Label.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
### @value
|
|
8
|
+
|
|
9
|
+
> **@value**: `string`
|
|
10
|
+
|
|
11
|
+
The value for the label.
|
|
12
|
+
|
|
13
|
+
***
|
|
14
|
+
|
|
15
|
+
### @language
|
|
16
|
+
|
|
17
|
+
> **@language**: `string`
|
|
18
|
+
|
|
19
|
+
The language for the label.
|
|
20
|
+
|
|
21
|
+
***
|
|
22
|
+
|
|
23
|
+
### @direction?
|
|
24
|
+
|
|
25
|
+
> `optional` **@direction**: `string`
|
|
26
|
+
|
|
27
|
+
The direction of the label.
|
|
@@ -56,7 +56,7 @@ Annotate type definitions or lock them to specific versions of the vocabulary.
|
|
|
56
56
|
|
|
57
57
|
### issuer?
|
|
58
58
|
|
|
59
|
-
> `optional` **issuer**: `string` \| \{ `
|
|
59
|
+
> `optional` **issuer**: `string` \| \{ `id`: `string`; `name`: `string` \| [`IDidLabel`](IDidLabel.md)[]; `description`: `string` \| [`IDidLabel`](IDidLabel.md)[]; \}
|
|
60
60
|
|
|
61
61
|
The issuing identity.
|
|
62
62
|
|
|
@@ -72,7 +72,7 @@ The date the verifiable credential was issued.
|
|
|
72
72
|
|
|
73
73
|
### name?
|
|
74
74
|
|
|
75
|
-
> `optional` **name**: `string` \| `
|
|
75
|
+
> `optional` **name**: `string` \| [`IDidLabel`](IDidLabel.md)[]
|
|
76
76
|
|
|
77
77
|
The name of the credential.
|
|
78
78
|
|
|
@@ -80,7 +80,7 @@ The name of the credential.
|
|
|
80
80
|
|
|
81
81
|
### description?
|
|
82
82
|
|
|
83
|
-
> `optional` **description**: `string` \| `
|
|
83
|
+
> `optional` **description**: `string` \| [`IDidLabel`](IDidLabel.md)[]
|
|
84
84
|
|
|
85
85
|
The description of the credential.
|
|
86
86
|
|