@twin.org/immutable-proof-rest-client 0.0.2-next.3 → 0.0.3-next.10

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.
@@ -1,13 +1,12 @@
1
- import { BaseRestClient } from '@twin.org/api-core';
2
- import { Guards, NotSupportedError } from '@twin.org/core';
3
- import { HeaderTypes, MimeTypes } from '@twin.org/web';
4
-
5
1
  // Copyright 2024 IOTA Stiftung.
6
2
  // SPDX-License-Identifier: Apache-2.0.
3
+ import { BaseRestClient } from "@twin.org/api-core";
4
+ import { Guards, NotSupportedError } from "@twin.org/core";
5
+ import { HeaderTypes, MimeTypes } from "@twin.org/web";
7
6
  /**
8
7
  * Client for performing immutable proof through to REST endpoints.
9
8
  */
10
- class ImmutableProofRestClient extends BaseRestClient {
9
+ export class ImmutableProofRestClient extends BaseRestClient {
11
10
  /**
12
11
  * Runtime name for the class.
13
12
  */
@@ -19,6 +18,13 @@ class ImmutableProofRestClient extends BaseRestClient {
19
18
  constructor(config) {
20
19
  super("ImmutableProofRestClient", config, "immutable-proof");
21
20
  }
21
+ /**
22
+ * Returns the class name of the component.
23
+ * @returns The class name of the component.
24
+ */
25
+ className() {
26
+ return ImmutableProofRestClient.CLASS_NAME;
27
+ }
22
28
  /**
23
29
  * Create a new proof.
24
30
  * @param document The document to create the proof for.
@@ -81,5 +87,4 @@ class ImmutableProofRestClient extends BaseRestClient {
81
87
  });
82
88
  }
83
89
  }
84
-
85
- export { ImmutableProofRestClient };
90
+ //# sourceMappingURL=immutableProofRestClient.js.map
@@ -0,0 +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\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"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./immutableProofRestClient.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,+BAA+B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./immutableProofRestClient.js\";\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 { IImmutableProof, IImmutableProofComponent, IImmutableProofVerification } from "@twin.org/immutable-proof-models";
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
  */
@@ -15,6 +16,11 @@ export declare class ImmutableProofRestClient extends BaseRestClient implements
15
16
  * @param config The configuration for the client.
16
17
  */
17
18
  constructor(config: IBaseRestClientConfig);
19
+ /**
20
+ * Returns the class name of the component.
21
+ * @returns The class name of the component.
22
+ */
23
+ className(): string;
18
24
  /**
19
25
  * Create a new proof.
20
26
  * @param document The document to create the proof for.
@@ -27,7 +33,7 @@ export declare class ImmutableProofRestClient extends BaseRestClient implements
27
33
  * @returns The proof.
28
34
  * @throws NotFoundError if the proof is not found.
29
35
  */
30
- get(id: string): Promise<IImmutableProof>;
36
+ get(id: string): Promise<IDidVerifiableCredential>;
31
37
  /**
32
38
  * Verify a proof.
33
39
  * @param id The id of the proof to verify.
@@ -1 +1 @@
1
- export * from "./immutableProofRestClient";
1
+ export * from "./immutableProofRestClient.js";
package/docs/changelog.md CHANGED
@@ -1,5 +1,150 @@
1
1
  # @twin.org/immutable-proof-rest-client - Changelog
2
2
 
3
+ ## [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)
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.9 to 0.0.3-next.10
16
+
17
+ ## [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)
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.8 to 0.0.3-next.9
30
+
31
+ ## [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)
32
+
33
+
34
+ ### Features
35
+
36
+ * immutable proof as vc ([#31](https://github.com/twinfoundation/immutable-proof/issues/31)) ([79cdb03](https://github.com/twinfoundation/immutable-proof/commit/79cdb03eb86c4f6d2ab1d5bf235f74ff74e8b877))
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.7 to 0.0.3-next.8
44
+
45
+ ## [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)
46
+
47
+
48
+ ### Miscellaneous Chores
49
+
50
+ * **immutable-proof-rest-client:** Synchronize repo versions
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.6 to 0.0.3-next.7
58
+
59
+ ## [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)
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.5 to 0.0.3-next.6
72
+
73
+ ## [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)
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.4 to 0.0.3-next.5
86
+
87
+ ## [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)
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.3 to 0.0.3-next.4
100
+
101
+ ## [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)
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.2 to 0.0.3-next.3
114
+
115
+ ## [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)
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.1 to 0.0.3-next.2
128
+
129
+ ## [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)
130
+
131
+
132
+ ### Features
133
+
134
+ * add context id features ([#14](https://github.com/twinfoundation/immutable-proof/issues/14)) ([ed5a594](https://github.com/twinfoundation/immutable-proof/commit/ed5a594eaa7d50f74b1c09a7a560d48b33a4ecd1))
135
+ * add validate-locales ([d6a7c07](https://github.com/twinfoundation/immutable-proof/commit/d6a7c0794a1922981a42f56cc24724d7cee727f6))
136
+ * eslint migration to flat config ([c8536f2](https://github.com/twinfoundation/immutable-proof/commit/c8536f219c7709c6c08b9266e537831f9054dda9))
137
+ * update dependencies ([7d6b321](https://github.com/twinfoundation/immutable-proof/commit/7d6b321928ca0434ee530816b1440f1687b94a6e))
138
+ * update framework core ([e708d4d](https://github.com/twinfoundation/immutable-proof/commit/e708d4dd3febcfbcd64663d5be004eab1d26c0fb))
139
+ * use shared store mechanism ([#3](https://github.com/twinfoundation/immutable-proof/issues/3)) ([7042a40](https://github.com/twinfoundation/immutable-proof/commit/7042a40f0ef8b01463f07aeb1efae4f417162fa1))
140
+
141
+
142
+ ### Dependencies
143
+
144
+ * The following workspace dependencies were updated
145
+ * dependencies
146
+ * @twin.org/immutable-proof-models bumped from 0.0.3-next.0 to 0.0.3-next.1
147
+
3
148
  ## [0.0.2-next.3](https://github.com/twinfoundation/immutable-proof/compare/immutable-proof-rest-client-v0.0.2-next.2...immutable-proof-rest-client-v0.0.2-next.3) (2025-10-09)
4
149
 
5
150
 
@@ -44,6 +44,24 @@ Runtime name for the class.
44
44
 
45
45
  ## Methods
46
46
 
47
+ ### className()
48
+
49
+ > **className**(): `string`
50
+
51
+ Returns the class name of the component.
52
+
53
+ #### Returns
54
+
55
+ `string`
56
+
57
+ The class name of the component.
58
+
59
+ #### Implementation of
60
+
61
+ `IImmutableProofComponent.className`
62
+
63
+ ***
64
+
47
65
  ### create()
48
66
 
49
67
  > **create**(`document`): `Promise`\<`string`\>
@@ -72,7 +90,7 @@ The id of the new proof.
72
90
 
73
91
  ### get()
74
92
 
75
- > **get**(`id`): `Promise`\<`IImmutableProof`\>
93
+ > **get**(`id`): `Promise`\<`IDidVerifiableCredential`\>
76
94
 
77
95
  Get a proof.
78
96
 
@@ -86,7 +104,7 @@ The id of the proof to get.
86
104
 
87
105
  #### Returns
88
106
 
89
- `Promise`\<`IImmutableProof`\>
107
+ `Promise`\<`IDidVerifiableCredential`\>
90
108
 
91
109
  The proof.
92
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/immutable-proof-rest-client",
3
- "version": "0.0.2-next.3",
3
+ "version": "0.0.3-next.10",
4
4
  "description": "Immutable Proof contract implementation which can connect to REST endpoints",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,24 +19,22 @@
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.2-next.3",
22
+ "@twin.org/immutable-proof-models": "0.0.3-next.10",
23
23
  "@twin.org/nameof": "next",
24
24
  "@twin.org/web": "next"
25
25
  },
26
- "main": "./dist/cjs/index.cjs",
27
- "module": "./dist/esm/index.mjs",
26
+ "main": "./dist/es/index.js",
28
27
  "types": "./dist/types/index.d.ts",
29
28
  "exports": {
30
29
  ".": {
31
30
  "types": "./dist/types/index.d.ts",
32
- "require": "./dist/cjs/index.cjs",
33
- "import": "./dist/esm/index.mjs"
31
+ "import": "./dist/es/index.js",
32
+ "default": "./dist/es/index.js"
34
33
  },
35
34
  "./locales/*.json": "./locales/*.json"
36
35
  },
37
36
  "files": [
38
- "dist/cjs",
39
- "dist/esm",
37
+ "dist/es",
40
38
  "dist/types",
41
39
  "locales",
42
40
  "docs"
@@ -1,87 +0,0 @@
1
- 'use strict';
2
-
3
- var apiCore = require('@twin.org/api-core');
4
- var core = require('@twin.org/core');
5
- var web = require('@twin.org/web');
6
-
7
- // Copyright 2024 IOTA Stiftung.
8
- // SPDX-License-Identifier: Apache-2.0.
9
- /**
10
- * Client for performing immutable proof through to REST endpoints.
11
- */
12
- class ImmutableProofRestClient extends apiCore.BaseRestClient {
13
- /**
14
- * Runtime name for the class.
15
- */
16
- static CLASS_NAME = "ImmutableProofRestClient";
17
- /**
18
- * Create a new instance of ImmutableProofRestClient.
19
- * @param config The configuration for the client.
20
- */
21
- constructor(config) {
22
- super("ImmutableProofRestClient", config, "immutable-proof");
23
- }
24
- /**
25
- * Create a new proof.
26
- * @param document The document to create the proof for.
27
- * @returns The id of the new proof.
28
- */
29
- async create(document) {
30
- core.Guards.object(ImmutableProofRestClient.CLASS_NAME, "document", document);
31
- const response = await this.fetch("/", "POST", {
32
- body: {
33
- document
34
- }
35
- });
36
- return response.headers[web.HeaderTypes.Location];
37
- }
38
- /**
39
- * Get a proof.
40
- * @param id The id of the proof to get.
41
- * @returns The proof.
42
- * @throws NotFoundError if the proof is not found.
43
- */
44
- async get(id) {
45
- core.Guards.stringValue(ImmutableProofRestClient.CLASS_NAME, "id", id);
46
- const response = await this.fetch("/:id", "GET", {
47
- headers: {
48
- [web.HeaderTypes.Accept]: web.MimeTypes.JsonLd
49
- },
50
- pathParams: {
51
- id
52
- }
53
- });
54
- return response.body;
55
- }
56
- /**
57
- * Verify a proof.
58
- * @param id The id of the proof to verify.
59
- * @returns The result of the verification and any failures.
60
- * @throws NotFoundError if the proof is not found.
61
- */
62
- async verify(id) {
63
- core.Guards.stringValue(ImmutableProofRestClient.CLASS_NAME, "id", id);
64
- const response = await this.fetch("/:id/verify", "GET", {
65
- headers: {
66
- [web.HeaderTypes.Accept]: web.MimeTypes.JsonLd
67
- },
68
- pathParams: {
69
- id
70
- }
71
- });
72
- return response.body;
73
- }
74
- /**
75
- * Remove the verifiable storage for the proof.
76
- * @param id The id of the proof to remove the storage from.
77
- * @returns Nothing.
78
- * @throws NotFoundError if the proof is not found.
79
- */
80
- async removeVerifiable(id) {
81
- throw new core.NotSupportedError(ImmutableProofRestClient.CLASS_NAME, "notSupportedOnClient", {
82
- methodName: "removeVerifiable"
83
- });
84
- }
85
- }
86
-
87
- exports.ImmutableProofRestClient = ImmutableProofRestClient;