@icure/api 5.0.35 → 5.0.37
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.
|
@@ -10,7 +10,7 @@ class KeyStorageImpl {
|
|
|
10
10
|
}
|
|
11
11
|
getKeypair(key) {
|
|
12
12
|
var _a;
|
|
13
|
-
const keyPair = JSON.parse((_a = this._storage.getItem(key)) !== null && _a !== void 0 ? _a : '');
|
|
13
|
+
const keyPair = JSON.parse((_a = this._storage.getItem(key)) !== null && _a !== void 0 ? _a : '{}');
|
|
14
14
|
return keyPair.hasOwnProperty('publicKey') && keyPair.hasOwnProperty('privateKey')
|
|
15
15
|
? {
|
|
16
16
|
publicKey: keyPair.publicKey,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyStorageImpl.js","sourceRoot":"","sources":["../../../icc-x-api/storage/KeyStorageImpl.ts"],"names":[],"mappings":";;;AAIA,MAAa,cAAc;IAGzB,YAAY,OAA8B;QACxC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;IACzB,CAAC;IAED,aAAa,CAAC,GAAW;QACvB,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACtC,CAAC;IAED,UAAU,CAAC,GAAW;;QACpB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,mCAAI,
|
|
1
|
+
{"version":3,"file":"KeyStorageImpl.js","sourceRoot":"","sources":["../../../icc-x-api/storage/KeyStorageImpl.ts"],"names":[],"mappings":";;;AAIA,MAAa,cAAc;IAGzB,YAAY,OAA8B;QACxC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;IACzB,CAAC;IAED,aAAa,CAAC,GAAW;QACvB,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACtC,CAAC;IAED,UAAU,CAAC,GAAW;;QACpB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,mCAAI,IAAI,CAAC,CAAA;QAC9D,OAAO,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC;YAChF,CAAC,CAAC;gBACE,SAAS,EAAE,OAAO,CAAC,SAAuB;gBAC1C,UAAU,EAAE,OAAO,CAAC,UAAwB;aAC7C;YACH,CAAC,CAAC,SAAS,CAAA;IACf,CAAC;IAED,aAAa,CAAC,GAAW;;QACvB,OAAO,MAAA,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,0CAAE,UAAU,CAAA;IACzC,CAAC;IAED,YAAY,CAAC,GAAW;;QACtB,OAAO,MAAA,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,0CAAE,SAAS,CAAA;IACxC,CAAC;IAED,YAAY,CAAC,GAAW,EAAE,OAA0D;QAClF,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAC5D,CAAC;CACF;AAhCD,wCAgCC","sourcesContent":["import { StorageFacade } from './StorageFacade'\nimport { KeyStorageFacade } from './KeyStorageFacade'\nimport { b2a } from '../../icc-api/model/ModelHelper'\n\nexport class KeyStorageImpl implements KeyStorageFacade {\n private readonly _storage: StorageFacade<string>\n\n constructor(storage: StorageFacade<string>) {\n this._storage = storage\n }\n\n deleteKeypair(key: string): void {\n return this._storage.deleteItem(key)\n }\n\n getKeypair(key: string): { publicKey: JsonWebKey; privateKey: JsonWebKey } | undefined {\n const keyPair = JSON.parse(this._storage.getItem(key) ?? '{}')\n return keyPair.hasOwnProperty('publicKey') && keyPair.hasOwnProperty('privateKey')\n ? {\n publicKey: keyPair.publicKey as JsonWebKey,\n privateKey: keyPair.privateKey as JsonWebKey,\n }\n : undefined\n }\n\n getPrivateKey(key: string): JsonWebKey | undefined {\n return this.getKeypair(key)?.privateKey\n }\n\n getPublicKey(key: string): JsonWebKey | undefined {\n return this.getKeypair(key)?.publicKey\n }\n\n storeKeyPair(key: string, keyPair: { publicKey: JsonWebKey; privateKey: JsonWebKey }): void {\n return this._storage.setItem(key, JSON.stringify(keyPair))\n }\n}\n"]}
|