@credo-ts/react-native 0.6.0-alpha-20251010154241 → 0.6.0-alpha-20251010164336

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,113 +1,73 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ReactNativeFileSystem = void 0;
37
- const core_1 = require("@credo-ts/core");
38
- const react_native_1 = require("react-native");
39
- const RNFS = __importStar(require("react-native-fs"));
40
- class ReactNativeFileSystem {
41
- /**
42
- * Create new ReactNativeFileSystem class instance.
43
- *
44
- * @param baseDataPath The base path to use for reading and writing data files used within the framework.
45
- * Files will be created under baseDataPath/.afj directory. If not specified, it will be set to
46
- * RNFS.DocumentDirectoryPath
47
- * @param baseCachePath The base path to use for reading and writing cache files used within the framework.
48
- * Files will be created under baseCachePath/.afj directory. If not specified, it will be set to
49
- * RNFS.CachesDirectoryPath
50
- * @param baseTempPath The base path to use for reading and writing temporary files within the framework.
51
- * Files will be created under baseTempPath/.afj directory. If not specified, it will be set to
52
- * RNFS.TemporaryDirectoryPath
53
- *
54
- * @see https://github.com/itinance/react-native-fs#constants
55
- */
56
- constructor(options) {
57
- this.dataPath = `${options?.baseDataPath ?? RNFS.DocumentDirectoryPath}/.afj`;
58
- // In Android, TemporaryDirectoryPath falls back to CachesDirectoryPath
59
- this.cachePath = options?.baseCachePath
60
- ? `${options?.baseCachePath}/.afj`
61
- : `${RNFS.CachesDirectoryPath}/.afj${react_native_1.Platform.OS === 'android' ? '/cache' : ''}`;
62
- this.tempPath = options?.baseTempPath
63
- ? `${options?.baseTempPath}/.afj`
64
- : `${RNFS.TemporaryDirectoryPath}/.afj${react_native_1.Platform.OS === 'android' ? '/temp' : ''}`;
65
- }
66
- async exists(path) {
67
- return RNFS.exists(path);
68
- }
69
- async createDirectory(path) {
70
- await RNFS.mkdir((0, core_1.getDirFromFilePath)(path));
71
- }
72
- async copyFile(sourcePath, destinationPath) {
73
- await RNFS.copyFile(sourcePath, destinationPath);
74
- }
75
- async write(path, data) {
76
- // Make sure parent directories exist
77
- await RNFS.mkdir((0, core_1.getDirFromFilePath)(path));
78
- return RNFS.writeFile(path, data, 'utf8');
79
- }
80
- async read(path) {
81
- return RNFS.readFile(path, 'utf8');
82
- }
83
- async delete(path) {
84
- await RNFS.unlink(path);
85
- }
86
- async downloadToFile(url, path, options) {
87
- // Make sure parent directories exist
88
- await RNFS.mkdir((0, core_1.getDirFromFilePath)(path));
89
- const fromUrl = this.encodeUriIfRequired(url);
90
- const { promise } = RNFS.downloadFile({
91
- fromUrl,
92
- toFile: path,
93
- });
94
- await promise;
95
- if (options?.verifyHash) {
96
- // RNFS returns hash as HEX
97
- const fileHash = await RNFS.hash(path, options.verifyHash.algorithm);
98
- const fileHashBuffer = core_1.Buffer.from(fileHash, 'hex');
99
- // If hash doesn't match, remove file and throw error
100
- if (fileHashBuffer.compare(options.verifyHash.hash) !== 0) {
101
- await RNFS.unlink(path);
102
- throw new core_1.CredoError(`Hash of downloaded file does not match expected hash. Expected: ${core_1.TypedArrayEncoder.toBase58(options.verifyHash.hash)}, Actual: ${core_1.TypedArrayEncoder.toBase58(fileHashBuffer)}`);
103
- }
104
- }
105
- }
106
- encodeUriIfRequired(uri) {
107
- // Some characters in the URL might be invalid for
108
- // the native os to handle. Only encode if necessary.
109
- return uri === decodeURI(uri) ? encodeURI(uri) : uri;
110
- }
111
- }
112
- exports.ReactNativeFileSystem = ReactNativeFileSystem;
113
- //# sourceMappingURL=ReactNativeFileSystem.js.map
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.js');
2
+ let __credo_ts_core = require("@credo-ts/core");
3
+ __credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);
4
+ let react_native = require("react-native");
5
+ react_native = require_rolldown_runtime.__toESM(react_native);
6
+ let react_native_fs = require("react-native-fs");
7
+ react_native_fs = require_rolldown_runtime.__toESM(react_native_fs);
8
+
9
+ //#region src/ReactNativeFileSystem.ts
10
+ var ReactNativeFileSystem = class {
11
+ /**
12
+ * Create new ReactNativeFileSystem class instance.
13
+ *
14
+ * @param baseDataPath The base path to use for reading and writing data files used within the framework.
15
+ * Files will be created under baseDataPath/.afj directory. If not specified, it will be set to
16
+ * RNFS.DocumentDirectoryPath
17
+ * @param baseCachePath The base path to use for reading and writing cache files used within the framework.
18
+ * Files will be created under baseCachePath/.afj directory. If not specified, it will be set to
19
+ * RNFS.CachesDirectoryPath
20
+ * @param baseTempPath The base path to use for reading and writing temporary files within the framework.
21
+ * Files will be created under baseTempPath/.afj directory. If not specified, it will be set to
22
+ * RNFS.TemporaryDirectoryPath
23
+ *
24
+ * @see https://github.com/itinance/react-native-fs#constants
25
+ */
26
+ constructor(options) {
27
+ this.dataPath = `${options?.baseDataPath ?? react_native_fs.DocumentDirectoryPath}/.afj`;
28
+ this.cachePath = options?.baseCachePath ? `${options?.baseCachePath}/.afj` : `${react_native_fs.CachesDirectoryPath}/.afj${react_native.Platform.OS === "android" ? "/cache" : ""}`;
29
+ this.tempPath = options?.baseTempPath ? `${options?.baseTempPath}/.afj` : `${react_native_fs.TemporaryDirectoryPath}/.afj${react_native.Platform.OS === "android" ? "/temp" : ""}`;
30
+ }
31
+ async exists(path) {
32
+ return react_native_fs.exists(path);
33
+ }
34
+ async createDirectory(path) {
35
+ await react_native_fs.mkdir((0, __credo_ts_core.getDirFromFilePath)(path));
36
+ }
37
+ async copyFile(sourcePath, destinationPath) {
38
+ await react_native_fs.copyFile(sourcePath, destinationPath);
39
+ }
40
+ async write(path, data) {
41
+ await react_native_fs.mkdir((0, __credo_ts_core.getDirFromFilePath)(path));
42
+ return react_native_fs.writeFile(path, data, "utf8");
43
+ }
44
+ async read(path) {
45
+ return react_native_fs.readFile(path, "utf8");
46
+ }
47
+ async delete(path) {
48
+ await react_native_fs.unlink(path);
49
+ }
50
+ async downloadToFile(url, path, options) {
51
+ await react_native_fs.mkdir((0, __credo_ts_core.getDirFromFilePath)(path));
52
+ const fromUrl = this.encodeUriIfRequired(url);
53
+ const { promise } = react_native_fs.downloadFile({
54
+ fromUrl,
55
+ toFile: path
56
+ });
57
+ await promise;
58
+ if (options?.verifyHash) {
59
+ const fileHash = await react_native_fs.hash(path, options.verifyHash.algorithm);
60
+ const fileHashBuffer = __credo_ts_core.Buffer.from(fileHash, "hex");
61
+ if (fileHashBuffer.compare(options.verifyHash.hash) !== 0) {
62
+ await react_native_fs.unlink(path);
63
+ throw new __credo_ts_core.CredoError(`Hash of downloaded file does not match expected hash. Expected: ${__credo_ts_core.TypedArrayEncoder.toBase58(options.verifyHash.hash)}, Actual: ${__credo_ts_core.TypedArrayEncoder.toBase58(fileHashBuffer)}`);
64
+ }
65
+ }
66
+ }
67
+ encodeUriIfRequired(uri) {
68
+ return uri === decodeURI(uri) ? encodeURI(uri) : uri;
69
+ }
70
+ };
71
+
72
+ //#endregion
73
+ exports.ReactNativeFileSystem = ReactNativeFileSystem;
@@ -0,0 +1,70 @@
1
+ import { Buffer, CredoError, TypedArrayEncoder, getDirFromFilePath } from "@credo-ts/core";
2
+ import { Platform } from "react-native";
3
+ import * as RNFS from "react-native-fs";
4
+
5
+ //#region src/ReactNativeFileSystem.ts
6
+ var ReactNativeFileSystem = class {
7
+ /**
8
+ * Create new ReactNativeFileSystem class instance.
9
+ *
10
+ * @param baseDataPath The base path to use for reading and writing data files used within the framework.
11
+ * Files will be created under baseDataPath/.afj directory. If not specified, it will be set to
12
+ * RNFS.DocumentDirectoryPath
13
+ * @param baseCachePath The base path to use for reading and writing cache files used within the framework.
14
+ * Files will be created under baseCachePath/.afj directory. If not specified, it will be set to
15
+ * RNFS.CachesDirectoryPath
16
+ * @param baseTempPath The base path to use for reading and writing temporary files within the framework.
17
+ * Files will be created under baseTempPath/.afj directory. If not specified, it will be set to
18
+ * RNFS.TemporaryDirectoryPath
19
+ *
20
+ * @see https://github.com/itinance/react-native-fs#constants
21
+ */
22
+ constructor(options) {
23
+ this.dataPath = `${options?.baseDataPath ?? RNFS.DocumentDirectoryPath}/.afj`;
24
+ this.cachePath = options?.baseCachePath ? `${options?.baseCachePath}/.afj` : `${RNFS.CachesDirectoryPath}/.afj${Platform.OS === "android" ? "/cache" : ""}`;
25
+ this.tempPath = options?.baseTempPath ? `${options?.baseTempPath}/.afj` : `${RNFS.TemporaryDirectoryPath}/.afj${Platform.OS === "android" ? "/temp" : ""}`;
26
+ }
27
+ async exists(path) {
28
+ return RNFS.exists(path);
29
+ }
30
+ async createDirectory(path) {
31
+ await RNFS.mkdir(getDirFromFilePath(path));
32
+ }
33
+ async copyFile(sourcePath, destinationPath) {
34
+ await RNFS.copyFile(sourcePath, destinationPath);
35
+ }
36
+ async write(path, data) {
37
+ await RNFS.mkdir(getDirFromFilePath(path));
38
+ return RNFS.writeFile(path, data, "utf8");
39
+ }
40
+ async read(path) {
41
+ return RNFS.readFile(path, "utf8");
42
+ }
43
+ async delete(path) {
44
+ await RNFS.unlink(path);
45
+ }
46
+ async downloadToFile(url, path, options) {
47
+ await RNFS.mkdir(getDirFromFilePath(path));
48
+ const fromUrl = this.encodeUriIfRequired(url);
49
+ const { promise } = RNFS.downloadFile({
50
+ fromUrl,
51
+ toFile: path
52
+ });
53
+ await promise;
54
+ if (options?.verifyHash) {
55
+ const fileHash = await RNFS.hash(path, options.verifyHash.algorithm);
56
+ const fileHashBuffer = Buffer.from(fileHash, "hex");
57
+ if (fileHashBuffer.compare(options.verifyHash.hash) !== 0) {
58
+ await RNFS.unlink(path);
59
+ throw new CredoError(`Hash of downloaded file does not match expected hash. Expected: ${TypedArrayEncoder.toBase58(options.verifyHash.hash)}, Actual: ${TypedArrayEncoder.toBase58(fileHashBuffer)}`);
60
+ }
61
+ }
62
+ }
63
+ encodeUriIfRequired(uri) {
64
+ return uri === decodeURI(uri) ? encodeURI(uri) : uri;
65
+ }
66
+ };
67
+
68
+ //#endregion
69
+ export { ReactNativeFileSystem };
70
+ //# sourceMappingURL=ReactNativeFileSystem.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactNativeFileSystem.mjs","names":[],"sources":["../src/ReactNativeFileSystem.ts"],"sourcesContent":["import type { DownloadToFileOptions, FileSystem } from '@credo-ts/core'\n\nimport { Buffer, CredoError, TypedArrayEncoder, getDirFromFilePath } from '@credo-ts/core'\nimport { Platform } from 'react-native'\nimport * as RNFS from 'react-native-fs'\n\nexport class ReactNativeFileSystem implements FileSystem {\n public readonly dataPath\n public readonly cachePath\n public readonly tempPath\n\n /**\n * Create new ReactNativeFileSystem class instance.\n *\n * @param baseDataPath The base path to use for reading and writing data files used within the framework.\n * Files will be created under baseDataPath/.afj directory. If not specified, it will be set to\n * RNFS.DocumentDirectoryPath\n * @param baseCachePath The base path to use for reading and writing cache files used within the framework.\n * Files will be created under baseCachePath/.afj directory. If not specified, it will be set to\n * RNFS.CachesDirectoryPath\n * @param baseTempPath The base path to use for reading and writing temporary files within the framework.\n * Files will be created under baseTempPath/.afj directory. If not specified, it will be set to\n * RNFS.TemporaryDirectoryPath\n *\n * @see https://github.com/itinance/react-native-fs#constants\n */\n public constructor(options?: { baseDataPath?: string; baseCachePath?: string; baseTempPath?: string }) {\n this.dataPath = `${options?.baseDataPath ?? RNFS.DocumentDirectoryPath}/.afj`\n // In Android, TemporaryDirectoryPath falls back to CachesDirectoryPath\n this.cachePath = options?.baseCachePath\n ? `${options?.baseCachePath}/.afj`\n : `${RNFS.CachesDirectoryPath}/.afj${Platform.OS === 'android' ? '/cache' : ''}`\n this.tempPath = options?.baseTempPath\n ? `${options?.baseTempPath}/.afj`\n : `${RNFS.TemporaryDirectoryPath}/.afj${Platform.OS === 'android' ? '/temp' : ''}`\n }\n\n public async exists(path: string): Promise<boolean> {\n return RNFS.exists(path)\n }\n\n public async createDirectory(path: string): Promise<void> {\n await RNFS.mkdir(getDirFromFilePath(path))\n }\n\n public async copyFile(sourcePath: string, destinationPath: string): Promise<void> {\n await RNFS.copyFile(sourcePath, destinationPath)\n }\n\n public async write(path: string, data: string): Promise<void> {\n // Make sure parent directories exist\n await RNFS.mkdir(getDirFromFilePath(path))\n\n return RNFS.writeFile(path, data, 'utf8')\n }\n\n public async read(path: string): Promise<string> {\n return RNFS.readFile(path, 'utf8')\n }\n\n public async delete(path: string): Promise<void> {\n await RNFS.unlink(path)\n }\n\n public async downloadToFile(url: string, path: string, options?: DownloadToFileOptions) {\n // Make sure parent directories exist\n await RNFS.mkdir(getDirFromFilePath(path))\n\n const fromUrl = this.encodeUriIfRequired(url)\n\n const { promise } = RNFS.downloadFile({\n fromUrl,\n toFile: path,\n })\n\n await promise\n\n if (options?.verifyHash) {\n // RNFS returns hash as HEX\n const fileHash = await RNFS.hash(path, options.verifyHash.algorithm)\n const fileHashBuffer = Buffer.from(fileHash, 'hex')\n\n // If hash doesn't match, remove file and throw error\n if (fileHashBuffer.compare(options.verifyHash.hash) !== 0) {\n await RNFS.unlink(path)\n throw new CredoError(\n `Hash of downloaded file does not match expected hash. Expected: ${TypedArrayEncoder.toBase58(\n options.verifyHash.hash\n )}, Actual: ${TypedArrayEncoder.toBase58(fileHashBuffer)}`\n )\n }\n }\n }\n\n private encodeUriIfRequired(uri: string) {\n // Some characters in the URL might be invalid for\n // the native os to handle. Only encode if necessary.\n return uri === decodeURI(uri) ? encodeURI(uri) : uri\n }\n}\n"],"mappings":";;;;;AAMA,IAAa,wBAAb,MAAyD;;;;;;;;;;;;;;;;CAoBvD,AAAO,YAAY,SAAoF;AACrG,OAAK,WAAW,GAAG,SAAS,gBAAgB,KAAK,sBAAsB;AAEvE,OAAK,YAAY,SAAS,gBACtB,GAAG,SAAS,cAAc,SAC1B,GAAG,KAAK,oBAAoB,OAAO,SAAS,OAAO,YAAY,WAAW;AAC9E,OAAK,WAAW,SAAS,eACrB,GAAG,SAAS,aAAa,SACzB,GAAG,KAAK,uBAAuB,OAAO,SAAS,OAAO,YAAY,UAAU;;CAGlF,MAAa,OAAO,MAAgC;AAClD,SAAO,KAAK,OAAO,KAAK;;CAG1B,MAAa,gBAAgB,MAA6B;AACxD,QAAM,KAAK,MAAM,mBAAmB,KAAK,CAAC;;CAG5C,MAAa,SAAS,YAAoB,iBAAwC;AAChF,QAAM,KAAK,SAAS,YAAY,gBAAgB;;CAGlD,MAAa,MAAM,MAAc,MAA6B;AAE5D,QAAM,KAAK,MAAM,mBAAmB,KAAK,CAAC;AAE1C,SAAO,KAAK,UAAU,MAAM,MAAM,OAAO;;CAG3C,MAAa,KAAK,MAA+B;AAC/C,SAAO,KAAK,SAAS,MAAM,OAAO;;CAGpC,MAAa,OAAO,MAA6B;AAC/C,QAAM,KAAK,OAAO,KAAK;;CAGzB,MAAa,eAAe,KAAa,MAAc,SAAiC;AAEtF,QAAM,KAAK,MAAM,mBAAmB,KAAK,CAAC;EAE1C,MAAM,UAAU,KAAK,oBAAoB,IAAI;EAE7C,MAAM,EAAE,YAAY,KAAK,aAAa;GACpC;GACA,QAAQ;GACT,CAAC;AAEF,QAAM;AAEN,MAAI,SAAS,YAAY;GAEvB,MAAM,WAAW,MAAM,KAAK,KAAK,MAAM,QAAQ,WAAW,UAAU;GACpE,MAAM,iBAAiB,OAAO,KAAK,UAAU,MAAM;AAGnD,OAAI,eAAe,QAAQ,QAAQ,WAAW,KAAK,KAAK,GAAG;AACzD,UAAM,KAAK,OAAO,KAAK;AACvB,UAAM,IAAI,WACR,mEAAmE,kBAAkB,SACnF,QAAQ,WAAW,KACpB,CAAC,YAAY,kBAAkB,SAAS,eAAe,GACzD;;;;CAKP,AAAQ,oBAAoB,KAAa;AAGvC,SAAO,QAAQ,UAAU,IAAI,GAAG,UAAU,IAAI,GAAG"}
@@ -0,0 +1,25 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+
25
+ exports.__toESM = __toESM;
@@ -0,0 +1,10 @@
1
+ import { SecureEnvironmentKeyManagementService } from "./kms/SecureEnvironmentKeyManagementService.mjs";
2
+ import "react-native-get-random-values";
3
+ import "@azure/core-asynciterator-polyfill";
4
+ import { AgentDependencies } from "@credo-ts/core";
5
+
6
+ //#region src/index.d.ts
7
+ declare const agentDependencies: AgentDependencies;
8
+ //#endregion
9
+ export { SecureEnvironmentKeyManagementService, agentDependencies };
10
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;cAcM,mBAAmB"}
package/build/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import 'react-native-get-random-values';
2
- import '@azure/core-asynciterator-polyfill';
3
- import type { AgentDependencies } from '@credo-ts/core';
4
- export { SecureEnvironmentKeyManagementService } from './kms/SecureEnvironmentKeyManagementService';
1
+ import { SecureEnvironmentKeyManagementService } from "./kms/SecureEnvironmentKeyManagementService.js";
2
+ import { AgentDependencies } from "@credo-ts/core";
3
+
4
+ //#region src/index.d.ts
5
5
  declare const agentDependencies: AgentDependencies;
