@twin.org/immutable-proof-rest-client 0.0.3-next.13 → 0.0.3-next.16

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,7 +1,7 @@
1
1
  // Copyright 2024 IOTA Stiftung.
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
3
  import { BaseRestClient } from "@twin.org/api-core";
4
- import { Guards, NotSupportedError } from "@twin.org/core";
4
+ import { Guards } from "@twin.org/core";
5
5
  import { HeaderTypes, MimeTypes } from "@twin.org/web";
6
6
  /**
7
7
  * Client for performing immutable proof through to REST endpoints.
@@ -28,13 +28,16 @@ export class ImmutableProofRestClient extends BaseRestClient {
28
28
  /**
29
29
  * Create a new proof.
30
30
  * @param document The document to create the proof for.
31
+ * @param options Optional settings for the proof.
32
+ * @param options.deleteLock An ISO 8601 date-time string specifying when the notarization lock expires; if omitted no lock is applied.
31
33
  * @returns The id of the new proof.
32
34
  */
33
- async create(document) {
35
+ async create(document, options) {
34
36
  Guards.object(ImmutableProofRestClient.CLASS_NAME, "document", document);
35
37
  const response = await this.fetch("/", "POST", {
36
38
  body: {
37
- document
39
+ document,
40
+ options
38
41
  }
39
42
  });
40
43
  return response.headers[HeaderTypes.Location];
@@ -76,14 +79,31 @@ export class ImmutableProofRestClient extends BaseRestClient {
76
79
  return response.body;
77
80
  }
78
81
  /**
79
- * Remove the verifiable storage for the proof.
80
- * @param id The id of the proof to remove the storage from.
82
+ * Remove the proof and its notarization.
83
+ * @param id The id of the proof to remove.
81
84
  * @returns Nothing.
82
85
  * @throws NotFoundError if the proof is not found.
83
86
  */
84
- async removeVerifiable(id) {
85
- throw new NotSupportedError(ImmutableProofRestClient.CLASS_NAME, "notSupportedOnClient", {
86
- methodName: "removeVerifiable"
87
+ async remove(id) {
88
+ Guards.stringValue(ImmutableProofRestClient.CLASS_NAME, "id", id);
89
+ await this.fetch("/:id", "DELETE", {
90
+ pathParams: {
91
+ id
92
+ }
93
+ });
94
+ }
95
+ /**
96
+ * Remove only the notarization for the proof, keeping the proof entity.
97
+ * @param id The id of the proof to remove the notarization from.
98
+ * @returns Nothing.
99
+ * @throws NotFoundError if the proof is not found.
100
+ */
101
+ async removeNotarization(id) {
102
+ Guards.stringValue(ImmutableProofRestClient.CLASS_NAME, "id", id);
103
+ await this.fetch("/:id/notarization", "DELETE", {
104
+ pathParams: {
105
+ id
106
+ }
87
107
  });
88
108
  }
89
109
  }
@@ -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\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
+ {"version":3,"file":"immutableProofRestClient.js","sourceRoot":"","sources":["../../src/immutableProofRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMpD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAexC,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;;;;;;OAMG;IACI,KAAK,CAAC,MAAM,CAClB,QAA2B,EAC3B,OAAiC;QAEjC,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;gBACR,OAAO;aACP;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,MAAM,CAAC,EAAU;QAC7B,MAAM,CAAC,WAAW,CAAC,wBAAwB,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAExE,MAAM,IAAI,CAAC,KAAK,CAAmD,MAAM,EAAE,QAAQ,EAAE;YACpF,UAAU,EAAE;gBACX,EAAE;aACF;SACD,CAAC,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,kBAAkB,CAAC,EAAU;QACzC,MAAM,CAAC,WAAW,CAAC,wBAAwB,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAExE,MAAM,IAAI,CAAC,KAAK,CACf,mBAAmB,EACnB,QAAQ,EACR;YACC,UAAU,EAAE;gBACX,EAAE;aACF;SACD,CACD,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type {\n\tIBaseRestClientConfig,\n\tICreatedResponse,\n\tINoContentResponse\n} from \"@twin.org/api-models\";\nimport { Guards } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type {\n\tIImmutableProofComponent,\n\tIImmutableProofCreateRequest,\n\tIImmutableProofCredential,\n\tIImmutableProofGetRequest,\n\tIImmutableProofGetResponse,\n\tIImmutableProofRemoveNotarizationRequest,\n\tIImmutableProofRemoveRequest,\n\tIImmutableProofVerification,\n\tIImmutableProofVerifyRequest,\n\tIImmutableProofVerifyResponse\n} from \"@twin.org/immutable-proof-models\";\nimport { nameof } from \"@twin.org/nameof\";\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 * @param options Optional settings for the proof.\n\t * @param options.deleteLock An ISO 8601 date-time string specifying when the notarization lock expires; if omitted no lock is applied.\n\t * @returns The id of the new proof.\n\t */\n\tpublic async create(\n\t\tdocument: IJsonLdNodeObject,\n\t\toptions?: { deleteLock?: string }\n\t): 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\toptions\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<IImmutableProofCredential> {\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 proof and its notarization.\n\t * @param id The id of the proof to remove.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the proof is not found.\n\t */\n\tpublic async remove(id: string): Promise<void> {\n\t\tGuards.stringValue(ImmutableProofRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tawait this.fetch<IImmutableProofRemoveRequest, INoContentResponse>(\"/:id\", \"DELETE\", {\n\t\t\tpathParams: {\n\t\t\t\tid\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Remove only the notarization for the proof, keeping the proof entity.\n\t * @param id The id of the proof to remove the notarization from.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the proof is not found.\n\t */\n\tpublic async removeNotarization(id: string): Promise<void> {\n\t\tGuards.stringValue(ImmutableProofRestClient.CLASS_NAME, nameof(id), id);\n\n\t\tawait this.fetch<IImmutableProofRemoveNotarizationRequest, INoContentResponse>(\n\t\t\t\"/:id/notarization\",\n\t\t\t\"DELETE\",\n\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\t}\n}\n"]}
@@ -1,8 +1,7 @@
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 { IImmutableProofComponent, IImmutableProofVerification } from "@twin.org/immutable-proof-models";
5
- import type { IDidVerifiableCredential } from "@twin.org/standards-w3c-did";
4
+ import type { IImmutableProofComponent, IImmutableProofCredential, IImmutableProofVerification } from "@twin.org/immutable-proof-models";
6
5
  /**
7
6
  * Client for performing immutable proof through to REST endpoints.
8
7
  */
@@ -24,16 +23,20 @@ export declare class ImmutableProofRestClient extends BaseRestClient implements
24
23
  /**
25
24
  * Create a new proof.
26
25
  * @param document The document to create the proof for.
26
+ * @param options Optional settings for the proof.
27
+ * @param options.deleteLock An ISO 8601 date-time string specifying when the notarization lock expires; if omitted no lock is applied.
27
28
  * @returns The id of the new proof.
28
29
  */
29
- create(document: IJsonLdNodeObject): Promise<string>;
30
+ create(document: IJsonLdNodeObject, options?: {
31
+ deleteLock?: string;
32
+ }): Promise<string>;
30
33
  /**
31
34
  * Get a proof.
32
35
  * @param id The id of the proof to get.
33
36
  * @returns The proof.
34
37
  * @throws NotFoundError if the proof is not found.
35
38
  */
36
- get(id: string): Promise<IDidVerifiableCredential>;
39
+ get(id: string): Promise<IImmutableProofCredential>;
37
40
  /**
38
41
  * Verify a proof.
39
42
  * @param id The id of the proof to verify.
@@ -42,10 +45,17 @@ export declare class ImmutableProofRestClient extends BaseRestClient implements
42
45
  */
43
46
  verify(id: string): Promise<IImmutableProofVerification>;
44
47
  /**
45
- * Remove the verifiable storage for the proof.
46
- * @param id The id of the proof to remove the storage from.
48
+ * Remove the proof and its notarization.
49
+ * @param id The id of the proof to remove.
47
50
  * @returns Nothing.
48
51
  * @throws NotFoundError if the proof is not found.
49
52
  */
50
- removeVerifiable(id: string): Promise<void>;
53
+ remove(id: string): Promise<void>;
54
+ /**
55
+ * Remove only the notarization for the proof, keeping the proof entity.
56
+ * @param id The id of the proof to remove the notarization from.
57
+ * @returns Nothing.
58
+ * @throws NotFoundError if the proof is not found.
59
+ */
60
+ removeNotarization(id: string): Promise<void>;
51
61
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.16](https://github.com/iotaledger/twin-immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.15...immutable-proof-rest-client-v0.0.3-next.16) (2026-05-29)
4
+
5
+
6
+ ### Features
7
+
8
+ * add context id features ([#14](https://github.com/iotaledger/twin-immutable-proof/issues/14)) ([ed5a594](https://github.com/iotaledger/twin-immutable-proof/commit/ed5a594eaa7d50f74b1c09a7a560d48b33a4ecd1))
9
+ * add validate-locales ([d6a7c07](https://github.com/iotaledger/twin-immutable-proof/commit/d6a7c0794a1922981a42f56cc24724d7cee727f6))
10
+ * eslint migration to flat config ([c8536f2](https://github.com/iotaledger/twin-immutable-proof/commit/c8536f219c7709c6c08b9266e537831f9054dda9))
11
+ * immutable proof as vc ([#31](https://github.com/iotaledger/twin-immutable-proof/issues/31)) ([79cdb03](https://github.com/iotaledger/twin-immutable-proof/commit/79cdb03eb86c4f6d2ab1d5bf235f74ff74e8b877))
12
+ * replace verifiable storage with notarization as immutable proof ([#41](https://github.com/iotaledger/twin-immutable-proof/issues/41)) ([54f2154](https://github.com/iotaledger/twin-immutable-proof/commit/54f215469b0bdc9ea94cad572ca13b8533144104))
13
+ * typescript 6 update ([34d8aea](https://github.com/iotaledger/twin-immutable-proof/commit/34d8aea0ea0c1e1252de1882517abb1683d98313))
14
+ * update dependencies ([7d6b321](https://github.com/iotaledger/twin-immutable-proof/commit/7d6b321928ca0434ee530816b1440f1687b94a6e))
15
+ * update framework core ([e708d4d](https://github.com/iotaledger/twin-immutable-proof/commit/e708d4dd3febcfbcd64663d5be004eab1d26c0fb))
16
+ * update remove methods ([#45](https://github.com/iotaledger/twin-immutable-proof/issues/45)) ([9db19bb](https://github.com/iotaledger/twin-immutable-proof/commit/9db19bb4c8e6f5d66139755e8b8a8071a77c4887))
17
+ * use shared store mechanism ([#3](https://github.com/iotaledger/twin-immutable-proof/issues/3)) ([7042a40](https://github.com/iotaledger/twin-immutable-proof/commit/7042a40f0ef8b01463f07aeb1efae4f417162fa1))
18
+
19
+
20
+ ### Dependencies
21
+
22
+ * The following workspace dependencies were updated
23
+ * dependencies
24
+ * @twin.org/immutable-proof-models bumped from 0.0.3-next.15 to 0.0.3-next.16
25
+
26
+ ## [0.0.3-next.15](https://github.com/iotaledger/twin-immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.14...immutable-proof-rest-client-v0.0.3-next.15) (2026-05-29)
27
+
28
+
29
+ ### Features
30
+
31
+ * update remove methods ([#45](https://github.com/iotaledger/twin-immutable-proof/issues/45)) ([9db19bb](https://github.com/iotaledger/twin-immutable-proof/commit/9db19bb4c8e6f5d66139755e8b8a8071a77c4887))
32
+
33
+
34
+ ### Dependencies
35
+
36
+ * The following workspace dependencies were updated
37
+ * dependencies
38
+ * @twin.org/immutable-proof-models bumped from 0.0.3-next.14 to 0.0.3-next.15
39
+
40
+ ## [0.0.3-next.14](https://github.com/iotaledger/twin-immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.13...immutable-proof-rest-client-v0.0.3-next.14) (2026-05-28)
41
+
42
+
43
+ ### Features
44
+
45
+ * replace verifiable storage with notarization as immutable proof ([#41](https://github.com/iotaledger/twin-immutable-proof/issues/41)) ([54f2154](https://github.com/iotaledger/twin-immutable-proof/commit/54f215469b0bdc9ea94cad572ca13b8533144104))
46
+
47
+
48
+ ### Dependencies
49
+
50
+ * The following workspace dependencies were updated
51
+ * dependencies
52
+ * @twin.org/immutable-proof-models bumped from 0.0.3-next.13 to 0.0.3-next.14
53
+
3
54
  ## [0.0.3-next.13](https://github.com/iotaledger/twin-immutable-proof/compare/immutable-proof-rest-client-v0.0.3-next.12...immutable-proof-rest-client-v0.0.3-next.13) (2026-05-20)
4
55
 
5
56
 
@@ -64,7 +64,7 @@ The class name of the component.
64
64
 
65
65
  ### create() {#create}
66
66
 
67
- > **create**(`document`): `Promise`\<`string`\>
67
+ > **create**(`document`, `options?`): `Promise`\<`string`\>
68
68
 
69
69
  Create a new proof.
70
70
 
@@ -76,6 +76,16 @@ Create a new proof.
76
76
 
77
77
  The document to create the proof for.
78
78
 
79
+ ##### options?
80
+
81
+ Optional settings for the proof.
82
+
83
+ ###### deleteLock?
84
+
85
+ `string`
86
+
87
+ An ISO 8601 date-time string specifying when the notarization lock expires; if omitted no lock is applied.
88
+
79
89
  #### Returns
80
90
 
81
91
  `Promise`\<`string`\>
@@ -90,7 +100,7 @@ The id of the new proof.
90
100
 
91
101
  ### get() {#get}
92
102
 
93
- > **get**(`id`): `Promise`\<`IDidVerifiableCredential`\>
103
+ > **get**(`id`): `Promise`\<`IImmutableProofCredential`\>
94
104
 
95
105
  Get a proof.
96
106
 
@@ -104,7 +114,7 @@ The id of the proof to get.
104
114
 
105
115
  #### Returns
106
116
 
107
- `Promise`\<`IDidVerifiableCredential`\>
117
+ `Promise`\<`IImmutableProofCredential`\>
108
118
 
109
119
  The proof.
110
120
 
@@ -148,11 +158,41 @@ NotFoundError if the proof is not found.
148
158
 
149
159
  ***
150
160
 
151
- ### removeVerifiable() {#removeverifiable}
161
+ ### remove() {#remove}
162
+
163
+ > **remove**(`id`): `Promise`\<`void`\>
164
+
165
+ Remove the proof and its notarization.
166
+
167
+ #### Parameters
168
+
169
+ ##### id
170
+
171
+ `string`
172
+
173
+ The id of the proof to remove.
174
+
175
+ #### Returns
176
+
177
+ `Promise`\<`void`\>
178
+
179
+ Nothing.
180
+
181
+ #### Throws
182
+
183
+ NotFoundError if the proof is not found.
184
+
185
+ #### Implementation of
186
+
187
+ `IImmutableProofComponent.remove`
188
+
189
+ ***
190
+
191
+ ### removeNotarization() {#removenotarization}
152
192
 
153
- > **removeVerifiable**(`id`): `Promise`\<`void`\>
193
+ > **removeNotarization**(`id`): `Promise`\<`void`\>
154
194
 
155
- Remove the verifiable storage for the proof.
195
+ Remove only the notarization for the proof, keeping the proof entity.
156
196
 
157
197
  #### Parameters
158
198
 
@@ -160,7 +200,7 @@ Remove the verifiable storage for the proof.
160
200
 
161
201
  `string`
162
202
 
163
- The id of the proof to remove the storage from.
203
+ The id of the proof to remove the notarization from.
164
204
 
165
205
  #### Returns
166
206
 
@@ -174,4 +214,4 @@ NotFoundError if the proof is not found.
174
214
 
175
215
  #### Implementation of
176
216
 
177
- `IImmutableProofComponent.removeVerifiable`
217
+ `IImmutableProofComponent.removeNotarization`
package/locales/en.json CHANGED
@@ -1,7 +1 @@
1
- {
2
- "error": {
3
- "immutableProofRestClient": {
4
- "notSupportedOnClient": "The method \"{methodName}\" is not supported on the REST client, it can only be used on a server side component"
5
- }
6
- }
7
- }
1
+ {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/immutable-proof-rest-client",
3
- "version": "0.0.3-next.13",
3
+ "version": "0.0.3-next.16",
4
4
  "description": "HTTP client for calling immutable proof service endpoints from external components",
5
5
  "repository": {
6
6
  "type": "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.13",
22
+ "@twin.org/immutable-proof-models": "0.0.3-next.16",
23
23
  "@twin.org/nameof": "next",
24
24
  "@twin.org/web": "next"
25
25
  },