@twin.org/attestation-models 0.0.1-next.7 → 0.0.1-next.8
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 +180 -0
- package/dist/esm/index.mjs +179 -1
- package/dist/types/dataTypes/attestationDataTypes.d.ts +9 -0
- package/dist/types/index.d.ts +8 -8
- package/dist/types/models/IAttestationComponent.d.ts +8 -12
- package/dist/types/models/IAttestationConnector.d.ts +6 -10
- package/dist/types/models/IAttestationInformation.d.ts +25 -9
- package/dist/types/models/IAttestationJwtProof.d.ts +18 -0
- package/dist/types/models/api/{IAttestationAttestRequest.d.ts → IAttestationCreateRequest.d.ts} +3 -3
- package/dist/types/models/api/IAttestationGetRequest.d.ts +21 -0
- package/dist/types/models/api/IAttestationGetResponse.d.ts +17 -0
- package/dist/types/models/attestationTypes.d.ts +21 -0
- package/docs/changelog.md +1 -1
- package/docs/reference/classes/AttestationDataTypes.md +25 -0
- package/docs/reference/index.md +13 -6
- package/docs/reference/interfaces/IAttestationComponent.md +13 -37
- package/docs/reference/interfaces/IAttestationConnector.md +11 -35
- package/docs/reference/interfaces/{IAttestationAttestRequest.md → IAttestationCreateRequest.md} +4 -4
- package/docs/reference/interfaces/IAttestationGetRequest.md +29 -0
- package/docs/reference/interfaces/IAttestationGetResponse.md +23 -0
- package/docs/reference/interfaces/IAttestationInformation.md +44 -16
- package/docs/reference/interfaces/IAttestationJwtProof.md +27 -0
- package/docs/reference/type-aliases/AttestationTypes.md +5 -0
- package/docs/reference/variables/AttestationTypes.md +25 -0
- package/package.json +4 -2
- package/dist/types/models/IAttestationProof.d.ts +0 -13
- package/dist/types/models/api/IAttestationAttestResponse.d.ts +0 -15
- package/dist/types/models/api/IAttestationTransferResponse.d.ts +0 -15
- package/dist/types/models/api/IAttestationVerifyRequest.d.ts +0 -14
- package/dist/types/models/api/IAttestationVerifyResponse.d.ts +0 -23
- package/docs/reference/interfaces/IAttestationAttestResponse.md +0 -17
- package/docs/reference/interfaces/IAttestationProof.md +0 -19
- package/docs/reference/interfaces/IAttestationTransferResponse.md +0 -17
- package/docs/reference/interfaces/IAttestationVerifyRequest.md +0 -17
- package/docs/reference/interfaces/IAttestationVerifyResponse.md +0 -29
package/dist/cjs/index.cjs
CHANGED
@@ -1,7 +1,185 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
+
var dataCore = require('@twin.org/data-core');
|
3
4
|
var core = require('@twin.org/core');
|
4
5
|
|
6
|
+
// Copyright 2024 IOTA Stiftung.
|
7
|
+
// SPDX-License-Identifier: Apache-2.0.
|
8
|
+
/**
|
9
|
+
* The types of attestation data.
|
10
|
+
*/
|
11
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
12
|
+
const AttestationTypes = {
|
13
|
+
/**
|
14
|
+
* The context root for the attestation types.
|
15
|
+
*/
|
16
|
+
ContextRoot: "https://schema.twindev.org/attestation/",
|
17
|
+
/**
|
18
|
+
* Represents attestation information.
|
19
|
+
*/
|
20
|
+
Information: "Information",
|
21
|
+
/**
|
22
|
+
* Represents attestation JWT proof.
|
23
|
+
*/
|
24
|
+
JwtProof: "JwtProof"
|
25
|
+
};
|
26
|
+
|
27
|
+
var type$1 = "object";
|
28
|
+
var properties$1 = {
|
29
|
+
"@context": {
|
30
|
+
anyOf: [
|
31
|
+
{
|
32
|
+
type: "string",
|
33
|
+
"const": "https://schema.twindev.org/attestation/"
|
34
|
+
},
|
35
|
+
{
|
36
|
+
type: "array",
|
37
|
+
minItems: 1,
|
38
|
+
items: [
|
39
|
+
{
|
40
|
+
type: "string",
|
41
|
+
"const": "https://schema.twindev.org/attestation/"
|
42
|
+
}
|
43
|
+
],
|
44
|
+
additionalItems: {
|
45
|
+
type: "string"
|
46
|
+
}
|
47
|
+
}
|
48
|
+
],
|
49
|
+
description: "JSON-LD Context."
|
50
|
+
},
|
51
|
+
type: {
|
52
|
+
type: "string",
|
53
|
+
"const": "Information",
|
54
|
+
description: "JSON-LD Type."
|
55
|
+
},
|
56
|
+
id: {
|
57
|
+
type: "string",
|
58
|
+
description: "The unique identifier of the attestation."
|
59
|
+
},
|
60
|
+
dateCreated: {
|
61
|
+
type: "string",
|
62
|
+
description: "Created date/time of the attestation in ISO format."
|
63
|
+
},
|
64
|
+
dateTransferred: {
|
65
|
+
type: "string",
|
66
|
+
description: "Transferred date/time of the attestation in ISO format, can be blank if holder identity is owner."
|
67
|
+
},
|
68
|
+
ownerIdentity: {
|
69
|
+
type: "string",
|
70
|
+
description: "The identity of the owner."
|
71
|
+
},
|
72
|
+
holderIdentity: {
|
73
|
+
type: "string",
|
74
|
+
description: "The identity of the current holder, can be undefined if owner is still the holder."
|
75
|
+
},
|
76
|
+
attestationObject: {
|
77
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
|
78
|
+
description: "The data that was attested."
|
79
|
+
},
|
80
|
+
proof: {
|
81
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
|
82
|
+
description: "The proof for the attested data."
|
83
|
+
},
|
84
|
+
verified: {
|
85
|
+
type: "boolean",
|
86
|
+
description: "Whether the attestation has been verified."
|
87
|
+
},
|
88
|
+
verificationFailure: {
|
89
|
+
type: "string",
|
90
|
+
description: "The verification failure message."
|
91
|
+
}
|
92
|
+
};
|
93
|
+
var required$1 = [
|
94
|
+
"@context",
|
95
|
+
"type",
|
96
|
+
"id",
|
97
|
+
"dateCreated",
|
98
|
+
"ownerIdentity",
|
99
|
+
"attestationObject"
|
100
|
+
];
|
101
|
+
var additionalProperties$1 = false;
|
102
|
+
var description$1 = "Interface describing the collated attestation information.";
|
103
|
+
var AttestationInformationSchema = {
|
104
|
+
type: type$1,
|
105
|
+
properties: properties$1,
|
106
|
+
required: required$1,
|
107
|
+
additionalProperties: additionalProperties$1,
|
108
|
+
description: description$1
|
109
|
+
};
|
110
|
+
|
111
|
+
var type = "object";
|
112
|
+
var properties = {
|
113
|
+
"@context": {
|
114
|
+
anyOf: [
|
115
|
+
{
|
116
|
+
type: "string",
|
117
|
+
"const": "https://schema.twindev.org/attestation/"
|
118
|
+
},
|
119
|
+
{
|
120
|
+
type: "array",
|
121
|
+
minItems: 1,
|
122
|
+
items: [
|
123
|
+
{
|
124
|
+
type: "string",
|
125
|
+
"const": "https://schema.twindev.org/attestation/"
|
126
|
+
}
|
127
|
+
],
|
128
|
+
additionalItems: {
|
129
|
+
type: "string"
|
130
|
+
}
|
131
|
+
}
|
132
|
+
],
|
133
|
+
description: "JSON-LD Context."
|
134
|
+
},
|
135
|
+
type: {
|
136
|
+
type: "string",
|
137
|
+
"const": "JwtProof",
|
138
|
+
description: "The type of the proof."
|
139
|
+
},
|
140
|
+
value: {
|
141
|
+
type: "string",
|
142
|
+
description: "The value of the proof."
|
143
|
+
}
|
144
|
+
};
|
145
|
+
var required = [
|
146
|
+
"@context",
|
147
|
+
"type",
|
148
|
+
"value"
|
149
|
+
];
|
150
|
+
var additionalProperties = false;
|
151
|
+
var description = "Interface describing an attestation proof.";
|
152
|
+
var AttestationJwtProofSchema = {
|
153
|
+
type: type,
|
154
|
+
properties: properties,
|
155
|
+
required: required,
|
156
|
+
additionalProperties: additionalProperties,
|
157
|
+
description: description
|
158
|
+
};
|
159
|
+
|
160
|
+
// Copyright 2024 IOTA Stiftung.
|
161
|
+
// SPDX-License-Identifier: Apache-2.0.
|
162
|
+
/**
|
163
|
+
* Handle all the data types for attestation.
|
164
|
+
*/
|
165
|
+
class AttestationDataTypes {
|
166
|
+
/**
|
167
|
+
* Register all the data types.
|
168
|
+
*/
|
169
|
+
static registerTypes() {
|
170
|
+
dataCore.DataTypeHandlerFactory.register(AttestationTypes.Information, () => ({
|
171
|
+
type: AttestationTypes.Information,
|
172
|
+
defaultValue: {},
|
173
|
+
jsonSchema: async () => AttestationInformationSchema
|
174
|
+
}));
|
175
|
+
dataCore.DataTypeHandlerFactory.register(AttestationTypes.JwtProof, () => ({
|
176
|
+
type: AttestationTypes.JwtProof,
|
177
|
+
defaultValue: {},
|
178
|
+
jsonSchema: async () => AttestationJwtProofSchema
|
179
|
+
}));
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
5
183
|
// Copyright 2024 IOTA Stiftung.
|
6
184
|
// SPDX-License-Identifier: Apache-2.0.
|
7
185
|
/**
|
@@ -11,3 +189,5 @@ var core = require('@twin.org/core');
|
|
11
189
|
const AttestationConnectorFactory = core.Factory.createFactory("attestation");
|
12
190
|
|
13
191
|
exports.AttestationConnectorFactory = AttestationConnectorFactory;
|
192
|
+
exports.AttestationDataTypes = AttestationDataTypes;
|
193
|
+
exports.AttestationTypes = AttestationTypes;
|
package/dist/esm/index.mjs
CHANGED
@@ -1,5 +1,183 @@
|
|
1
|
+
import { DataTypeHandlerFactory } from '@twin.org/data-core';
|
1
2
|
import { Factory } from '@twin.org/core';
|
2
3
|
|
4
|
+
// Copyright 2024 IOTA Stiftung.
|
5
|
+
// SPDX-License-Identifier: Apache-2.0.
|
6
|
+
/**
|
7
|
+
* The types of attestation data.
|
8
|
+
*/
|
9
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
10
|
+
const AttestationTypes = {
|
11
|
+
/**
|
12
|
+
* The context root for the attestation types.
|
13
|
+
*/
|
14
|
+
ContextRoot: "https://schema.twindev.org/attestation/",
|
15
|
+
/**
|
16
|
+
* Represents attestation information.
|
17
|
+
*/
|
18
|
+
Information: "Information",
|
19
|
+
/**
|
20
|
+
* Represents attestation JWT proof.
|
21
|
+
*/
|
22
|
+
JwtProof: "JwtProof"
|
23
|
+
};
|
24
|
+
|
25
|
+
var type$1 = "object";
|
26
|
+
var properties$1 = {
|
27
|
+
"@context": {
|
28
|
+
anyOf: [
|
29
|
+
{
|
30
|
+
type: "string",
|
31
|
+
"const": "https://schema.twindev.org/attestation/"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
type: "array",
|
35
|
+
minItems: 1,
|
36
|
+
items: [
|
37
|
+
{
|
38
|
+
type: "string",
|
39
|
+
"const": "https://schema.twindev.org/attestation/"
|
40
|
+
}
|
41
|
+
],
|
42
|
+
additionalItems: {
|
43
|
+
type: "string"
|
44
|
+
}
|
45
|
+
}
|
46
|
+
],
|
47
|
+
description: "JSON-LD Context."
|
48
|
+
},
|
49
|
+
type: {
|
50
|
+
type: "string",
|
51
|
+
"const": "Information",
|
52
|
+
description: "JSON-LD Type."
|
53
|
+
},
|
54
|
+
id: {
|
55
|
+
type: "string",
|
56
|
+
description: "The unique identifier of the attestation."
|
57
|
+
},
|
58
|
+
dateCreated: {
|
59
|
+
type: "string",
|
60
|
+
description: "Created date/time of the attestation in ISO format."
|
61
|
+
},
|
62
|
+
dateTransferred: {
|
63
|
+
type: "string",
|
64
|
+
description: "Transferred date/time of the attestation in ISO format, can be blank if holder identity is owner."
|
65
|
+
},
|
66
|
+
ownerIdentity: {
|
67
|
+
type: "string",
|
68
|
+
description: "The identity of the owner."
|
69
|
+
},
|
70
|
+
holderIdentity: {
|
71
|
+
type: "string",
|
72
|
+
description: "The identity of the current holder, can be undefined if owner is still the holder."
|
73
|
+
},
|
74
|
+
attestationObject: {
|
75
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
|
76
|
+
description: "The data that was attested."
|
77
|
+
},
|
78
|
+
proof: {
|
79
|
+
$ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
|
80
|
+
description: "The proof for the attested data."
|
81
|
+
},
|
82
|
+
verified: {
|
83
|
+
type: "boolean",
|
84
|
+
description: "Whether the attestation has been verified."
|
85
|
+
},
|
86
|
+
verificationFailure: {
|
87
|
+
type: "string",
|
88
|
+
description: "The verification failure message."
|
89
|
+
}
|
90
|
+
};
|
91
|
+
var required$1 = [
|
92
|
+
"@context",
|
93
|
+
"type",
|
94
|
+
"id",
|
95
|
+
"dateCreated",
|
96
|
+
"ownerIdentity",
|
97
|
+
"attestationObject"
|
98
|
+
];
|
99
|
+
var additionalProperties$1 = false;
|
100
|
+
var description$1 = "Interface describing the collated attestation information.";
|
101
|
+
var AttestationInformationSchema = {
|
102
|
+
type: type$1,
|
103
|
+
properties: properties$1,
|
104
|
+
required: required$1,
|
105
|
+
additionalProperties: additionalProperties$1,
|
106
|
+
description: description$1
|
107
|
+
};
|
108
|
+
|
109
|
+
var type = "object";
|
110
|
+
var properties = {
|
111
|
+
"@context": {
|
112
|
+
anyOf: [
|
113
|
+
{
|
114
|
+
type: "string",
|
115
|
+
"const": "https://schema.twindev.org/attestation/"
|
116
|
+
},
|
117
|
+
{
|
118
|
+
type: "array",
|
119
|
+
minItems: 1,
|
120
|
+
items: [
|
121
|
+
{
|
122
|
+
type: "string",
|
123
|
+
"const": "https://schema.twindev.org/attestation/"
|
124
|
+
}
|
125
|
+
],
|
126
|
+
additionalItems: {
|
127
|
+
type: "string"
|
128
|
+
}
|
129
|
+
}
|
130
|
+
],
|
131
|
+
description: "JSON-LD Context."
|
132
|
+
},
|
133
|
+
type: {
|
134
|
+
type: "string",
|
135
|
+
"const": "JwtProof",
|
136
|
+
description: "The type of the proof."
|
137
|
+
},
|
138
|
+
value: {
|
139
|
+
type: "string",
|
140
|
+
description: "The value of the proof."
|
141
|
+
}
|
142
|
+
};
|
143
|
+
var required = [
|
144
|
+
"@context",
|
145
|
+
"type",
|
146
|
+
"value"
|
147
|
+
];
|
148
|
+
var additionalProperties = false;
|
149
|
+
var description = "Interface describing an attestation proof.";
|
150
|
+
var AttestationJwtProofSchema = {
|
151
|
+
type: type,
|
152
|
+
properties: properties,
|
153
|
+
required: required,
|
154
|
+
additionalProperties: additionalProperties,
|
155
|
+
description: description
|
156
|
+
};
|
157
|
+
|
158
|
+
// Copyright 2024 IOTA Stiftung.
|
159
|
+
// SPDX-License-Identifier: Apache-2.0.
|
160
|
+
/**
|
161
|
+
* Handle all the data types for attestation.
|
162
|
+
*/
|
163
|
+
class AttestationDataTypes {
|
164
|
+
/**
|
165
|
+
* Register all the data types.
|
166
|
+
*/
|
167
|
+
static registerTypes() {
|
168
|
+
DataTypeHandlerFactory.register(AttestationTypes.Information, () => ({
|
169
|
+
type: AttestationTypes.Information,
|
170
|
+
defaultValue: {},
|
171
|
+
jsonSchema: async () => AttestationInformationSchema
|
172
|
+
}));
|
173
|
+
DataTypeHandlerFactory.register(AttestationTypes.JwtProof, () => ({
|
174
|
+
type: AttestationTypes.JwtProof,
|
175
|
+
defaultValue: {},
|
176
|
+
jsonSchema: async () => AttestationJwtProofSchema
|
177
|
+
}));
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
3
181
|
// Copyright 2024 IOTA Stiftung.
|
4
182
|
// SPDX-License-Identifier: Apache-2.0.
|
5
183
|
/**
|
@@ -8,4 +186,4 @@ import { Factory } from '@twin.org/core';
|
|
8
186
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
9
187
|
const AttestationConnectorFactory = Factory.createFactory("attestation");
|
10
188
|
|
11
|
-
export { AttestationConnectorFactory };
|
189
|
+
export { AttestationConnectorFactory, AttestationDataTypes, AttestationTypes };
|
package/dist/types/index.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
+
export * from "./dataTypes/attestationDataTypes";
|
1
2
|
export * from "./factories/attestationConnectorFactory";
|
3
|
+
export * from "./models/api/IAttestationCreateRequest";
|
4
|
+
export * from "./models/api/IAttestationDestroyRequest";
|
5
|
+
export * from "./models/api/IAttestationGetRequest";
|
6
|
+
export * from "./models/api/IAttestationGetResponse";
|
7
|
+
export * from "./models/api/IAttestationTransferRequest";
|
8
|
+
export * from "./models/attestationTypes";
|
2
9
|
export * from "./models/IAttestationComponent";
|
3
10
|
export * from "./models/IAttestationConnector";
|
4
11
|
export * from "./models/IAttestationInformation";
|
5
|
-
export * from "./models/
|
6
|
-
export * from "./models/api/IAttestationAttestRequest";
|
7
|
-
export * from "./models/api/IAttestationAttestResponse";
|
8
|
-
export * from "./models/api/IAttestationDestroyRequest";
|
9
|
-
export * from "./models/api/IAttestationTransferRequest";
|
10
|
-
export * from "./models/api/IAttestationTransferResponse";
|
11
|
-
export * from "./models/api/IAttestationVerifyRequest";
|
12
|
-
export * from "./models/api/IAttestationVerifyResponse";
|
12
|
+
export * from "./models/IAttestationJwtProof";
|
@@ -8,36 +8,32 @@ export interface IAttestationComponent extends IComponent {
|
|
8
8
|
/**
|
9
9
|
* Attest the data and return the collated information.
|
10
10
|
* @param verificationMethodId The identity verification method to use for attesting the data.
|
11
|
-
* @param
|
11
|
+
* @param attestationObject The data to attest.
|
12
12
|
* @param namespace The namespace of the connector to use for the attestation, defaults to component configured namespace.
|
13
13
|
* @param identity The identity to perform the attestation operation with.
|
14
14
|
* @param nodeIdentity The node identity to include in the attestation.
|
15
|
-
* @returns The
|
15
|
+
* @returns The id of the attestation.
|
16
16
|
*/
|
17
|
-
|
17
|
+
create(verificationMethodId: string, attestationObject: IJsonLdNodeObject, namespace?: string, identity?: string, nodeIdentity?: string): Promise<string>;
|
18
18
|
/**
|
19
19
|
* Resolve and verify the attestation id.
|
20
|
-
* @param
|
20
|
+
* @param id The attestation id to verify.
|
21
21
|
* @returns The verified attestation details.
|
22
22
|
*/
|
23
|
-
|
24
|
-
verified: boolean;
|
25
|
-
failure?: string;
|
26
|
-
information?: Partial<IAttestationInformation<T>>;
|
27
|
-
}>;
|
23
|
+
get(id: string): Promise<IAttestationInformation>;
|
28
24
|
/**
|
29
25
|
* Transfer the attestation to a new holder.
|
30
26
|
* @param attestationId The attestation to transfer.
|
31
27
|
* @param holderIdentity The identity to transfer the attestation to.
|
32
28
|
* @param identity The identity to perform the attestation operation with.
|
33
|
-
* @returns
|
29
|
+
* @returns Nothing.
|
34
30
|
*/
|
35
|
-
transfer
|
31
|
+
transfer(attestationId: string, holderIdentity: string, identity?: string): Promise<void>;
|
36
32
|
/**
|
37
33
|
* Destroy the attestation.
|
38
34
|
* @param attestationId The attestation to transfer.
|
39
35
|
* @param identity The identity to perform the attestation operation with.
|
40
|
-
* @returns
|
36
|
+
* @returns Nothing.
|
41
37
|
*/
|
42
38
|
destroy(attestationId: string, identity?: string): Promise<void>;
|
43
39
|
}
|
@@ -10,29 +10,25 @@ export interface IAttestationConnector extends IComponent {
|
|
10
10
|
* @param controller The controller identity of the user to access the vault keys.
|
11
11
|
* @param address The controller address for the attestation.
|
12
12
|
* @param verificationMethodId The identity verification method to use for attesting the data.
|
13
|
-
* @param
|
13
|
+
* @param attestationObject The data to attest.
|
14
14
|
* @returns The collated attestation data.
|
15
15
|
*/
|
16
|
-
|
16
|
+
create(controller: string, address: string, verificationMethodId: string, attestationObject: IJsonLdNodeObject): Promise<string>;
|
17
17
|
/**
|
18
18
|
* Resolve and verify the attestation id.
|
19
|
-
* @param
|
19
|
+
* @param id The attestation id to verify.
|
20
20
|
* @returns The verified attestation details.
|
21
21
|
*/
|
22
|
-
|
23
|
-
verified: boolean;
|
24
|
-
failure?: string;
|
25
|
-
information?: Partial<IAttestationInformation<T>>;
|
26
|
-
}>;
|
22
|
+
get(id: string): Promise<IAttestationInformation>;
|
27
23
|
/**
|
28
24
|
* Transfer the attestation to a new holder.
|
29
25
|
* @param controller The controller identity of the user to access the vault keys.
|
30
26
|
* @param attestationId The attestation to transfer.
|
31
27
|
* @param holderIdentity The holder identity of the attestation.
|
32
28
|
* @param holderAddress The new controller address of the attestation belonging to the holder.
|
33
|
-
* @returns
|
29
|
+
* @returns Nothing.
|
34
30
|
*/
|
35
|
-
transfer
|
31
|
+
transfer(controller: string, attestationId: string, holderIdentity: string, holderAddress: string): Promise<void>;
|
36
32
|
/**
|
37
33
|
* Destroy the attestation.
|
38
34
|
* @param controller The controller identity of the user to access the vault keys.
|
@@ -1,9 +1,17 @@
|
|
1
1
|
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
2
|
-
import type {
|
2
|
+
import type { AttestationTypes } from "./attestationTypes";
|
3
3
|
/**
|
4
4
|
* Interface describing the collated attestation information.
|
5
5
|
*/
|
6
|
-
export interface IAttestationInformation
|
6
|
+
export interface IAttestationInformation {
|
7
|
+
/**
|
8
|
+
* JSON-LD Context.
|
9
|
+
*/
|
10
|
+
"@context": typeof AttestationTypes.ContextRoot | [typeof AttestationTypes.ContextRoot, ...string[]];
|
11
|
+
/**
|
12
|
+
* JSON-LD Type.
|
13
|
+
*/
|
14
|
+
type: typeof AttestationTypes.Information;
|
7
15
|
/**
|
8
16
|
* The unique identifier of the attestation.
|
9
17
|
*/
|
@@ -11,15 +19,15 @@ export interface IAttestationInformation<T extends IJsonLdNodeObject = IJsonLdNo
|
|
11
19
|
/**
|
12
20
|
* Created date/time of the attestation in ISO format.
|
13
21
|
*/
|
14
|
-
|
22
|
+
dateCreated: string;
|
15
23
|
/**
|
16
|
-
*
|
24
|
+
* Transferred date/time of the attestation in ISO format, can be blank if holder identity is owner.
|
17
25
|
*/
|
18
|
-
|
26
|
+
dateTransferred?: string;
|
19
27
|
/**
|
20
|
-
*
|
28
|
+
* The identity of the owner.
|
21
29
|
*/
|
22
|
-
|
30
|
+
ownerIdentity: string;
|
23
31
|
/**
|
24
32
|
* The identity of the current holder, can be undefined if owner is still the holder.
|
25
33
|
*/
|
@@ -27,9 +35,17 @@ export interface IAttestationInformation<T extends IJsonLdNodeObject = IJsonLdNo
|
|
27
35
|
/**
|
28
36
|
* The data that was attested.
|
29
37
|
*/
|
30
|
-
|
38
|
+
attestationObject: IJsonLdNodeObject;
|
31
39
|
/**
|
32
40
|
* The proof for the attested data.
|
33
41
|
*/
|
34
|
-
proof
|
42
|
+
proof?: IJsonLdNodeObject;
|
43
|
+
/**
|
44
|
+
* Whether the attestation has been verified.
|
45
|
+
*/
|
46
|
+
verified?: boolean;
|
47
|
+
/**
|
48
|
+
* The verification failure message.
|
49
|
+
*/
|
50
|
+
verificationFailure?: string;
|
35
51
|
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import type { AttestationTypes } from "./attestationTypes";
|
2
|
+
/**
|
3
|
+
* Interface describing an attestation proof.
|
4
|
+
*/
|
5
|
+
export interface IAttestationJwtProof {
|
6
|
+
/**
|
7
|
+
* JSON-LD Context.
|
8
|
+
*/
|
9
|
+
"@context": typeof AttestationTypes.ContextRoot | [typeof AttestationTypes.ContextRoot, ...string[]];
|
10
|
+
/**
|
11
|
+
* The type of the proof.
|
12
|
+
*/
|
13
|
+
type: typeof AttestationTypes.JwtProof;
|
14
|
+
/**
|
15
|
+
* The value of the proof.
|
16
|
+
*/
|
17
|
+
value: string;
|
18
|
+
}
|
package/dist/types/models/api/{IAttestationAttestRequest.d.ts → IAttestationCreateRequest.d.ts}
RENAMED
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
2
2
|
/**
|
3
|
-
* Attest the data and return the
|
3
|
+
* Attest the data and return the id of the attestation.
|
4
4
|
*/
|
5
|
-
export interface
|
5
|
+
export interface IAttestationCreateRequest {
|
6
6
|
/**
|
7
7
|
* The data to be used in the signing.
|
8
8
|
*/
|
@@ -14,7 +14,7 @@ export interface IAttestationAttestRequest {
|
|
14
14
|
/**
|
15
15
|
* The data object to attest.
|
16
16
|
*/
|
17
|
-
|
17
|
+
attestationObject: IJsonLdNodeObject;
|
18
18
|
/**
|
19
19
|
* The namespace of the connector to use for the attestation, defaults to component configured namespace.
|
20
20
|
*/
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
2
|
+
/**
|
3
|
+
* Verify that the proof is valid for the attestation.
|
4
|
+
*/
|
5
|
+
export interface IAttestationGetRequest {
|
6
|
+
/**
|
7
|
+
* The headers which can be used to determine the response data type.
|
8
|
+
*/
|
9
|
+
headers?: {
|
10
|
+
[HeaderTypes.Accept]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
|
11
|
+
};
|
12
|
+
/**
|
13
|
+
* The parameters to be used in the verification.
|
14
|
+
*/
|
15
|
+
pathParams: {
|
16
|
+
/**
|
17
|
+
* The attestation id to verify.
|
18
|
+
*/
|
19
|
+
id: string;
|
20
|
+
};
|
21
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import type { HeaderTypes, MimeTypes } from "@twin.org/web";
|
2
|
+
import type { IAttestationInformation } from "../IAttestationInformation";
|
3
|
+
/**
|
4
|
+
* The response to verifying the attestation.
|
5
|
+
*/
|
6
|
+
export interface IAttestationGetResponse {
|
7
|
+
/**
|
8
|
+
* The headers which can be used to determine the response data type.
|
9
|
+
*/
|
10
|
+
headers?: {
|
11
|
+
[HeaderTypes.ContentType]: typeof MimeTypes.Json | typeof MimeTypes.JsonLd;
|
12
|
+
};
|
13
|
+
/**
|
14
|
+
* The data returned from the verification response.
|
15
|
+
*/
|
16
|
+
body: IAttestationInformation;
|
17
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
/**
|
2
|
+
* The types of attestation data.
|
3
|
+
*/
|
4
|
+
export declare const AttestationTypes: {
|
5
|
+
/**
|
6
|
+
* The context root for the attestation types.
|
7
|
+
*/
|
8
|
+
readonly ContextRoot: "https://schema.twindev.org/attestation/";
|
9
|
+
/**
|
10
|
+
* Represents attestation information.
|
11
|
+
*/
|
12
|
+
readonly Information: "Information";
|
13
|
+
/**
|
14
|
+
* Represents attestation JWT proof.
|
15
|
+
*/
|
16
|
+
readonly JwtProof: "JwtProof";
|
17
|
+
};
|
18
|
+
/**
|
19
|
+
* The types of attestation data.
|
20
|
+
*/
|
21
|
+
export type AttestationTypes = (typeof AttestationTypes)[keyof typeof AttestationTypes];
|
package/docs/changelog.md
CHANGED