@twin.org/standards-w3c-did 0.0.1-next.9 → 0.0.2-next.1
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 +459 -3
- package/dist/esm/index.mjs +454 -4
- package/dist/types/index.d.ts +13 -1
- package/dist/types/models/{IDidProof.d.ts → IDataIntegrityProof.d.ts} +18 -6
- package/dist/types/models/IDidCredentialSchema.d.ts +13 -0
- package/dist/types/models/IDidDocument.d.ts +6 -0
- package/dist/types/models/IDidDocumentVerificationMethod.d.ts +3 -2
- package/dist/types/models/IDidLabel.d.ts +17 -0
- package/dist/types/models/IDidVerifiableCredential.d.ts +41 -9
- package/dist/types/models/IDidVerifiablePresentation.d.ts +9 -8
- package/dist/types/models/IJsonWebSignature2020Proof.d.ts +33 -0
- package/dist/types/models/IMultikey.d.ts +41 -0
- package/dist/types/models/IProof.d.ts +6 -0
- package/dist/types/models/IProofSignerVerifier.d.ts +31 -0
- package/dist/types/models/didContexts.d.ts +26 -2
- package/dist/types/models/didCryptoSuites.d.ts +19 -0
- package/dist/types/models/didTypes.d.ts +16 -0
- package/dist/types/models/proofTypes.d.ts +17 -0
- package/dist/types/signerVerifiers/dataIntegrityProofSignerVerifier.d.ts +38 -0
- package/dist/types/signerVerifiers/jsonWebSignature2020SignerVerifier.d.ts +36 -0
- package/dist/types/utils/multikeyHelper.d.ts +37 -0
- package/dist/types/utils/proofHelper.d.ts +47 -0
- package/docs/changelog.md +134 -1
- package/docs/reference/classes/DataIntegrityProofSignerVerifier.md +134 -0
- package/docs/reference/classes/JsonWebSignature2020SignerVerifier.md +133 -0
- package/docs/reference/classes/MultikeyHelper.md +119 -0
- package/docs/reference/classes/ProofHelper.md +159 -0
- package/docs/reference/index.md +18 -1
- package/docs/reference/interfaces/{IDidProof.md → IDataIntegrityProof.md} +23 -7
- package/docs/reference/interfaces/IDidCredentialSchema.md +19 -0
- package/docs/reference/interfaces/IDidCredentialStatus.md +3 -1
- package/docs/reference/interfaces/IDidDocument.md +8 -0
- package/docs/reference/interfaces/IDidDocumentVerificationMethod.md +9 -1
- package/docs/reference/interfaces/IDidLabel.md +27 -0
- package/docs/reference/interfaces/IDidVerifiableCredential.md +57 -12
- package/docs/reference/interfaces/IDidVerifiablePresentation.md +7 -11
- package/docs/reference/interfaces/IJsonWebSignature2020Proof.md +52 -0
- package/docs/reference/interfaces/IMultikey.md +68 -0
- package/docs/reference/interfaces/IProofSignerVerifier.md +99 -0
- package/docs/reference/type-aliases/DidContexts.md +1 -1
- package/docs/reference/type-aliases/DidCryptoSuites.md +5 -0
- package/docs/reference/type-aliases/DidTypes.md +1 -1
- package/docs/reference/type-aliases/DidVerificationMethodType.md +1 -1
- package/docs/reference/type-aliases/IProof.md +5 -0
- package/docs/reference/type-aliases/ProofTypes.md +5 -0
- package/docs/reference/variables/DidContexts.md +40 -4
- package/docs/reference/variables/DidCryptoSuites.md +21 -0
- package/docs/reference/variables/DidTypes.md +24 -0
- package/docs/reference/variables/DidVerificationMethodType.md +1 -1
- package/docs/reference/variables/ProofTypes.md +19 -0
- package/locales/en.json +27 -1
- package/package.json +7 -4
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { DidContexts } from "./didContexts";
|
|
3
|
+
import type { IDidCredentialSchema } from "./IDidCredentialSchema";
|
|
2
4
|
import type { IDidCredentialStatus } from "./IDidCredentialStatus";
|
|
3
|
-
import type {
|
|
5
|
+
import type { IDidLabel } from "./IDidLabel";
|
|
6
|
+
import type { IProof } from "./IProof";
|
|
4
7
|
/**
|
|
5
8
|
* Interface describing a verifiable credential.
|
|
9
|
+
* https://www.w3.org/TR/vc-data-model-2.0
|
|
6
10
|
*/
|
|
7
|
-
export interface IDidVerifiableCredential
|
|
11
|
+
export interface IDidVerifiableCredential {
|
|
8
12
|
/**
|
|
9
13
|
* The context for the verifiable credential.
|
|
10
14
|
*/
|
|
11
|
-
"@context":
|
|
15
|
+
"@context": typeof DidContexts.ContextVCv1 | typeof DidContexts.ContextVCv2 | [typeof DidContexts.ContextVCv1, ...IJsonLdContextDefinitionElement[]] | [typeof DidContexts.ContextVCv2, ...IJsonLdContextDefinitionElement[]];
|
|
12
16
|
/**
|
|
13
17
|
* The identifier for the verifiable credential.
|
|
14
18
|
*/
|
|
@@ -16,27 +20,55 @@ export interface IDidVerifiableCredential<T extends IJsonLdNodeObject = IJsonLdN
|
|
|
16
20
|
/**
|
|
17
21
|
* The types of the data stored in the verifiable credential.
|
|
18
22
|
*/
|
|
19
|
-
type: string[];
|
|
23
|
+
type: string | string[];
|
|
20
24
|
/**
|
|
21
25
|
* The data for the verifiable credential.
|
|
22
26
|
*/
|
|
23
|
-
credentialSubject
|
|
27
|
+
credentialSubject?: IJsonLdNodeObject | IJsonLdNodeObject[];
|
|
24
28
|
/**
|
|
25
29
|
* Used to discover information about the current status of the
|
|
26
30
|
* verifiable credential, such as whether it is suspended or revoked.
|
|
27
31
|
*/
|
|
28
|
-
credentialStatus?: IDidCredentialStatus;
|
|
32
|
+
credentialStatus?: IDidCredentialStatus | IDidCredentialStatus[];
|
|
33
|
+
/**
|
|
34
|
+
* Annotate type definitions or lock them to specific versions of the vocabulary.
|
|
35
|
+
*/
|
|
36
|
+
credentialSchema?: IDidCredentialSchema | IDidCredentialSchema[];
|
|
29
37
|
/**
|
|
30
38
|
* The issuing identity.
|
|
31
39
|
*/
|
|
32
|
-
issuer?: string
|
|
40
|
+
issuer?: string | {
|
|
41
|
+
id: string;
|
|
42
|
+
name?: string | IDidLabel[];
|
|
43
|
+
description?: string | IDidLabel[];
|
|
44
|
+
};
|
|
33
45
|
/**
|
|
34
46
|
* The date the verifiable credential was issued.
|
|
35
47
|
*/
|
|
36
48
|
issuanceDate?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The name of the credential.
|
|
51
|
+
*/
|
|
52
|
+
name?: string | IDidLabel[];
|
|
53
|
+
/**
|
|
54
|
+
* The description of the credential.
|
|
55
|
+
*/
|
|
56
|
+
description?: string | IDidLabel[];
|
|
57
|
+
/**
|
|
58
|
+
* The date the verifiable credential is valid from.
|
|
59
|
+
*/
|
|
60
|
+
validFrom?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The date the verifiable credential is valid until.
|
|
63
|
+
*/
|
|
64
|
+
validUntil?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Evidence associated with the Credential.
|
|
67
|
+
*/
|
|
68
|
+
evidence?: IJsonLdNodeObject | IJsonLdNodeObject[];
|
|
37
69
|
/**
|
|
38
70
|
* Proofs that the verifiable credential is valid.
|
|
39
71
|
* Optional if a different proof method is used, such as JWT.
|
|
40
72
|
*/
|
|
41
|
-
proof?:
|
|
73
|
+
proof?: IProof | IProof[];
|
|
42
74
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { DidContexts } from "./didContexts";
|
|
3
3
|
import type { IDidVerifiableCredential } from "./IDidVerifiableCredential";
|
|
4
|
+
import type { IProof } from "./IProof";
|
|
4
5
|
/**
|
|
5
6
|
* Interface describing a verifiable presentation.
|
|
6
7
|
*/
|
|
7
|
-
export interface IDidVerifiablePresentation
|
|
8
|
+
export interface IDidVerifiablePresentation {
|
|
8
9
|
/**
|
|
9
|
-
* The context for the verifiable
|
|
10
|
+
* The context for the verifiable presentation.
|
|
10
11
|
*/
|
|
11
|
-
"@context":
|
|
12
|
+
"@context": typeof DidContexts.ContextVCv2 | [typeof DidContexts.ContextVCv2, ...IJsonLdContextDefinitionElement[]];
|
|
12
13
|
/**
|
|
13
14
|
* Provide a unique identifier for the presentation.
|
|
14
15
|
*/
|
|
@@ -16,11 +17,11 @@ export interface IDidVerifiablePresentation<T extends IJsonLdNodeObject = IJsonL
|
|
|
16
17
|
/**
|
|
17
18
|
* The types of the data stored in the verifiable credential.
|
|
18
19
|
*/
|
|
19
|
-
type: string[];
|
|
20
|
+
type: string | string[];
|
|
20
21
|
/**
|
|
21
22
|
* The data for the verifiable credentials.
|
|
22
23
|
*/
|
|
23
|
-
verifiableCredential
|
|
24
|
+
verifiableCredential?: (string | IDidVerifiableCredential)[];
|
|
24
25
|
/**
|
|
25
26
|
* The entity generating the presentation.
|
|
26
27
|
*/
|
|
@@ -29,5 +30,5 @@ export interface IDidVerifiablePresentation<T extends IJsonLdNodeObject = IJsonL
|
|
|
29
30
|
* Proofs that the verifiable presentation is valid.
|
|
30
31
|
* Optional if a different proof method is used, such as JWT.
|
|
31
32
|
*/
|
|
32
|
-
proof?:
|
|
33
|
+
proof?: IProof | IProof[];
|
|
33
34
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { DidContexts } from "./didContexts";
|
|
3
|
+
import type { ProofTypes } from "./proofTypes";
|
|
4
|
+
/**
|
|
5
|
+
* Interface describing a did proof in JSON Web Signature 2020 Format.
|
|
6
|
+
* https://www.w3.org/TR/vc-jws-2020/
|
|
7
|
+
*/
|
|
8
|
+
export interface IJsonWebSignature2020Proof {
|
|
9
|
+
/**
|
|
10
|
+
* JSON-LD Context.
|
|
11
|
+
*/
|
|
12
|
+
"@context"?: typeof DidContexts.ContextSecurityJws2020 | [typeof DidContexts.ContextSecurityJws2020, ...IJsonLdContextDefinitionElement[]];
|
|
13
|
+
/**
|
|
14
|
+
* JSON-LD Type.
|
|
15
|
+
*/
|
|
16
|
+
type: typeof ProofTypes.JsonWebSignature2020;
|
|
17
|
+
/**
|
|
18
|
+
* The reason the proof was created.
|
|
19
|
+
*/
|
|
20
|
+
proofPurpose: string;
|
|
21
|
+
/**
|
|
22
|
+
* The verification method of the proof.
|
|
23
|
+
*/
|
|
24
|
+
verificationMethod?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The iso date of when the proof was created.
|
|
27
|
+
*/
|
|
28
|
+
created?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The JSON Web Signature.
|
|
31
|
+
*/
|
|
32
|
+
jws?: string;
|
|
33
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { DidContexts } from "./didContexts";
|
|
3
|
+
import type { DidTypes } from "./didTypes";
|
|
4
|
+
/**
|
|
5
|
+
* Interface describing a Multikey.
|
|
6
|
+
* https://www.w3.org/TR/cid-1.0/
|
|
7
|
+
*/
|
|
8
|
+
export interface IMultikey {
|
|
9
|
+
/**
|
|
10
|
+
* JSON-LD Context.
|
|
11
|
+
*/
|
|
12
|
+
"@context"?: typeof DidContexts.ContextControllerIdentifiers | typeof DidContexts.ContextSecurityMultikey | [typeof DidContexts.ContextControllerIdentifiers, ...IJsonLdContextDefinitionElement[]] | [typeof DidContexts.ContextSecurityMultikey, ...IJsonLdContextDefinitionElement[]];
|
|
13
|
+
/**
|
|
14
|
+
* The id of the entry.
|
|
15
|
+
*/
|
|
16
|
+
id?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The type of the entry.
|
|
19
|
+
*/
|
|
20
|
+
type: typeof DidTypes.Multikey;
|
|
21
|
+
/**
|
|
22
|
+
* The controller for the entry.
|
|
23
|
+
*/
|
|
24
|
+
controller?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The public key for the entry.
|
|
27
|
+
*/
|
|
28
|
+
publicKeyMultibase: string;
|
|
29
|
+
/**
|
|
30
|
+
* The secret key for the entry.
|
|
31
|
+
*/
|
|
32
|
+
secretKeyMultibase?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The date the entry expires.
|
|
35
|
+
*/
|
|
36
|
+
expires?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The date the entry was revoked.
|
|
39
|
+
*/
|
|
40
|
+
revoked?: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { IJwk } from "@twin.org/web";
|
|
3
|
+
import type { IProof } from "./IProof";
|
|
4
|
+
/**
|
|
5
|
+
* Interface describing a proof signer and verifier.
|
|
6
|
+
*/
|
|
7
|
+
export interface IProofSignerVerifier {
|
|
8
|
+
/**
|
|
9
|
+
* Create a proof for the given data.
|
|
10
|
+
* @param unsecuredDocument The data to create the proof for.
|
|
11
|
+
* @param unsignedProof The proof options.
|
|
12
|
+
* @param signKey The key to sign the proof with.
|
|
13
|
+
* @returns The created proof.
|
|
14
|
+
*/
|
|
15
|
+
createProof(unsecuredDocument: IJsonLdNodeObject, unsignedProof: IProof, signKey: IJwk): Promise<IProof>;
|
|
16
|
+
/**
|
|
17
|
+
* Verify a proof for the given data.
|
|
18
|
+
* @param securedDocument The credential to verify.
|
|
19
|
+
* @param signedProof The proof to verify.
|
|
20
|
+
* @param verifyKey The public key to verify the proof with.
|
|
21
|
+
* @returns True if the credential was verified.
|
|
22
|
+
*/
|
|
23
|
+
verifyProof(securedDocument: IJsonLdNodeObject, signedProof: IProof, verifyKey: IJwk): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Create a hash for the given data.
|
|
26
|
+
* @param unsecuredDocument The data to create the proof for.
|
|
27
|
+
* @param unsignedProof The unsigned proof.
|
|
28
|
+
* @returns The created hash.
|
|
29
|
+
*/
|
|
30
|
+
createHash(unsecuredDocument: IJsonLdNodeObject, unsignedProof: IProof): Promise<Uint8Array>;
|
|
31
|
+
}
|
|
@@ -2,14 +2,38 @@
|
|
|
2
2
|
* The contexts for DIDs.
|
|
3
3
|
*/
|
|
4
4
|
export declare const DidContexts: {
|
|
5
|
+
/**
|
|
6
|
+
* The context root for DID.
|
|
7
|
+
*/
|
|
8
|
+
readonly Context: "https://www.w3.org/ns/did/v1";
|
|
5
9
|
/**
|
|
6
10
|
* The context root for DID VC v1.
|
|
7
11
|
*/
|
|
8
|
-
readonly
|
|
12
|
+
readonly ContextVCv1: "https://www.w3.org/2018/credentials/v1";
|
|
9
13
|
/**
|
|
10
14
|
* The context root for DID VC v2.
|
|
11
15
|
*/
|
|
12
|
-
readonly
|
|
16
|
+
readonly ContextVCv2: "https://www.w3.org/ns/credentials/v2";
|
|
17
|
+
/**
|
|
18
|
+
* The context root for security ed25519 suites.
|
|
19
|
+
*/
|
|
20
|
+
readonly ContextSecurityEd25519: "https://w3id.org/security/suites/ed25519-2020/v1";
|
|
21
|
+
/**
|
|
22
|
+
* The context root for security jws-2020 suites.
|
|
23
|
+
*/
|
|
24
|
+
readonly ContextSecurityJws2020: "https://w3id.org/security/suites/jws-2020/v1";
|
|
25
|
+
/**
|
|
26
|
+
* The context root for VC Data Integrity.
|
|
27
|
+
*/
|
|
28
|
+
readonly ContextDataIntegrity: "https://www.w3.org/ns/credentials/v2";
|
|
29
|
+
/**
|
|
30
|
+
* The context root for VC Data Integrity.
|
|
31
|
+
*/
|
|
32
|
+
readonly ContextControllerIdentifiers: "https://www.w3.org/ns/cid/v1";
|
|
33
|
+
/**
|
|
34
|
+
* The context root for security multikey suites.
|
|
35
|
+
*/
|
|
36
|
+
readonly ContextSecurityMultikey: "https://w3id.org/security/multikey/v1";
|
|
13
37
|
};
|
|
14
38
|
/**
|
|
15
39
|
* The contexts for DIDs.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The types for DID Proof crypto suites.
|
|
3
|
+
*/
|
|
4
|
+
export declare const DidCryptoSuites: {
|
|
5
|
+
/**
|
|
6
|
+
* The type for EdDSA crypto suite for JSON Canonicalization Scheme [RFC8785].
|
|
7
|
+
* https://www.w3.org/TR/vc-di-eddsa/#eddsa-jcs-2022
|
|
8
|
+
*/
|
|
9
|
+
readonly EdDSAJcs2022: "eddsa-jcs-2022";
|
|
10
|
+
/**
|
|
11
|
+
* The type for EdDSA crypto suite for RDF Dataset Canonicalization.
|
|
12
|
+
* https://www.w3.org/TR/vc-di-eddsa/#eddsa-rdfc-2022
|
|
13
|
+
*/
|
|
14
|
+
readonly EdDSARdfc2022: "eddsa-rdfc-2022";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The types for DID Proof crypto suites.
|
|
18
|
+
*/
|
|
19
|
+
export type DidCryptoSuites = (typeof DidCryptoSuites)[keyof typeof DidCryptoSuites];
|
|
@@ -10,6 +10,22 @@ export declare const DidTypes: {
|
|
|
10
10
|
* The type for Verifiable Presentation.
|
|
11
11
|
*/
|
|
12
12
|
readonly VerifiablePresentation: "VerifiablePresentation";
|
|
13
|
+
/**
|
|
14
|
+
* The type for Ed25519VerificationKey2020.
|
|
15
|
+
*/
|
|
16
|
+
readonly Ed25519VerificationKey2020: "Ed25519VerificationKey2020";
|
|
17
|
+
/**
|
|
18
|
+
* The type for JsonWebKey2020.
|
|
19
|
+
*/
|
|
20
|
+
readonly JsonWebKey2020: "JsonWebKey2020";
|
|
21
|
+
/**
|
|
22
|
+
* The type for LinkedDomains.
|
|
23
|
+
*/
|
|
24
|
+
readonly LinkedDomains: "LinkedDomains";
|
|
25
|
+
/**
|
|
26
|
+
* The type for Multikey.
|
|
27
|
+
*/
|
|
28
|
+
readonly Multikey: "Multikey";
|
|
13
29
|
};
|
|
14
30
|
/**
|
|
15
31
|
* The types for DIDs.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The types for proofs.
|
|
3
|
+
*/
|
|
4
|
+
export declare const ProofTypes: {
|
|
5
|
+
/**
|
|
6
|
+
* The type for Data Integrity Proof.
|
|
7
|
+
*/
|
|
8
|
+
readonly DataIntegrityProof: "DataIntegrityProof";
|
|
9
|
+
/**
|
|
10
|
+
* The type for Json Web Signature 2020.
|
|
11
|
+
*/
|
|
12
|
+
readonly JsonWebSignature2020: "JsonWebSignature2020";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The types for proofs.
|
|
16
|
+
*/
|
|
17
|
+
export type ProofTypes = (typeof ProofTypes)[keyof typeof ProofTypes];
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import { type IJwk } from "@twin.org/web";
|
|
3
|
+
import type { IDataIntegrityProof } from "../models/IDataIntegrityProof";
|
|
4
|
+
import type { IProof } from "../models/IProof";
|
|
5
|
+
import type { IProofSignerVerifier } from "../models/IProofSignerVerifier";
|
|
6
|
+
/**
|
|
7
|
+
* Helper methods for creating and verifying proofs.
|
|
8
|
+
* https://www.w3.org/TR/vc-di-eddsa/#eddsa-jcs-2022
|
|
9
|
+
*/
|
|
10
|
+
export declare class DataIntegrityProofSignerVerifier implements IProofSignerVerifier {
|
|
11
|
+
/**
|
|
12
|
+
* Runtime name for the class.
|
|
13
|
+
*/
|
|
14
|
+
readonly CLASS_NAME: string;
|
|
15
|
+
/**
|
|
16
|
+
* Create a proof for the given data.
|
|
17
|
+
* @param unsecuredDocument The data to create the proof for.
|
|
18
|
+
* @param unsignedProof The proof options.
|
|
19
|
+
* @param signKey The key to sign the proof with.
|
|
20
|
+
* @returns The created proof.
|
|
21
|
+
*/
|
|
22
|
+
createProof(unsecuredDocument: IJsonLdNodeObject, unsignedProof: IDataIntegrityProof, signKey: IJwk): Promise<IProof>;
|
|
23
|
+
/**
|
|
24
|
+
* Verify a proof for the given data in format.
|
|
25
|
+
* @param securedDocument The credential to verify.
|
|
26
|
+
* @param signedProof The proof to verify.
|
|
27
|
+
* @param verifyKey The public key to verify the proof with.
|
|
28
|
+
* @returns True if the credential was verified.
|
|
29
|
+
*/
|
|
30
|
+
verifyProof(securedDocument: IJsonLdNodeObject, signedProof: IDataIntegrityProof, verifyKey: IJwk): Promise<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* Create a hash for the given data.
|
|
33
|
+
* @param unsecuredDocument The data to create the proof for.
|
|
34
|
+
* @param unsignedProof The unsigned proof.
|
|
35
|
+
* @returns The created hash.
|
|
36
|
+
*/
|
|
37
|
+
createHash(unsecuredDocument: IJsonLdNodeObject, unsignedProof: IDataIntegrityProof): Promise<Uint8Array>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import { type IJwk } from "@twin.org/web";
|
|
3
|
+
import type { IJsonWebSignature2020Proof } from "../models/IJsonWebSignature2020Proof";
|
|
4
|
+
import type { IProofSignerVerifier } from "../models/IProofSignerVerifier";
|
|
5
|
+
/**
|
|
6
|
+
* Helper methods for creating and verifying proofs.
|
|
7
|
+
*/
|
|
8
|
+
export declare class JsonWebSignature2020SignerVerifier implements IProofSignerVerifier {
|
|
9
|
+
/**
|
|
10
|
+
* Runtime name for the class.
|
|
11
|
+
*/
|
|
12
|
+
readonly CLASS_NAME: string;
|
|
13
|
+
/**
|
|
14
|
+
* Create a proof for the given data.
|
|
15
|
+
* @param unsecuredDocument The data to create the proof for.
|
|
16
|
+
* @param unsignedProof The proof options.
|
|
17
|
+
* @param signKey The key to sign the proof with.
|
|
18
|
+
* @returns The created proof.
|
|
19
|
+
*/
|
|
20
|
+
createProof(unsecuredDocument: IJsonLdNodeObject, unsignedProof: IJsonWebSignature2020Proof, signKey: IJwk): Promise<IJsonWebSignature2020Proof>;
|
|
21
|
+
/**
|
|
22
|
+
* Verify a proof for the given data in format.
|
|
23
|
+
* @param securedDocument The credential to verify.
|
|
24
|
+
* @param signedProof The proof to verify.
|
|
25
|
+
* @param verifyKey The public key to verify the proof with.
|
|
26
|
+
* @returns True if the credential was verified.
|
|
27
|
+
*/
|
|
28
|
+
verifyProof(securedDocument: IJsonLdNodeObject, signedProof: IJsonWebSignature2020Proof, verifyKey: IJwk): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Create a hash for the given data.
|
|
31
|
+
* @param unsecuredDocument The data to create the proof for.
|
|
32
|
+
* @param unsignedProof The unsigned proof.
|
|
33
|
+
* @returns The created hash.
|
|
34
|
+
*/
|
|
35
|
+
createHash(unsecuredDocument: IJsonLdNodeObject, unsignedProof: IJsonWebSignature2020Proof): Promise<Uint8Array>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { IJwk } from "@twin.org/web";
|
|
2
|
+
import type { IMultikey } from "../models/IMultikey";
|
|
3
|
+
/**
|
|
4
|
+
* Helper methods for multikey.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MultikeyHelper {
|
|
7
|
+
/**
|
|
8
|
+
* Runtime name for the class.
|
|
9
|
+
*/
|
|
10
|
+
static readonly CLASS_NAME: string;
|
|
11
|
+
/**
|
|
12
|
+
* Convert a multikey to a JWK.
|
|
13
|
+
* @param multikey The multikey to convert.
|
|
14
|
+
* @returns The JWK.
|
|
15
|
+
* @throws GeneralError if the multikey is invalid.
|
|
16
|
+
*/
|
|
17
|
+
static toJwk(multikey: IMultikey): IJwk;
|
|
18
|
+
/**
|
|
19
|
+
* Convert a JWK to a Multikey.
|
|
20
|
+
* @param controller The controller of the multikey.
|
|
21
|
+
* @param id The id of the multikey.
|
|
22
|
+
* @param jwk The jwk to convert.
|
|
23
|
+
* @returns The multikey.
|
|
24
|
+
* @throws GeneralError if the jwk is invalid.
|
|
25
|
+
*/
|
|
26
|
+
static fromJwk(controller: string, id: string, jwk: IJwk): IMultikey;
|
|
27
|
+
/**
|
|
28
|
+
* Convert a multikey to raw keys.
|
|
29
|
+
* @param multikey The multikey to convert.
|
|
30
|
+
* @returns The JWK.
|
|
31
|
+
* @throws GeneralError if the multikey is invalid.
|
|
32
|
+
*/
|
|
33
|
+
static toRaw(multikey: IMultikey): {
|
|
34
|
+
publicKey: Uint8Array;
|
|
35
|
+
privateKey: Uint8Array;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { IJwk } from "@twin.org/web";
|
|
3
|
+
import type { IProof } from "../models/IProof";
|
|
4
|
+
import type { IProofSignerVerifier } from "../models/IProofSignerVerifier";
|
|
5
|
+
import { ProofTypes } from "../models/proofTypes";
|
|
6
|
+
/**
|
|
7
|
+
* Helper methods for creating and verifying proofs.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ProofHelper {
|
|
10
|
+
/**
|
|
11
|
+
* Runtime name for the class.
|
|
12
|
+
*/
|
|
13
|
+
static readonly CLASS_NAME: string;
|
|
14
|
+
/**
|
|
15
|
+
* Create a signer verifier.
|
|
16
|
+
* @param proofType The type of proof to create.
|
|
17
|
+
* @returns The created signer verifier.
|
|
18
|
+
* @throws GeneralError if the proof type is not supported.
|
|
19
|
+
*/
|
|
20
|
+
static createSignerVerifier(proofType: ProofTypes): IProofSignerVerifier;
|
|
21
|
+
/**
|
|
22
|
+
* Create a proof for the given data.
|
|
23
|
+
* @param proofType The type of proof to create.
|
|
24
|
+
* @param unsecuredDocument The data to create the proof for.
|
|
25
|
+
* @param unsignedProof The proof options.
|
|
26
|
+
* @param signKey The key to sign the proof with.
|
|
27
|
+
* @returns The created proof.
|
|
28
|
+
*/
|
|
29
|
+
static createProof(proofType: ProofTypes, unsecuredDocument: IJsonLdNodeObject, unsignedProof: IProof, signKey: IJwk): Promise<IProof>;
|
|
30
|
+
/**
|
|
31
|
+
* Verify a proof for the given data.
|
|
32
|
+
* @param securedDocument The credential to verify.
|
|
33
|
+
* @param signedProof The proof to verify.
|
|
34
|
+
* @param verifyKey The public key to verify the proof with.
|
|
35
|
+
* @returns True if the credential was verified.
|
|
36
|
+
*/
|
|
37
|
+
static verifyProof(securedDocument: IJsonLdNodeObject, signedProof: IProof, verifyKey: IJwk): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Create an unsigned proof.
|
|
40
|
+
* @param proofType The type of proof to create.
|
|
41
|
+
* @param verificationMethodId The verification method id.
|
|
42
|
+
* @param otherParams Other parameters for the proof.
|
|
43
|
+
* @returns The created proof.
|
|
44
|
+
* @throws GeneralError if the proof type is not supported.
|
|
45
|
+
*/
|
|
46
|
+
static createUnsignedProof(proofType: ProofTypes, verificationMethodId: string, otherParams?: any): IProof;
|
|
47
|
+
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,138 @@
|
|
|
1
1
|
# @twin.org/standards-w3c-did - Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## [0.0.2-next.1](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.2-next.0...standards-w3c-did-v0.0.2-next.1) (2025-07-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Add additional properties to the verifiable credential data model ([#8](https://github.com/twinfoundation/standards/issues/8)) ([4b7af9c](https://github.com/twinfoundation/standards/commit/4b7af9cf892e071eb348f30737c035c0f94591b5))
|
|
9
|
+
* alg usage ([#19](https://github.com/twinfoundation/standards/issues/19)) ([3946fb2](https://github.com/twinfoundation/standards/commit/3946fb2e8bd9a486ad186765d1d09361fa75786b))
|
|
10
|
+
* export additional schemas ([4201127](https://github.com/twinfoundation/standards/commit/42011276a0b9110b75557c555f859db4d7382aca))
|
|
11
|
+
* normalise type outputs ([0b3aed7](https://github.com/twinfoundation/standards/commit/0b3aed7df0802cd609423bbd7fda6bde601d3ceb))
|
|
12
|
+
* update to latest JSON schema spec ([7a23930](https://github.com/twinfoundation/standards/commit/7a2393032d7f48bfb20d3a484f981fb6dd83a92c))
|
|
13
|
+
* update ts-to-schema generation ([ba4e76d](https://github.com/twinfoundation/standards/commit/ba4e76d677556a1817092f8079d4cce67dee94bc))
|
|
14
|
+
* update ts-to-schema generation ([0905daa](https://github.com/twinfoundation/standards/commit/0905daa4a344ed35fc37b7f12fcf9ce9d34e4bd6))
|
|
15
|
+
* use shared store mechanism ([#11](https://github.com/twinfoundation/standards/issues/11)) ([96fa237](https://github.com/twinfoundation/standards/commit/96fa23735f69c1fc7e3d0019b527634fa0a042d9))
|
|
16
|
+
|
|
17
|
+
## 0.0.1 (2025-07-03)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* release to production ([2ae4125](https://github.com/twinfoundation/standards/commit/2ae4125f305d4714b50036eb8a0bd47e4100a7be))
|
|
23
|
+
|
|
24
|
+
## [0.0.1-next.49](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.48...standards-w3c-did-v0.0.1-next.49) (2025-06-18)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Miscellaneous Chores
|
|
28
|
+
|
|
29
|
+
* **standards-w3c-did:** Synchronize repo versions
|
|
30
|
+
|
|
31
|
+
## [0.0.1-next.48](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.47...standards-w3c-did-v0.0.1-next.48) (2025-06-11)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* update to latest JSON schema spec ([7a23930](https://github.com/twinfoundation/standards/commit/7a2393032d7f48bfb20d3a484f981fb6dd83a92c))
|
|
37
|
+
|
|
38
|
+
## [0.0.1-next.47](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.46...standards-w3c-did-v0.0.1-next.47) (2025-06-05)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* update ts-to-schema generation ([ba4e76d](https://github.com/twinfoundation/standards/commit/ba4e76d677556a1817092f8079d4cce67dee94bc))
|
|
44
|
+
|
|
45
|
+
## [0.0.1-next.46](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.45...standards-w3c-did-v0.0.1-next.46) (2025-06-03)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
* update ts-to-schema generation ([0905daa](https://github.com/twinfoundation/standards/commit/0905daa4a344ed35fc37b7f12fcf9ce9d34e4bd6))
|
|
51
|
+
|
|
52
|
+
## [0.0.1-next.45](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.44...standards-w3c-did-v0.0.1-next.45) (2025-06-02)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Miscellaneous Chores
|
|
56
|
+
|
|
57
|
+
* **standards-w3c-did:** Synchronize repo versions
|
|
58
|
+
|
|
59
|
+
## [0.0.1-next.44](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.43...standards-w3c-did-v0.0.1-next.44) (2025-05-28)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Miscellaneous Chores
|
|
63
|
+
|
|
64
|
+
* **standards-w3c-did:** Synchronize repo versions
|
|
65
|
+
|
|
66
|
+
## [0.0.1-next.43](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.42...standards-w3c-did-v0.0.1-next.43) (2025-05-20)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Miscellaneous Chores
|
|
70
|
+
|
|
71
|
+
* **standards-w3c-did:** Synchronize repo versions
|
|
72
|
+
|
|
73
|
+
## [0.0.1-next.42](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.41...standards-w3c-did-v0.0.1-next.42) (2025-05-09)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Miscellaneous Chores
|
|
77
|
+
|
|
78
|
+
* **standards-w3c-did:** Synchronize repo versions
|
|
79
|
+
|
|
80
|
+
## [0.0.1-next.41](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.40...standards-w3c-did-v0.0.1-next.41) (2025-05-08)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Miscellaneous Chores
|
|
84
|
+
|
|
85
|
+
* **standards-w3c-did:** Synchronize repo versions
|
|
86
|
+
|
|
87
|
+
## [0.0.1-next.40](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.39...standards-w3c-did-v0.0.1-next.40) (2025-05-08)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Miscellaneous Chores
|
|
91
|
+
|
|
92
|
+
* **standards-w3c-did:** Synchronize repo versions
|
|
93
|
+
|
|
94
|
+
## [0.0.1-next.39](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.38...standards-w3c-did-v0.0.1-next.39) (2025-05-07)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Features
|
|
98
|
+
|
|
99
|
+
* alg usage ([#19](https://github.com/twinfoundation/standards/issues/19)) ([3946fb2](https://github.com/twinfoundation/standards/commit/3946fb2e8bd9a486ad186765d1d09361fa75786b))
|
|
100
|
+
|
|
101
|
+
## [0.0.1-next.38](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.37...standards-w3c-did-v0.0.1-next.38) (2025-05-07)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Miscellaneous Chores
|
|
105
|
+
|
|
106
|
+
* **standards-w3c-did:** Synchronize repo versions
|
|
107
|
+
|
|
108
|
+
## [0.0.1-next.37](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.36...standards-w3c-did-v0.0.1-next.37) (2025-05-06)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### Miscellaneous Chores
|
|
112
|
+
|
|
113
|
+
* **standards-w3c-did:** Synchronize repo versions
|
|
114
|
+
|
|
115
|
+
## [0.0.1-next.36](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.35...standards-w3c-did-v0.0.1-next.36) (2025-04-30)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Miscellaneous Chores
|
|
119
|
+
|
|
120
|
+
* **standards-w3c-did:** Synchronize repo versions
|
|
121
|
+
|
|
122
|
+
## [0.0.1-next.35](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.34...standards-w3c-did-v0.0.1-next.35) (2025-04-17)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### Features
|
|
126
|
+
|
|
127
|
+
* use shared store mechanism ([#11](https://github.com/twinfoundation/standards/issues/11)) ([96fa237](https://github.com/twinfoundation/standards/commit/96fa23735f69c1fc7e3d0019b527634fa0a042d9))
|
|
128
|
+
|
|
129
|
+
## [0.0.1-next.34](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.1-next.33...standards-w3c-did-v0.0.1-next.34) (2025-03-28)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### Features
|
|
133
|
+
|
|
134
|
+
* Add additional properties to the verifiable credential data model ([#8](https://github.com/twinfoundation/standards/issues/8)) ([4b7af9c](https://github.com/twinfoundation/standards/commit/4b7af9cf892e071eb348f30737c035c0f94591b5))
|
|
135
|
+
|
|
136
|
+
## v0.0.1-next.33
|
|
4
137
|
|
|
5
138
|
- Initial Release
|