@twin.org/identity-connector-entity-storage 0.0.1-next.56 → 0.0.1-next.57

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.
@@ -176,6 +176,26 @@ class EntityStorageIdentityConnector {
176
176
  throw new core.GeneralError(this.CLASS_NAME, "createDocumentFailed", undefined, error);
177
177
  }
178
178
  }
179
+ /**
180
+ * Remove a document.
181
+ * @param controller The controller of the identity who can make changes.
182
+ * @param documentId The id of the document to remove.
183
+ * @returns Nothing.
184
+ */
185
+ async removeDocument(controller, documentId) {
186
+ core.Guards.stringValue(this.CLASS_NAME, "controller", controller);
187
+ core.Guards.stringValue(this.CLASS_NAME, "documentId", documentId);
188
+ try {
189
+ const didDocument = await this._didDocumentEntityStorage.get(documentId);
190
+ if (core.Is.empty(didDocument)) {
191
+ throw new core.NotFoundError(this.CLASS_NAME, "documentNotFound", documentId);
192
+ }
193
+ await this._didDocumentEntityStorage.remove(documentId);
194
+ }
195
+ catch (error) {
196
+ throw new core.GeneralError(this.CLASS_NAME, "removeDocumentFailed", undefined, error);
197
+ }
198
+ }
179
199
  /**
180
200
  * Add a verification method to the document in JSON Web key Format.
181
201
  * @param controller The controller of the identity who can make changes.
@@ -174,6 +174,26 @@ class EntityStorageIdentityConnector {
174
174
  throw new GeneralError(this.CLASS_NAME, "createDocumentFailed", undefined, error);
175
175
  }
176
176
  }
177
+ /**
178
+ * Remove a document.
179
+ * @param controller The controller of the identity who can make changes.
180
+ * @param documentId The id of the document to remove.
181
+ * @returns Nothing.
182
+ */
183
+ async removeDocument(controller, documentId) {
184
+ Guards.stringValue(this.CLASS_NAME, "controller", controller);
185
+ Guards.stringValue(this.CLASS_NAME, "documentId", documentId);
186
+ try {
187
+ const didDocument = await this._didDocumentEntityStorage.get(documentId);
188
+ if (Is.empty(didDocument)) {
189
+ throw new NotFoundError(this.CLASS_NAME, "documentNotFound", documentId);
190
+ }
191
+ await this._didDocumentEntityStorage.remove(documentId);
192
+ }
193
+ catch (error) {
194
+ throw new GeneralError(this.CLASS_NAME, "removeDocumentFailed", undefined, error);
195
+ }
196
+ }
177
197
  /**
178
198
  * Add a verification method to the document in JSON Web key Format.
179
199
  * @param controller The controller of the identity who can make changes.
@@ -25,6 +25,13 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
25
25
  * @returns The created document.
26
26
  */
27
27
  createDocument(controller: string): Promise<IDidDocument>;
28
+ /**
29
+ * Remove a document.
30
+ * @param controller The controller of the identity who can make changes.
31
+ * @param documentId The id of the document to remove.
32
+ * @returns Nothing.
33
+ */
34
+ removeDocument(controller: string, documentId: string): Promise<void>;
28
35
  /**
29
36
  * Add a verification method to the document in JSON Web key Format.
30
37
  * @param controller The controller of the identity who can make changes.
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @twin.org/identity-connector-entity-storage- Changelog
2
2
 
3
+ ## [0.0.1-next.57](https://github.com/twinfoundation/identity/compare/identity-connector-entity-storage-v0.0.1-next.56...identity-connector-entity-storage-v0.0.1-next.57) (2025-07-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * add identity remove ([eebc13f](https://github.com/twinfoundation/identity/commit/eebc13f4c2cd994d2d9cce4da2128fb346c80ba7))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/identity-models bumped from 0.0.1-next.56 to 0.0.1-next.57
16
+
3
17
  ## [0.0.1-next.56](https://github.com/twinfoundation/identity/compare/identity-connector-entity-storage-v0.0.1-next.55...identity-connector-entity-storage-v0.0.1-next.56) (2025-06-30)
4
18
 
5
19
 
@@ -74,6 +74,38 @@ The created document.
74
74
 
75
75
  ***
76
76
 
77
+ ### removeDocument()
78
+
79
+ > **removeDocument**(`controller`, `documentId`): `Promise`\<`void`\>
80
+
81
+ Remove a document.
82
+
83
+ #### Parameters
84
+
85
+ ##### controller
86
+
87
+ `string`
88
+
89
+ The controller of the identity who can make changes.
90
+
91
+ ##### documentId
92
+
93
+ `string`
94
+
95
+ The id of the document to remove.
96
+
97
+ #### Returns
98
+
99
+ `Promise`\<`void`\>
100
+
101
+ Nothing.
102
+
103
+ #### Implementation of
104
+
105
+ `IIdentityConnector.removeDocument`
106
+
107
+ ***
108
+
77
109
  ### addVerificationMethod()
78
110
 
79
111
  > **addVerificationMethod**(`controller`, `documentId`, `verificationMethodType`, `verificationMethodId?`): `Promise`\<`IDidDocumentVerificationMethod`\>
package/locales/en.json CHANGED
@@ -6,13 +6,14 @@
6
6
  },
7
7
  "entityStorageIdentityConnector": {
8
8
  "createDocumentFailed": "Creating the document failed",
9
+ "removeDocumentFailed": "Removing the document failed",
9
10
  "signatureVerificationFailed": "The document integrity check failed",
10
11
  "missingDid": "The full id including DID is required",
11
12
  "addVerificationMethodFailed": "Adding the verification method failed",
12
13
  "removeVerificationMethodFailed": "Removing the verification method failed",
13
14
  "addServiceFailed": "Adding the service failed",
14
15
  "removeServiceFailed": "Removing the service failed",
15
- "documentNotFound": "The document could not be found",
16
+ "documentNotFound": "The document could not be found \"{notFoundId}\"",
16
17
  "documentPrivateKeyNotFound": "The private key for document could not be found in the vault",
17
18
  "verificationMethodNotFound": "The verification method could not be found",
18
19
  "verificationPrivateKeyNotFound": "The private key for the verification method could not be found in the vault",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-connector-entity-storage",
3
- "version": "0.0.1-next.56",
3
+ "version": "0.0.1-next.57",
4
4
  "description": "Identity connector implementation using entity storage",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,7 +19,7 @@
19
19
  "@twin.org/data-core": "next",
20
20
  "@twin.org/data-json-ld": "next",
21
21
  "@twin.org/entity": "next",
22
- "@twin.org/identity-models": "0.0.1-next.56",
22
+ "@twin.org/identity-models": "0.0.1-next.57",
23
23
  "@twin.org/nameof": "next",
24
24
  "@twin.org/standards-w3c-did": "next",
25
25
  "@twin.org/vault-models": "next",