6
- export { agentDependencies };
6
+ //#endregion
7
+ export { SecureEnvironmentKeyManagementService, agentDependencies };
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;AASmG,cAK7F,iBAKL,EALwB,iBAAA"}
package/build/index.js CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.agentDependencies = exports.SecureEnvironmentKeyManagementService = void 0;
1
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.js');
2
+ const require_ReactNativeFileSystem = require('./ReactNativeFileSystem.js');
3
+ const require_SecureEnvironmentKeyManagementService = require('./kms/SecureEnvironmentKeyManagementService.js');
4
4
  require("react-native-get-random-values");
5
5
  require("@azure/core-asynciterator-polyfill");
6
- const events_1 = require("events");
7
- const ReactNativeFileSystem_1 = require("./ReactNativeFileSystem");
8
- var SecureEnvironmentKeyManagementService_1 = require("./kms/SecureEnvironmentKeyManagementService");
9
- Object.defineProperty(exports, "SecureEnvironmentKeyManagementService", { enumerable: true, get: function () { return SecureEnvironmentKeyManagementService_1.SecureEnvironmentKeyManagementService; } });
10
- const fetch = global.fetch;
11
- const WebSocket = global.WebSocket;
6
+ let events = require("events");
7
+ events = require_rolldown_runtime.__toESM(events);
8
+
9
+ //#region src/index.ts
12
10
  const agentDependencies = {
13
- FileSystem: ReactNativeFileSystem_1.ReactNativeFileSystem,
14
- fetch,
15
- EventEmitterClass: events_1.EventEmitter,
16
- WebSocketClass: WebSocket,
11
+ FileSystem: require_ReactNativeFileSystem.ReactNativeFileSystem,
12
+ fetch: global.fetch,
13
+ EventEmitterClass: events.EventEmitter,
14
+ WebSocketClass: global.WebSocket
17
15
  };
