@twin.org/standards-w3c-did 0.0.1-next.14 → 0.0.1-next.16

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.
@@ -33,6 +33,25 @@ const DidContexts = {
33
33
  ContextVCDataIntegrity: "https://w3id.org/security/data-integrity/v2"
34
34
  };
35
35
 
36
+ // Copyright 2024 IOTA Stiftung.
37
+ // SPDX-License-Identifier: Apache-2.0.
38
+ /**
39
+ * The types for DID Proof crypto suites.
40
+ */
41
+ // eslint-disable-next-line @typescript-eslint/naming-convention
42
+ const DidCryptoSuites = {
43
+ /**
44
+ * The type for EdDSA crypto suite for JSON Canonicalization Scheme [RFC8785].
45
+ * https://www.w3.org/TR/vc-di-eddsa/#eddsa-jcs-2022
46
+ */
47
+ EdDSAJcs2022: "eddsa-jcs-2022",
48
+ /**
49
+ * The type for EdDSA crypto suite for RDF Dataset Canonicalization.
50
+ * https://www.w3.org/TR/vc-di-eddsa/#eddsa-rdfc-2022
51
+ */
52
+ EdDSARdfc2022: "eddsa-rdfc-2022"
53
+ };
54
+
36
55
  // Copyright 2024 IOTA Stiftung.
37
56
  // SPDX-License-Identifier: Apache-2.0.
38
57
  /**
@@ -98,5 +117,6 @@ const DidVerificationMethodType = {
98
117
  };
99
118
 
100
119
  exports.DidContexts = DidContexts;
120
+ exports.DidCryptoSuites = DidCryptoSuites;
101
121
  exports.DidTypes = DidTypes;
102
122
  exports.DidVerificationMethodType = DidVerificationMethodType;
@@ -31,6 +31,25 @@ const DidContexts = {
31
31
  ContextVCDataIntegrity: "https://w3id.org/security/data-integrity/v2"
32
32
  };
33
33
 
34
+ // Copyright 2024 IOTA Stiftung.
35
+ // SPDX-License-Identifier: Apache-2.0.
36
+ /**
37
+ * The types for DID Proof crypto suites.
38
+ */
39
+ // eslint-disable-next-line @typescript-eslint/naming-convention
40
+ const DidCryptoSuites = {
41
+ /**
42
+ * The type for EdDSA crypto suite for JSON Canonicalization Scheme [RFC8785].
43
+ * https://www.w3.org/TR/vc-di-eddsa/#eddsa-jcs-2022
44
+ */
45
+ EdDSAJcs2022: "eddsa-jcs-2022",
46
+ /**
47
+ * The type for EdDSA crypto suite for RDF Dataset Canonicalization.
48
+ * https://www.w3.org/TR/vc-di-eddsa/#eddsa-rdfc-2022
49
+ */
50
+ EdDSARdfc2022: "eddsa-rdfc-2022"
51
+ };
52
+
34
53
  // Copyright 2024 IOTA Stiftung.
35
54
  // SPDX-License-Identifier: Apache-2.0.
36
55
  /**
@@ -95,4 +114,4 @@ const DidVerificationMethodType = {
95
114
  CapabilityDelegation: "capabilityDelegation"
96
115
  };
97
116
 
98
- export { DidContexts, DidTypes, DidVerificationMethodType };
117
+ export { DidContexts, DidCryptoSuites, DidTypes, DidVerificationMethodType };
@@ -1,4 +1,5 @@
1
1
  export * from "./models/didContexts";
2
+ export * from "./models/didCryptoSuites";
2
3
  export * from "./models/didTypes";
3
4
  export * from "./models/didVerificationMethodType";
4
5
  export * from "./models/IDidCredentialStatus";
@@ -1,4 +1,5 @@
1
1
  import type { DidContexts } from "./didContexts";
2
+ import type { DidCryptoSuites } from "./didCryptoSuites";
2
3
  import type { DidTypes } from "./didTypes";
3
4
  /**
4
5
  * Interface describing a did proof.
@@ -8,7 +9,7 @@ export interface IDidProof {
8
9
  /**
9
10
  * JSON-LD Context.
10
11
  */
11
- "@context"?: typeof DidContexts.ContextVCDataIntegrity | [typeof DidContexts.ContextVCDataIntegrity, ...string[]];
12
+ "@context": typeof DidContexts.ContextVCDataIntegrity | [typeof DidContexts.ContextVCDataIntegrity, ...string[]];
12
13
  /**
13
14
  * JSON-LD Type.
14
15
  */
