@twin.org/standards-w3c-did 0.0.1-next.7 → 0.0.1-next.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/dist/cjs/index.cjs +18 -0
- package/dist/esm/index.mjs +18 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/IDidVerifiableCredential.d.ts +2 -2
- package/dist/types/models/IDidVerifiablePresentation.d.ts +3 -3
- package/dist/types/models/didTypes.d.ts +17 -0
- package/docs/changelog.md +1 -1
- package/docs/reference/index.md +2 -0
- package/docs/reference/interfaces/IDidVerifiableCredential.md +6 -2
- package/docs/reference/interfaces/IDidVerifiablePresentation.md +6 -2
- package/docs/reference/type-aliases/DidTypes.md +5 -0
- package/docs/reference/variables/DidTypes.md +19 -0
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -17,6 +17,23 @@ const DidContexts = {
|
|
|
17
17
|
ContextV2: "https://www.w3.org/ns/credentials/v2"
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
// Copyright 2024 IOTA Stiftung.
|
|
21
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
22
|
+
/**
|
|
23
|
+
* The types for DIDs.
|
|
24
|
+
*/
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
26
|
+
const DidTypes = {
|
|
27
|
+
/**
|
|
28
|
+
* The type for Verifiable Credential.
|
|
29
|
+
*/
|
|
30
|
+
VerifiableCredential: "VerifiableCredential",
|
|
31
|
+
/**
|
|
32
|
+
* The type for Verifiable Presentation.
|
|
33
|
+
*/
|
|
34
|
+
VerifiablePresentation: "VerifiablePresentation"
|
|
35
|
+
};
|
|
36
|
+
|
|
20
37
|
/**
|
|
21
38
|
* The types of verification method.
|
|
22
39
|
*/
|
|
@@ -49,4 +66,5 @@ const DidVerificationMethodType = {
|
|
|
49
66
|
};
|
|
50
67
|
|
|
51
68
|
exports.DidContexts = DidContexts;
|
|
69
|
+
exports.DidTypes = DidTypes;
|
|
52
70
|
exports.DidVerificationMethodType = DidVerificationMethodType;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -15,6 +15,23 @@ const DidContexts = {
|
|
|
15
15
|
ContextV2: "https://www.w3.org/ns/credentials/v2"
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
// Copyright 2024 IOTA Stiftung.
|
|
19
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
20
|
+
/**
|
|
21
|
+
* The types for DIDs.
|
|
22
|
+
*/
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
24
|
+
const DidTypes = {
|
|
25
|
+
/**
|
|
26
|
+
* The type for Verifiable Credential.
|
|
27
|
+
*/
|
|
28
|
+
VerifiableCredential: "VerifiableCredential",
|
|
29
|
+
/**
|
|
30
|
+
* The type for Verifiable Presentation.
|
|
31
|
+
*/
|
|
32
|
+
VerifiablePresentation: "VerifiablePresentation"
|
|
33
|
+
};
|
|
34
|
+
|
|
18
35
|
/**
|
|
19
36
|
* The types of verification method.
|
|
20
37
|
*/
|
|
@@ -46,4 +63,4 @@ const DidVerificationMethodType = {
|
|
|
46
63
|
CapabilityDelegation: "capabilityDelegation"
|
|
47
64
|
};
|
|
48
65
|
|
|
49
|
-
export { DidContexts, DidVerificationMethodType };
|
|
66
|
+
export { DidContexts, DidTypes, DidVerificationMethodType };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { IDidProof } from "./IDidProof";
|
|
|
4
4
|
/**
|
|
5
5
|
* Interface describing a verifiable credential.
|
|
6
6
|
*/
|
|
7
|
-
export interface IDidVerifiableCredential {
|
|
7
|
+
export interface IDidVerifiableCredential<T extends IJsonLdNodeObject = IJsonLdNodeObject> {
|
|
8
8
|
/**
|
|
9
9
|
* The context for the verifiable credential.
|
|
10
10
|
*/
|
|
@@ -20,7 +20,7 @@ export interface IDidVerifiableCredential {
|
|
|
20
20
|
/**
|
|
21
21
|
* The data for the verifiable credential.
|
|
22
22
|
*/
|
|
23
|
-
credentialSubject:
|
|
23
|
+
credentialSubject: T | T[];
|
|
24
24
|
/**
|
|
25
25
|
* Used to discover information about the current status of the
|
|
26
26
|
* verifiable credential, such as whether it is suspended or revoked.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { IJsonLdContextDefinitionRoot } from "@twin.org/data-json-ld";
|
|
1
|
+
import type { IJsonLdContextDefinitionRoot, IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
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 {
|
|
7
|
+
export interface IDidVerifiablePresentation<T extends IJsonLdNodeObject = IJsonLdNodeObject> {
|
|
8
8
|
/**
|
|
9
9
|
* The context for the verifiable credential.
|
|
10
10
|
*/
|
|
@@ -20,7 +20,7 @@ export interface IDidVerifiablePresentation {
|
|
|
20
20
|
/**
|
|
21
21
|
* The data for the verifiable credentials.
|
|
22
22
|
*/
|
|
23
|
-
verifiableCredential: (string | IDidVerifiableCredential)[];
|
|
23
|
+
verifiableCredential: (string | IDidVerifiableCredential<T>)[];
|
|
24
24
|
/**
|
|
25
25
|
* The entity generating the presentation.
|
|
26
26
|
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The types for DIDs.
|
|
3
|
+
*/
|
|
4
|
+
export declare const DidTypes: {
|
|
5
|
+
/**
|
|
6
|
+
* The type for Verifiable Credential.
|
|
7
|
+
*/
|
|
8
|
+
readonly VerifiableCredential: "VerifiableCredential";
|
|
9
|
+
/**
|
|
10
|
+
* The type for Verifiable Presentation.
|
|
11
|
+
*/
|
|
12
|
+
readonly VerifiablePresentation: "VerifiablePresentation";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The types for DIDs.
|
|
16
|
+
*/
|
|
17
|
+
export type DidTypes = (typeof DidTypes)[keyof typeof DidTypes];
|
package/docs/changelog.md
CHANGED
package/docs/reference/index.md
CHANGED
|
@@ -14,9 +14,11 @@
|
|
|
14
14
|
## Type Aliases
|
|
15
15
|
|
|
16
16
|
- [DidContexts](type-aliases/DidContexts.md)
|
|
17
|
+
- [DidTypes](type-aliases/DidTypes.md)
|
|
17
18
|
- [DidVerificationMethodType](type-aliases/DidVerificationMethodType.md)
|
|
18
19
|
|
|
19
20
|
## Variables
|
|
20
21
|
|
|
21
22
|
- [DidContexts](variables/DidContexts.md)
|
|
23
|
+
- [DidTypes](variables/DidTypes.md)
|
|
22
24
|
- [DidVerificationMethodType](variables/DidVerificationMethodType.md)
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
# Interface: IDidVerifiableCredential
|
|
1
|
+
# Interface: IDidVerifiableCredential\<T\>
|
|
2
2
|
|
|
3
3
|
Interface describing a verifiable credential.
|
|
4
4
|
|
|
5
|
+
## Type Parameters
|
|
6
|
+
|
|
7
|
+
• **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
|
|
8
|
+
|
|
5
9
|
## Properties
|
|
6
10
|
|
|
7
11
|
### @context
|
|
@@ -30,7 +34,7 @@ The types of the data stored in the verifiable credential.
|
|
|
30
34
|
|
|
31
35
|
### credentialSubject
|
|
32
36
|
|
|
33
|
-
> **credentialSubject**: `
|
|
37
|
+
> **credentialSubject**: `T` \| `T`[]
|
|
34
38
|
|
|
35
39
|
The data for the verifiable credential.
|
|
36
40
|
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
# Interface: IDidVerifiablePresentation
|
|
1
|
+
# Interface: IDidVerifiablePresentation\<T\>
|
|
2
2
|
|
|
3
3
|
Interface describing a verifiable presentation.
|
|
4
4
|
|
|
5
|
+
## Type Parameters
|
|
6
|
+
|
|
7
|
+
• **T** *extends* `IJsonLdNodeObject` = `IJsonLdNodeObject`
|
|
8
|
+
|
|
5
9
|
## Properties
|
|
6
10
|
|
|
7
11
|
### @context
|
|
@@ -30,7 +34,7 @@ The types of the data stored in the verifiable credential.
|
|
|
30
34
|
|
|
31
35
|
### verifiableCredential
|
|
32
36
|
|
|
33
|
-
> **verifiableCredential**: (`string` \| [`IDidVerifiableCredential`](IDidVerifiableCredential.md))[]
|
|
37
|
+
> **verifiableCredential**: (`string` \| [`IDidVerifiableCredential`](IDidVerifiableCredential.md)\<`T`\>)[]
|
|
34
38
|
|
|
35
39
|
The data for the verifiable credentials.
|
|
36
40
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Variable: DidTypes
|
|
2
|
+
|
|
3
|
+
> `const` **DidTypes**: `object`
|
|
4
|
+
|
|
5
|
+
The types for DIDs.
|
|
6
|
+
|
|
7
|
+
## Type declaration
|
|
8
|
+
|
|
9
|
+
### VerifiableCredential
|
|
10
|
+
|
|
11
|
+
> `readonly` **VerifiableCredential**: `"VerifiableCredential"` = `"VerifiableCredential"`
|
|
12
|
+
|
|
13
|
+
The type for Verifiable Credential.
|
|
14
|
+
|
|
15
|
+
### VerifiablePresentation
|
|
16
|
+
|
|
17
|
+
> `readonly` **VerifiablePresentation**: `"VerifiablePresentation"` = `"VerifiablePresentation"`
|
|
18
|
+
|
|
19
|
+
The type for Verifiable Presentation.
|