18
- exports.agentDependencies = agentDependencies;
19
- //# sourceMappingURL=index.js.map
16
+
17
+ //#endregion
18
+ exports.SecureEnvironmentKeyManagementService = require_SecureEnvironmentKeyManagementService.SecureEnvironmentKeyManagementService;
19
+ exports.agentDependencies = agentDependencies;
@@ -0,0 +1,17 @@
1
+ import { ReactNativeFileSystem } from "./ReactNativeFileSystem.mjs";
2
+ import { SecureEnvironmentKeyManagementService } from "./kms/SecureEnvironmentKeyManagementService.mjs";
3
+ import "react-native-get-random-values";
4
+ import "@azure/core-asynciterator-polyfill";
5
+ import { EventEmitter } from "events";
6
+
7
+ //#region src/index.ts
8
+ const agentDependencies = {
9
+ FileSystem: ReactNativeFileSystem,
10
+ fetch: global.fetch,
11
+ EventEmitterClass: EventEmitter,
12
+ WebSocketClass: global.WebSocket
13
+ };
14
+
15
+ //#endregion
16
+ export { SecureEnvironmentKeyManagementService, agentDependencies };
17
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["agentDependencies: AgentDependencies"],"sources":["../src/index.ts"],"sourcesContent":["import 'react-native-get-random-values'\nimport '@azure/core-asynciterator-polyfill'\n\nimport type { AgentDependencies } from '@credo-ts/core'\n\nimport { EventEmitter } from 'events'\n\nimport { ReactNativeFileSystem } from './ReactNativeFileSystem'\n\nexport { SecureEnvironmentKeyManagementService } from './kms/SecureEnvironmentKeyManagementService'\n\nconst fetch = global.fetch as unknown as AgentDependencies['fetch']\nconst WebSocket = global.WebSocket as unknown as AgentDependencies['WebSocketClass']\n\nconst agentDependencies: AgentDependencies = {\n FileSystem: ReactNativeFileSystem,\n fetch,\n EventEmitterClass: EventEmitter,\n WebSocketClass: WebSocket,\n}\n\nexport { agentDependencies }\n"],"mappings":";;;;;;;AAcA,MAAMA,oBAAuC;CAC3C,YAAY;CACZ,OALY,OAAO;CAMnB,mBAAmB;CACnB,gBANgB,OAAO;CAOxB"}
@@ -0,0 +1,22 @@
1
+ import { AgentContext, Kms } from "@credo-ts/core";
2
+
3
+ //#region src/kms/SecureEnvironmentKeyManagementService.d.ts
4
+ declare class SecureEnvironmentKeyManagementService implements Kms.KeyManagementService {
5
+ readonly backend = "secureEnvironment";
6
+ private readonly secureEnvironment;
7
+ isOperationSupported(_agentContext: AgentContext, operation: Kms.KmsOperation): boolean;
8
+ randomBytes(_agentContext: AgentContext, _options: Kms.KmsRandomBytesOptions): Kms.KmsRandomBytesReturn;
9
+ getPublicKey(_agentContext: AgentContext, keyId: string): Promise<Kms.KmsJwkPublic | null>;
10
+ importKey(): Promise<Kms.KmsImportKeyReturn<Kms.KmsJwkPrivate>>;
11
+ deleteKey(_agentContext: AgentContext, options: Kms.KmsDeleteKeyOptions): Promise<boolean>;
12
+ encrypt(): Promise<Kms.KmsEncryptReturn>;
13
+ decrypt(): Promise<Kms.KmsDecryptReturn>;
14
+ createKey(_agentContext: AgentContext, options: Kms.KmsCreateKeyOptions): Promise<Kms.KmsCreateKeyReturn>;
15
+ sign(_agentContext: AgentContext, options: Kms.KmsSignOptions): Promise<Kms.KmsSignReturn>;
16
+ verify(): Promise<Kms.KmsVerifyReturn>;
17
+ private publicJwkFromPublicKeyBytes;
18
+ private getKeyAsserted;
19
+ }
20
+ //#endregion
21
+ export { SecureEnvironmentKeyManagementService };
22
+ //# sourceMappingURL=SecureEnvironmentKeyManagementService.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecureEnvironmentKeyManagementService.d.mts","names":[],"sources":["../../src/kms/SecureEnvironmentKeyManagementService.ts"],"sourcesContent":[],"mappings":";;;cAMa,qCAAA,YAAiD,GAAA,CAAI;EAArD,SAAA,OAAA,GAAA,mBAAA;EAAsC,iBAAA,iBAAA;sBAIN,CAAA,aAAA,EAAA,YAAA,EAAA,SAAA,EAAyB,GAAA,CAAI,YAA7B,CAAA,EAAA,OAAA;aAA6B,CAAA,aAAA,EAgBtC,YAhBsC,EAAA,QAAA,EAgBd,GAAA,CAAI,qBAhBU,CAAA,EAgBc,GAAA,CAAI,oBAhBlB;cAgBtC,CAAA,aAAA,EAIO,YAJP,EAAA,KAAA,EAAA,MAAA,CAAA,EAIqC,OAJrC,CAI6C,GAAA,CAAI,YAJjD,GAAA,IAAA,CAAA;WAA4B,CAAA,CAAA,EAapC,OAboC,CAa5B,GAAA,CAAI,kBAbwB,CAaL,GAAA,CAAI,aAbC,CAAA,CAAA;WAA4B,CAAA,aAAA,EAiBpD,YAjBoD,EAAA,OAAA,EAiB7B,GAAA,CAAI,mBAjByB,CAAA,EAiBH,OAjBG,CAAA,OAAA,CAAA;SAIjD,CAAA,CAAA,EA6BjB,OA7BiB,CA6BT,GAAA,CAAI,gBA7BK,CAAA;SAA0C,CAAA,CAAA,EAiC3D,OAjC2D,CAiCnD,GAAA,CAAI,gBAjC+C,CAAA;WAAZ,CAAA,aAAA,EAsCtD,YAtCsD,EAAA,OAAA,EAuC5D,GAAA,CAAI,mBAvCwD,CAAA,EAwCpE,OAxCoE,CAwC5D,GAAA,CAAI,kBAxCwD,CAAA;MASd,CAAA,aAAI,EAiE5B,YAjE4B,EAAA,OAAA,EAiEL,GAAA,CAAI,cAjEC,CAAA,EAiEgB,OAjEhB,CAiEwB,GAAA,CAAI,aAjE5B,CAAA;QAA3B,CAAA,CAAI,EA8Ff,OA9Fe,CA8FP,GAAA,CAAI,eA9FG,CAAA;UAAZ,2BAAA;UAIY,cAAA"}
@@ -1,18 +1,22 @@
1
- import type { AgentContext } from '@credo-ts/core';
2
- import { Kms } from '@credo-ts/core';
3
- export declare class SecureEnvironmentKeyManagementService implements Kms.KeyManagementService {
4
- readonly backend = "secureEnvironment";
5
- private readonly secureEnvironment;
6
- isOperationSupported(_agentContext: AgentContext, operation: Kms.KmsOperation): boolean;
7
- randomBytes(_agentContext: AgentContext, _options: Kms.KmsRandomBytesOptions): Kms.KmsRandomBytesReturn;
8
- getPublicKey(_agentContext: AgentContext, keyId: string): Promise<Kms.KmsJwkPublic | null>;
9
- importKey(): Promise<Kms.KmsImportKeyReturn<Kms.KmsJwkPrivate>>;
10
- deleteKey(_agentContext: AgentContext, options: Kms.KmsDeleteKeyOptions): Promise<boolean>;
11
- encrypt(): Promise<Kms.KmsEncryptReturn>;
12
- decrypt(): Promise<Kms.KmsDecryptReturn>;
13
- createKey(_agentContext: AgentContext, options: Kms.KmsCreateKeyOptions): Promise<Kms.KmsCreateKeyReturn>;
14
- sign(_agentContext: AgentContext, options: Kms.KmsSignOptions): Promise<Kms.KmsSignReturn>;
15
- verify(): Promise<Kms.KmsVerifyReturn>;
16
- private publicJwkFromPublicKeyBytes;
17
- private getKeyAsserted;
1
+ import { AgentContext, Kms } from "@credo-ts/core";
2
+
3
+ //#region src/kms/SecureEnvironmentKeyManagementService.d.ts
4
+ declare class SecureEnvironmentKeyManagementService implements Kms.KeyManagementService {
5
+ readonly backend = "secureEnvironment";
6
+ private readonly secureEnvironment;
7
+ isOperationSupported(_agentContext: AgentContext, operation: Kms.KmsOperation): boolean;
8
+ randomBytes(_agentContext: AgentContext, _options: Kms.KmsRandomBytesOptions): Kms.KmsRandomBytesReturn;
9
+ getPublicKey(_agentContext: AgentContext, keyId: string): Promise<Kms.KmsJwkPublic | null>;
10
+ importKey(): Promise<Kms.KmsImportKeyReturn<Kms.KmsJwkPrivate>>;
11
+ deleteKey(_agentContext: AgentContext, options: Kms.KmsDeleteKeyOptions): Promise<boolean>;
12
+ encrypt(): Promise<Kms.KmsEncryptReturn>;
13
+ decrypt(): Promise<Kms.KmsDecryptReturn>;
14
+ createKey(_agentContext: AgentContext, options: Kms.KmsCreateKeyOptions): Promise<Kms.KmsCreateKeyReturn>;
15
+ sign(_agentContext: AgentContext, options: Kms.KmsSignOptions): Promise<Kms.KmsSignReturn>;
16
+ verify(): Promise<Kms.KmsVerifyReturn>;
17
+ private publicJwkFromPublicKeyBytes;
18
+ private getKeyAsserted;
18
19
  }
20
+ //#endregion
21
+ export { SecureEnvironmentKeyManagementService };
22
+ //# sourceMappingURL=SecureEnvironmentKeyManagementService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecureEnvironmentKeyManagementService.d.ts","names":[],"sources":["../../src/kms/SecureEnvironmentKeyManagementService.ts"],"sourcesContent":[],"mappings":";;;cAMa,qCAAA,YAAiD,GAAA,CAAI;EAArD,SAAA,OAAA,GAAA,mBAAA;EAAsC,iBAAA,iBAAA;sBAIN,CAAA,aAAA,EAAA,YAAA,EAAA,SAAA,EAAyB,GAAA,CAAI,YAA7B,CAAA,EAAA,OAAA;aAA6B,CAAA,aAAA,EAgBtC,YAhBsC,EAAA,QAAA,EAgBd,GAAA,CAAI,qBAhBU,CAAA,EAgBc,GAAA,CAAI,oBAhBlB;cAgBtC,CAAA,aAAA,EAIO,YAJP,EAAA,KAAA,EAAA,MAAA,CAAA,EAIqC,OAJrC,CAI6C,GAAA,CAAI,YAJjD,GAAA,IAAA,CAAA;WAA4B,CAAA,CAAA,EAapC,OAboC,CAa5B,GAAA,CAAI,kBAbwB,CAaL,GAAA,CAAI,aAbC,CAAA,CAAA;WAA4B,CAAA,aAAA,EAiBpD,YAjBoD,EAAA,OAAA,EAiB7B,GAAA,CAAI,mBAjByB,CAAA,EAiBH,OAjBG,CAAA,OAAA,CAAA;SAIjD,CAAA,CAAA,EA6BjB,OA7BiB,CA6BT,GAAA,CAAI,gBA7BK,CAAA;SAA0C,CAAA,CAAA,EAiC3D,OAjC2D,CAiCnD,GAAA,CAAI,gBAjC+C,CAAA;WAAZ,CAAA,aAAA,EAsCtD,YAtCsD,EAAA,OAAA,EAuC5D,GAAA,CAAI,mBAvCwD,CAAA,EAwCpE,OAxCoE,CAwC5D,GAAA,CAAI,kBAxCwD,CAAA;MASd,CAAA,aAAI,EAiE5B,YAjE4B,EAAA,OAAA,EAiEL,GAAA,CAAI,cAjEC,CAAA,EAiEgB,OAjEhB,CAiEwB,GAAA,CAAI,aAjE5B,CAAA;QAA3B,CAAA,CAAI,EA8Ff,OA9Fe,CA8FP,GAAA,CAAI,eA9FG,CAAA;UAAZ,2BAAA;UAIY,cAAA"}
@@ -1,133 +1,101 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SecureEnvironmentKeyManagementService = void 0;
4
- const core_1 = require("@credo-ts/core");
5
- const secureEnvironment_1 = require("./secureEnvironment");
6
- class SecureEnvironmentKeyManagementService {
7
- constructor() {
8
- this.backend = 'secureEnvironment';
9
- this.secureEnvironment = (0, secureEnvironment_1.importSecureEnvironment)();
10
- }
11
- isOperationSupported(_agentContext, operation) {
12
- if (operation.operation === 'createKey') {
13
- return operation.type.kty === 'EC' && operation.type.crv === 'P-256';
14
- }
15
- if (operation.operation === 'sign') {
16
- return operation.algorithm === 'ES256';
17
- }
18
- if (operation.operation === 'deleteKey') {
19
- return true;
20
- }
21
- return false;
22
- }
23
- randomBytes(_agentContext, _options) {
24
- throw new core_1.Kms.KeyManagementError(`Generating random bytes is not supported for backend '${this.backend}'`);
25
- }
26
- async getPublicKey(_agentContext, keyId) {
27
- try {
28
- return await this.getKeyAsserted(keyId);
29
- }
30
- catch (error) {
31
- if (error instanceof core_1.Kms.KeyManagementKeyNotFoundError)
32
- return null;
33
- throw error;
34
- }
35
- }
36
- async importKey() {
37
- throw new core_1.Kms.KeyManagementError(`Importing a key is not supported for backend '${this.backend}'`);
38
- }
39
- async deleteKey(_agentContext, options) {
40
- try {
41
- await this.secureEnvironment.deleteKey(options.keyId);
42
- return true;
43
- }
44
- catch (error) {
45
- if (error instanceof this.secureEnvironment.KeyNotFoundError) {
46
- return false;
47
- }
48
- throw new core_1.Kms.KeyManagementError(`Error deleting key with id '${options.keyId}' in backend '${this.backend}'`, {
49
- cause: error,
50
- });
51
- }
52
- }
53
- async encrypt() {
54
- throw new core_1.Kms.KeyManagementError(`Encryption is not supported for backend '${this.backend}'`);
55
- }
56
- async decrypt() {
57
- throw new core_1.Kms.KeyManagementError(`Decryption is not supported for backend '${this.backend}'`);
58
- }
59
- async createKey(_agentContext, options) {
60
- if (options.type.kty !== 'EC') {
61
- throw new core_1.Kms.KeyManagementAlgorithmNotSupportedError(`kty ${options.type.kty}. Only EC P-256 supported.`, this.backend);
62
- }
63
- if (options.type.crv !== 'P-256') {
64
- throw new core_1.Kms.KeyManagementAlgorithmNotSupportedError(`kty ${options.type.kty} with crv ${options.type.crv}. Only EC P-256 supported.`, this.backend);
65
- }
66
- const keyId = options.keyId ?? core_1.utils.uuid();
67
- try {
68
- await this.secureEnvironment.generateKeypair(keyId);
69
- return {
70
- keyId,
71
- publicJwk: await this.getKeyAsserted(keyId),
72
- };
73
- }
74
- catch (error) {
75
- if (error instanceof core_1.Kms.KeyManagementError)
76
- throw error;
77
- if (error instanceof this.secureEnvironment.KeyAlreadyExistsError) {
78
- throw new core_1.Kms.KeyManagementKeyExistsError(keyId, this.backend);
79
- }
80
- throw new core_1.Kms.KeyManagementError('Error creating key', { cause: error });
81
- }
82
- }
83
- async sign(_agentContext, options) {
84
- if (options.algorithm !== 'ES256') {
85
- throw new core_1.Kms.KeyManagementAlgorithmNotSupportedError(`algorithm '${options.algorithm}'. Only 'ES256' supported.`, this.backend);
86
- }
87
- try {
88
- // TODO: can we store something like 'use' for the key in secure environment?
89
- // Kms.assertKeyAllowsSign(publicJwk)
90
- // Perform the signing operation
91
- const signature = await this.secureEnvironment.sign(options.keyId, options.data);
92
- return {
93
- signature,
94
- };
95
- }
96
- catch (error) {
97
- if (error instanceof this.secureEnvironment.KeyNotFoundError) {
98
- throw new core_1.Kms.KeyManagementKeyNotFoundError(options.keyId, this.backend);
99
- }
100
- throw new core_1.Kms.KeyManagementError('Error signing with key', { cause: error });
101
- }
102
- }
103
- async verify() {
104
- throw new core_1.Kms.KeyManagementError(`verification of signatures is not supported for backend '${this.backend}'`);
105
- }
106
- publicJwkFromPublicKeyBytes(key, keyId) {
107
- const publicJwk = core_1.Kms.PublicJwk.fromPublicKey({
108
- kty: 'EC',
109
- crv: 'P-256',
110
- publicKey: key,
111
- }).toJson();
112
- return {
113
- ...publicJwk,
114
- kid: keyId,
115
- };
116
- }
117
- async getKeyAsserted(keyId) {
118
- try {
119
- const publicKeyBytes = await this.secureEnvironment.getPublicBytesForKeyId(keyId);
120
- return this.publicJwkFromPublicKeyBytes(publicKeyBytes, keyId);
121
- }
122
- catch (error) {
123
- if (error instanceof this.secureEnvironment.KeyNotFoundError) {
124
- throw new core_1.Kms.KeyManagementKeyNotFoundError(keyId, this.backend);
125
- }
126
- throw new core_1.Kms.KeyManagementError(`Error retrieving key with id '${keyId}' from backend ${this.backend}`, {
127
- cause: error,
128
- });
129
- }
130
- }
131
- }
132
- exports.SecureEnvironmentKeyManagementService = SecureEnvironmentKeyManagementService;
133
- //# sourceMappingURL=SecureEnvironmentKeyManagementService.js.map
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
2
+ const require_secureEnvironment = require('./secureEnvironment.js');
3
+ let __credo_ts_core = require("@credo-ts/core");
4
+ __credo_ts_core = require_rolldown_runtime.__toESM(__credo_ts_core);
5
+
6
+ //#region src/kms/SecureEnvironmentKeyManagementService.ts
7
+ var SecureEnvironmentKeyManagementService = class {
8
+ constructor() {
9
+ this.backend = "secureEnvironment";
10
+ this.secureEnvironment = require_secureEnvironment.importSecureEnvironment();
11
+ }
12
+ isOperationSupported(_agentContext, operation) {
13
+ if (operation.operation === "createKey") return operation.type.kty === "EC" && operation.type.crv === "P-256";
14
+ if (operation.operation === "sign") return operation.algorithm === "ES256";
15
+ if (operation.operation === "deleteKey") return true;
16
+ return false;
17
+ }
18
+ randomBytes(_agentContext, _options) {
19
+ throw new __credo_ts_core.Kms.KeyManagementError(`Generating random bytes is not supported for backend '${this.backend}'`);
20
+ }
21
+ async getPublicKey(_agentContext, keyId) {
22
+ try {
23
+ return await this.getKeyAsserted(keyId);
24
+ } catch (error) {
25
+ if (error instanceof __credo_ts_core.Kms.KeyManagementKeyNotFoundError) return null;
26
+ throw error;
27
+ }
28
+ }
29
+ async importKey() {
30
+ throw new __credo_ts_core.Kms.KeyManagementError(`Importing a key is not supported for backend '${this.backend}'`);
31
+ }
32
+ async deleteKey(_agentContext, options) {
33
+ const secureEnvironment = await this.secureEnvironment;
34
+ try {
35
+ await secureEnvironment.deleteKey(options.keyId);
36
+ return true;
37
+ } catch (error) {
38
+ if (error instanceof secureEnvironment.KeyNotFoundError) return false;
39
+ throw new __credo_ts_core.Kms.KeyManagementError(`Error deleting key with id '${options.keyId}' in backend '${this.backend}'`, { cause: error });
40
+ }
41
+ }
42
+ async encrypt() {
43
+ throw new __credo_ts_core.Kms.KeyManagementError(`Encryption is not supported for backend '${this.backend}'`);
44
+ }
45
+ async decrypt() {
46
+ throw new __credo_ts_core.Kms.KeyManagementError(`Decryption is not supported for backend '${this.backend}'`);
47
+ }
48
+ async createKey(_agentContext, options) {
49
+ if (options.type.kty !== "EC") throw new __credo_ts_core.Kms.KeyManagementAlgorithmNotSupportedError(`kty ${options.type.kty}. Only EC P-256 supported.`, this.backend);
50
+ if (options.type.crv !== "P-256") throw new __credo_ts_core.Kms.KeyManagementAlgorithmNotSupportedError(`kty ${options.type.kty} with crv ${options.type.crv}. Only EC P-256 supported.`, this.backend);
51
+ const keyId = options.keyId ?? __credo_ts_core.utils.uuid();
52
+ const secureEnvironment = await this.secureEnvironment;
53
+ try {
54
+ await secureEnvironment.generateKeypair(keyId);
55
+ return {
56
+ keyId,
57
+ publicJwk: await this.getKeyAsserted(keyId)
58
+ };
59
+ } catch (error) {
60
+ if (error instanceof __credo_ts_core.Kms.KeyManagementError) throw error;
61
+ if (error instanceof secureEnvironment.KeyAlreadyExistsError) throw new __credo_ts_core.Kms.KeyManagementKeyExistsError(keyId, this.backend);
62
+ throw new __credo_ts_core.Kms.KeyManagementError("Error creating key", { cause: error });
63
+ }
64
+ }
65
+ async sign(_agentContext, options) {
66
+ if (options.algorithm !== "ES256") throw new __credo_ts_core.Kms.KeyManagementAlgorithmNotSupportedError(`algorithm '${options.algorithm}'. Only 'ES256' supported.`, this.backend);
67
+ const secureEnvironment = await this.secureEnvironment;
68
+ try {
69
+ return { signature: await secureEnvironment.sign(options.keyId, options.data) };
70
+ } catch (error) {
71
+ if (error instanceof secureEnvironment.KeyNotFoundError) throw new __credo_ts_core.Kms.KeyManagementKeyNotFoundError(options.keyId, this.backend);
72
+ throw new __credo_ts_core.Kms.KeyManagementError("Error signing with key", { cause: error });
73
+ }
74
+ }
75
+ async verify() {
76
+ throw new __credo_ts_core.Kms.KeyManagementError(`verification of signatures is not supported for backend '${this.backend}'`);
77
+ }
78
+ publicJwkFromPublicKeyBytes(key, keyId) {
79
+ return {
80
+ ...__credo_ts_core.Kms.PublicJwk.fromPublicKey({
81
+ kty: "EC",
82
+ crv: "P-256",
83
+ publicKey: key
84
+ }).toJson(),
85
+ kid: keyId
86
+ };
87
+ }
88
+ async getKeyAsserted(keyId) {
89
+ const secureEnvironment = await this.secureEnvironment;
90
+ try {
91
+ const publicKeyBytes = await secureEnvironment.getPublicBytesForKeyId(keyId);
92
+ return this.publicJwkFromPublicKeyBytes(publicKeyBytes, keyId);
93
+ } catch (error) {
94
+ if (error instanceof secureEnvironment.KeyNotFoundError) throw new __credo_ts_core.Kms.KeyManagementKeyNotFoundError(keyId, this.backend);
95
+ throw new __credo_ts_core.Kms.KeyManagementError(`Error retrieving key with id '${keyId}' from backend ${this.backend}`, { cause: error });
96
+ }
97
+ }
98
+ };
99
+
100
+ //#endregion
101
+ exports.SecureEnvironmentKeyManagementService = SecureEnvironmentKeyManagementService;
@@ -0,0 +1,100 @@
1
+ import { importSecureEnvironment } from "./secureEnvironment.mjs";
2
+ import { Kms, utils } from "@credo-ts/core";
3
+
4
+ //#region src/kms/SecureEnvironmentKeyManagementService.ts
5
+ var SecureEnvironmentKeyManagementService = class {
6
+ constructor() {
7
+ this.backend = "secureEnvironment";
8
+ this.secureEnvironment = importSecureEnvironment();
9
+ }
10
+ isOperationSupported(_agentContext, operation) {
11
+ if (operation.operation === "createKey") return operation.type.kty === "EC" && operation.type.crv === "P-256";
12
+ if (operation.operation === "sign") return operation.algorithm === "ES256";
13
+ if (operation.operation === "deleteKey") return true;
14
+ return false;
15
+ }
16
+ randomBytes(_agentContext, _options) {
17
+ throw new Kms.KeyManagementError(`Generating random bytes is not supported for backend '${this.backend}'`);
18
+ }
19
+ async getPublicKey(_agentContext, keyId) {
20
+ try {
21
+ return await this.getKeyAsserted(keyId);
22
+ } catch (error) {
23
+ if (error instanceof Kms.KeyManagementKeyNotFoundError) return null;
24
+ throw error;
25
+ }
26
+ }
27
+ async importKey() {
28
+ throw new Kms.KeyManagementError(`Importing a key is not supported for backend '${this.backend}'`);
29
+ }
30
+ async deleteKey(_agentContext, options) {
31
+ const secureEnvironment = await this.secureEnvironment;
32
+ try {
33
+ await secureEnvironment.deleteKey(options.keyId);
34
+ return true;
35
+ } catch (error) {
36
+ if (error instanceof secureEnvironment.KeyNotFoundError) return false;
37
+ throw new Kms.KeyManagementError(`Error deleting key with id '${options.keyId}' in backend '${this.backend}'`, { cause: error });
38
+ }
39
+ }
40
+ async encrypt() {
41
+ throw new Kms.KeyManagementError(`Encryption is not supported for backend '${this.backend}'`);
42
+ }
43
+ async decrypt() {
44
+ throw new Kms.KeyManagementError(`Decryption is not supported for backend '${this.backend}'`);
45
+ }
46
+ async createKey(_agentContext, options) {
47
+ if (options.type.kty !== "EC") throw new Kms.KeyManagementAlgorithmNotSupportedError(`kty ${options.type.kty}. Only EC P-256 supported.`, this.backend);
48
+ if (options.type.crv !== "P-256") throw new Kms.KeyManagementAlgorithmNotSupportedError(`kty ${options.type.kty} with crv ${options.type.crv}. Only EC P-256 supported.`, this.backend);
49
+ const keyId = options.keyId ?? utils.uuid();
50
+ const secureEnvironment = await this.secureEnvironment;
51
+ try {
52
+ await secureEnvironment.generateKeypair(keyId);
53
+ return {
54
+ keyId,
55
+ publicJwk: await this.getKeyAsserted(keyId)
56
+ };
57
+ } catch (error) {
58
+ if (error instanceof Kms.KeyManagementError) throw error;
59
+ if (error instanceof secureEnvironment.KeyAlreadyExistsError) throw new Kms.KeyManagementKeyExistsError(keyId, this.backend);
60
+ throw new Kms.KeyManagementError("Error creating key", { cause: error });
61
+ }
62
+ }
63
+ async sign(_agentContext, options) {
64
+ if (options.algorithm !== "ES256") throw new Kms.KeyManagementAlgorithmNotSupportedError(`algorithm '${options.algorithm}'. Only 'ES256' supported.`, this.backend);
65
+ const secureEnvironment = await this.secureEnvironment;
66
+ try {
67
+ return { signature: await secureEnvironment.sign(options.keyId, options.data) };
68
+ } catch (error) {
69
+ if (error instanceof secureEnvironment.KeyNotFoundError) throw new Kms.KeyManagementKeyNotFoundError(options.keyId, this.backend);
70
+ throw new Kms.KeyManagementError("Error signing with key", { cause: error });
71
+ }
72
+ }
73
+ async verify() {
74
+ throw new Kms.KeyManagementError(`verification of signatures is not supported for backend '${this.backend}'`);
75
+ }
76
+ publicJwkFromPublicKeyBytes(key, keyId) {
77
+ return {
78
+ ...Kms.PublicJwk.fromPublicKey({
79
+ kty: "EC",
80
+ crv: "P-256",
81
+ publicKey: key
82
+ }).toJson(),
83
+ kid: keyId
84
+ };
85
+ }
86
+ async getKeyAsserted(keyId) {
87
+ const secureEnvironment = await this.secureEnvironment;
88
+ try {
89
+ const publicKeyBytes = await secureEnvironment.getPublicBytesForKeyId(keyId);
90
+ return this.publicJwkFromPublicKeyBytes(publicKeyBytes, keyId);
91
+ } catch (error) {
92
+ if (error instanceof secureEnvironment.KeyNotFoundError) throw new Kms.KeyManagementKeyNotFoundError(keyId, this.backend);
93
+ throw new Kms.KeyManagementError(`Error retrieving key with id '${keyId}' from backend ${this.backend}`, { cause: error });
94
+ }
95
+ }
96
+ };
97
+
98
+ //#endregion
99
+ export { SecureEnvironmentKeyManagementService };
100
+ //# sourceMappingURL=SecureEnvironmentKeyManagementService.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecureEnvironmentKeyManagementService.mjs","names":[],"sources":["../../src/kms/SecureEnvironmentKeyManagementService.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\n\nimport { Kms, utils } from '@credo-ts/core'\n\nimport { importSecureEnvironment } from './secureEnvironment'\n\nexport class SecureEnvironmentKeyManagementService implements Kms.KeyManagementService {\n public readonly backend = 'secureEnvironment'\n private readonly secureEnvironment = importSecureEnvironment()\n\n public isOperationSupported(_agentContext: AgentContext, operation: Kms.KmsOperation): boolean {\n if (operation.operation === 'createKey') {\n return operation.type.kty === 'EC' && operation.type.crv === 'P-256'\n }\n\n if (operation.operation === 'sign') {\n return operation.algorithm === 'ES256'\n }\n\n if (operation.operation === 'deleteKey') {\n return true\n }\n\n return false\n }\n\n public randomBytes(_agentContext: AgentContext, _options: Kms.KmsRandomBytesOptions): Kms.KmsRandomBytesReturn {\n throw new Kms.KeyManagementError(`Generating random bytes is not supported for backend '${this.backend}'`)\n }\n\n public async getPublicKey(_agentContext: AgentContext, keyId: string): Promise<Kms.KmsJwkPublic | null> {\n try {\n return await this.getKeyAsserted(keyId)\n } catch (error) {\n if (error instanceof Kms.KeyManagementKeyNotFoundError) return null\n throw error\n }\n }\n\n public async importKey(): Promise<Kms.KmsImportKeyReturn<Kms.KmsJwkPrivate>> {\n throw new Kms.KeyManagementError(`Importing a key is not supported for backend '${this.backend}'`)\n }\n\n public async deleteKey(_agentContext: AgentContext, options: Kms.KmsDeleteKeyOptions): Promise<boolean> {\n const secureEnvironment = await this.secureEnvironment\n try {\n await secureEnvironment.deleteKey(options.keyId)\n return true\n } catch (error) {\n if (error instanceof secureEnvironment.KeyNotFoundError) {\n return false\n }\n\n throw new Kms.KeyManagementError(`Error deleting key with id '${options.keyId}' in backend '${this.backend}'`, {\n cause: error,\n })\n }\n }\n\n public async encrypt(): Promise<Kms.KmsEncryptReturn> {\n throw new Kms.KeyManagementError(`Encryption is not supported for backend '${this.backend}'`)\n }\n\n public async decrypt(): Promise<Kms.KmsDecryptReturn> {\n throw new Kms.KeyManagementError(`Decryption is not supported for backend '${this.backend}'`)\n }\n\n public async createKey(\n _agentContext: AgentContext,\n options: Kms.KmsCreateKeyOptions\n ): Promise<Kms.KmsCreateKeyReturn> {\n if (options.type.kty !== 'EC') {\n throw new Kms.KeyManagementAlgorithmNotSupportedError(\n `kty ${options.type.kty}. Only EC P-256 supported.`,\n this.backend\n )\n }\n if (options.type.crv !== 'P-256') {\n throw new Kms.KeyManagementAlgorithmNotSupportedError(\n `kty ${options.type.kty} with crv ${options.type.crv}. Only EC P-256 supported.`,\n this.backend\n )\n }\n\n const keyId = options.keyId ?? utils.uuid()\n const secureEnvironment = await this.secureEnvironment\n\n try {\n await secureEnvironment.generateKeypair(keyId)\n\n return {\n keyId,\n publicJwk: await this.getKeyAsserted(keyId),\n }\n } catch (error) {\n if (error instanceof Kms.KeyManagementError) throw error\n if (error instanceof secureEnvironment.KeyAlreadyExistsError) {\n throw new Kms.KeyManagementKeyExistsError(keyId, this.backend)\n }\n\n throw new Kms.KeyManagementError('Error creating key', { cause: error })\n }\n }\n\n public async sign(_agentContext: AgentContext, options: Kms.KmsSignOptions): Promise<Kms.KmsSignReturn> {\n if (options.algorithm !== 'ES256') {\n throw new Kms.KeyManagementAlgorithmNotSupportedError(\n `algorithm '${options.algorithm}'. Only 'ES256' supported.`,\n this.backend\n )\n }\n\n const secureEnvironment = await this.secureEnvironment\n\n try {\n // TODO: can we store something like 'use' for the key in secure environment?\n // Kms.assertKeyAllowsSign(publicJwk)\n\n // Perform the signing operation\n const signature = await secureEnvironment.sign(options.keyId, options.data)\n\n return {\n signature,\n }\n } catch (error) {\n if (error instanceof secureEnvironment.KeyNotFoundError) {\n throw new Kms.KeyManagementKeyNotFoundError(options.keyId, this.backend)\n }\n\n throw new Kms.KeyManagementError('Error signing with key', { cause: error })\n }\n }\n\n public async verify(): Promise<Kms.KmsVerifyReturn> {\n throw new Kms.KeyManagementError(`verification of signatures is not supported for backend '${this.backend}'`)\n }\n\n private publicJwkFromPublicKeyBytes(key: Uint8Array, keyId: string) {\n const publicJwk = Kms.PublicJwk.fromPublicKey<Kms.P256PublicJwk['publicKey']>({\n kty: 'EC',\n crv: 'P-256',\n publicKey: key,\n }).toJson()\n\n return {\n ...publicJwk,\n kid: keyId,\n } satisfies Kms.KmsJwkPublicEc\n }\n\n private async getKeyAsserted(keyId: string) {\n const secureEnvironment = await this.secureEnvironment\n\n try {\n const publicKeyBytes = await secureEnvironment.getPublicBytesForKeyId(keyId)\n return this.publicJwkFromPublicKeyBytes(publicKeyBytes, keyId)\n } catch (error) {\n if (error instanceof secureEnvironment.KeyNotFoundError) {\n throw new Kms.KeyManagementKeyNotFoundError(keyId, this.backend)\n }\n\n throw new Kms.KeyManagementError(`Error retrieving key with id '${keyId}' from backend ${this.backend}`, {\n cause: error,\n })\n }\n }\n}\n"],"mappings":";;;;AAMA,IAAa,wCAAb,MAAuF;;OACrE,UAAU;OACT,oBAAoB,yBAAyB;;CAE9D,AAAO,qBAAqB,eAA6B,WAAsC;AAC7F,MAAI,UAAU,cAAc,YAC1B,QAAO,UAAU,KAAK,QAAQ,QAAQ,UAAU,KAAK,QAAQ;AAG/D,MAAI,UAAU,cAAc,OAC1B,QAAO,UAAU,cAAc;AAGjC,MAAI,U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AAC"}
@@ -1,13 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.importSecureEnvironment = importSecureEnvironment;
4
- function importSecureEnvironment() {
5
- try {
6
- const secureEnvironment = require('@animo-id/expo-secure-environment');
7
- return secureEnvironment;
8
- }
9
- catch (_error) {
10
- throw new Error('@animo-id/expo-secure-environment must be installed as a peer dependency');
11
- }
1
+
2
+ //#region src/kms/secureEnvironment.ts
3
+ async function importSecureEnvironment() {
4
+ try {
5
+ return require("@animo-id/expo-secure-environment");
6
+ } catch (_error) {
7
+ throw new Error("@animo-id/expo-secure-environment must be installed as a peer dependency");
8
+ }
12
9
  }
13
- //# sourceMappingURL=secureEnvironment.js.map
10
+
11
+ //#endregion
12
+ exports.importSecureEnvironment = importSecureEnvironment;
@@ -0,0 +1,12 @@
1
+ //#region src/kms/secureEnvironment.ts
2
+ async function importSecureEnvironment() {
3
+ try {
4
+ return await import("@animo-id/expo-secure-environment");
5
+ } catch (_error) {
6
+ throw new Error("@animo-id/expo-secure-environment must be installed as a peer dependency");
7
+ }
8
+ }
9
+
10
+ //#endregion
11
+ export { importSecureEnvironment };
12
+ //# sourceMappingURL=secureEnvironment.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"secureEnvironment.mjs","names":[],"sources":["../../src/kms/secureEnvironment.ts"],"sourcesContent":["export async function importSecureEnvironment() {\n try {\n const secureEnvironment = await import('@animo-id/expo-secure-environment')\n return secureEnvironment\n } catch (_error) {\n throw new Error('@animo-id/expo-secure-environment must be installed as a peer dependency')\n }\n}\n"],"mappings":";AAAA,eAAsB,0BAA0B;AAC9C,KAAI;AAEF,SAD0B,MAAM,OAAO;UAEhC,QAAQ;AACf,QAAM,IAAI,MAAM,2EAA2E"}
package/package.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "@credo-ts/react-native",
3
- "main": "build/index",
4
- "types": "build/index",
5
- "version": "0.6.0-alpha-20251010154241",
3
+ "exports": {
4
+ ".": {
5
+ "import": "./build/index.mjs",
6
+ "require": "./build/index.js",
7
+ "types": "./build/index.d.ts"
8
+ },
9
+ "./package.json": "./package.json"
10
+ },
11
+ "version": "0.6.0-alpha-20251010164336",
6
12
  "files": [
7
13
  "build"
8
14
  ],
@@ -19,13 +25,12 @@
19
25
  "dependencies": {
20
26
  "@azure/core-asynciterator-polyfill": "^1.0.2",
21
27
  "events": "^3.3.0",
22
- "@credo-ts/core": "0.6.0-alpha-20251010154241"
28
+ "@credo-ts/core": "0.6.0-alpha-20251010164336"
23
29
  },
24
30
  "devDependencies": {
25
31
  "react-native": "^0.79.3",
26
32
  "react-native-fs": "^2.20.0",
27
33
  "react-native-get-random-values": "^1.8.0",
28
- "rimraf": "^6.0.1",
29
34
  "typescript": "~5.8.3"
30
35
  },
31
36
  "peerDependencies": {
@@ -40,9 +45,9 @@
40
45
  }
41
46
  },
42
47
  "scripts": {
43
- "build": "pnpm run clean && pnpm run compile",
44
- "clean": "rimraf ./build",
45
- "compile": "tsc -p tsconfig.build.json",
46
- "test": "jest"
47
- }
48
+ "build": "tsdown --config-loader unconfig"
49
+ },
50
+ "main": "./build/index.js",
51
+ "types": "./build/index.d.ts",
52
+ "module": "./build/index.mjs"
48
53
  }
