@twin.org/immutable-proof-rest-client 0.0.3-next.1 → 0.0.3-next.11
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/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# TWIN Immutable Proof REST Client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This package delivers a dedicated client for immutable proof HTTP endpoints. It provides a simple interface for creating proofs, loading proof credentials, and running verification calls without reimplementing request handling in each consuming project.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"immutableProofRestClient.js","sourceRoot":"","sources":["../../src/immutableProofRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAa3D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEvD;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAAc;IAC3D;;OAEG;IACI,MAAM,CAAU,UAAU,8BAA8C;IAE/E;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,6BAAqC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,wBAAwB,CAAC,UAAU,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,QAA2B;QAC9C,MAAM,CAAC,MAAM,CAAC,wBAAwB,CAAC,UAAU,cAAoB,QAAQ,CAAC,CAAC;QAE/E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAiD,GAAG,EAAE,MAAM,EAAE;YAC9F,IAAI,EAAE;gBACL,QAAQ;aACR;SACD,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CAAC,EAAU;QAC1B,MAAM,CAAC,WAAW,CAAC,wBAAwB,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAExE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,MAAM,EACN,KAAK,EACL;YACC,OAAO,EAAE;gBACR,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM;aACtC;YACD,UAAU,EAAE;gBACX,EAAE;aACF;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,EAAU;QAC7B,MAAM,CAAC,WAAW,CAAC,wBAAwB,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAExE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,aAAa,EACb,KAAK,EACL;YACC,OAAO,EAAE;gBACR,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM;aACtC;YACD,UAAU,EAAE;gBACX,EAAE;aACF;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,gBAAgB,CAAC,EAAU;QACvC,MAAM,IAAI,iBAAiB,CAAC,wBAAwB,CAAC,UAAU,EAAE,sBAAsB,EAAE;YACxF,UAAU,EAAE,kBAAkB;SAC9B,CAAC,CAAC;IACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig, ICreatedResponse } from \"@twin.org/api-models\";\nimport { Guards, NotSupportedError } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type {\n\
|
|
1
|
+
{"version":3,"file":"immutableProofRestClient.js","sourceRoot":"","sources":["../../src/immutableProofRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAa3D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEvD;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,cAAc;IAC3D;;OAEG;IACI,MAAM,CAAU,UAAU,8BAA8C;IAE/E;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,6BAAqC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,wBAAwB,CAAC,UAAU,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAAC,QAA2B;QAC9C,MAAM,CAAC,MAAM,CAAC,wBAAwB,CAAC,UAAU,cAAoB,QAAQ,CAAC,CAAC;QAE/E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAiD,GAAG,EAAE,MAAM,EAAE;YAC9F,IAAI,EAAE;gBACL,QAAQ;aACR;SACD,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CAAC,EAAU;QAC1B,MAAM,CAAC,WAAW,CAAC,wBAAwB,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAExE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,MAAM,EACN,KAAK,EACL;YACC,OAAO,EAAE;gBACR,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM;aACtC;YACD,UAAU,EAAE;gBACX,EAAE;aACF;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,EAAU;QAC7B,MAAM,CAAC,WAAW,CAAC,wBAAwB,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAExE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAChC,aAAa,EACb,KAAK,EACL;YACC,OAAO,EAAE;gBACR,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM;aACtC;YACD,UAAU,EAAE;gBACX,EAAE;aACF;SACD,CACD,CAAC;QAEF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,gBAAgB,CAAC,EAAU;QACvC,MAAM,IAAI,iBAAiB,CAAC,wBAAwB,CAAC,UAAU,EAAE,sBAAsB,EAAE;YACxF,UAAU,EAAE,kBAAkB;SAC9B,CAAC,CAAC;IACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig, ICreatedResponse } from \"@twin.org/api-models\";\nimport { Guards, NotSupportedError } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type {\n\tIImmutableProofComponent,\n\tIImmutableProofCreateRequest,\n\tIImmutableProofGetRequest,\n\tIImmutableProofGetResponse,\n\tIImmutableProofVerification,\n\tIImmutableProofVerifyRequest,\n\tIImmutableProofVerifyResponse\n} from \"@twin.org/immutable-proof-models\";\nimport { nameof } from \"@twin.org/nameof\";\nimport type { IDidVerifiableCredential } from \"@twin.org/standards-w3c-did\";\nimport { HeaderTypes, MimeTypes } from \"@twin.org/web\";\n\n/**\n * Client for performing immutable proof through to REST endpoints.\n */\nexport class ImmutableProofRestClient extends BaseRestClient implements IImmutableProofComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<ImmutableProofRestClient>();\n\n\t/**\n\t * Create a new instance of ImmutableProofRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(nameof<ImmutableProofRestClient>(), config, \"immutable-proof\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn ImmutableProofRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a new proof.\n\t * @param document The document to create the proof for.\n\t * @returns The id of the new proof.\n\t */\n\tpublic async create(document: IJsonLdNodeObject): Promise<string> {\n\t\tGuards.object(ImmutableProofRestClient.CLASS_NAME, nameof(document), document);\n\n\t\tconst response = await this.fetch<IImmutableProofCreateRequest, ICreatedResponse>(\"/\", \"POST\", {\n\t\t\tbody: {\n\t\t\t\tdocument\n\t\t\t}\n\t\t});\n\n\t\treturn response.headers[HeaderTypes.Location];\n\t}\n\n\t/**\n\t * Get a proof.\n\t * @param id The id of the proof to get.\n\t * @returns The proof.\n\t * @throws NotFoundError if the proof is not found.\n\t */\n\tpublic async get(id: string): Promise<IDidVerifiableCredential> {\n\t\tGuards.stringValue(ImmutableProofRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst response = await this.fetch<IImmutableProofGetRequest, IImmutableProofGetResponse>(\n\t\t\t\"/:id\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t\t},\n\t\t\t\tpathParams: {\n\t\t\t\t\tid\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Verify a proof.\n\t * @param id The id of the proof to verify.\n\t * @returns The result of the verification and any failures.\n\t * @throws NotFoundError if the proof is not found.\n\t */\n\tpublic async verify(id: string): Promise<IImmutableProofVerification> {\n\t\tGuards.stringValue(ImmutableProofRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tconst response = await this.fetch<IImmutableProofVerifyRequest, IImmutableProofVerifyResponse>(\n\t\t\t\"/:id/verify\",\n\t\t\t\"GET\",\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\t[HeaderTypes.Accept]: MimeTypes.JsonLd\n\t\t\t\t},\n\t\t\t\tpathParams: {\n\t\t\t\t\tid\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn response.body;\n\t}\n\n\t/**\n\t * Remove the verifiable storage for the proof.\n\t * @param id The id of the proof to remove the storage from.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the proof is not found.\n\t */\n\tpublic async removeVerifiable(id: string): Promise<void> {\n\t\tthrow new NotSupportedError(ImmutableProofRestClient.CLASS_NAME, \"notSupportedOnClient\", {\n\t\t\tmethodName: \"removeVerifiable\"\n\t\t});\n\t}\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BaseRestClient } from "@twin.org/api-core";
|
|
2
2
|
import type { IBaseRestClientConfig } from "@twin.org/api-models";
|
|
3
3
|
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
4
|
-
import type {
|
|
4
|
+
import type { IImmutableProofComponent, IImmutableProofVerification } from "@twin.org/immutable-proof-models";
|
|
5
|
+
import type { IDidVerifiableCredential } from "@twin.org/standards-w3c-did";
|
|
5
6
|
/**
|
|
6
7
|
* Client for performing immutable proof through to REST endpoints.
|
|
7
8
|
*/
|
|
@@ -32,7 +33,7 @@ export declare class ImmutableProofRestClient extends BaseRestClient implements
|
|
|
32
33
|
* @returns The proof.
|
|
33
34
|
* @throws NotFoundError if the proof is not found.
|
|
34
35
|
*/
|
|
35
|
-
get(id: string): Promise<
|
|
36
|
+
get(id: string): Promise<IDidVerifiableCredential>;
|
|
36
37
|
/**
|
|
37
38
|
* Verify a proof.
|
|
38
39
|
* @param id The id of the proof to verify.
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,144 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-next.11](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.10...immutable-proof-rest-client-v0.0.3-next.11) (2026-03-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **immutable-proof-rest-client:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/immutable-proof-models bumped from 0.0.3-next.10 to 0.0.3-next.11
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.10](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.9...immutable-proof-rest-client-v0.0.3-next.10) (2026-02-25)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* **immutable-proof-rest-client:** Synchronize repo versions
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/immutable-proof-models bumped from 0.0.3-next.9 to 0.0.3-next.10
|
|
30
|
+
|
|
31
|
+
## [0.0.3-next.9](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.8...immutable-proof-rest-client-v0.0.3-next.9) (2026-02-13)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Miscellaneous Chores
|
|
35
|
+
|
|
36
|
+
* **immutable-proof-rest-client:** Synchronize repo versions
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Dependencies
|
|
40
|
+
|
|
41
|
+
* The following workspace dependencies were updated
|
|
42
|
+
* dependencies
|
|
43
|
+
* @twin.org/immutable-proof-models bumped from 0.0.3-next.8 to 0.0.3-next.9
|
|
44
|
+
|
|
45
|
+
## [0.0.3-next.8](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.7...immutable-proof-rest-client-v0.0.3-next.8) (2026-02-10)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
* immutable proof as vc ([#31](https://github.com/twinfoundation/immutable-proof/issues/31)) ([79cdb03](https://github.com/twinfoundation/immutable-proof/commit/79cdb03eb86c4f6d2ab1d5bf235f74ff74e8b877))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Dependencies
|
|
54
|
+
|
|
55
|
+
* The following workspace dependencies were updated
|
|
56
|
+
* dependencies
|
|
57
|
+
* @twin.org/immutable-proof-models bumped from 0.0.3-next.7 to 0.0.3-next.8
|
|
58
|
+
|
|
59
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.6...immutable-proof-rest-client-v0.0.3-next.7) (2026-02-05)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Miscellaneous Chores
|
|
63
|
+
|
|
64
|
+
* **immutable-proof-rest-client:** Synchronize repo versions
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Dependencies
|
|
68
|
+
|
|
69
|
+
* The following workspace dependencies were updated
|
|
70
|
+
* dependencies
|
|
71
|
+
* @twin.org/immutable-proof-models bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
72
|
+
|
|
73
|
+
## [0.0.3-next.6](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.5...immutable-proof-rest-client-v0.0.3-next.6) (2026-01-21)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Miscellaneous Chores
|
|
77
|
+
|
|
78
|
+
* **immutable-proof-rest-client:** Synchronize repo versions
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Dependencies
|
|
82
|
+
|
|
83
|
+
* The following workspace dependencies were updated
|
|
84
|
+
* dependencies
|
|
85
|
+
* @twin.org/immutable-proof-models bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
86
|
+
|
|
87
|
+
## [0.0.3-next.5](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.4...immutable-proof-rest-client-v0.0.3-next.5) (2026-01-14)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Miscellaneous Chores
|
|
91
|
+
|
|
92
|
+
* **immutable-proof-rest-client:** Synchronize repo versions
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
### Dependencies
|
|
96
|
+
|
|
97
|
+
* The following workspace dependencies were updated
|
|
98
|
+
* dependencies
|
|
99
|
+
* @twin.org/immutable-proof-models bumped from 0.0.3-next.4 to 0.0.3-next.5
|
|
100
|
+
|
|
101
|
+
## [0.0.3-next.4](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.3...immutable-proof-rest-client-v0.0.3-next.4) (2026-01-07)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Miscellaneous Chores
|
|
105
|
+
|
|
106
|
+
* **immutable-proof-rest-client:** Synchronize repo versions
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### Dependencies
|
|
110
|
+
|
|
111
|
+
* The following workspace dependencies were updated
|
|
112
|
+
* dependencies
|
|
113
|
+
* @twin.org/immutable-proof-models bumped from 0.0.3-next.3 to 0.0.3-next.4
|
|
114
|
+
|
|
115
|
+
## [0.0.3-next.3](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.2...immutable-proof-rest-client-v0.0.3-next.3) (2025-11-28)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
### Miscellaneous Chores
|
|
119
|
+
|
|
120
|
+
* **immutable-proof-rest-client:** Synchronize repo versions
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
### Dependencies
|
|
124
|
+
|
|
125
|
+
* The following workspace dependencies were updated
|
|
126
|
+
* dependencies
|
|
127
|
+
* @twin.org/immutable-proof-models bumped from 0.0.3-next.2 to 0.0.3-next.3
|
|
128
|
+
|
|
129
|
+
## [0.0.3-next.2](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.1...immutable-proof-rest-client-v0.0.3-next.2) (2025-11-28)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### Miscellaneous Chores
|
|
133
|
+
|
|
134
|
+
* **immutable-proof-rest-client:** Synchronize repo versions
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
### Dependencies
|
|
138
|
+
|
|
139
|
+
* The following workspace dependencies were updated
|
|
140
|
+
* dependencies
|
|
141
|
+
* @twin.org/immutable-proof-models bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
2
142
|
|
|
3
143
|
## [0.0.3-next.1](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.0...immutable-proof-rest-client-v0.0.3-next.1) (2025-11-12)
|
|
4
144
|
|
package/docs/examples.md
CHANGED
|
@@ -1 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Immutable Proof REST Client Examples
|
|
2
|
+
|
|
3
|
+
Use these snippets to connect to an API, create and retrieve proofs, and validate proofs through REST endpoints.
|
|
4
|
+
|
|
5
|
+
## ImmutableProofRestClient
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { ImmutableProofRestClient } from '@twin.org/immutable-proof-rest-client';
|
|
9
|
+
|
|
10
|
+
const client = new ImmutableProofRestClient({
|
|
11
|
+
endpoint: 'http://localhost:8080'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
console.log(client.className()); // ImmutableProofRestClient
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { ImmutableProofRestClient } from '@twin.org/immutable-proof-rest-client';
|
|
19
|
+
|
|
20
|
+
const client = new ImmutableProofRestClient({
|
|
21
|
+
endpoint: 'http://localhost:8080'
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const proofId = await client.create({
|
|
25
|
+
'@context': 'https://schema.org',
|
|
26
|
+
type: 'Person',
|
|
27
|
+
name: 'Alice Example'
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
console.log(proofId); // immutable-proof:01JABCDEF1234567890
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { ImmutableProofRestClient } from '@twin.org/immutable-proof-rest-client';
|
|
35
|
+
|
|
36
|
+
const client = new ImmutableProofRestClient({
|
|
37
|
+
endpoint: 'http://localhost:8080'
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const proof = await client.get('immutable-proof:01JABCDEF1234567890');
|
|
41
|
+
const verification = await client.verify('immutable-proof:01JABCDEF1234567890');
|
|
42
|
+
|
|
43
|
+
console.log(proof.id); // immutable-proof:01JABCDEF1234567890
|
|
44
|
+
console.log(verification.verified); // true
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import { ImmutableProofRestClient } from '@twin.org/immutable-proof-rest-client';
|
|
49
|
+
|
|
50
|
+
const client = new ImmutableProofRestClient({
|
|
51
|
+
endpoint: 'http://localhost:8080'
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
try {
|
|
55
|
+
await client.removeVerifiable('immutable-proof:01JABCDEF1234567890');
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.log(error instanceof Error); // true
|
|
58
|
+
}
|
|
59
|
+
```
|
|
@@ -36,7 +36,7 @@ The configuration for the client.
|
|
|
36
36
|
|
|
37
37
|
## Properties
|
|
38
38
|
|
|
39
|
-
### CLASS\_NAME
|
|
39
|
+
### CLASS\_NAME {#class_name}
|
|
40
40
|
|
|
41
41
|
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
42
|
|
|
@@ -44,7 +44,7 @@ Runtime name for the class.
|
|
|
44
44
|
|
|
45
45
|
## Methods
|
|
46
46
|
|
|
47
|
-
### className()
|
|
47
|
+
### className() {#classname}
|
|
48
48
|
|
|
49
49
|
> **className**(): `string`
|
|
50
50
|
|
|
@@ -62,7 +62,7 @@ The class name of the component.
|
|
|
62
62
|
|
|
63
63
|
***
|
|
64
64
|
|
|
65
|
-
### create()
|
|
65
|
+
### create() {#create}
|
|
66
66
|
|
|
67
67
|
> **create**(`document`): `Promise`\<`string`\>
|
|
68
68
|
|
|
@@ -88,9 +88,9 @@ The id of the new proof.
|
|
|
88
88
|
|
|
89
89
|
***
|
|
90
90
|
|
|
91
|
-
### get()
|
|
91
|
+
### get() {#get}
|
|
92
92
|
|
|
93
|
-
> **get**(`id`): `Promise`\<`
|
|
93
|
+
> **get**(`id`): `Promise`\<`IDidVerifiableCredential`\>
|
|
94
94
|
|
|
95
95
|
Get a proof.
|
|
96
96
|
|
|
@@ -104,7 +104,7 @@ The id of the proof to get.
|
|
|
104
104
|
|
|
105
105
|
#### Returns
|
|
106
106
|
|
|
107
|
-
`Promise`\<`
|
|
107
|
+
`Promise`\<`IDidVerifiableCredential`\>
|
|
108
108
|
|
|
109
109
|
The proof.
|
|
110
110
|
|
|
@@ -118,7 +118,7 @@ NotFoundError if the proof is not found.
|
|
|
118
118
|
|
|
119
119
|
***
|
|
120
120
|
|
|
121
|
-
### verify()
|
|
121
|
+
### verify() {#verify}
|
|
122
122
|
|
|
123
123
|
> **verify**(`id`): `Promise`\<`IImmutableProofVerification`\>
|
|
124
124
|
|
|
@@ -148,7 +148,7 @@ NotFoundError if the proof is not found.
|
|
|
148
148
|
|
|
149
149
|
***
|
|
150
150
|
|
|
151
|
-
### removeVerifiable()
|
|
151
|
+
### removeVerifiable() {#removeverifiable}
|
|
152
152
|
|
|
153
153
|
> **removeVerifiable**(`id`): `Promise`\<`void`\>
|
|
154
154
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/immutable-proof-rest-client",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.11",
|
|
4
|
+
"description": "HTTP client for calling immutable proof service endpoints from external components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/immutable-proof.git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/data-json-ld": "next",
|
|
21
21
|
"@twin.org/entity": "next",
|
|
22
|
-
"@twin.org/immutable-proof-models": "0.0.3-next.
|
|
22
|
+
"@twin.org/immutable-proof-models": "0.0.3-next.11",
|
|
23
23
|
"@twin.org/nameof": "next",
|
|
24
24
|
"@twin.org/web": "next"
|
|
25
25
|
},
|