@twin.org/attestation-models 0.0.1-next.8 → 0.0.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 +53 -29
- package/dist/esm/index.mjs +53 -30
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/IAttestationComponent.d.ts +3 -3
- package/dist/types/models/IAttestationConnector.d.ts +1 -2
- package/dist/types/models/IAttestationInformation.d.ts +9 -2
- package/dist/types/models/IAttestationJwtProof.d.ts +3 -1
- package/dist/types/models/api/IAttestationCreateRequest.d.ts +0 -4
- package/dist/types/models/api/IAttestationTransferRequest.d.ts +5 -1
- package/dist/types/models/attestationContexts.d.ts +17 -0
- package/dist/types/models/attestationTypes.d.ts +0 -4
- package/docs/changelog.md +51 -1
- package/docs/reference/classes/AttestationDataTypes.md +3 -3
- package/docs/reference/index.md +2 -0
- package/docs/reference/interfaces/IAttestationComponent.md +38 -16
- package/docs/reference/interfaces/IAttestationConnector.md +30 -14
- package/docs/reference/interfaces/IAttestationCreateRequest.md +0 -6
- package/docs/reference/interfaces/IAttestationInformation.md +1 -1
- package/docs/reference/interfaces/IAttestationJwtProof.md +1 -1
- package/docs/reference/interfaces/IAttestationTransferRequest.md +7 -1
- package/docs/reference/type-aliases/AttestationContexts.md +5 -0
- package/docs/reference/type-aliases/AttestationTypes.md +1 -1
- package/docs/reference/variables/AttestationContexts.md +19 -0
- package/docs/reference/variables/AttestationTypes.md +0 -6
- package/package.json +12 -11
package/dist/cjs/index.cjs
CHANGED
|
@@ -6,14 +6,27 @@ var core = require('@twin.org/core');
|
|
|
6
6
|
// Copyright 2024 IOTA Stiftung.
|
|
7
7
|
// SPDX-License-Identifier: Apache-2.0.
|
|
8
8
|
/**
|
|
9
|
-
* The
|
|
9
|
+
* The contexts of attestation data.
|
|
10
10
|
*/
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
12
|
-
const
|
|
12
|
+
const AttestationContexts = {
|
|
13
13
|
/**
|
|
14
14
|
* The context root for the attestation types.
|
|
15
15
|
*/
|
|
16
16
|
ContextRoot: "https://schema.twindev.org/attestation/",
|
|
17
|
+
/**
|
|
18
|
+
* The context root for the common types.
|
|
19
|
+
*/
|
|
20
|
+
ContextRootCommon: "https://schema.twindev.org/common/"
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Copyright 2024 IOTA Stiftung.
|
|
24
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
25
|
+
/**
|
|
26
|
+
* The types of attestation data.
|
|
27
|
+
*/
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
29
|
+
const AttestationTypes = {
|
|
17
30
|
/**
|
|
18
31
|
* Represents attestation information.
|
|
19
32
|
*/
|
|
@@ -24,29 +37,32 @@ const AttestationTypes = {
|
|
|
24
37
|
JwtProof: "JwtProof"
|
|
25
38
|
};
|
|
26
39
|
|
|
40
|
+
var $schema$1 = "https://json-schema.org/draft/2020-12/schema";
|
|
41
|
+
var $id$1 = "https://schema.twindev.org/attestation/AttestationInformation";
|
|
42
|
+
var description$1 = "Interface describing the collated attestation information.";
|
|
27
43
|
var type$1 = "object";
|
|
28
44
|
var properties$1 = {
|
|
29
45
|
"@context": {
|
|
30
|
-
|
|
46
|
+
type: "array",
|
|
47
|
+
minItems: 3,
|
|
48
|
+
items: {
|
|
49
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
50
|
+
},
|
|
51
|
+
description: "JSON-LD Context.",
|
|
52
|
+
prefixItems: [
|
|
31
53
|
{
|
|
32
54
|
type: "string",
|
|
33
55
|
"const": "https://schema.twindev.org/attestation/"
|
|
34
56
|
},
|
|
35
57
|
{
|
|
36
|
-
type: "
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
],
|
|
44
|
-
additionalItems: {
|
|
45
|
-
type: "string"
|
|
46
|
-
}
|
|
58
|
+
type: "string",
|
|
59
|
+
"const": "https://schema.twindev.org/common/"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: "string",
|
|
63
|
+
"const": "https://schema.org"
|
|
47
64
|
}
|
|
48
|
-
]
|
|
49
|
-
description: "JSON-LD Context."
|
|
65
|
+
]
|
|
50
66
|
},
|
|
51
67
|
type: {
|
|
52
68
|
type: "string",
|
|
@@ -99,15 +115,19 @@ var required$1 = [
|
|
|
99
115
|
"attestationObject"
|
|
100
116
|
];
|
|
101
117
|
var additionalProperties$1 = false;
|
|
102
|
-
var description$1 = "Interface describing the collated attestation information.";
|
|
103
118
|
var AttestationInformationSchema = {
|
|
119
|
+
$schema: $schema$1,
|
|
120
|
+
$id: $id$1,
|
|
121
|
+
description: description$1,
|
|
104
122
|
type: type$1,
|
|
105
123
|
properties: properties$1,
|
|
106
124
|
required: required$1,
|
|
107
|
-
additionalProperties: additionalProperties$1
|
|
108
|
-
description: description$1
|
|
125
|
+
additionalProperties: additionalProperties$1
|
|
109
126
|
};
|
|
110
127
|
|
|
128
|
+
var $schema = "https://json-schema.org/draft/2020-12/schema";
|
|
129
|
+
var $id = "https://schema.twindev.org/attestation/AttestationJwtProof";
|
|
130
|
+
var description = "Interface describing an attestation proof.";
|
|
111
131
|
var type = "object";
|
|
112
132
|
var properties = {
|
|
113
133
|
"@context": {
|
|
@@ -119,15 +139,15 @@ var properties = {
|
|
|
119
139
|
{
|
|
120
140
|
type: "array",
|
|
121
141
|
minItems: 1,
|
|
122
|
-
items:
|
|
142
|
+
items: {
|
|
143
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
144
|
+
},
|
|
145
|
+
prefixItems: [
|
|
123
146
|
{
|
|
124
147
|
type: "string",
|
|
125
148
|
"const": "https://schema.twindev.org/attestation/"
|
|
126
149
|
}
|
|
127
|
-
]
|
|
128
|
-
additionalItems: {
|
|
129
|
-
type: "string"
|
|
130
|
-
}
|
|
150
|
+
]
|
|
131
151
|
}
|
|
132
152
|
],
|
|
133
153
|
description: "JSON-LD Context."
|
|
@@ -148,13 +168,14 @@ var required = [
|
|
|
148
168
|
"value"
|
|
149
169
|
];
|
|
150
170
|
var additionalProperties = false;
|
|
151
|
-
var description = "Interface describing an attestation proof.";
|
|
152
171
|
var AttestationJwtProofSchema = {
|
|
172
|
+
$schema: $schema,
|
|
173
|
+
$id: $id,
|
|
174
|
+
description: description,
|
|
153
175
|
type: type,
|
|
154
176
|
properties: properties,
|
|
155
177
|
required: required,
|
|
156
|
-
additionalProperties: additionalProperties
|
|
157
|
-
description: description
|
|
178
|
+
additionalProperties: additionalProperties
|
|
158
179
|
};
|
|
159
180
|
|
|
160
181
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -167,12 +188,14 @@ class AttestationDataTypes {
|
|
|
167
188
|
* Register all the data types.
|
|
168
189
|
*/
|
|
169
190
|
static registerTypes() {
|
|
170
|
-
dataCore.DataTypeHandlerFactory.register(AttestationTypes.Information
|
|
191
|
+
dataCore.DataTypeHandlerFactory.register(`${AttestationContexts.ContextRoot}${AttestationTypes.Information}`, () => ({
|
|
192
|
+
context: AttestationContexts.ContextRoot,
|
|
171
193
|
type: AttestationTypes.Information,
|
|
172
194
|
defaultValue: {},
|
|
173
195
|
jsonSchema: async () => AttestationInformationSchema
|
|
174
196
|
}));
|
|
175
|
-
dataCore.DataTypeHandlerFactory.register(AttestationTypes.JwtProof
|
|
197
|
+
dataCore.DataTypeHandlerFactory.register(`${AttestationContexts.ContextRoot}${AttestationTypes.JwtProof}`, () => ({
|
|
198
|
+
context: AttestationContexts.ContextRoot,
|
|
176
199
|
type: AttestationTypes.JwtProof,
|
|
177
200
|
defaultValue: {},
|
|
178
201
|
jsonSchema: async () => AttestationJwtProofSchema
|
|
@@ -189,5 +212,6 @@ class AttestationDataTypes {
|
|
|
189
212
|
const AttestationConnectorFactory = core.Factory.createFactory("attestation");
|
|
190
213
|
|
|
191
214
|
exports.AttestationConnectorFactory = AttestationConnectorFactory;
|
|
215
|
+
exports.AttestationContexts = AttestationContexts;
|
|
192
216
|
exports.AttestationDataTypes = AttestationDataTypes;
|
|
193
217
|
exports.AttestationTypes = AttestationTypes;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -4,14 +4,27 @@ import { Factory } from '@twin.org/core';
|
|
|
4
4
|
// Copyright 2024 IOTA Stiftung.
|
|
5
5
|
// SPDX-License-Identifier: Apache-2.0.
|
|
6
6
|
/**
|
|
7
|
-
* The
|
|
7
|
+
* The contexts of attestation data.
|
|
8
8
|
*/
|
|
9
9
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10
|
-
const
|
|
10
|
+
const AttestationContexts = {
|
|
11
11
|
/**
|
|
12
12
|
* The context root for the attestation types.
|
|
13
13
|
*/
|
|
14
14
|
ContextRoot: "https://schema.twindev.org/attestation/",
|
|
15
|
+
/**
|
|
16
|
+
* The context root for the common types.
|
|
17
|
+
*/
|
|
18
|
+
ContextRootCommon: "https://schema.twindev.org/common/"
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Copyright 2024 IOTA Stiftung.
|
|
22
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
23
|
+
/**
|
|
24
|
+
* The types of attestation data.
|
|
25
|
+
*/
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
27
|
+
const AttestationTypes = {
|
|
15
28
|
/**
|
|
16
29
|
* Represents attestation information.
|
|
17
30
|
*/
|
|
@@ -22,29 +35,32 @@ const AttestationTypes = {
|
|
|
22
35
|
JwtProof: "JwtProof"
|
|
23
36
|
};
|
|
24
37
|
|
|
38
|
+
var $schema$1 = "https://json-schema.org/draft/2020-12/schema";
|
|
39
|
+
var $id$1 = "https://schema.twindev.org/attestation/AttestationInformation";
|
|
40
|
+
var description$1 = "Interface describing the collated attestation information.";
|
|
25
41
|
var type$1 = "object";
|
|
26
42
|
var properties$1 = {
|
|
27
43
|
"@context": {
|
|
28
|
-
|
|
44
|
+
type: "array",
|
|
45
|
+
minItems: 3,
|
|
46
|
+
items: {
|
|
47
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
48
|
+
},
|
|
49
|
+
description: "JSON-LD Context.",
|
|
50
|
+
prefixItems: [
|
|
29
51
|
{
|
|
30
52
|
type: "string",
|
|
31
53
|
"const": "https://schema.twindev.org/attestation/"
|
|
32
54
|
},
|
|
33
55
|
{
|
|
34
|
-
type: "
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
],
|
|
42
|
-
additionalItems: {
|
|
43
|
-
type: "string"
|
|
44
|
-
}
|
|
56
|
+
type: "string",
|
|
57
|
+
"const": "https://schema.twindev.org/common/"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: "string",
|
|
61
|
+
"const": "https://schema.org"
|
|
45
62
|
}
|
|
46
|
-
]
|
|
47
|
-
description: "JSON-LD Context."
|
|
63
|
+
]
|
|
48
64
|
},
|
|
49
65
|
type: {
|
|
50
66
|
type: "string",
|
|
@@ -97,15 +113,19 @@ var required$1 = [
|
|
|
97
113
|
"attestationObject"
|
|
98
114
|
];
|
|
99
115
|
var additionalProperties$1 = false;
|
|
100
|
-
var description$1 = "Interface describing the collated attestation information.";
|
|
101
116
|
var AttestationInformationSchema = {
|
|
117
|
+
$schema: $schema$1,
|
|
118
|
+
$id: $id$1,
|
|
119
|
+
description: description$1,
|
|
102
120
|
type: type$1,
|
|
103
121
|
properties: properties$1,
|
|
104
122
|
required: required$1,
|
|
105
|
-
additionalProperties: additionalProperties$1
|
|
106
|
-
description: description$1
|
|
123
|
+
additionalProperties: additionalProperties$1
|
|
107
124
|
};
|
|
108
125
|
|
|
126
|
+
var $schema = "https://json-schema.org/draft/2020-12/schema";
|
|
127
|
+
var $id = "https://schema.twindev.org/attestation/AttestationJwtProof";
|
|
128
|
+
var description = "Interface describing an attestation proof.";
|
|
109
129
|
var type = "object";
|
|
110
130
|
var properties = {
|
|
111
131
|
"@context": {
|
|
@@ -117,15 +137,15 @@ var properties = {
|
|
|
117
137
|
{
|
|
118
138
|
type: "array",
|
|
119
139
|
minItems: 1,
|
|
120
|
-
items:
|
|
140
|
+
items: {
|
|
141
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
|
|
142
|
+
},
|
|
143
|
+
prefixItems: [
|
|
121
144
|
{
|
|
122
145
|
type: "string",
|
|
123
146
|
"const": "https://schema.twindev.org/attestation/"
|
|
124
147
|
}
|
|
125
|
-
]
|
|
126
|
-
additionalItems: {
|
|
127
|
-
type: "string"
|
|
128
|
-
}
|
|
148
|
+
]
|
|
129
149
|
}
|
|
130
150
|
],
|
|
131
151
|
description: "JSON-LD Context."
|
|
@@ -146,13 +166,14 @@ var required = [
|
|
|
146
166
|
"value"
|
|
147
167
|
];
|
|
148
168
|
var additionalProperties = false;
|
|
149
|
-
var description = "Interface describing an attestation proof.";
|
|
150
169
|
var AttestationJwtProofSchema = {
|
|
170
|
+
$schema: $schema,
|
|
171
|
+
$id: $id,
|
|
172
|
+
description: description,
|
|
151
173
|
type: type,
|
|
152
174
|
properties: properties,
|
|
153
175
|
required: required,
|
|
154
|
-
additionalProperties: additionalProperties
|
|
155
|
-
description: description
|
|
176
|
+
additionalProperties: additionalProperties
|
|
156
177
|
};
|
|
157
178
|
|
|
158
179
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -165,12 +186,14 @@ class AttestationDataTypes {
|
|
|
165
186
|
* Register all the data types.
|
|
166
187
|
*/
|
|
167
188
|
static registerTypes() {
|
|
168
|
-
DataTypeHandlerFactory.register(AttestationTypes.Information
|
|
189
|
+
DataTypeHandlerFactory.register(`${AttestationContexts.ContextRoot}${AttestationTypes.Information}`, () => ({
|
|
190
|
+
context: AttestationContexts.ContextRoot,
|
|
169
191
|
type: AttestationTypes.Information,
|
|
170
192
|
defaultValue: {},
|
|
171
193
|
jsonSchema: async () => AttestationInformationSchema
|
|
172
194
|
}));
|
|
173
|
-
DataTypeHandlerFactory.register(AttestationTypes.JwtProof
|
|
195
|
+
DataTypeHandlerFactory.register(`${AttestationContexts.ContextRoot}${AttestationTypes.JwtProof}`, () => ({
|
|
196
|
+
context: AttestationContexts.ContextRoot,
|
|
174
197
|
type: AttestationTypes.JwtProof,
|
|
175
198
|
defaultValue: {},
|
|
176
199
|
jsonSchema: async () => AttestationJwtProofSchema
|
|
@@ -186,4 +209,4 @@ class AttestationDataTypes {
|
|
|
186
209
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
187
210
|
const AttestationConnectorFactory = Factory.createFactory("attestation");
|
|
188
211
|
|
|
189
|
-
export { AttestationConnectorFactory, AttestationDataTypes, AttestationTypes };
|
|
212
|
+
export { AttestationConnectorFactory, AttestationContexts, AttestationDataTypes, AttestationTypes };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./models/api/IAttestationDestroyRequest";
|
|
|
5
5
|
export * from "./models/api/IAttestationGetRequest";
|
|
6
6
|
export * from "./models/api/IAttestationGetResponse";
|
|
7
7
|
export * from "./models/api/IAttestationTransferRequest";
|
|
8
|
+
export * from "./models/attestationContexts";
|
|
8
9
|
export * from "./models/attestationTypes";
|
|
9
10
|
export * from "./models/IAttestationComponent";
|
|
10
11
|
export * from "./models/IAttestationConnector";
|
|
@@ -7,14 +7,13 @@ import type { IAttestationInformation } from "./IAttestationInformation";
|
|
|
7
7
|
export interface IAttestationComponent extends IComponent {
|
|
8
8
|
/**
|
|
9
9
|
* Attest the data and return the collated information.
|
|
10
|
-
* @param verificationMethodId The identity verification method to use for attesting the data.
|
|
11
10
|
* @param attestationObject The data to attest.
|
|
12
11
|
* @param namespace The namespace of the connector to use for the attestation, defaults to component configured namespace.
|
|
13
12
|
* @param identity The identity to perform the attestation operation with.
|
|
14
13
|
* @param nodeIdentity The node identity to include in the attestation.
|
|
15
14
|
* @returns The id of the attestation.
|
|
16
15
|
*/
|
|
17
|
-
create(
|
|
16
|
+
create(attestationObject: IJsonLdNodeObject, namespace?: string, identity?: string, nodeIdentity?: string): Promise<string>;
|
|
18
17
|
/**
|
|
19
18
|
* Resolve and verify the attestation id.
|
|
20
19
|
* @param id The attestation id to verify.
|
|
@@ -25,10 +24,11 @@ export interface IAttestationComponent extends IComponent {
|
|
|
25
24
|
* Transfer the attestation to a new holder.
|
|
26
25
|
* @param attestationId The attestation to transfer.
|
|
27
26
|
* @param holderIdentity The identity to transfer the attestation to.
|
|
27
|
+
* @param holderAddress The address to transfer the attestation to.
|
|
28
28
|
* @param identity The identity to perform the attestation operation with.
|
|
29
29
|
* @returns Nothing.
|
|
30
30
|
*/
|
|
31
|
-
transfer(attestationId: string, holderIdentity: string, identity?: string): Promise<void>;
|
|
31
|
+
transfer(attestationId: string, holderIdentity: string, holderAddress: string, identity?: string): Promise<void>;
|
|
32
32
|
/**
|
|
33
33
|
* Destroy the attestation.
|
|
34
34
|
* @param attestationId The attestation to transfer.
|
|
@@ -8,12 +8,11 @@ export interface IAttestationConnector extends IComponent {
|
|
|
8
8
|
/**
|
|
9
9
|
* Attest the data and return the collated information.
|
|
10
10
|
* @param controller The controller identity of the user to access the vault keys.
|
|
11
|
-
* @param address The controller address for the attestation.
|
|
12
11
|
* @param verificationMethodId The identity verification method to use for attesting the data.
|
|
13
12
|
* @param attestationObject The data to attest.
|
|
14
13
|
* @returns The collated attestation data.
|
|
15
14
|
*/
|
|
16
|
-
create(controller: string,
|
|
15
|
+
create(controller: string, verificationMethodId: string, attestationObject: IJsonLdNodeObject): Promise<string>;
|
|
17
16
|
/**
|
|
18
17
|
* Resolve and verify the attestation id.
|
|
19
18
|
* @param id The attestation id to verify.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
1
|
+
import type { IJsonLdContextDefinitionElement, IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { SchemaOrgContexts } from "@twin.org/standards-schema-org";
|
|
3
|
+
import type { AttestationContexts } from "./attestationContexts";
|
|
2
4
|
import type { AttestationTypes } from "./attestationTypes";
|
|
3
5
|
/**
|
|
4
6
|
* Interface describing the collated attestation information.
|
|
@@ -7,7 +9,12 @@ export interface IAttestationInformation {
|
|
|
7
9
|
/**
|
|
8
10
|
* JSON-LD Context.
|
|
9
11
|
*/
|
|
10
|
-
"@context":
|
|
12
|
+
"@context": [
|
|
13
|
+
typeof AttestationContexts.ContextRoot,
|
|
14
|
+
typeof AttestationContexts.ContextRootCommon,
|
|
15
|
+
typeof SchemaOrgContexts.ContextRoot,
|
|
16
|
+
...IJsonLdContextDefinitionElement[]
|
|
17
|
+
];
|
|
11
18
|
/**
|
|
12
19
|
* JSON-LD Type.
|
|
13
20
|
*/
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { IJsonLdContextDefinitionElement } from "@twin.org/data-json-ld";
|
|
2
|
+
import type { AttestationContexts } from "./attestationContexts";
|
|
1
3
|
import type { AttestationTypes } from "./attestationTypes";
|
|
2
4
|
/**
|
|
3
5
|
* Interface describing an attestation proof.
|
|
@@ -6,7 +8,7 @@ export interface IAttestationJwtProof {
|
|
|
6
8
|
/**
|
|
7
9
|
* JSON-LD Context.
|
|
8
10
|
*/
|
|
9
|
-
"@context": typeof
|
|
11
|
+
"@context": typeof AttestationContexts.ContextRoot | [typeof AttestationContexts.ContextRoot, ...IJsonLdContextDefinitionElement[]];
|
|
10
12
|
/**
|
|
11
13
|
* The type of the proof.
|
|
12
14
|
*/
|
|
@@ -7,7 +7,7 @@ export interface IAttestationTransferRequest {
|
|
|
7
7
|
*/
|
|
8
8
|
pathParams: {
|
|
9
9
|
/**
|
|
10
|
-
* The attestation id to
|
|
10
|
+
* The attestation id to transfer.
|
|
11
11
|
*/
|
|
12
12
|
id: string;
|
|
13
13
|
};
|
|
@@ -19,5 +19,9 @@ export interface IAttestationTransferRequest {
|
|
|
19
19
|
* The new holder identity.
|
|
20
20
|
*/
|
|
21
21
|
holderIdentity: string;
|
|
22
|
+
/**
|
|
23
|
+
* The new holder address.
|
|
24
|
+
*/
|
|
25
|
+
holderAddress: string;
|
|
22
26
|
};
|
|
23
27
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The contexts of attestation data.
|
|
3
|
+
*/
|
|
4
|
+
export declare const AttestationContexts: {
|
|
5
|
+
/**
|
|
6
|
+
* The context root for the attestation types.
|
|
7
|
+
*/
|
|
8
|
+
readonly ContextRoot: "https://schema.twindev.org/attestation/";
|
|
9
|
+
/**
|
|
10
|
+
* The context root for the common types.
|
|
11
|
+
*/
|
|
12
|
+
readonly ContextRootCommon: "https://schema.twindev.org/common/";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The contexts of attestation data.
|
|
16
|
+
*/
|
|
17
|
+
export type AttestationContexts = (typeof AttestationContexts)[keyof typeof AttestationContexts];
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# @twin.org/attestation-models - Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.0.1 (2025-07-09)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* release to production ([aa69a08](https://github.com/twinfoundation/attestation/commit/aa69a08fbd3897c8d72b0d32ec730f104ad31b33))
|
|
9
|
+
* release to production ([89ca987](https://github.com/twinfoundation/attestation/commit/89ca987963d9090abcfc1b62bc997e2c521944ec))
|
|
10
|
+
|
|
11
|
+
## [0.0.1-next.30](https://github.com/twinfoundation/attestation/compare/attestation-models-v0.0.1-next.29...attestation-models-v0.0.1-next.30) (2025-06-12)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* update dependencies ([1d96d2e](https://github.com/twinfoundation/attestation/commit/1d96d2ee6e81a30396980f6f5e16e9658710d32d))
|
|
17
|
+
|
|
18
|
+
## [0.0.1-next.29](https://github.com/twinfoundation/attestation/compare/attestation-models-v0.0.1-next.28...attestation-models-v0.0.1-next.29) (2025-06-03)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* update ts-to-schema generation ([0f23298](https://github.com/twinfoundation/attestation/commit/0f23298f6e8accb19c0faaf74220cce02155b48a))
|
|
24
|
+
|
|
25
|
+
## [0.0.1-next.28](https://github.com/twinfoundation/attestation/compare/attestation-models-v0.0.1-next.27...attestation-models-v0.0.1-next.28) (2025-05-28)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* update data type registration with fully qualified names ([5982245](https://github.com/twinfoundation/attestation/commit/59822454a027a9c6dfa72ffa9aabb9622b925929))
|
|
31
|
+
|
|
32
|
+
## [0.0.1-next.27](https://github.com/twinfoundation/attestation/compare/attestation-models-v0.0.1-next.26...attestation-models-v0.0.1-next.27) (2025-05-06)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Miscellaneous Chores
|
|
36
|
+
|
|
37
|
+
* **attestation-models:** Synchronize repo versions
|
|
38
|
+
|
|
39
|
+
## [0.0.1-next.26](https://github.com/twinfoundation/attestation/compare/attestation-models-v0.0.1-next.25...attestation-models-v0.0.1-next.26) (2025-04-17)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
|
|
44
|
+
* use shared store mechanism ([#5](https://github.com/twinfoundation/attestation/issues/5)) ([3768cf7](https://github.com/twinfoundation/attestation/commit/3768cf7214d30a5429b7b08190539b517d7fafa0))
|
|
45
|
+
|
|
46
|
+
## [0.0.1-next.25](https://github.com/twinfoundation/attestation/compare/attestation-models-v0.0.1-next.24...attestation-models-v0.0.1-next.25) (2025-03-28)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Miscellaneous Chores
|
|
50
|
+
|
|
51
|
+
* **attestation-models:** Synchronize repo versions
|
|
52
|
+
|
|
53
|
+
## v0.0.1-next.24
|
|
4
54
|
|
|
5
55
|
- Initial Release
|
|
@@ -4,13 +4,13 @@ Handle all the data types for attestation.
|
|
|
4
4
|
|
|
5
5
|
## Constructors
|
|
6
6
|
|
|
7
|
-
###
|
|
7
|
+
### Constructor
|
|
8
8
|
|
|
9
|
-
> **new AttestationDataTypes**():
|
|
9
|
+
> **new AttestationDataTypes**(): `AttestationDataTypes`
|
|
10
10
|
|
|
11
11
|
#### Returns
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`AttestationDataTypes`
|
|
14
14
|
|
|
15
15
|
## Methods
|
|
16
16
|
|
package/docs/reference/index.md
CHANGED
|
@@ -18,9 +18,11 @@
|
|
|
18
18
|
|
|
19
19
|
## Type Aliases
|
|
20
20
|
|
|
21
|
+
- [AttestationContexts](type-aliases/AttestationContexts.md)
|
|
21
22
|
- [AttestationTypes](type-aliases/AttestationTypes.md)
|
|
22
23
|
|
|
23
24
|
## Variables
|
|
24
25
|
|
|
25
26
|
- [AttestationConnectorFactory](variables/AttestationConnectorFactory.md)
|
|
27
|
+
- [AttestationContexts](variables/AttestationContexts.md)
|
|
26
28
|
- [AttestationTypes](variables/AttestationTypes.md)
|
|
@@ -10,29 +10,33 @@ Interface describing an attestation contract.
|
|
|
10
10
|
|
|
11
11
|
### create()
|
|
12
12
|
|
|
13
|
-
> **create**(`
|
|
13
|
+
> **create**(`attestationObject`, `namespace?`, `identity?`, `nodeIdentity?`): `Promise`\<`string`\>
|
|
14
14
|
|
|
15
15
|
Attest the data and return the collated information.
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### attestationObject
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
• **attestationObject**: `IJsonLdNodeObject`
|
|
21
|
+
`IJsonLdNodeObject`
|
|
24
22
|
|
|
25
23
|
The data to attest.
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
##### namespace?
|
|
26
|
+
|
|
27
|
+
`string`
|
|
28
28
|
|
|
29
29
|
The namespace of the connector to use for the attestation, defaults to component configured namespace.
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
##### identity?
|
|
32
|
+
|
|
33
|
+
`string`
|
|
32
34
|
|
|
33
35
|
The identity to perform the attestation operation with.
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
##### nodeIdentity?
|
|
38
|
+
|
|
39
|
+
`string`
|
|
36
40
|
|
|
37
41
|
The node identity to include in the attestation.
|
|
38
42
|
|
|
@@ -52,7 +56,9 @@ Resolve and verify the attestation id.
|
|
|
52
56
|
|
|
53
57
|
#### Parameters
|
|
54
58
|
|
|
55
|
-
|
|
59
|
+
##### id
|
|
60
|
+
|
|
61
|
+
`string`
|
|
56
62
|
|
|
57
63
|
The attestation id to verify.
|
|
58
64
|
|
|
@@ -66,21 +72,33 @@ The verified attestation details.
|
|
|
66
72
|
|
|
67
73
|
### transfer()
|
|
68
74
|
|
|
69
|
-
> **transfer**(`attestationId`, `holderIdentity`, `identity
|
|
75
|
+
> **transfer**(`attestationId`, `holderIdentity`, `holderAddress`, `identity?`): `Promise`\<`void`\>
|
|
70
76
|
|
|
71
77
|
Transfer the attestation to a new holder.
|
|
72
78
|
|
|
73
79
|
#### Parameters
|
|
74
80
|
|
|
75
|
-
|
|
81
|
+
##### attestationId
|
|
82
|
+
|
|
83
|
+
`string`
|
|
76
84
|
|
|
77
85
|
The attestation to transfer.
|
|
78
86
|
|
|
79
|
-
|
|
87
|
+
##### holderIdentity
|
|
88
|
+
|
|
89
|
+
`string`
|
|
80
90
|
|
|
81
91
|
The identity to transfer the attestation to.
|
|
82
92
|
|
|
83
|
-
|
|
93
|
+
##### holderAddress
|
|
94
|
+
|
|
95
|
+
`string`
|
|
96
|
+
|
|
97
|
+
The address to transfer the attestation to.
|
|
98
|
+
|
|
99
|
+
##### identity?
|
|
100
|
+
|
|
101
|
+
`string`
|
|
84
102
|
|
|
85
103
|
The identity to perform the attestation operation with.
|
|
86
104
|
|
|
@@ -94,17 +112,21 @@ Nothing.
|
|
|
94
112
|
|
|
95
113
|
### destroy()
|
|
96
114
|
|
|
97
|
-
> **destroy**(`attestationId`, `identity
|
|
115
|
+
> **destroy**(`attestationId`, `identity?`): `Promise`\<`void`\>
|
|
98
116
|
|
|
99
117
|
Destroy the attestation.
|
|
100
118
|
|
|
101
119
|
#### Parameters
|
|
102
120
|
|
|
103
|
-
|
|
121
|
+
##### attestationId
|
|
122
|
+
|
|
123
|
+
`string`
|
|
104
124
|
|
|
105
125
|
The attestation to transfer.
|
|
106
126
|
|
|
107
|
-
|
|
127
|
+
##### identity?
|
|
128
|
+
|
|
129
|
+
`string`
|
|
108
130
|
|
|
109
131
|
The identity to perform the attestation operation with.
|
|
110
132
|
|
|
@@ -10,25 +10,27 @@ Interface describing an attestation connector.
|
|
|
10
10
|
|
|
11
11
|
### create()
|
|
12
12
|
|
|
13
|
-
> **create**(`controller`, `
|
|
13
|
+
> **create**(`controller`, `verificationMethodId`, `attestationObject`): `Promise`\<`string`\>
|
|
14
14
|
|
|
15
15
|
Attest the data and return the collated information.
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
##### controller
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
`string`
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
The controller identity of the user to access the vault keys.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
##### verificationMethodId
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
`string`
|
|
28
28
|
|
|
29
29
|
The identity verification method to use for attesting the data.
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
##### attestationObject
|
|
32
|
+
|
|
33
|
+
`IJsonLdNodeObject`
|
|
32
34
|
|
|
33
35
|
The data to attest.
|
|
34
36
|
|
|
@@ -48,7 +50,9 @@ Resolve and verify the attestation id.
|
|
|
48
50
|
|
|
49
51
|
#### Parameters
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
##### id
|
|
54
|
+
|
|
55
|
+
`string`
|
|
52
56
|
|
|
53
57
|
The attestation id to verify.
|
|
54
58
|
|
|
@@ -68,19 +72,27 @@ Transfer the attestation to a new holder.
|
|
|
68
72
|
|
|
69
73
|
#### Parameters
|
|
70
74
|
|
|
71
|
-
|
|
75
|
+
##### controller
|
|
76
|
+
|
|
77
|
+
`string`
|
|
72
78
|
|
|
73
79
|
The controller identity of the user to access the vault keys.
|
|
74
80
|
|
|
75
|
-
|
|
81
|
+
##### attestationId
|
|
82
|
+
|
|
83
|
+
`string`
|
|
76
84
|
|
|
77
85
|
The attestation to transfer.
|
|
78
86
|
|
|
79
|
-
|
|
87
|
+
##### holderIdentity
|
|
88
|
+
|
|
89
|
+
`string`
|
|
80
90
|
|
|
81
91
|
The holder identity of the attestation.
|
|
82
92
|
|
|
83
|
-
|
|
93
|
+
##### holderAddress
|
|
94
|
+
|
|
95
|
+
`string`
|
|
84
96
|
|
|
85
97
|
The new controller address of the attestation belonging to the holder.
|
|
86
98
|
|
|
@@ -100,11 +112,15 @@ Destroy the attestation.
|
|
|
100
112
|
|
|
101
113
|
#### Parameters
|
|
102
114
|
|
|
103
|
-
|
|
115
|
+
##### controller
|
|
116
|
+
|
|
117
|
+
`string`
|
|
104
118
|
|
|
105
119
|
The controller identity of the user to access the vault keys.
|
|
106
120
|
|
|
107
|
-
|
|
121
|
+
##### attestationId
|
|
122
|
+
|
|
123
|
+
`string`
|
|
108
124
|
|
|
109
125
|
The attestation to destroy.
|
|
110
126
|
|
|
@@ -10,12 +10,6 @@ Attest the data and return the id of the attestation.
|
|
|
10
10
|
|
|
11
11
|
The data to be used in the signing.
|
|
12
12
|
|
|
13
|
-
#### verificationMethodId
|
|
14
|
-
|
|
15
|
-
> **verificationMethodId**: `string`
|
|
16
|
-
|
|
17
|
-
The identity verification method to use for attesting the data.
|
|
18
|
-
|
|
19
13
|
#### attestationObject
|
|
20
14
|
|
|
21
15
|
> **attestationObject**: `IJsonLdNodeObject`
|
|
@@ -6,7 +6,7 @@ Interface describing the collated attestation information.
|
|
|
6
6
|
|
|
7
7
|
### @context
|
|
8
8
|
|
|
9
|
-
> **@context**: `"https://schema.twindev.org/attestation/"
|
|
9
|
+
> **@context**: \[`"https://schema.twindev.org/attestation/"`, `"https://schema.twindev.org/common/"`, `"https://schema.org"`, `...IJsonLdContextDefinitionElement[]`\]
|
|
10
10
|
|
|
11
11
|
JSON-LD Context.
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ Interface describing an attestation proof.
|
|
|
6
6
|
|
|
7
7
|
### @context
|
|
8
8
|
|
|
9
|
-
> **@context**: `"https://schema.twindev.org/attestation/"` \| [`"https://schema.twindev.org/attestation/"`, `...
|
|
9
|
+
> **@context**: `"https://schema.twindev.org/attestation/"` \| \[`"https://schema.twindev.org/attestation/"`, `...IJsonLdContextDefinitionElement[]`\]
|
|
10
10
|
|
|
11
11
|
JSON-LD Context.
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ The parameters to be used in the transfer.
|
|
|
14
14
|
|
|
15
15
|
> **id**: `string`
|
|
16
16
|
|
|
17
|
-
The attestation id to
|
|
17
|
+
The attestation id to transfer.
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
@@ -29,3 +29,9 @@ The parameters to be used in the transfer.
|
|
|
29
29
|
> **holderIdentity**: `string`
|
|
30
30
|
|
|
31
31
|
The new holder identity.
|
|
32
|
+
|
|
33
|
+
#### holderAddress
|
|
34
|
+
|
|
35
|
+
> **holderAddress**: `string`
|
|
36
|
+
|
|
37
|
+
The new holder address.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Type Alias: AttestationTypes
|
|
2
2
|
|
|
3
|
-
> **AttestationTypes
|
|
3
|
+
> **AttestationTypes** = *typeof* [`AttestationTypes`](../variables/AttestationTypes.md)\[keyof *typeof* [`AttestationTypes`](../variables/AttestationTypes.md)\]
|
|
4
4
|
|
|
5
5
|
The types of attestation data.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Variable: AttestationContexts
|
|
2
|
+
|
|
3
|
+
> `const` **AttestationContexts**: `object`
|
|
4
|
+
|
|
5
|
+
The contexts of attestation data.
|
|
6
|
+
|
|
7
|
+
## Type declaration
|
|
8
|
+
|
|
9
|
+
### ContextRoot
|
|
10
|
+
|
|
11
|
+
> `readonly` **ContextRoot**: `"https://schema.twindev.org/attestation/"` = `"https://schema.twindev.org/attestation/"`
|
|
12
|
+
|
|
13
|
+
The context root for the attestation types.
|
|
14
|
+
|
|
15
|
+
### ContextRootCommon
|
|
16
|
+
|
|
17
|
+
> `readonly` **ContextRootCommon**: `"https://schema.twindev.org/common/"` = `"https://schema.twindev.org/common/"`
|
|
18
|
+
|
|
19
|
+
The context root for the common types.
|
|
@@ -6,12 +6,6 @@ The types of attestation data.
|
|
|
6
6
|
|
|
7
7
|
## Type declaration
|
|
8
8
|
|
|
9
|
-
### ContextRoot
|
|
10
|
-
|
|
11
|
-
> `readonly` **ContextRoot**: `"https://schema.twindev.org/attestation/"` = `"https://schema.twindev.org/attestation/"`
|
|
12
|
-
|
|
13
|
-
The context root for the attestation types.
|
|
14
|
-
|
|
15
9
|
### Information
|
|
16
10
|
|
|
17
11
|
> `readonly` **Information**: `"Information"` = `"Information"`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/attestation-models",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "Models which define the structure of the attestation connectors and services",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,24 +14,25 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/core": "
|
|
18
|
-
"@twin.org/data-core": "
|
|
19
|
-
"@twin.org/data-json-ld": "
|
|
20
|
-
"@twin.org/entity": "
|
|
21
|
-
"@twin.org/nameof": "
|
|
22
|
-
"@twin.org/standards-
|
|
23
|
-
"@twin.org/
|
|
17
|
+
"@twin.org/core": "^0.0.1",
|
|
18
|
+
"@twin.org/data-core": "^0.0.1",
|
|
19
|
+
"@twin.org/data-json-ld": "^0.0.1",
|
|
20
|
+
"@twin.org/entity": "^0.0.1",
|
|
21
|
+
"@twin.org/nameof": "^0.0.1",
|
|
22
|
+
"@twin.org/standards-schema-org": "^0.0.1",
|
|
23
|
+
"@twin.org/standards-w3c-did": "^0.0.1",
|
|
24
|
+
"@twin.org/web": "^0.0.1"
|
|
24
25
|
},
|
|
25
26
|
"main": "./dist/cjs/index.cjs",
|
|
26
27
|
"module": "./dist/esm/index.mjs",
|
|
27
28
|
"types": "./dist/types/index.d.ts",
|
|
28
29
|
"exports": {
|
|
29
30
|
".": {
|
|
31
|
+
"types": "./dist/types/index.d.ts",
|
|
30
32
|
"require": "./dist/cjs/index.cjs",
|
|
31
|
-
"import": "./dist/esm/index.mjs"
|
|
32
|
-
"types": "./dist/types/index.d.ts"
|
|
33
|
+
"import": "./dist/esm/index.mjs"
|
|
33
34
|
},
|
|
34
|
-
"./locales": "./locales"
|
|
35
|
+
"./locales/*.json": "./locales/*.json"
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
37
38
|
"dist/cjs",
|