@twin.org/verifiable-storage-service 0.0.3-next.11 → 0.0.3-next.13

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.
@@ -121,6 +121,7 @@ export class VerifiableStorageService {
121
121
  * Get the connector from the uri.
122
122
  * @param id The id of the item in urn format.
123
123
  * @returns The connector.
124
+ * @throws GeneralError If the namespace does not match.
124
125
  * @internal
125
126
  */
126
127
  getConnector(id) {
@@ -1 +1 @@
1
- {"version":3,"file":"verifiableStorageService.js","sourceRoot":"","sources":["../../src/verifiableStorageService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EACN,iCAAiC,EAGjC,MAAM,qCAAqC,CAAC;AAG7C;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC;;OAEG;IACI,MAAM,CAAU,UAAU,8BAA8C;IAE/E;;;OAGG;IACK,MAAM,CAAU,UAAU,GAAW,YAAY,CAAC;IAE1D;;;OAGG;IACc,iBAAiB,CAAS;IAE3C;;;OAGG;IACH,YAAY,OAAqD;QAChE,MAAM,KAAK,GAAG,iCAAiC,CAAC,KAAK,EAAE,CAAC;QACxD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,YAAY,CAAC,wBAAwB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC7E,CAAC;QAED,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,MAAM,EAAE,gBAAgB,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,wBAAwB,CAAC,UAAU,CAAC;IAC5C,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,MAAM,CAClB,IAAgB,EAChB,SAAoB,EACpB,OAEC,EACD,SAAkB,EAClB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AU,EAAE,CAAC;YACzE,MAAM,IAAI,YAAY,CAAC,wBAAwB,CAAC,UAAU,EAAE,mBAAmB,EAAE;gBAChF,SAAS,EAAE,wBAAwB,CAAC,UAAU;gBAC9C,EAAE;aACF,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,iCAAiC,CAAC,GAAG,CAC3C,KAAK,CAAC,eAAe,EAAE,CACvB,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Urn } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tVerifiableStorageConnectorFactory,\n\ttype IVerifiableStorageComponent,\n\ttype IVerifiableStorageConnector\n} from \"@twin.org/verifiable-storage-models\";\nimport type { IVerifiableStorageServiceConstructorOptions } from \"./models/IVerifiableStorageServiceConstructorOptions.js\";\n\n/**\n * Service for performing Verifiable Storage operations to a connector.\n */\nexport class VerifiableStorageService implements IVerifiableStorageComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<VerifiableStorageService>();\n\n\t/**\n\t * The namespace supported by the verifiableStorage service.\n\t * @internal\n\t */\n\tprivate static readonly _NAMESPACE: string = \"verifiable\";\n\n\t/**\n\t * The default namespace for the connector to use.\n\t * @internal\n\t */\n\tprivate readonly _defaultNamespace: string;\n\n\t/**\n\t * Create a new instance of VerifiableStorageService.\n\t * @param options The options for the service.\n\t */\n\tconstructor(options?: IVerifiableStorageServiceConstructorOptions) {\n\t\tconst names = VerifiableStorageConnectorFactory.names();\n\t\tif (names.length === 0) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"noConnectors\");\n\t\t}\n\n\t\tthis._defaultNamespace = options?.config?.defaultNamespace ?? names[0];\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 VerifiableStorageService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a verifiable storage item.\n\t * @param data The data for the verifiable storage item.\n\t * @param allowList The list of identities that are allowed to modify the item.\n\t * @param options Additional options for creating the item.\n\t * @param options.maxAllowListSize The maximum size of the allow list.\n\t * @param namespace The namespace to use for the connector to use.\n\t * @param controller The identity of the controller to access the vault keys.\n\t * @returns The id of the created verifiable storage item.\n\t */\n\tpublic async create(\n\t\tdata: Uint8Array,\n\t\tallowList?: string[],\n\t\toptions?: {\n\t\t\tmaxAllowListSize?: number;\n\t\t},\n\t\tnamespace?: string,\n\t\tcontroller?: string\n\t): Promise<{\n\t\tid: string;\n\t\treceipt: IJsonLdNodeObject;\n\t}> {\n\t\tGuards.uint8Array(VerifiableStorageService.CLASS_NAME, nameof(data), data);\n\t\tGuards.stringValue(VerifiableStorageService.CLASS_NAME, nameof(controller), controller);\n\n\t\ttry {\n\t\t\tconst connectorNamespace = namespace ?? this._defaultNamespace;\n\n\t\t\tconst verifiableStorageConnector =\n\t\t\t\tVerifiableStorageConnectorFactory.get<IVerifiableStorageConnector>(connectorNamespace);\n\n\t\t\tconst verifiableStorageResult = await verifiableStorageConnector.create(\n\t\t\t\tcontroller,\n\t\t\t\tdata,\n\t\t\t\tallowList,\n\t\t\t\toptions\n\t\t\t);\n\n\t\t\treturn verifiableStorageResult;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"createFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Update an item in verifiable storage.\n\t * @param id The id of the item to update.\n\t * @param data The data to store, optional if updating the allow list.\n\t * @param allowList Updated list of identities that are allowed to modify the item.\n\t * @param controller The identity of the controller to access the vault keys.\n\t * @returns The updated receipt.\n\t */\n\tpublic async update(\n\t\tid: string,\n\t\tdata?: Uint8Array,\n\t\tallowList?: string[],\n\t\tcontroller?: string\n\t): Promise<IJsonLdNodeObject> {\n\t\tUrn.guard(VerifiableStorageService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(VerifiableStorageService.CLASS_NAME, nameof(controller), controller);\n\n\t\ttry {\n\t\t\tconst verifiableStorageConnector = this.getConnector(id);\n\t\t\tconst verifiableStorageResult = await verifiableStorageConnector.update(\n\t\t\t\tcontroller,\n\t\t\t\tid,\n\t\t\t\tdata,\n\t\t\t\tallowList\n\t\t\t);\n\n\t\t\treturn verifiableStorageResult;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"updateFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get an Verifiable Storage.\n\t * @param id The id of the verifiable storage item to get.\n\t * @param options Additional options for getting the verifiable storage item.\n\t * @param options.includeData Should the data be included in the response, defaults to true.\n\t * @param options.includeAllowList Should the allow list be included in the response, defaults to true.\n\t * @returns The data for the verifiable storage item.\n\t */\n\tpublic async get(\n\t\tid: string,\n\t\toptions?: { includeData?: boolean; includeAllowList?: boolean }\n\t): Promise<{\n\t\tdata?: Uint8Array;\n\t\treceipt: IJsonLdNodeObject;\n\t}> {\n\t\tUrn.guard(VerifiableStorageService.CLASS_NAME, nameof(id), id);\n\n\t\ttry {\n\t\t\tconst verifiableStorageConnector = this.getConnector(id);\n\t\t\tconst result = await verifiableStorageConnector.get(id, options);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"getFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Remove a verifiable storage item.\n\t * @param id The id of the Verifiable Storage to remove.\n\t * @param controller The identity of the controller to access the vault keys.\n\t * @returns Nothing.\n\t */\n\tpublic async remove(id: string, controller?: string): Promise<void> {\n\t\tUrn.guard(VerifiableStorageService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(VerifiableStorageService.CLASS_NAME, nameof(controller), controller);\n\n\t\ttry {\n\t\t\tconst verifiableStorageConnector = this.getConnector(id);\n\t\t\tawait verifiableStorageConnector.remove(controller, id);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"removeFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get the connector from the uri.\n\t * @param id The id of the item in urn format.\n\t * @returns The connector.\n\t * @internal\n\t */\n\tprivate getConnector(id: string): IVerifiableStorageConnector {\n\t\tconst idUri = Urn.fromValidString(id);\n\n\t\tif (idUri.namespaceIdentifier() !== VerifiableStorageService._NAMESPACE) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: VerifiableStorageService._NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\treturn VerifiableStorageConnectorFactory.get<IVerifiableStorageConnector>(\n\t\t\tidUri.namespaceMethod()\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"verifiableStorageService.js","sourceRoot":"","sources":["../../src/verifiableStorageService.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EACN,iCAAiC,EAGjC,MAAM,qCAAqC,CAAC;AAG7C;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC;;OAEG;IACI,MAAM,CAAU,UAAU,8BAA8C;IAE/E;;;OAGG;IACK,MAAM,CAAU,UAAU,GAAW,YAAY,CAAC;IAE1D;;;OAGG;IACc,iBAAiB,CAAS;IAE3C;;;OAGG;IACH,YAAY,OAAqD;QAChE,MAAM,KAAK,GAAG,iCAAiC,CAAC,KAAK,EAAE,CAAC;QACxD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,YAAY,CAAC,wBAAwB,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;QAC7E,CAAC;QAED,IAAI,CAAC,iBAAiB,GAAG,OAAO,EAAE,MAAM,EAAE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,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAC/F,CAAC;IACF,CAAC;IAED;;;;;;OAMG;IACK,YAAY,CAAC,EAAU;QAC9B,MAAM,KAAK,GAAG,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAEtC,IAAI,KAAK,CAAC,mBAAmB,EAAE,KAAK,wBAAwB,CAAC,UAAU,EAAE,CAAC;YACzE,MAAM,IAAI,YAAY,CAAC,wBAAwB,CAAC,UAAU,EAAE,mBAAmB,EAAE;gBAChF,SAAS,EAAE,wBAAwB,CAAC,UAAU;gBAC9C,EAAE;aACF,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,iCAAiC,CAAC,GAAG,CAC3C,KAAK,CAAC,eAAe,EAAE,CACvB,CAAC;IACH,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Urn } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport { nameof } from \"@twin.org/nameof\";\nimport {\n\tVerifiableStorageConnectorFactory,\n\ttype IVerifiableStorageComponent,\n\ttype IVerifiableStorageConnector\n} from \"@twin.org/verifiable-storage-models\";\nimport type { IVerifiableStorageServiceConstructorOptions } from \"./models/IVerifiableStorageServiceConstructorOptions.js\";\n\n/**\n * Service for performing Verifiable Storage operations to a connector.\n */\nexport class VerifiableStorageService implements IVerifiableStorageComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<VerifiableStorageService>();\n\n\t/**\n\t * The namespace supported by the verifiableStorage service.\n\t * @internal\n\t */\n\tprivate static readonly _NAMESPACE: string = \"verifiable\";\n\n\t/**\n\t * The default namespace for the connector to use.\n\t * @internal\n\t */\n\tprivate readonly _defaultNamespace: string;\n\n\t/**\n\t * Create a new instance of VerifiableStorageService.\n\t * @param options The options for the service.\n\t */\n\tconstructor(options?: IVerifiableStorageServiceConstructorOptions) {\n\t\tconst names = VerifiableStorageConnectorFactory.names();\n\t\tif (names.length === 0) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"noConnectors\");\n\t\t}\n\n\t\tthis._defaultNamespace = options?.config?.defaultNamespace ?? names[0];\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 VerifiableStorageService.CLASS_NAME;\n\t}\n\n\t/**\n\t * Create a verifiable storage item.\n\t * @param data The data for the verifiable storage item.\n\t * @param allowList The list of identities that are allowed to modify the item.\n\t * @param options Additional options for creating the item.\n\t * @param options.maxAllowListSize The maximum size of the allow list.\n\t * @param namespace The namespace to use for the connector to use.\n\t * @param controller The identity of the controller to access the vault keys.\n\t * @returns The id of the created verifiable storage item.\n\t */\n\tpublic async create(\n\t\tdata: Uint8Array,\n\t\tallowList?: string[],\n\t\toptions?: {\n\t\t\tmaxAllowListSize?: number;\n\t\t},\n\t\tnamespace?: string,\n\t\tcontroller?: string\n\t): Promise<{\n\t\tid: string;\n\t\treceipt: IJsonLdNodeObject;\n\t}> {\n\t\tGuards.uint8Array(VerifiableStorageService.CLASS_NAME, nameof(data), data);\n\t\tGuards.stringValue(VerifiableStorageService.CLASS_NAME, nameof(controller), controller);\n\n\t\ttry {\n\t\t\tconst connectorNamespace = namespace ?? this._defaultNamespace;\n\n\t\t\tconst verifiableStorageConnector =\n\t\t\t\tVerifiableStorageConnectorFactory.get<IVerifiableStorageConnector>(connectorNamespace);\n\n\t\t\tconst verifiableStorageResult = await verifiableStorageConnector.create(\n\t\t\t\tcontroller,\n\t\t\t\tdata,\n\t\t\t\tallowList,\n\t\t\t\toptions\n\t\t\t);\n\n\t\t\treturn verifiableStorageResult;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"createFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Update an item in verifiable storage.\n\t * @param id The id of the item to update.\n\t * @param data The data to store, optional if updating the allow list.\n\t * @param allowList Updated list of identities that are allowed to modify the item.\n\t * @param controller The identity of the controller to access the vault keys.\n\t * @returns The updated receipt.\n\t */\n\tpublic async update(\n\t\tid: string,\n\t\tdata?: Uint8Array,\n\t\tallowList?: string[],\n\t\tcontroller?: string\n\t): Promise<IJsonLdNodeObject> {\n\t\tUrn.guard(VerifiableStorageService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(VerifiableStorageService.CLASS_NAME, nameof(controller), controller);\n\n\t\ttry {\n\t\t\tconst verifiableStorageConnector = this.getConnector(id);\n\t\t\tconst verifiableStorageResult = await verifiableStorageConnector.update(\n\t\t\t\tcontroller,\n\t\t\t\tid,\n\t\t\t\tdata,\n\t\t\t\tallowList\n\t\t\t);\n\n\t\t\treturn verifiableStorageResult;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"updateFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get an Verifiable Storage.\n\t * @param id The id of the verifiable storage item to get.\n\t * @param options Additional options for getting the verifiable storage item.\n\t * @param options.includeData Should the data be included in the response, defaults to true.\n\t * @param options.includeAllowList Should the allow list be included in the response, defaults to true.\n\t * @returns The data for the verifiable storage item.\n\t */\n\tpublic async get(\n\t\tid: string,\n\t\toptions?: { includeData?: boolean; includeAllowList?: boolean }\n\t): Promise<{\n\t\tdata?: Uint8Array;\n\t\treceipt: IJsonLdNodeObject;\n\t}> {\n\t\tUrn.guard(VerifiableStorageService.CLASS_NAME, nameof(id), id);\n\n\t\ttry {\n\t\t\tconst verifiableStorageConnector = this.getConnector(id);\n\t\t\tconst result = await verifiableStorageConnector.get(id, options);\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"getFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Remove a verifiable storage item.\n\t * @param id The id of the Verifiable Storage to remove.\n\t * @param controller The identity of the controller to access the vault keys.\n\t * @returns Nothing.\n\t */\n\tpublic async remove(id: string, controller?: string): Promise<void> {\n\t\tUrn.guard(VerifiableStorageService.CLASS_NAME, nameof(id), id);\n\t\tGuards.stringValue(VerifiableStorageService.CLASS_NAME, nameof(controller), controller);\n\n\t\ttry {\n\t\t\tconst verifiableStorageConnector = this.getConnector(id);\n\t\t\tawait verifiableStorageConnector.remove(controller, id);\n\t\t} catch (error) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"removeFailed\", undefined, error);\n\t\t}\n\t}\n\n\t/**\n\t * Get the connector from the uri.\n\t * @param id The id of the item in urn format.\n\t * @returns The connector.\n\t * @throws GeneralError If the namespace does not match.\n\t * @internal\n\t */\n\tprivate getConnector(id: string): IVerifiableStorageConnector {\n\t\tconst idUri = Urn.fromValidString(id);\n\n\t\tif (idUri.namespaceIdentifier() !== VerifiableStorageService._NAMESPACE) {\n\t\t\tthrow new GeneralError(VerifiableStorageService.CLASS_NAME, \"namespaceMismatch\", {\n\t\t\t\tnamespace: VerifiableStorageService._NAMESPACE,\n\t\t\t\tid\n\t\t\t});\n\t\t}\n\n\t\treturn VerifiableStorageConnectorFactory.get<IVerifiableStorageConnector>(\n\t\t\tidUri.namespaceMethod()\n\t\t);\n\t}\n}\n"]}
package/docs/changelog.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.13](https://github.com/iotaledger/twin-verifiable-storage/compare/verifiable-storage-service-v0.0.3-next.12...verifiable-storage-service-v0.0.3-next.13) (2026-06-11)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **verifiable-storage-service:** Synchronize repo versions
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/verifiable-storage-models bumped from 0.0.3-next.12 to 0.0.3-next.13
16
+ * devDependencies
17
+ * @twin.org/verifiable-storage-connector-entity-storage bumped from 0.0.3-next.12 to 0.0.3-next.13
18
+
19
+ ## [0.0.3-next.12](https://github.com/iotaledger/twin-verifiable-storage/compare/verifiable-storage-service-v0.0.3-next.11...verifiable-storage-service-v0.0.3-next.12) (2026-05-28)
20
+
21
+
22
+ ### Miscellaneous Chores
23
+
24
+ * **verifiable-storage-service:** Synchronize repo versions
25
+
26
+
27
+ ### Dependencies
28
+
29
+ * The following workspace dependencies were updated
30
+ * dependencies
31
+ * @twin.org/verifiable-storage-models bumped from 0.0.3-next.11 to 0.0.3-next.12
32
+ * devDependencies
33
+ * @twin.org/verifiable-storage-connector-entity-storage bumped from 0.0.3-next.11 to 0.0.3-next.12
34
+
3
35
  ## [0.0.3-next.11](https://github.com/iotaledger/twin-verifiable-storage/compare/verifiable-storage-service-v0.0.3-next.10...verifiable-storage-service-v0.0.3-next.11) (2026-05-20)
4
36
 
5
37
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@twin.org/verifiable-storage-service",
3
- "version": "0.0.3-next.11",
3
+ "version": "0.0.3-next.13",
4
4
  "description": "Service component and REST routes that expose verifiable storage operations",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/iotaledger/verifiable-storage.git",
7
+ "url": "git+https://github.com/iotaledger/twin-verifiable-storage.git",
8
8
  "directory": "packages/verifiable-storage-service"
9
9
  },
10
10
  "contributors": [
@@ -22,7 +22,7 @@
22
22
  "@twin.org/core": "next",
23
23
  "@twin.org/entity": "next",
24
24
  "@twin.org/nameof": "next",
25
- "@twin.org/verifiable-storage-models": "0.0.3-next.11",
25
+ "@twin.org/verifiable-storage-models": "0.0.3-next.13",
26
26
  "@twin.org/web": "next"
27
27
  },
28
28
  "main": "./dist/es/index.js",
@@ -57,7 +57,7 @@
57
57
  "business-logic"
58
58
  ],
59
59
  "bugs": {
60
- "url": "git+https://github.com/iotaledger/verifiable-storage/issues"
60
+ "url": "git+https://github.com/iotaledger/twin-verifiable-storage/issues"
61
61
  },
62
62
  "homepage": "https://twindev.org"
63
63
  }