@@ -1,34 +0,0 @@
1
- import type { DownloadToFileOptions, FileSystem } from '@credo-ts/core';
2
- export declare class ReactNativeFileSystem implements FileSystem {
3
- readonly dataPath: string;
4
- readonly cachePath: string;
5
- readonly tempPath: string;
6
- /**
7
- * Create new ReactNativeFileSystem class instance.
8
- *
9
- * @param baseDataPath The base path to use for reading and writing data files used within the framework.
10
- * Files will be created under baseDataPath/.afj directory. If not specified, it will be set to
11
- * RNFS.DocumentDirectoryPath
12
- * @param baseCachePath The base path to use for reading and writing cache files used within the framework.
13
- * Files will be created under baseCachePath/.afj directory. If not specified, it will be set to
14
- * RNFS.CachesDirectoryPath
15
- * @param baseTempPath The base path to use for reading and writing temporary files within the framework.
16
- * Files will be created under baseTempPath/.afj directory. If not specified, it will be set to
17
- * RNFS.TemporaryDirectoryPath
18
- *
19
- * @see https://github.com/itinance/react-native-fs#constants
20
- */
21
- constructor(options?: {
22
- baseDataPath?: string;
23
- baseCachePath?: string;
24
- baseTempPath?: string;
25
- });
26
- exists(path: string): Promise<boolean>;
27
- createDirectory(path: string): Promise<void>;
28
- copyFile(sourcePath: string, destinationPath: string): Promise<void>;
29
- write(path: string, data: string): Promise<void>;
30
- read(path: string): Promise<string>;
31
- delete(path: string): Promise<void>;
32
- downloadToFile(url: string, path: string, options?: DownloadToFileOptions): Promise<void>;
33
- private encodeUriIfRequired;
34
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"ReactNativeFileSystem.js","sourceRoot":"","sources":["../src/ReactNativeFileSystem.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAA0F;AAC1F,+CAAuC;AACvC,sDAAuC;AAEvC,MAAa,qBAAqB;IAKhC;;;;;;;;;;;;;;OAcG;IACH,YAAmB,OAAkF;QACnG,IAAI,CAAC,QAAQ,GAAG,GAAG,OAAO,EAAE,YAAY,IAAI,IAAI,CAAC,qBAAqB,OAAO,CAAA;QAC7E,uEAAuE;QACvE,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE,aAAa;YACrC,CAAC,CAAC,GAAG,OAAO,EAAE,aAAa,OAAO;YAClC,CAAC,CAAC,GAAG,IAAI,CAAC,mBAAmB,QAAQ,uBAAQ,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;QAClF,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,YAAY;YACnC,CAAC,CAAC,GAAG,OAAO,EAAE,YAAY,OAAO;YACjC,CAAC,CAAC,GAAG,IAAI,CAAC,sBAAsB,QAAQ,uBAAQ,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAA;I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 -1 +0,0 @@
1
- {"version":3,"file":"SecureEnvironmentKeyManagementService.js","sourceRoot":"","sources":["../../src/kms/SecureEnvironmentKeyManagementService.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAE3C,2DAA6D;AAE7D,MAAa,qCAAqC;IAAlD;QACkB,YAAO,GAAG,mBAAmB,CAAA;QAC5B,sBAAiB,GAAG,IAAA,2CAAuB,GAAE,CAAA;IAwJhE,CAAC;IAtJQ,oBAAoB,CAAC,aAA2B,EAAE,SAA2B;QAClF,IAAI,SAAS,CAAC,SAAS,KAAK,WAAW,EAAE,CAAC;YACxC,OAAO,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,KAAK,OAAO,CAAA;QACtE,CAAC;QAED,IAAI,SAAS,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;YACnC,OAAO,SAAS,CAAC,SAAS,KAAK,OAAO,CAAA;QACxC,CAAC;QAED,IAAI,SAAS,CAAC,SAAS,KAAK,WAAW,EAAE,CAAC;YACxC,OAAO,IAAI,CAAA;QACb,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;IAEM,WAAW,CAAC,aAA2B,EAAE,QAAmC;QACjF,MAAM,IAAI,UAAG,CAAC,kBAAkB,CAAC,yDAAyD,IAAI,CAAC,OAAO,GAAG,CAAC,CAAA;IAC5G,CAAC;IAEM,KAAK,CAAC,YAAY,CAAC,aAA2B,EAAE,KAAa;QAClE,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;QACzC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,UAAG,CAAC,6BAA6B;gBAAE,OAAO,IAAI,CAAA;YACnE,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,SAAS;QACpB,MAAM,IAAI,UAAG,CAAC,kBAAkB,CAAC,iDAAiD,IAAI,C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;aACb,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF;AA1JD,sFA0JC"}
@@ -1,8 +0,0 @@
1
- export declare function importSecureEnvironment(): {
2
- sign: (id: string, message: Uint8Array) => Promise<Uint8Array>;
3
- getPublicBytesForKeyId: (id: string) => Promise<Uint8Array>;
4
- generateKeypair: (id: string) => Promise<void>;
5
- deleteKey: (id: string) => Promise<void>;
6
- KeyAlreadyExistsError: typeof Error;
7
- KeyNotFoundError: typeof Error;
8
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"secureEnvironment.js","sourceRoot":"","sources":["../../src/kms/secureEnvironment.ts"],"names":[],"mappings":";;AAAA,0DAcC;AAdD,SAAgB,uBAAuB;IAQrC,IAAI,CAAC;QACH,MAAM,iBAAiB,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAA;QACtE,OAAO,iBAAiB,CAAA;IAC1B,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAA;IAC7F,CAAC;AACH,CAAC"}