@@ -16,7 +17,7 @@ export interface IDidProof {
16
17
  /**
17
18
  * An identifier for the cryptographic suite that can be used to verify the proof.
18
19
  */
19
- cryptosuite: string;
20
+ cryptosuite: DidCryptoSuites | string;
20
21
  /**
21
22
  * The id of the proof.
22
23
  */
@@ -29,7 +30,7 @@ export interface IDidProof {
29
30
  * Contains the base-encoded binary data necessary to verify the
30
31
  * digital proof using the verificationMethod specified.
31
32
  */
32
- proofValue?: string;
33
+ proofValue: string;
33
34
  /**
34
35
  * The verification method of the proof.
35
36
  */
@@ -1,14 +1,15 @@
1
- import type { IJsonLdContextDefinitionRoot, IJsonLdObject } from "@twin.org/data-json-ld";
1
+ import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
2
+ import type { DidContexts } from "./didContexts";
2
3
  import type { IDidCredentialStatus } from "./IDidCredentialStatus";
3
4
  import type { IDidProof } from "./IDidProof";
4
5
  /**
5
6
  * Interface describing a verifiable credential.
6
7
  */
7
- export interface IDidVerifiableCredential<T extends IJsonLdObject = IJsonLdObject> {
8
+ export interface IDidVerifiableCredential {
8
9
  /**
9
10
  * The context for the verifiable credential.
10
11
  */
11
- "@context": IJsonLdContextDefinitionRoot;
12
+ "@context": typeof DidContexts.ContextVCv2 | [typeof DidContexts.ContextVCv2, ...string[]];
12
13
  /**
13
14
  * The identifier for the verifiable credential.
14
15
  */
@@ -20,7 +21,7 @@ export interface IDidVerifiableCredential<T extends IJsonLdObject = IJsonLdObjec
20
21
  /**
21
22
  * The data for the verifiable credential.
22
23
  */
23
- credentialSubject: T | T[];
24
+ credentialSubject: IJsonLdNodeObject | IJsonLdNodeObject[];
24
25
  /**
25
26
  * Used to discover information about the current status of the
26
27
  * verifiable credential, such as whether it is suspended or revoked.
@@ -1,14 +1,14 @@
1
- import type { IJsonLdContextDefinitionRoot, IJsonLdObject } from "@twin.org/data-json-ld";
1
+ import type { DidContexts } from "./didContexts";
2
2
  import type { IDidProof } from "./IDidProof";
3
3
  import type { IDidVerifiableCredential } from "./IDidVerifiableCredential";
4
4
  /**
5
5
  * Interface describing a verifiable presentation.
6
6
  */
7
- export interface IDidVerifiablePresentation<T extends IJsonLdObject = IJsonLdObject> {
7
+ export interface IDidVerifiablePresentation {
8
8
  /**
9
- * The context for the verifiable credential.
9
+ * The context for the verifiable presentation.
10
10
  */
11
- "@context": IJsonLdContextDefinitionRoot;
11
+ "@context": typeof DidContexts.ContextVCv2 | [typeof DidContexts.ContextVCv2, ...string[]];
12
12
  /**
13
13
  * Provide a unique identifier for the presentation.
14
14
  */
@@ -20,7 +20,7 @@ export interface IDidVerifiablePresentation<T extends IJsonLdObject = IJsonLdObj
20
20
  /**
21
21
  * The data for the verifiable credentials.
22
22
  */
23
- verifiableCredential: (string | IDidVerifiableCredential<T>)[];
23
+ verifiableCredential: (string | IDidVerifiableCredential)[];
24
24
  /**
25
25
  * The entity generating the presentation.
26
26
  */
@@ -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];
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/standards-w3c-did - Changelog
2
2
 
3
- ## v0.0.1-next.14
3
+ ## v0.0.1-next.16
4
4
 
5
5
  - Initial Release
@@ -14,11 +14,13 @@
14
14
  ## Type Aliases
15
15
 
16
16
  - [DidContexts](type-aliases/DidContexts.md)
17
+ - [DidCryptoSuites](type-aliases/DidCryptoSuites.md)
17
18
  - [DidTypes](type-aliases/DidTypes.md)
18
19
  - [DidVerificationMethodType](type-aliases/DidVerificationMethodType.md)
19
20
 
20
21
  ## Variables
21
22
 
22
23
  - [DidContexts](variables/DidContexts.md)
24
+ - [DidCryptoSuites](variables/DidCryptoSuites.md)
23
25
  - [DidTypes](variables/DidTypes.md)
24
26
  - [DidVerificationMethodType](variables/DidVerificationMethodType.md)
@@ -5,9 +5,9 @@ https://www.w3.org/TR/vc-data-integrity/
5
5
 
6
6
  ## Properties
7
7
 
8
- ### @context?
8
+ ### @context
9
9
 
10
- > `optional` **@context**: `"https://w3id.org/security/data-integrity/v2"` \| [`"https://w3id.org/security/data-integrity/v2"`, `...string[]`]
10
+ > **@context**: `"https://w3id.org/security/data-integrity/v2"` \| [`"https://w3id.org/security/data-integrity/v2"`, `...string[]`]
11
11
 
12
12
  JSON-LD Context.
13
13
 
@@ -45,9 +45,9 @@ The reason the proof was created.
45
45
 
46
46
  ***
47
47
 
48
- ### proofValue?
48
+ ### proofValue
49
49
 
50
- > `optional` **proofValue**: `string`
50
+ > **proofValue**: `string`
51
51
 
52
52
  Contains the base-encoded binary data necessary to verify the
53
53
  digital proof using the verificationMethod specified.
@@ -1,16 +1,12 @@
1
- # Interface: IDidVerifiableCredential\<T\>
1
+ # Interface: IDidVerifiableCredential
2
2
 
3
3
  Interface describing a verifiable credential.
4
4
 
5
- ## Type Parameters
6
-
7
- • **T** *extends* `IJsonLdObject` = `IJsonLdObject`
8
-
9
5
  ## Properties
10
6
 
11
7
  ### @context
12
8
 
13
- > **@context**: `IJsonLdContextDefinitionRoot`
9
+ > **@context**: `"https://www.w3.org/ns/credentials/v2"` \| [`"https://www.w3.org/ns/credentials/v2"`, `...string[]`]
14
10
 
15
11
  The context for the verifiable credential.
16
12
 
@@ -34,7 +30,7 @@ The types of the data stored in the verifiable credential.
34
30
 
35
31
  ### credentialSubject
36
32
 
37
- > **credentialSubject**: `T` \| `T`[]
33
+ > **credentialSubject**: `IJsonLdNodeObject` \| `IJsonLdNodeObject`[]
38
34
 
39
35
  The data for the verifiable credential.
40
36
 
@@ -1,18 +1,14 @@
1
- # Interface: IDidVerifiablePresentation\<T\>
1
+ # Interface: IDidVerifiablePresentation
2
2
 
3
3
  Interface describing a verifiable presentation.
4
4
 
5
- ## Type Parameters
6
-
7
- • **T** *extends* `IJsonLdObject` = `IJsonLdObject`
8
-
9
5
  ## Properties
10
6
 
11
7
  ### @context
12
8
 
13
- > **@context**: `IJsonLdContextDefinitionRoot`
9
+ > **@context**: `"https://www.w3.org/ns/credentials/v2"` \| [`"https://www.w3.org/ns/credentials/v2"`, `...string[]`]
14
10
 
15
- The context for the verifiable credential.
11
+ The context for the verifiable presentation.
16
12
 
17
13
  ***
18
14
 
@@ -34,7 +30,7 @@ The types of the data stored in the verifiable credential.
34
30
 
35
31
  ### verifiableCredential
36
32
 
37
- > **verifiableCredential**: (`string` \| [`IDidVerifiableCredential`](IDidVerifiableCredential.md)\<`T`\>)[]
33
+ > **verifiableCredential**: (`string` \| [`IDidVerifiableCredential`](IDidVerifiableCredential.md))[]
38
34
 
39
35
  The data for the verifiable credentials.
40
36
 
@@ -0,0 +1,5 @@
1
+ # Type Alias: DidCryptoSuites
2
+
3
+ > **DidCryptoSuites**: *typeof* [`DidCryptoSuites`](../variables/DidCryptoSuites.md)\[keyof *typeof* [`DidCryptoSuites`](../variables/DidCryptoSuites.md)\]
4
+
5
+ The types for DID Proof crypto suites.
@@ -0,0 +1,21 @@
1
+ # Variable: DidCryptoSuites
2
+
3
+ > `const` **DidCryptoSuites**: `object`
4
+
5
+ The types for DID Proof crypto suites.
6
+
7
+ ## Type declaration
8
+
9
+ ### EdDSAJcs2022
10
+
11
+ > `readonly` **EdDSAJcs2022**: `"eddsa-jcs-2022"` = `"eddsa-jcs-2022"`
12
+
13
+ The type for EdDSA crypto suite for JSON Canonicalization Scheme [RFC8785].
14
+ https://www.w3.org/TR/vc-di-eddsa/#eddsa-jcs-2022
15
+
16
+ ### EdDSARdfc2022
17
+
18
+ > `readonly` **EdDSARdfc2022**: `"eddsa-rdfc-2022"` = `"eddsa-rdfc-2022"`
19
+
20
+ The type for EdDSA crypto suite for RDF Dataset Canonicalization.
21
+ https://www.w3.org/TR/vc-di-eddsa/#eddsa-rdfc-2022
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/standards-w3c-did",
3
- "version": "0.0.1-next.14",
3
+ "version": "0.0.1-next.16",
4
4
  "description": "Models which define the structure of W3C DID Standard",
5
5
  "repository": {
6
6
  "type": "git",