@icure/api 5.0.37 → 6.0.0
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.
- package/icc-x-api/icc-crypto-x-api.d.ts +5 -5
- package/icc-x-api/icc-crypto-x-api.js +28 -24
- package/icc-x-api/icc-crypto-x-api.js.map +1 -1
- package/icc-x-api/storage/KeyStorageFacade.d.ts +6 -6
- package/icc-x-api/storage/KeyStorageFacade.js.map +1 -1
- package/icc-x-api/storage/KeyStorageImpl.d.ts +6 -6
- package/icc-x-api/storage/KeyStorageImpl.js +27 -10
- package/icc-x-api/storage/KeyStorageImpl.js.map +1 -1
- package/icc-x-api/storage/LocalStorageImpl.d.ts +3 -7
- package/icc-x-api/storage/LocalStorageImpl.js +22 -11
- package/icc-x-api/storage/LocalStorageImpl.js.map +1 -1
- package/icc-x-api/storage/StorageFacade.d.ts +3 -3
- package/icc-x-api/storage/StorageFacade.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,27 +4,27 @@ export interface KeyStorageFacade {
|
|
|
4
4
|
* @param key Key of the value to retrieve
|
|
5
5
|
* @return The publicKey associated to the provided key or undefined if not found.
|
|
6
6
|
*/
|
|
7
|
-
getPublicKey(key: string): JsonWebKey | undefined
|
|
7
|
+
getPublicKey(key: string): Promise<JsonWebKey | undefined>;
|
|
8
8
|
/**
|
|
9
9
|
* Returns the privateKey of the provided key from the storage
|
|
10
10
|
* @param key Key of the value to retrieve
|
|
11
11
|
* @return The privateKey associated to the provided key or undefined if not found.
|
|
12
12
|
*/
|
|
13
|
-
getPrivateKey(key: string): JsonWebKey | undefined
|
|
13
|
+
getPrivateKey(key: string): Promise<JsonWebKey | undefined>;
|
|
14
14
|
/**
|
|
15
15
|
* Get the keyPair associated to the provided key
|
|
16
16
|
* @param key Key of the value to retrieve
|
|
17
17
|
* @return The keyPair associated to the provided key or undefined if not found.
|
|
18
18
|
*/
|
|
19
|
-
getKeypair(key: string): {
|
|
19
|
+
getKeypair(key: string): Promise<{
|
|
20
20
|
publicKey: JsonWebKey;
|
|
21
21
|
privateKey: JsonWebKey;
|
|
22
|
-
} | undefined
|
|
22
|
+
} | undefined>;
|
|
23
23
|
/**
|
|
24
24
|
* Delete the keyPair associated to the provided key
|
|
25
25
|
* @param key Key of the value to delete
|
|
26
26
|
*/
|
|
27
|
-
deleteKeypair(key: string): void
|
|
27
|
+
deleteKeypair(key: string): Promise<void>;
|
|
28
28
|
/**
|
|
29
29
|
* Stores the given keyPair under the given key in the storage.
|
|
30
30
|
* @param key The id of the entry in storage
|
|
@@ -33,5 +33,5 @@ export interface KeyStorageFacade {
|
|
|
33
33
|
storeKeyPair(key: string, keyPair: {
|
|
34
34
|
publicKey: JsonWebKey;
|
|
35
35
|
privateKey: JsonWebKey;
|
|
36
|
-
}): void
|
|
36
|
+
}): Promise<void>;
|
|
37
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyStorageFacade.js","sourceRoot":"","sources":["../../../icc-x-api/storage/KeyStorageFacade.ts"],"names":[],"mappings":"","sourcesContent":["export interface KeyStorageFacade {\n /**\n * Returns the publicKey of the provided key from the storage\n * @param key Key of the value to retrieve\n * @return The publicKey associated to the provided key or undefined if not found.\n */\n getPublicKey(key: string): JsonWebKey | undefined
|
|
1
|
+
{"version":3,"file":"KeyStorageFacade.js","sourceRoot":"","sources":["../../../icc-x-api/storage/KeyStorageFacade.ts"],"names":[],"mappings":"","sourcesContent":["export interface KeyStorageFacade {\n /**\n * Returns the publicKey of the provided key from the storage\n * @param key Key of the value to retrieve\n * @return The publicKey associated to the provided key or undefined if not found.\n */\n getPublicKey(key: string): Promise<JsonWebKey | undefined>\n\n /**\n * Returns the privateKey of the provided key from the storage\n * @param key Key of the value to retrieve\n * @return The privateKey associated to the provided key or undefined if not found.\n */\n getPrivateKey(key: string): Promise<JsonWebKey | undefined>\n\n /**\n * Get the keyPair associated to the provided key\n * @param key Key of the value to retrieve\n * @return The keyPair associated to the provided key or undefined if not found.\n */\n getKeypair(key: string): Promise<{ publicKey: JsonWebKey; privateKey: JsonWebKey } | undefined>\n\n /**\n * Delete the keyPair associated to the provided key\n * @param key Key of the value to delete\n */\n deleteKeypair(key: string): Promise<void>\n\n /**\n * Stores the given keyPair under the given key in the storage.\n * @param key The id of the entry in storage\n * @param keyPair should be JWK\n */\n storeKeyPair(key: string, keyPair: { publicKey: JsonWebKey; privateKey: JsonWebKey }): Promise<void>\n}\n"]}
|
|
@@ -3,15 +3,15 @@ import { KeyStorageFacade } from './KeyStorageFacade';
|
|
|
3
3
|
export declare class KeyStorageImpl implements KeyStorageFacade {
|
|
4
4
|
private readonly _storage;
|
|
5
5
|
constructor(storage: StorageFacade<string>);
|
|
6
|
-
deleteKeypair(key: string): void
|
|
7
|
-
getKeypair(key: string): {
|
|
6
|
+
deleteKeypair(key: string): Promise<void>;
|
|
7
|
+
getKeypair(key: string): Promise<{
|
|
8
8
|
publicKey: JsonWebKey;
|
|
9
9
|
privateKey: JsonWebKey;
|
|
10
|
-
} | undefined
|
|
11
|
-
getPrivateKey(key: string): JsonWebKey | undefined
|
|
12
|
-
getPublicKey(key: string): JsonWebKey | undefined
|
|
10
|
+
} | undefined>;
|
|
11
|
+
getPrivateKey(key: string): Promise<JsonWebKey | undefined>;
|
|
12
|
+
getPublicKey(key: string): Promise<JsonWebKey | undefined>;
|
|
13
13
|
storeKeyPair(key: string, keyPair: {
|
|
14
14
|
publicKey: JsonWebKey;
|
|
15
15
|
privateKey: JsonWebKey;
|
|
16
|
-
}): void
|
|
16
|
+
}): Promise<void>;
|
|
17
17
|
}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.KeyStorageImpl = void 0;
|
|
4
13
|
class KeyStorageImpl {
|
|
@@ -10,24 +19,32 @@ class KeyStorageImpl {
|
|
|
10
19
|
}
|
|
11
20
|
getKeypair(key) {
|
|
12
21
|
var _a;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const keyPair = JSON.parse((_a = (yield this._storage.getItem(key))) !== null && _a !== void 0 ? _a : '{}');
|
|
24
|
+
return keyPair.hasOwnProperty('publicKey') && keyPair.hasOwnProperty('privateKey')
|
|
25
|
+
? {
|
|
26
|
+
publicKey: keyPair.publicKey,
|
|
27
|
+
privateKey: keyPair.privateKey,
|
|
28
|
+
}
|
|
29
|
+
: undefined;
|
|
30
|
+
});
|
|
20
31
|
}
|
|
21
32
|
getPrivateKey(key) {
|
|
22
33
|
var _a;
|
|
23
|
-
return (
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return (_a = (yield this.getKeypair(key))) === null || _a === void 0 ? void 0 : _a.privateKey;
|
|
36
|
+
});
|
|
24
37
|
}
|
|
25
38
|
getPublicKey(key) {
|
|
26
39
|
var _a;
|
|
27
|
-
return (
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
return (_a = (yield this.getKeypair(key))) === null || _a === void 0 ? void 0 : _a.publicKey;
|
|
42
|
+
});
|
|
28
43
|
}
|
|
29
44
|
storeKeyPair(key, keyPair) {
|
|
30
|
-
return this
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
return yield this._storage.setItem(key, JSON.stringify(keyPair));
|
|
47
|
+
});
|
|
31
48
|
}
|
|
32
49
|
}
|
|
33
50
|
exports.KeyStorageImpl = KeyStorageImpl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyStorageImpl.js","sourceRoot":"","sources":["../../../icc-x-api/storage/KeyStorageImpl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"KeyStorageImpl.js","sourceRoot":"","sources":["../../../icc-x-api/storage/KeyStorageImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,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;IAEK,UAAU,CAAC,GAAW;;;YAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAA,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,mCAAI,IAAI,CAAC,CAAA;YACtE,OAAO,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC;gBAChF,CAAC,CAAC;oBACE,SAAS,EAAE,OAAO,CAAC,SAAuB;oBAC1C,UAAU,EAAE,OAAO,CAAC,UAAwB;iBAC7C;gBACH,CAAC,CAAC,SAAS,CAAA;;KACd;IAEK,aAAa,CAAC,GAAW;;;YAC7B,OAAO,MAAA,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,0CAAE,UAAU,CAAA;;KAChD;IAEK,YAAY,CAAC,GAAW;;;YAC5B,OAAO,MAAA,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,0CAAE,SAAS,CAAA;;KAC/C;IAEK,YAAY,CAAC,GAAW,EAAE,OAA0D;;YACxF,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;QAClE,CAAC;KAAA;CACF;AAhCD,wCAgCC","sourcesContent":["import { StorageFacade } from './StorageFacade'\nimport { KeyStorageFacade } from './KeyStorageFacade'\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): Promise<void> {\n return this._storage.deleteItem(key)\n }\n\n async getKeypair(key: string): Promise<{ publicKey: JsonWebKey; privateKey: JsonWebKey } | undefined> {\n const keyPair = JSON.parse((await 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 async getPrivateKey(key: string): Promise<JsonWebKey | undefined> {\n return (await this.getKeypair(key))?.privateKey\n }\n\n async getPublicKey(key: string): Promise<JsonWebKey | undefined> {\n return (await this.getKeypair(key))?.publicKey\n }\n\n async storeKeyPair(key: string, keyPair: { publicKey: JsonWebKey; privateKey: JsonWebKey }): Promise<void> {\n return await this._storage.setItem(key, JSON.stringify(keyPair))\n }\n}\n"]}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { StorageFacade } from './StorageFacade';
|
|
2
2
|
export declare class LocalStorageImpl implements StorageFacade<string> {
|
|
3
|
-
getItem(key: string): string | undefined
|
|
4
|
-
deleteItem(key: string): void
|
|
5
|
-
setItem(key: string, valueToStore: string): void
|
|
6
|
-
storeKeyPair(key: string, keyPair: {
|
|
7
|
-
publicKey: any;
|
|
8
|
-
privateKey: any;
|
|
9
|
-
}): void;
|
|
3
|
+
getItem(key: string): Promise<string | undefined>;
|
|
4
|
+
deleteItem(key: string): Promise<void>;
|
|
5
|
+
setItem(key: string, valueToStore: string): Promise<void>;
|
|
10
6
|
}
|
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.LocalStorageImpl = void 0;
|
|
4
13
|
class LocalStorageImpl {
|
|
5
14
|
getItem(key) {
|
|
6
15
|
var _a;
|
|
7
|
-
return (
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
return (_a = localStorage.getItem(key)) !== null && _a !== void 0 ? _a : undefined;
|
|
18
|
+
});
|
|
8
19
|
}
|
|
9
20
|
deleteItem(key) {
|
|
10
|
-
return
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return localStorage.removeItem(key);
|
|
23
|
+
});
|
|
11
24
|
}
|
|
12
25
|
setItem(key, valueToStore) {
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
//TODO: encryption
|
|
21
|
-
this.setItem(key, JSON.stringify(keyPair));
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
if (typeof Storage === 'undefined') {
|
|
28
|
+
console.error('Your browser does not support HTML5 Browser Local Storage !');
|
|
29
|
+
throw 'Your browser does not support HTML5 Browser Local Storage !';
|
|
30
|
+
}
|
|
31
|
+
return localStorage.setItem(key, valueToStore);
|
|
32
|
+
});
|
|
22
33
|
}
|
|
23
34
|
}
|
|
24
35
|
exports.LocalStorageImpl = LocalStorageImpl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalStorageImpl.js","sourceRoot":"","sources":["../../../icc-x-api/storage/LocalStorageImpl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocalStorageImpl.js","sourceRoot":"","sources":["../../../icc-x-api/storage/LocalStorageImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,gBAAgB;IACrB,OAAO,CAAC,GAAW;;;YACvB,OAAO,MAAA,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,mCAAI,SAAS,CAAA;;KAC9C;IAEK,UAAU,CAAC,GAAW;;YAC1B,OAAO,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;KAAA;IAEK,OAAO,CAAC,GAAW,EAAE,YAAoB;;YAC7C,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;gBAClC,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;gBAC5E,MAAM,6DAA6D,CAAA;aACpE;YACD,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QAChD,CAAC;KAAA;CACF;AAhBD,4CAgBC","sourcesContent":["import { StorageFacade } from './StorageFacade'\n\nexport class LocalStorageImpl implements StorageFacade<string> {\n async getItem(key: string): Promise<string | undefined> {\n return localStorage.getItem(key) ?? undefined\n }\n\n async deleteItem(key: string): Promise<void> {\n return localStorage.removeItem(key)\n }\n\n async setItem(key: string, valueToStore: string): Promise<void> {\n if (typeof Storage === 'undefined') {\n console.error('Your browser does not support HTML5 Browser Local Storage !')\n throw 'Your browser does not support HTML5 Browser Local Storage !'\n }\n return localStorage.setItem(key, valueToStore)\n }\n}\n"]}
|
|
@@ -4,16 +4,16 @@ export interface StorageFacade<T> {
|
|
|
4
4
|
* @param key Key of the value to retrieve
|
|
5
5
|
* @return The value associated to the provided key or null if not found.
|
|
6
6
|
*/
|
|
7
|
-
getItem(key: string): T | undefined
|
|
7
|
+
getItem(key: string): Promise<T | undefined>;
|
|
8
8
|
/**
|
|
9
9
|
* Set an item in the storage for the given key
|
|
10
10
|
* @param key Key of the value to set
|
|
11
11
|
* @param valueToStore
|
|
12
12
|
*/
|
|
13
|
-
setItem(key: string, valueToStore: T): void
|
|
13
|
+
setItem(key: string, valueToStore: T): Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* Removes the item with the given key from the storage.
|
|
16
16
|
* @param key The key of the item to remove.
|
|
17
17
|
*/
|
|
18
|
-
deleteItem(key: string): void
|
|
18
|
+
deleteItem(key: string): Promise<void>;
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageFacade.js","sourceRoot":"","sources":["../../../icc-x-api/storage/StorageFacade.ts"],"names":[],"mappings":"","sourcesContent":["export interface StorageFacade<T> {\n /**\n * Returns the value of the provided key from the storage\n * @param key Key of the value to retrieve\n * @return The value associated to the provided key or null if not found.\n */\n getItem(key: string): T | undefined
|
|
1
|
+
{"version":3,"file":"StorageFacade.js","sourceRoot":"","sources":["../../../icc-x-api/storage/StorageFacade.ts"],"names":[],"mappings":"","sourcesContent":["export interface StorageFacade<T> {\n /**\n * Returns the value of the provided key from the storage\n * @param key Key of the value to retrieve\n * @return The value associated to the provided key or null if not found.\n */\n getItem(key: string): Promise<T | undefined>\n\n /**\n * Set an item in the storage for the given key\n * @param key Key of the value to set\n * @param valueToStore\n */\n setItem(key: string, valueToStore: T): Promise<void>\n\n /**\n * Removes the item with the given key from the storage.\n * @param key The key of the item to remove.\n */\n deleteItem(key: string): Promise<void>\n}\n"]}
|