@twin.org/immutable-proof-service 0.0.1-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.
@@ -0,0 +1,69 @@
1
+ # Class: ImmutableProof
2
+
3
+ Class describing the immutable proof.
4
+
5
+ ## Constructors
6
+
7
+ ### new ImmutableProof()
8
+
9
+ > **new ImmutableProof**(): [`ImmutableProof`](ImmutableProof.md)
10
+
11
+ #### Returns
12
+
13
+ [`ImmutableProof`](ImmutableProof.md)
14
+
15
+ ## Properties
16
+
17
+ ### id
18
+
19
+ > **id**: `string`
20
+
21
+ The id of the proof.
22
+
23
+ ***
24
+
25
+ ### nodeIdentity
26
+
27
+ > **nodeIdentity**: `string`
28
+
29
+ The identity of the node which controls the proof.
30
+
31
+ ***
32
+
33
+ ### userIdentity
34
+
35
+ > **userIdentity**: `string`
36
+
37
+ The identity of the user which created the proof.
38
+
39
+ ***
40
+
41
+ ### dateCreated
42
+
43
+ > **dateCreated**: `string`
44
+
45
+ The date/time of when the proof was created.
46
+
47
+ ***
48
+
49
+ ### proofObjectId?
50
+
51
+ > `optional` **proofObjectId**: `string`
52
+
53
+ The associated id for the item.
54
+
55
+ ***
56
+
57
+ ### proofObjectHash
58
+
59
+ > **proofObjectHash**: `string`
60
+
61
+ The associated hash for the item.
62
+
63
+ ***
64
+
65
+ ### immutableStorageId?
66
+
67
+ > `optional` **immutableStorageId**: `string`
68
+
69
+ The immutable storage id.
@@ -0,0 +1,197 @@
1
+ # Class: ImmutableProofService
2
+
3
+ Class for performing immutable proof operations.
4
+
5
+ ## Implements
6
+
7
+ - `IImmutableProofComponent`
8
+
9
+ ## Constructors
10
+
11
+ ### new ImmutableProofService()
12
+
13
+ > **new ImmutableProofService**(`options`?): [`ImmutableProofService`](ImmutableProofService.md)
14
+
15
+ Create a new instance of ImmutableProofService.
16
+
17
+ #### Parameters
18
+
19
+ • **options?**
20
+
21
+ The dependencies for the immutable proof connector.
22
+
23
+ • **options.vaultConnectorType?**: `string`
24
+
25
+ The vault connector type, defaults to "vault".
26
+
27
+ • **options.immutableProofEntityStorageType?**: `string`
28
+
29
+ The entity storage for proofs, defaults to "immutable-proof".
30
+
31
+ • **options.immutableStorageType?**: `string`
32
+
33
+ The immutable storage, defaults to "immutable-proof".
34
+
35
+ • **options.config?**: [`IImmutableProofServiceConfig`](../interfaces/IImmutableProofServiceConfig.md)
36
+
37
+ The configuration for the connector.
38
+
39
+ • **options.identityConnectorType?**: `string`
40
+
41
+ The identity connector type, defaults to "identity".
42
+
43
+ #### Returns
44
+
45
+ [`ImmutableProofService`](ImmutableProofService.md)
46
+
47
+ ## Properties
48
+
49
+ ### NAMESPACE
50
+
51
+ > `readonly` `static` **NAMESPACE**: `string` = `"immutable-proof"`
52
+
53
+ The namespace for the service.
54
+
55
+ ***
56
+
57
+ ### CLASS\_NAME
58
+
59
+ > `readonly` **CLASS\_NAME**: `string`
60
+
61
+ Runtime name for the class.
62
+
63
+ #### Implementation of
64
+
65
+ `IImmutableProofComponent.CLASS_NAME`
66
+
67
+ ## Methods
68
+
69
+ ### create()
70
+
71
+ > **create**(`proofObject`, `userIdentity`?, `nodeIdentity`?): `Promise`\<`string`\>
72
+
73
+ Create a new authentication proof.
74
+
75
+ #### Parameters
76
+
77
+ • **proofObject**: `IJsonLdNodeObject`
78
+
79
+ The object for the proof as JSON-LD.
80
+
81
+ • **userIdentity?**: `string`
82
+
83
+ The identity to create the immutable proof operation with.
84
+
85
+ • **nodeIdentity?**: `string`
86
+
87
+ The node identity to use for vault operations.
88
+
89
+ #### Returns
90
+
91
+ `Promise`\<`string`\>
92
+
93
+ The id of the new authentication proof.
94
+
95
+ #### Implementation of
96
+
97
+ `IImmutableProofComponent.create`
98
+
99
+ ***
100
+
101
+ ### get()
102
+
103
+ > **get**(`id`): `Promise`\<`IImmutableProof`\>
104
+
105
+ Get an authentication proof.
106
+
107
+ #### Parameters
108
+
109
+ • **id**: `string`
110
+
111
+ The id of the proof to get.
112
+
113
+ #### Returns
114
+
115
+ `Promise`\<`IImmutableProof`\>
116
+
117
+ The proof.
118
+
119
+ #### Throws
120
+
121
+ NotFoundError if the proof is not found.
122
+
123
+ #### Implementation of
124
+
125
+ `IImmutableProofComponent.get`
126
+
127
+ ***
128
+
129
+ ### verify()
130
+
131
+ > **verify**(`id`, `proofObject`): `Promise`\<`object`\>
132
+
133
+ Verify an authentication proof.
134
+
135
+ #### Parameters
136
+
137
+ • **id**: `string`
138
+
139
+ The id of the proof to verify.
140
+
141
+ • **proofObject**: `IJsonLdNodeObject`
142
+
143
+ The object to verify as JSON-LD.
144
+
145
+ #### Returns
146
+
147
+ `Promise`\<`object`\>
148
+
149
+ The result of the verification and any failures.
150
+
151
+ ##### verified
152
+
153
+ > **verified**: `boolean`
154
+
155
+ ##### failure?
156
+
157
+ > `optional` **failure**: `ImmutableProofFailure`
158
+
159
+ #### Throws
160
+
161
+ NotFoundError if the proof is not found.
162
+
163
+ #### Implementation of
164
+
165
+ `IImmutableProofComponent.verify`
166
+
167
+ ***
168
+
169
+ ### removeImmutable()
170
+
171
+ > **removeImmutable**(`id`, `nodeIdentity`?): `Promise`\<`void`\>
172
+
173
+ Remove the immutable storage for the proof.
174
+
175
+ #### Parameters
176
+
177
+ • **id**: `string`
178
+
179
+ The id of the proof to remove the storage from.
180
+
181
+ • **nodeIdentity?**: `string`
182
+
183
+ The node identity to use for vault operations.
184
+
185
+ #### Returns
186
+
187
+ `Promise`\<`void`\>
188
+
189
+ Nothing.
190
+
191
+ #### Throws
192
+
193
+ NotFoundError if the proof is not found.
194
+
195
+ #### Implementation of
196
+
197
+ `IImmutableProofComponent.removeImmutable`
@@ -0,0 +1,21 @@
1
+ # Function: generateRestRoutesImmutableProof()
2
+
3
+ > **generateRestRoutesImmutableProof**(`baseRouteName`, `componentName`): `IRestRoute`[]
4
+
5
+ The REST routes for immutable proof.
6
+
7
+ ## Parameters
8
+
9
+ • **baseRouteName**: `string`
10
+
11
+ Prefix to prepend to the paths.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes stored in the ComponentFactory.
16
+
17
+ ## Returns
18
+
19
+ `IRestRoute`[]
20
+
21
+ The generated routes.
@@ -0,0 +1,25 @@
1
+ # Function: immutableProofCreate()
2
+
3
+ > **immutableProofCreate**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`ICreatedResponse`\>
4
+
5
+ Create a proof.
6
+
7
+ ## Parameters
8
+
9
+ • **httpRequestContext**: `IHttpRequestContext`
10
+
11
+ The request context for the API.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes.
16
+
17
+ • **request**: `IImmutableProofCreateRequest`
18
+
19
+ The request.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`ICreatedResponse`\>
24
+
25
+ The response object with additional http response properties.
@@ -0,0 +1,25 @@
1
+ # Function: immutableProofGet()
2
+
3
+ > **immutableProofGet**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IImmutableProofGetResponse`\>
4
+
5
+ Get the proof.
6
+
7
+ ## Parameters
8
+
9
+ • **httpRequestContext**: `IHttpRequestContext`
10
+
11
+ The request context for the API.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes.
16
+
17
+ • **request**: `IImmutableProofGetRequest`
18
+
19
+ The request.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`IImmutableProofGetResponse`\>
24
+
25
+ The response object with additional http response properties.
@@ -0,0 +1,25 @@
1
+ # Function: immutableProofVerify()
2
+
3
+ > **immutableProofVerify**(`httpRequestContext`, `componentName`, `request`): `Promise`\<`IImmutableProofVerifyResponse`\>
4
+
5
+ Verify the proof.
6
+
7
+ ## Parameters
8
+
9
+ • **httpRequestContext**: `IHttpRequestContext`
10
+
11
+ The request context for the API.
12
+
13
+ • **componentName**: `string`
14
+
15
+ The name of the component to use in the routes.
16
+
17
+ • **request**: `IImmutableProofVerifyRequest`
18
+
19
+ The request.
20
+
21
+ ## Returns
22
+
23
+ `Promise`\<`IImmutableProofVerifyResponse`\>
24
+
25
+ The response object with additional http response properties.
@@ -0,0 +1,9 @@
1
+ # Function: initSchema()
2
+
3
+ > **initSchema**(): `void`
4
+
5
+ Initialize the schema for the immutable proof entity storage connector.
6
+
7
+ ## Returns
8
+
9
+ `void`
@@ -0,0 +1,23 @@
1
+ # @twin.org/immutable-proof-service
2
+
3
+ ## Classes
4
+
5
+ - [ImmutableProof](classes/ImmutableProof.md)
6
+ - [ImmutableProofService](classes/ImmutableProofService.md)
7
+
8
+ ## Interfaces
9
+
10
+ - [IImmutableProofServiceConfig](interfaces/IImmutableProofServiceConfig.md)
11
+
12
+ ## Variables
13
+
14
+ - [tagsImmutableProof](variables/tagsImmutableProof.md)
15
+ - [restEntryPoints](variables/restEntryPoints.md)
16
+
17
+ ## Functions
18
+
19
+ - [generateRestRoutesImmutableProof](functions/generateRestRoutesImmutableProof.md)
20
+ - [immutableProofCreate](functions/immutableProofCreate.md)
21
+ - [immutableProofGet](functions/immutableProofGet.md)
22
+ - [immutableProofVerify](functions/immutableProofVerify.md)
23
+ - [initSchema](functions/initSchema.md)
@@ -0,0 +1,31 @@
1
+ # Interface: IImmutableProofServiceConfig
2
+
3
+ Configuration for the immutable proof service.
4
+
5
+ ## Properties
6
+
7
+ ### assertionMethodId?
8
+
9
+ > `optional` **assertionMethodId**: `string`
10
+
11
+ The assertion method id to use for the stream.
12
+
13
+ #### Default
14
+
15
+ ```ts
16
+ immutable-proof
17
+ ```
18
+
19
+ ***
20
+
21
+ ### proofConfigKeyId?
22
+
23
+ > `optional` **proofConfigKeyId**: `string`
24
+
25
+ The key to use in the proof config.
26
+
27
+ #### Default
28
+
29
+ ```ts
30
+ immutable-proof
31
+ ```
@@ -0,0 +1,3 @@
1
+ # Variable: restEntryPoints
2
+
3
+ > `const` **restEntryPoints**: `IRestRouteEntryPoint`[]
@@ -0,0 +1,5 @@
1
+ # Variable: tagsImmutableProof
2
+
3
+ > `const` **tagsImmutableProof**: `ITag`[]
4
+
5
+ The tag to associate with the routes.
@@ -0,0 +1,12 @@
1
+ {
2
+ "error": {
3
+ "immutableProofService": {
4
+ "namespaceMismatch": "The namespace in the urn \"{id}\" does not match the namespace of the Immutable Proof service \"{namespace}\"",
5
+ "createFailed": "Creating the proof failed",
6
+ "getFailed": "Getting the proof failed",
7
+ "verifyFailed": "Verifying the proof failed",
8
+ "removeImmutableFailed": "Removing immutable entry from the Immutable Proof failed",
9
+ "proofNotFound": "The proof with the Id \"{notFoundId}\" was not found"
10
+ }
11
+ }
12
+ }
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@twin.org/immutable-proof-service",
3
+ "version": "0.0.1-next.1",
4
+ "description": "Immutable proof contract implementation and REST endpoint definitions",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/twinfoundation/immutable-proof.git",
8
+ "directory": "packages/immutable-proof-service"
9
+ },
10
+ "author": "martyn.janes@iota.org",
11
+ "license": "Apache-2.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=20.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@twin.org/api-models": "next",
18
+ "@twin.org/core": "next",
19
+ "@twin.org/crypto": "next",
20
+ "@twin.org/data-json-ld": "next",
21
+ "@twin.org/data-schema-org": "next",
22
+ "@twin.org/entity": "next",
23
+ "@twin.org/entity-storage-models": "next",
24
+ "@twin.org/identity-models": "next",
25
+ "@twin.org/immutable-proof-models": "0.0.1-next.1",
26
+ "@twin.org/immutable-storage-models": "next",
27
+ "@twin.org/nameof": "next",
28
+ "@twin.org/standards-w3c-did": "next",
29
+ "@twin.org/vault-models": "next",
30
+ "@twin.org/web": "next",
31
+ "jsonschema": "1.4.1"
32
+ },
33
+ "main": "./dist/cjs/index.cjs",
34
+ "module": "./dist/esm/index.mjs",
35
+ "types": "./dist/types/index.d.ts",
36
+ "exports": {
37
+ ".": {
38
+ "require": "./dist/cjs/index.cjs",
39
+ "import": "./dist/esm/index.mjs",
40
+ "types": "./dist/types/index.d.ts"
41
+ },
42
+ "./locales": "./locales"
43
+ },
44
+ "files": [
45
+ "dist/cjs",
46
+ "dist/esm",
47
+ "dist/types",
48
+ "locales",
49
+ "docs"
50
+ ]
51
+ }