@yourself_id/siwys-react-native 0.28.6 → 0.28.7-feat-add-load-save-wallet.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/dist/index.cjs +29 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -315,6 +315,29 @@ var KeymasterReactNative = class _KeymasterReactNative {
|
|
|
315
315
|
options
|
|
316
316
|
);
|
|
317
317
|
}
|
|
318
|
+
// Load wallet
|
|
319
|
+
/**
|
|
320
|
+
* Loads the current wallet.
|
|
321
|
+
* @returns A promise with the loaded wallet file.
|
|
322
|
+
*/
|
|
323
|
+
static async loadWallet() {
|
|
324
|
+
_KeymasterReactNative.getInstance().ensureInitialized();
|
|
325
|
+
return _KeymasterReactNative.getInstance().loadWalletInternal();
|
|
326
|
+
}
|
|
327
|
+
// Save wallet
|
|
328
|
+
/**
|
|
329
|
+
* Saves the wallet.
|
|
330
|
+
* @param wallet The wallet to save.
|
|
331
|
+
* @param overwrite Optional flag to overwrite the existing wallet (default: true).
|
|
332
|
+
* @returns A promise with a boolean indicating success.
|
|
333
|
+
*/
|
|
334
|
+
static async saveWallet(wallet, overwrite = true) {
|
|
335
|
+
_KeymasterReactNative.getInstance().ensureInitialized();
|
|
336
|
+
return _KeymasterReactNative.getInstance().saveWalletInternal(
|
|
337
|
+
wallet,
|
|
338
|
+
overwrite
|
|
339
|
+
);
|
|
340
|
+
}
|
|
318
341
|
// Create a new wallet
|
|
319
342
|
/**
|
|
320
343
|
* Creates a new wallet.
|
|
@@ -481,6 +504,12 @@ var KeymasterReactNative = class _KeymasterReactNative {
|
|
|
481
504
|
async createSchemaInternal(...args) {
|
|
482
505
|
return this.keymasterService.createSchema(...args);
|
|
483
506
|
}
|
|
507
|
+
async loadWalletInternal() {
|
|
508
|
+
return this.keymasterService.loadWallet();
|
|
509
|
+
}
|
|
510
|
+
async saveWalletInternal(wallet, overwrite = true) {
|
|
511
|
+
return this.keymasterService.saveWallet(wallet, overwrite);
|
|
512
|
+
}
|
|
484
513
|
async newWalletInternal(...args) {
|
|
485
514
|
return this.keymasterService.newWallet(...args);
|
|
486
515
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/keymaster-react-native.ts","../src/gatekeeper-react-native.ts"],"sourcesContent":["export {\n KeymasterReactNative,\n KeymasterConfig as KeymasterReactNativeConfig,\n} from \"./keymaster-react-native.js\";\nexport { GatekeeperReactNative } from \"./gatekeeper-react-native.js\";\n\nexport {\n SdkConfig,\n WalletConfig,\n CreateChallengeResponse,\n CreateChallengeSpec,\n} from \"./types/index.js\";\n\nexport * from \"@mdip/keymaster\";\nimport * as GatekeeperTypes from \"@mdip/gatekeeper\";\n\nexport { GatekeeperTypes };\n","// Imports\nimport CipherNode from \"@mdip/cipher\";\nimport {\n ChallengeResponse,\n CreateAssetOptions,\n CreateResponseOptions,\n IssueCredentialsOptions,\n VerifiableCredential,\n WalletBase,\n WalletFile,\n} from \"@mdip/keymaster\";\n\nimport {\n GatekeeperClient,\n MdipDocument,\n Operation,\n ResolveDIDOptions,\n} from \"@mdip/gatekeeper\";\nimport {\n CreateChallengeResponse,\n CreateChallengeSpec,\n SdkConfig,\n} from \"./types/index.js\";\nimport KeymasterModule from \"@mdip/keymaster\";\n\n// @ts-ignore\nconst Keymaster = KeymasterModule?.default || KeymasterModule;\n\n// Keymaster configuration interface\nexport interface KeymasterConfig {\n gatekeeperConfig?: SdkConfig;\n walletDb?: WalletBase;\n cipher?: CipherNode;\n passphrase: string;\n}\nexport class KeymasterReactNative {\n private static instance: KeymasterReactNative | null = null;\n private config: KeymasterConfig;\n private keymasterService!: typeof Keymaster;\n private gatekeeper: GatekeeperClient | null = null;\n\n private constructor(config: KeymasterConfig) {\n this.validateConfig(config);\n this.config = config;\n }\n\n // Initializes the instance if not already initialized\n /**\n * Initializes the KeymasterReactNative instance.\n * @param config The configuration object for the Keymaster service.\n */\n public static initialize(config: KeymasterConfig): void {\n if (!KeymasterReactNative.instance) {\n KeymasterReactNative.instance = new KeymasterReactNative(config);\n } else {\n console.warn(\n \"KeymasterReactNative already initialized, ignoring re-initialization.\"\n );\n }\n }\n\n // Ensures the instance is initialized\n private ensureInitialized(): void {\n if (!KeymasterReactNative.instance) {\n throw new Error(\n \"KeymasterReactNative not initialized. Call KeymasterReactNative.initialize() first.\"\n );\n }\n }\n\n /**\n * Starts the KeymasterReactNative service.\n * @returns A boolean indicating whether the service was started successfully.\n */\n public static async start(): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().startInternal();\n }\n\n // Method to create a challenge\n /**\n * Creates a challenge for the user to solve.\n * @param spec The challenge specifications.\n * @param options Additional options for creating the challenge (optional).\n * @returns A promise with the challenge response, including the challenge and its callback URL.\n */\n public static async createChallenge(\n spec: CreateChallengeSpec,\n options?: CreateAssetOptions\n ): Promise<CreateChallengeResponse> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createChallengeInternal(\n spec,\n options\n );\n }\n\n // Method to bind a credential to a user\n /**\n * Binds a credential to a subject.\n * @param schemaId The schema ID for the credential.\n * @param subjectId The subject's DID (Decentralized Identifier).\n * @param options Optional options, such as validity period and credential data.\n * @returns A promise with the verifiable credential that was bound.\n */\n public static async bindCredential(\n schemaId: string,\n subjectId: string,\n options?: {\n validFrom?: string;\n validUntil?: string;\n credential?: Record<string, unknown>;\n }\n ): Promise<VerifiableCredential> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().bindCredentialInternal(\n schemaId,\n subjectId,\n options\n );\n }\n\n // Method to create a response\n /**\n * Creates a response for the challenge.\n * @param challengeDID The DID of the challenge to respond to.\n * @param options Optional options for creating the response (optional).\n * @returns A promise with the response string.\n */\n public static async createResponse(\n challengeDID: string,\n options?: CreateResponseOptions\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createResponseInternal(\n challengeDID,\n options\n );\n }\n\n // Backup wallet\n /**\n * Backups the wallet data.\n * @param registry Optional registry URL for the wallet backup.\n * @returns A promise with a backup string (e.g., backup URL).\n */\n public static async backupWallet(registry?: string): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().backupWalletInternal(registry);\n }\n\n // Issue credential to a user\n /**\n * Issues a credential to the subject.\n * @param credential The credential to be issued.\n * @param options Optional parameters for issuing the credential.\n * @returns A promise with the credential ID or issuance result.\n */\n public static async issueCredential(\n credential: Partial<VerifiableCredential>,\n options?: IssueCredentialsOptions\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().issueCredentialInternal(\n credential,\n options\n );\n }\n\n // Publish a credential\n /**\n * Publishes a verifiable credential.\n * @param did The DID of the credential.\n * @param options Optional parameters, such as whether to reveal the credential.\n * @returns A promise with the published credential.\n */\n public static async publishCredential(\n did: string,\n options?: {\n reveal?: boolean;\n }\n ): Promise<VerifiableCredential> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().publishCredentialInternal(\n did,\n options\n );\n }\n\n // Accept a credential\n /**\n * Accepts a credential.\n * @param did The DID of the credential to accept.\n * @returns A promise indicating whether the credential was successfully accepted.\n */\n public static async acceptCredential(did: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().acceptCredentialInternal(did);\n }\n\n // Show mnemonic\n /**\n * Shows the mnemonic for the wallet.\n * @returns A promise with the mnemonic string.\n */\n public static async showMnemonic(): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().showMnemonicInternal();\n }\n\n // Verify a challenge response\n /**\n * Verifies a response to a challenge.\n * @param did The DID to verify the response for.\n * @param options Optional options, such as retry behavior.\n * @returns A promise with the response verification result.\n */\n public static async verifyResponse(\n did: string,\n options?: { retries?: number; delay?: number }\n ): Promise<ChallengeResponse> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().verifyResponseInternal(\n did,\n options\n );\n }\n\n // Decrypt a message\n /**\n * Decrypts a message using the current key.\n * @param did The DID of the message to decrypt.\n * @returns A promise with the decrypted message.\n */\n public static async decryptMessage(did: string): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().decryptMessageInternal(did);\n }\n\n // Decrypt mnemonic\n /**\n * Decrypts the mnemonic for the wallet.\n * @returns A promise with the decrypted mnemonic.\n */\n public static async decryptMnemonic(): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().decryptMnemonicInternal();\n }\n\n // Get a credential\n /**\n * Retrieves a verifiable credential.\n * @param id The credential ID to retrieve.\n * @returns A promise with the credential data or null if not found.\n */\n public static async getCredential(\n id: string\n ): Promise<VerifiableCredential | null> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().getCredentialInternal(id);\n }\n\n // Remove a credential\n /**\n * Removes a verifiable credential.\n * @param id The credential ID to remove.\n * @returns A promise indicating success or failure of the operation.\n */\n public static async removeCredential(id: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().removeCredentialInternal(id);\n }\n\n // Update a credential\n /**\n * Updates a verifiable credential.\n * @param did The DID of the credential to update.\n * @param credential The new credential data.\n * @returns A promise indicating success or failure of the update operation.\n */\n public static async updateCredential(\n did: string,\n credential: VerifiableCredential\n ): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().updateCredentialInternal(\n did,\n credential\n );\n }\n\n // Method to create an ID\n /**\n * Creates a new DID (Decentralized Identifier).\n * @param name The name for the DID.\n * @param options Optional options, such as registry URL.\n * @returns A promise with the newly created DID.\n */\n public static async createId(\n name: string,\n options?: {\n registry?: string;\n }\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createIdInternal(name, options);\n }\n\n // Method to create an ID\n /**\n * Creates a new DID (Decentralized Identifier).\n * @param name The name for the DID.\n * @param options Optional options, such as registry URL.\n * @returns A promise with the newly created DID.\n */\n public static async createIdOperation(\n name: string,\n account: number,\n options?: {\n registry?: string;\n }\n ): Promise<Operation> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createIdOperationInternal(name, account, options);\n }\n\n // Remove an ID\n /**\n * Removes an existing DID.\n * @param name The name of the DID to remove.\n * @returns A promise indicating success or failure of the operation.\n */\n public static async removeId(name: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().removeIdInternal(name);\n }\n\n // Resolve a DID\n /**\n * Resolves a DID to fetch associated data.\n * @param did The DID to resolve.\n * @param options Optional parameters for resolving the DID.\n * @returns A promise with the resolved DID data.\n */\n public static async resolveDID(\n did: string,\n options?: ResolveDIDOptions\n ): Promise<MdipDocument> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().resolveDIDInternal(did, options);\n }\n\n // Set the current DID\n /**\n * Sets the current DID in use.\n * @param name The DID name to set as the current one.\n * @returns A promise indicating success or failure of the operation.\n */\n public static async setCurrentId(name: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().setCurrentIdInternal(name);\n }\n\n // Create a schema\n /**\n * Creates a new schema for credentials.\n * @param schema The schema data to create.\n * @param options Optional options for creating the schema.\n * @returns A promise with the created schema data.\n */\n public static async createSchema(\n schema?: unknown,\n options?: CreateAssetOptions\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createSchemaInternal(\n schema,\n options\n );\n }\n\n // Create a new wallet\n /**\n * Creates a new wallet.\n * @param mnemonic Optional mnemonic to initialize the wallet.\n * @param overwrite Optional flag to overwrite the existing wallet.\n * @returns A promise with the wallet creation result.\n */\n public static async newWallet(\n mnemonic?: string,\n overwrite?: boolean\n ): Promise<WalletFile> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().newWalletInternal(\n mnemonic,\n overwrite\n );\n }\n\n /**\n * Adds a custom header to the GatekeeperClient instance.\n * @param header Header name\n * @param value Header value\n */\n public static addCustomHeader(header: string, value: string): void {\n KeymasterReactNative.getInstance().ensureInitialized();\n const gatekeeper = KeymasterReactNative.getInstance().getGatekeeper();\n return gatekeeper.addCustomHeader(header, value);\n }\n\n /**\n * Removes a custom header from the GatekeeperClient instance.\n * @param header Header name\n */\n public static removeCustomHeader(header: string): void {\n KeymasterReactNative.getInstance().ensureInitialized();\n const gatekeeper = KeymasterReactNative.getInstance().getGatekeeper();\n return gatekeeper.removeCustomHeader(header);\n }\n\n // Recover an existing wallet\n /**\n * Recovers a wallet from a backup.\n * @param did The DID to use for recovery (optional).\n * @returns A promise with the wallet recovery result.\n */\n public static async recoverWallet(did?: string): Promise<WalletFile> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().recoverWalletInternal(did);\n }\n\n // Helper method to retrieve the instance\n private static getInstance(): KeymasterReactNative {\n if (!KeymasterReactNative.instance) {\n throw new Error(\n \"KeymasterReactNative not initialized. Call KeymasterReactNative.initialize() first.\"\n );\n }\n return KeymasterReactNative.instance;\n }\n\n private getGatekeeper(): GatekeeperClient {\n if (!this.gatekeeper) {\n throw new Error(\"GatekeeperClient not initialized\");\n }\n return this.gatekeeper;\n }\n\n // -------- Internal instance methods (originals renamed with Internal) -------\n\n private async startInternal(): Promise<boolean> {\n if (this.config.gatekeeperConfig) {\n return await this.startIntegratedKeymaster();\n } else {\n throw \"Missing Gatekeeper config\";\n }\n }\n\n private async startIntegratedKeymaster(): Promise<boolean> {\n try {\n if (this.config.walletDb && this.config.cipher) {\n if (!this.gatekeeper) {\n this.gatekeeper = new GatekeeperClient();\n }\n await this.gatekeeper.connect({\n url: this.config.gatekeeperConfig?.url,\n waitUntilReady: this.config.gatekeeperConfig?.waitUntilReady,\n intervalSeconds: this.config.gatekeeperConfig?.intervalSeconds,\n chatty: this.config.gatekeeperConfig?.chatty,\n });\n if (this.config.gatekeeperConfig?.token) {\n this.gatekeeper.addCustomHeader(\n \"authorization\",\n `Bearer ${this.config.gatekeeperConfig.token}`\n );\n }\n this.keymasterService = new Keymaster({\n gatekeeper: this.gatekeeper,\n wallet: this.config.walletDb,\n cipher: this.config.cipher,\n passphrase: this.config.passphrase,\n });\n } else {\n return false;\n }\n } catch (e) {\n console.error(\"Error starting KeymasterReactNative service:\", e);\n return false;\n }\n return true;\n }\n\n private async createChallengeInternal(\n spec: CreateChallengeSpec,\n options?: CreateAssetOptions\n ): Promise<CreateChallengeResponse> {\n const challenge: string = await this.keymasterService.createChallenge(\n spec,\n options\n );\n return {\n challenge: challenge,\n challengeUrl: `${spec.callback}?challenge=${challenge}`,\n };\n }\n\n private async bindCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"bindCredential\"]>\n ) {\n return this.keymasterService.bindCredential(...args);\n }\n\n private async createResponseInternal(\n ...args: Parameters<(typeof Keymaster)[\"createResponse\"]>\n ) {\n return this.keymasterService.createResponse(...args);\n }\n\n private async backupWalletInternal(registry?: string): Promise<string> {\n return this.keymasterService.backupWallet(registry);\n }\n\n private async issueCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"issueCredential\"]>\n ) {\n return this.keymasterService.issueCredential(...args);\n }\n\n private async publishCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"publishCredential\"]>\n ) {\n return this.keymasterService.publishCredential(...args);\n }\n\n private async acceptCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"acceptCredential\"]>\n ) {\n return this.keymasterService.acceptCredential(...args);\n }\n\n private async showMnemonicInternal(): Promise<string> {\n return this.keymasterService.decryptMnemonic();\n }\n\n private async verifyResponseInternal(\n ...args: Parameters<(typeof Keymaster)[\"verifyResponse\"]>\n ) {\n return this.keymasterService.verifyResponse(...args);\n }\n\n private async decryptMessageInternal(\n ...args: Parameters<(typeof Keymaster)[\"decryptMessage\"]>\n ) {\n return this.keymasterService.decryptMessage(...args);\n }\n\n private async decryptMnemonicInternal() {\n return this.keymasterService.decryptMnemonic();\n }\n\n private async getCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"getCredential\"]>\n ) {\n return this.keymasterService.getCredential(...args);\n }\n\n private async removeCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"removeCredential\"]>\n ) {\n return this.keymasterService.removeCredential(...args);\n }\n\n private async updateCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"updateCredential\"]>\n ) {\n return this.keymasterService.updateCredential(...args);\n }\n\n private async createIdInternal(\n ...args: Parameters<(typeof Keymaster)[\"createId\"]>\n ) {\n return this.keymasterService.createId(...args);\n }\n\n private async createIdOperationInternal(\n ...args: Parameters<(typeof Keymaster)[\"createIdOperation\"]>\n ) {\n return this.keymasterService.createIdOperation(...args);\n }\n\n private async removeIdInternal(\n ...args: Parameters<(typeof Keymaster)[\"removeId\"]>\n ) {\n return this.keymasterService.removeId(...args);\n }\n\n private async resolveDIDInternal(\n ...args: Parameters<(typeof Keymaster)[\"resolveDID\"]>\n ) {\n return this.keymasterService.resolveDID(...args);\n }\n\n private async setCurrentIdInternal(\n ...args: Parameters<(typeof Keymaster)[\"setCurrentId\"]>\n ) {\n return this.keymasterService.setCurrentId(...args);\n }\n\n private async createSchemaInternal(\n ...args: Parameters<(typeof Keymaster)[\"createSchema\"]>\n ) {\n return this.keymasterService.createSchema(...args);\n }\n\n private async newWalletInternal(\n ...args: Parameters<(typeof Keymaster)[\"newWallet\"]>\n ) {\n return this.keymasterService.newWallet(...args);\n }\n\n private async recoverWalletInternal(\n ...args: Parameters<(typeof Keymaster)[\"recoverWallet\"]>\n ) {\n return this.keymasterService.recoverWallet(...args);\n }\n\n private validateConfig(config: KeymasterConfig): void {\n if (!config.gatekeeperConfig) {\n throw new Error(\"Missing Gatekeeper config\");\n }\n\n if (config.gatekeeperConfig) {\n if (!config.walletDb?.loadWallet) {\n throw new Error(\"Missing load wallet callback\");\n }\n if (!config.walletDb?.saveWallet) {\n throw new Error(\"Missing save wallet callback\");\n }\n if (!config.passphrase) {\n throw new Error(\"Missing passphrase\");\n }\n }\n }\n}\n","import { SdkConfig } from \"./types/index.js\";\nimport {\n GatekeeperClient,\n MdipDocument,\n GetDIDOptions,\n Operation,\n} from \"@mdip/gatekeeper\";\n\nexport class GatekeeperReactNative {\n private static instance: GatekeeperReactNative | null = null;\n\n private config: SdkConfig;\n private gatekeeperClient!: GatekeeperClient;\n\n private constructor(config: SdkConfig) {\n this.validateConfig(config);\n this.config = config;\n }\n\n public static initialize(config: SdkConfig) {\n if (!GatekeeperReactNative.instance) {\n GatekeeperReactNative.instance = new GatekeeperReactNative(config);\n } else {\n console.warn(\n \"GatekeeperReactNative already initialized, ignoring re-initialization.\"\n );\n }\n }\n\n private ensureInitialized() {\n if (!GatekeeperReactNative.instance) {\n throw new Error(\n \"GatekeeperReactNative not initialized. Call GatekeeperReactNative.initialize() first.\"\n );\n }\n }\n\n // Delegated STATIC methods\n\n public static async start() {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().startInternal();\n }\n\n public static async getDIDs(\n ...args: Parameters<GatekeeperReactNative[\"getDIDsInternal\"]>\n ) {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().getDIDsInternal(...args);\n }\n\n public static async addCustomHeader({\n header,\n value,\n }: {\n header: string;\n value: string;\n }) {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().addCustomHeaderInternal({\n header,\n value,\n });\n }\n\n public static async removeCustomHeader({ header }: { header: string }) {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().removeCustomHeaderInternal({\n header,\n });\n }\n\n public static async generateDID(operation: Operation): Promise<string> {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().generateDIDInternal(operation);\n }\n\n private static getInstance(): GatekeeperReactNative {\n if (!GatekeeperReactNative.instance) {\n throw new Error(\n \"GatekeeperReactNative not initialized. Call GatekeeperReactNative.initialize() first.\"\n );\n }\n return GatekeeperReactNative.instance;\n }\n\n // -------- Internal instance methods (originals renamed with Internal) -------\n\n private async startInternal(): Promise<boolean> {\n if (this.config) {\n return await this.startIntegratedGatekeeper();\n } else {\n throw \"Missing Gatekeeper config\";\n }\n }\n\n private async startIntegratedGatekeeper(): Promise<boolean> {\n try {\n this.gatekeeperClient = new GatekeeperClient();\n await this.gatekeeperClient.connect({\n url: this.config?.url,\n waitUntilReady: this.config?.waitUntilReady,\n intervalSeconds: this.config?.intervalSeconds,\n chatty: this.config?.chatty,\n });\n } catch (e) {\n console.error(\"Error starting GatekeeperReactNative service:\", e);\n return false;\n }\n return true;\n }\n\n private async getDIDsInternal({\n dids,\n resolve,\n }: GetDIDOptions): Promise<string[] | MdipDocument[]> {\n const response = await this.gatekeeperClient.getDIDs({ dids, resolve });\n return response;\n }\n\n private async addCustomHeaderInternal({\n header,\n value,\n }: {\n header: string;\n value: string;\n }): Promise<void> {\n await this.gatekeeperClient.addCustomHeader(header, value);\n }\n\n private async removeCustomHeaderInternal({\n header,\n }: {\n header: string;\n }): Promise<void> {\n await this.gatekeeperClient.removeCustomHeader(header);\n }\n\n private async generateDIDInternal(operation: Operation): Promise<string> {\n return await this.gatekeeperClient.generateDID(operation);\n }\n\n private validateConfig(config: SdkConfig): void {\n if (!config) {\n throw new Error(\"Missing Gatekeeper config\");\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACYA,wBAKO;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ymasterModule","import_gatekeeper"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/keymaster-react-native.ts","../src/gatekeeper-react-native.ts"],"sourcesContent":["export {\n KeymasterReactNative,\n KeymasterConfig as KeymasterReactNativeConfig,\n} from \"./keymaster-react-native.js\";\nexport { GatekeeperReactNative } from \"./gatekeeper-react-native.js\";\n\nexport {\n SdkConfig,\n WalletConfig,\n CreateChallengeResponse,\n CreateChallengeSpec,\n} from \"./types/index.js\";\n\nexport * from \"@mdip/keymaster\";\nimport * as GatekeeperTypes from \"@mdip/gatekeeper\";\n\nexport { GatekeeperTypes };\n","// Imports\nimport CipherNode from \"@mdip/cipher\";\nimport {\n ChallengeResponse,\n CreateAssetOptions,\n CreateResponseOptions,\n IssueCredentialsOptions,\n StoredWallet,\n VerifiableCredential,\n WalletBase,\n WalletFile,\n} from \"@mdip/keymaster\";\n\nimport {\n GatekeeperClient,\n MdipDocument,\n Operation,\n ResolveDIDOptions,\n} from \"@mdip/gatekeeper\";\nimport {\n CreateChallengeResponse,\n CreateChallengeSpec,\n SdkConfig,\n} from \"./types/index.js\";\nimport KeymasterModule from \"@mdip/keymaster\";\n\n// @ts-ignore\nconst Keymaster = KeymasterModule?.default || KeymasterModule;\n\n// Keymaster configuration interface\nexport interface KeymasterConfig {\n gatekeeperConfig?: SdkConfig;\n walletDb?: WalletBase;\n cipher?: CipherNode;\n passphrase: string;\n}\nexport class KeymasterReactNative {\n private static instance: KeymasterReactNative | null = null;\n private config: KeymasterConfig;\n private keymasterService!: typeof Keymaster;\n private gatekeeper: GatekeeperClient | null = null;\n\n private constructor(config: KeymasterConfig) {\n this.validateConfig(config);\n this.config = config;\n }\n\n // Initializes the instance if not already initialized\n /**\n * Initializes the KeymasterReactNative instance.\n * @param config The configuration object for the Keymaster service.\n */\n public static initialize(config: KeymasterConfig): void {\n if (!KeymasterReactNative.instance) {\n KeymasterReactNative.instance = new KeymasterReactNative(config);\n } else {\n console.warn(\n \"KeymasterReactNative already initialized, ignoring re-initialization.\"\n );\n }\n }\n\n // Ensures the instance is initialized\n private ensureInitialized(): void {\n if (!KeymasterReactNative.instance) {\n throw new Error(\n \"KeymasterReactNative not initialized. Call KeymasterReactNative.initialize() first.\"\n );\n }\n }\n\n /**\n * Starts the KeymasterReactNative service.\n * @returns A boolean indicating whether the service was started successfully.\n */\n public static async start(): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().startInternal();\n }\n\n // Method to create a challenge\n /**\n * Creates a challenge for the user to solve.\n * @param spec The challenge specifications.\n * @param options Additional options for creating the challenge (optional).\n * @returns A promise with the challenge response, including the challenge and its callback URL.\n */\n public static async createChallenge(\n spec: CreateChallengeSpec,\n options?: CreateAssetOptions\n ): Promise<CreateChallengeResponse> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createChallengeInternal(\n spec,\n options\n );\n }\n\n // Method to bind a credential to a user\n /**\n * Binds a credential to a subject.\n * @param schemaId The schema ID for the credential.\n * @param subjectId The subject's DID (Decentralized Identifier).\n * @param options Optional options, such as validity period and credential data.\n * @returns A promise with the verifiable credential that was bound.\n */\n public static async bindCredential(\n schemaId: string,\n subjectId: string,\n options?: {\n validFrom?: string;\n validUntil?: string;\n credential?: Record<string, unknown>;\n }\n ): Promise<VerifiableCredential> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().bindCredentialInternal(\n schemaId,\n subjectId,\n options\n );\n }\n\n // Method to create a response\n /**\n * Creates a response for the challenge.\n * @param challengeDID The DID of the challenge to respond to.\n * @param options Optional options for creating the response (optional).\n * @returns A promise with the response string.\n */\n public static async createResponse(\n challengeDID: string,\n options?: CreateResponseOptions\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createResponseInternal(\n challengeDID,\n options\n );\n }\n\n // Backup wallet\n /**\n * Backups the wallet data.\n * @param registry Optional registry URL for the wallet backup.\n * @returns A promise with a backup string (e.g., backup URL).\n */\n public static async backupWallet(registry?: string): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().backupWalletInternal(registry);\n }\n\n // Issue credential to a user\n /**\n * Issues a credential to the subject.\n * @param credential The credential to be issued.\n * @param options Optional parameters for issuing the credential.\n * @returns A promise with the credential ID or issuance result.\n */\n public static async issueCredential(\n credential: Partial<VerifiableCredential>,\n options?: IssueCredentialsOptions\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().issueCredentialInternal(\n credential,\n options\n );\n }\n\n // Publish a credential\n /**\n * Publishes a verifiable credential.\n * @param did The DID of the credential.\n * @param options Optional parameters, such as whether to reveal the credential.\n * @returns A promise with the published credential.\n */\n public static async publishCredential(\n did: string,\n options?: {\n reveal?: boolean;\n }\n ): Promise<VerifiableCredential> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().publishCredentialInternal(\n did,\n options\n );\n }\n\n // Accept a credential\n /**\n * Accepts a credential.\n * @param did The DID of the credential to accept.\n * @returns A promise indicating whether the credential was successfully accepted.\n */\n public static async acceptCredential(did: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().acceptCredentialInternal(did);\n }\n\n // Show mnemonic\n /**\n * Shows the mnemonic for the wallet.\n * @returns A promise with the mnemonic string.\n */\n public static async showMnemonic(): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().showMnemonicInternal();\n }\n\n // Verify a challenge response\n /**\n * Verifies a response to a challenge.\n * @param did The DID to verify the response for.\n * @param options Optional options, such as retry behavior.\n * @returns A promise with the response verification result.\n */\n public static async verifyResponse(\n did: string,\n options?: { retries?: number; delay?: number }\n ): Promise<ChallengeResponse> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().verifyResponseInternal(\n did,\n options\n );\n }\n\n // Decrypt a message\n /**\n * Decrypts a message using the current key.\n * @param did The DID of the message to decrypt.\n * @returns A promise with the decrypted message.\n */\n public static async decryptMessage(did: string): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().decryptMessageInternal(did);\n }\n\n // Decrypt mnemonic\n /**\n * Decrypts the mnemonic for the wallet.\n * @returns A promise with the decrypted mnemonic.\n */\n public static async decryptMnemonic(): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().decryptMnemonicInternal();\n }\n\n // Get a credential\n /**\n * Retrieves a verifiable credential.\n * @param id The credential ID to retrieve.\n * @returns A promise with the credential data or null if not found.\n */\n public static async getCredential(\n id: string\n ): Promise<VerifiableCredential | null> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().getCredentialInternal(id);\n }\n\n // Remove a credential\n /**\n * Removes a verifiable credential.\n * @param id The credential ID to remove.\n * @returns A promise indicating success or failure of the operation.\n */\n public static async removeCredential(id: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().removeCredentialInternal(id);\n }\n\n // Update a credential\n /**\n * Updates a verifiable credential.\n * @param did The DID of the credential to update.\n * @param credential The new credential data.\n * @returns A promise indicating success or failure of the update operation.\n */\n public static async updateCredential(\n did: string,\n credential: VerifiableCredential\n ): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().updateCredentialInternal(\n did,\n credential\n );\n }\n\n // Method to create an ID\n /**\n * Creates a new DID (Decentralized Identifier).\n * @param name The name for the DID.\n * @param options Optional options, such as registry URL.\n * @returns A promise with the newly created DID.\n */\n public static async createId(\n name: string,\n options?: {\n registry?: string;\n }\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createIdInternal(name, options);\n }\n\n // Method to create an ID\n /**\n * Creates a new DID (Decentralized Identifier).\n * @param name The name for the DID.\n * @param options Optional options, such as registry URL.\n * @returns A promise with the newly created DID.\n */\n public static async createIdOperation(\n name: string,\n account: number,\n options?: {\n registry?: string;\n }\n ): Promise<Operation> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createIdOperationInternal(name, account, options);\n }\n\n // Remove an ID\n /**\n * Removes an existing DID.\n * @param name The name of the DID to remove.\n * @returns A promise indicating success or failure of the operation.\n */\n public static async removeId(name: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().removeIdInternal(name);\n }\n\n // Resolve a DID\n /**\n * Resolves a DID to fetch associated data.\n * @param did The DID to resolve.\n * @param options Optional parameters for resolving the DID.\n * @returns A promise with the resolved DID data.\n */\n public static async resolveDID(\n did: string,\n options?: ResolveDIDOptions\n ): Promise<MdipDocument> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().resolveDIDInternal(did, options);\n }\n\n // Set the current DID\n /**\n * Sets the current DID in use.\n * @param name The DID name to set as the current one.\n * @returns A promise indicating success or failure of the operation.\n */\n public static async setCurrentId(name: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().setCurrentIdInternal(name);\n }\n\n // Create a schema\n /**\n * Creates a new schema for credentials.\n * @param schema The schema data to create.\n * @param options Optional options for creating the schema.\n * @returns A promise with the created schema data.\n */\n public static async createSchema(\n schema?: unknown,\n options?: CreateAssetOptions\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createSchemaInternal(\n schema,\n options\n );\n }\n\n // Load wallet\n /**\n * Loads the current wallet.\n * @returns A promise with the loaded wallet file.\n */\n public static async loadWallet(): Promise<WalletFile> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().loadWalletInternal();\n }\n\n // Save wallet\n /**\n * Saves the wallet.\n * @param wallet The wallet to save.\n * @param overwrite Optional flag to overwrite the existing wallet (default: true).\n * @returns A promise with a boolean indicating success.\n */\n public static async saveWallet(\n wallet: StoredWallet,\n overwrite = true\n ): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().saveWalletInternal(\n wallet,\n overwrite\n );\n }\n\n // Create a new wallet\n /**\n * Creates a new wallet.\n * @param mnemonic Optional mnemonic to initialize the wallet.\n * @param overwrite Optional flag to overwrite the existing wallet.\n * @returns A promise with the wallet creation result.\n */\n public static async newWallet(\n mnemonic?: string,\n overwrite?: boolean\n ): Promise<WalletFile> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().newWalletInternal(\n mnemonic,\n overwrite\n );\n }\n\n /**\n * Adds a custom header to the GatekeeperClient instance.\n * @param header Header name\n * @param value Header value\n */\n public static addCustomHeader(header: string, value: string): void {\n KeymasterReactNative.getInstance().ensureInitialized();\n const gatekeeper = KeymasterReactNative.getInstance().getGatekeeper();\n return gatekeeper.addCustomHeader(header, value);\n }\n\n /**\n * Removes a custom header from the GatekeeperClient instance.\n * @param header Header name\n */\n public static removeCustomHeader(header: string): void {\n KeymasterReactNative.getInstance().ensureInitialized();\n const gatekeeper = KeymasterReactNative.getInstance().getGatekeeper();\n return gatekeeper.removeCustomHeader(header);\n }\n\n // Recover an existing wallet\n /**\n * Recovers a wallet from a backup.\n * @param did The DID to use for recovery (optional).\n * @returns A promise with the wallet recovery result.\n */\n public static async recoverWallet(did?: string): Promise<WalletFile> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().recoverWalletInternal(did);\n }\n\n // Helper method to retrieve the instance\n private static getInstance(): KeymasterReactNative {\n if (!KeymasterReactNative.instance) {\n throw new Error(\n \"KeymasterReactNative not initialized. Call KeymasterReactNative.initialize() first.\"\n );\n }\n return KeymasterReactNative.instance;\n }\n\n private getGatekeeper(): GatekeeperClient {\n if (!this.gatekeeper) {\n throw new Error(\"GatekeeperClient not initialized\");\n }\n return this.gatekeeper;\n }\n\n // -------- Internal instance methods (originals renamed with Internal) -------\n\n private async startInternal(): Promise<boolean> {\n if (this.config.gatekeeperConfig) {\n return await this.startIntegratedKeymaster();\n } else {\n throw \"Missing Gatekeeper config\";\n }\n }\n\n private async startIntegratedKeymaster(): Promise<boolean> {\n try {\n if (this.config.walletDb && this.config.cipher) {\n if (!this.gatekeeper) {\n this.gatekeeper = new GatekeeperClient();\n }\n await this.gatekeeper.connect({\n url: this.config.gatekeeperConfig?.url,\n waitUntilReady: this.config.gatekeeperConfig?.waitUntilReady,\n intervalSeconds: this.config.gatekeeperConfig?.intervalSeconds,\n chatty: this.config.gatekeeperConfig?.chatty,\n });\n if (this.config.gatekeeperConfig?.token) {\n this.gatekeeper.addCustomHeader(\n \"authorization\",\n `Bearer ${this.config.gatekeeperConfig.token}`\n );\n }\n this.keymasterService = new Keymaster({\n gatekeeper: this.gatekeeper,\n wallet: this.config.walletDb,\n cipher: this.config.cipher,\n passphrase: this.config.passphrase,\n });\n } else {\n return false;\n }\n } catch (e) {\n console.error(\"Error starting KeymasterReactNative service:\", e);\n return false;\n }\n return true;\n }\n\n private async createChallengeInternal(\n spec: CreateChallengeSpec,\n options?: CreateAssetOptions\n ): Promise<CreateChallengeResponse> {\n const challenge: string = await this.keymasterService.createChallenge(\n spec,\n options\n );\n return {\n challenge: challenge,\n challengeUrl: `${spec.callback}?challenge=${challenge}`,\n };\n }\n\n private async bindCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"bindCredential\"]>\n ) {\n return this.keymasterService.bindCredential(...args);\n }\n\n private async createResponseInternal(\n ...args: Parameters<(typeof Keymaster)[\"createResponse\"]>\n ) {\n return this.keymasterService.createResponse(...args);\n }\n\n private async backupWalletInternal(registry?: string): Promise<string> {\n return this.keymasterService.backupWallet(registry);\n }\n\n private async issueCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"issueCredential\"]>\n ) {\n return this.keymasterService.issueCredential(...args);\n }\n\n private async publishCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"publishCredential\"]>\n ) {\n return this.keymasterService.publishCredential(...args);\n }\n\n private async acceptCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"acceptCredential\"]>\n ) {\n return this.keymasterService.acceptCredential(...args);\n }\n\n private async showMnemonicInternal(): Promise<string> {\n return this.keymasterService.decryptMnemonic();\n }\n\n private async verifyResponseInternal(\n ...args: Parameters<(typeof Keymaster)[\"verifyResponse\"]>\n ) {\n return this.keymasterService.verifyResponse(...args);\n }\n\n private async decryptMessageInternal(\n ...args: Parameters<(typeof Keymaster)[\"decryptMessage\"]>\n ) {\n return this.keymasterService.decryptMessage(...args);\n }\n\n private async decryptMnemonicInternal() {\n return this.keymasterService.decryptMnemonic();\n }\n\n private async getCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"getCredential\"]>\n ) {\n return this.keymasterService.getCredential(...args);\n }\n\n private async removeCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"removeCredential\"]>\n ) {\n return this.keymasterService.removeCredential(...args);\n }\n\n private async updateCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"updateCredential\"]>\n ) {\n return this.keymasterService.updateCredential(...args);\n }\n\n private async createIdInternal(\n ...args: Parameters<(typeof Keymaster)[\"createId\"]>\n ) {\n return this.keymasterService.createId(...args);\n }\n\n private async createIdOperationInternal(\n ...args: Parameters<(typeof Keymaster)[\"createIdOperation\"]>\n ) {\n return this.keymasterService.createIdOperation(...args);\n }\n\n private async removeIdInternal(\n ...args: Parameters<(typeof Keymaster)[\"removeId\"]>\n ) {\n return this.keymasterService.removeId(...args);\n }\n\n private async resolveDIDInternal(\n ...args: Parameters<(typeof Keymaster)[\"resolveDID\"]>\n ) {\n return this.keymasterService.resolveDID(...args);\n }\n\n private async setCurrentIdInternal(\n ...args: Parameters<(typeof Keymaster)[\"setCurrentId\"]>\n ) {\n return this.keymasterService.setCurrentId(...args);\n }\n\n private async createSchemaInternal(\n ...args: Parameters<(typeof Keymaster)[\"createSchema\"]>\n ) {\n return this.keymasterService.createSchema(...args);\n }\n\n private async loadWalletInternal(): Promise<WalletFile> {\n return this.keymasterService.loadWallet();\n }\n\n private async saveWalletInternal(\n wallet: StoredWallet,\n overwrite = true\n ): Promise<boolean> {\n return this.keymasterService.saveWallet(wallet, overwrite);\n }\n\n private async newWalletInternal(\n ...args: Parameters<(typeof Keymaster)[\"newWallet\"]>\n ) {\n return this.keymasterService.newWallet(...args);\n }\n\n private async recoverWalletInternal(\n ...args: Parameters<(typeof Keymaster)[\"recoverWallet\"]>\n ) {\n return this.keymasterService.recoverWallet(...args);\n }\n\n private validateConfig(config: KeymasterConfig): void {\n if (!config.gatekeeperConfig) {\n throw new Error(\"Missing Gatekeeper config\");\n }\n\n if (config.gatekeeperConfig) {\n if (!config.walletDb?.loadWallet) {\n throw new Error(\"Missing load wallet callback\");\n }\n if (!config.walletDb?.saveWallet) {\n throw new Error(\"Missing save wallet callback\");\n }\n if (!config.passphrase) {\n throw new Error(\"Missing passphrase\");\n }\n }\n }\n}\n","import { SdkConfig } from \"./types/index.js\";\nimport {\n GatekeeperClient,\n MdipDocument,\n GetDIDOptions,\n Operation,\n} from \"@mdip/gatekeeper\";\n\nexport class GatekeeperReactNative {\n private static instance: GatekeeperReactNative | null = null;\n\n private config: SdkConfig;\n private gatekeeperClient!: GatekeeperClient;\n\n private constructor(config: SdkConfig) {\n this.validateConfig(config);\n this.config = config;\n }\n\n public static initialize(config: SdkConfig) {\n if (!GatekeeperReactNative.instance) {\n GatekeeperReactNative.instance = new GatekeeperReactNative(config);\n } else {\n console.warn(\n \"GatekeeperReactNative already initialized, ignoring re-initialization.\"\n );\n }\n }\n\n private ensureInitialized() {\n if (!GatekeeperReactNative.instance) {\n throw new Error(\n \"GatekeeperReactNative not initialized. Call GatekeeperReactNative.initialize() first.\"\n );\n }\n }\n\n // Delegated STATIC methods\n\n public static async start() {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().startInternal();\n }\n\n public static async getDIDs(\n ...args: Parameters<GatekeeperReactNative[\"getDIDsInternal\"]>\n ) {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().getDIDsInternal(...args);\n }\n\n public static async addCustomHeader({\n header,\n value,\n }: {\n header: string;\n value: string;\n }) {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().addCustomHeaderInternal({\n header,\n value,\n });\n }\n\n public static async removeCustomHeader({ header }: { header: string }) {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().removeCustomHeaderInternal({\n header,\n });\n }\n\n public static async generateDID(operation: Operation): Promise<string> {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().generateDIDInternal(operation);\n }\n\n private static getInstance(): GatekeeperReactNative {\n if (!GatekeeperReactNative.instance) {\n throw new Error(\n \"GatekeeperReactNative not initialized. Call GatekeeperReactNative.initialize() first.\"\n );\n }\n return GatekeeperReactNative.instance;\n }\n\n // -------- Internal instance methods (originals renamed with Internal) -------\n\n private async startInternal(): Promise<boolean> {\n if (this.config) {\n return await this.startIntegratedGatekeeper();\n } else {\n throw \"Missing Gatekeeper config\";\n }\n }\n\n private async startIntegratedGatekeeper(): Promise<boolean> {\n try {\n this.gatekeeperClient = new GatekeeperClient();\n await this.gatekeeperClient.connect({\n url: this.config?.url,\n waitUntilReady: this.config?.waitUntilReady,\n intervalSeconds: this.config?.intervalSeconds,\n chatty: this.config?.chatty,\n });\n } catch (e) {\n console.error(\"Error starting GatekeeperReactNative service:\", e);\n return false;\n }\n return true;\n }\n\n private async getDIDsInternal({\n dids,\n resolve,\n }: GetDIDOptions): Promise<string[] | MdipDocument[]> {\n const response = await this.gatekeeperClient.getDIDs({ dids, resolve });\n return response;\n }\n\n private async addCustomHeaderInternal({\n header,\n value,\n }: {\n header: string;\n value: string;\n }): Promise<void> {\n await this.gatekeeperClient.addCustomHeader(header, value);\n }\n\n private async removeCustomHeaderInternal({\n header,\n }: {\n header: string;\n }): Promise<void> {\n await this.gatekeeperClient.removeCustomHeader(header);\n }\n\n private async generateDIDInternal(operation: Operation): Promise<string> {\n return await this.gatekeeperClient.generateDID(operation);\n }\n\n private validateConfig(config: SdkConfig): void {\n if (!config) {\n throw new Error(\"Missing Gatekeeper config\");\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaA,wBAKO;AAMP,uBAA4B;AAG5B,IAAM,YAAY,iBAAAA,SAAiB,WAAW,iBAAAA;AASvC,IAAM,uBAAN,MAAM,sBAAqB;AAAA,EAChC,OAAe,WAAwC;AAAA,EAC/C;AAAA,EACA;AAAA,EACA,aAAsC;AAAA,EAEtC,YAAY,QAAyB;AAC3C,SAAK,eAAe,MAAM;AAC1B,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAc,WAAW,QAA+B;AACtD,QAAI,CAAC,sBAAqB,UAAU;AAClC,4BAAqB,WAAW,IAAI,sBAAqB,MAAM;AAAA,IACjE,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGQ,oBAA0B;AAChC,QAAI,CAAC,sBAAqB,UAAU;AAClC,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAoB,QAA0B;AAC5C,0BAAqB,YAAY,EAAE,kBAAkB;AACrD,WAAO,sBAAqB,YAAY,EAAE,cAAc;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,aAAoB,gBAClB,MACA,SACkC;AAClC,0BAAqB,YAAY,EAAE,kBAAkB;AACrD,WAAO,sBAAqB,YAAY,EAAE;AAAA,MACxC;AAAA,MACA;AAAA,IACF;AAAA,EACF;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;AAAA,QAC7B,iBAAiB,KAAK,QAAQ;AAAA,QAC9B,QAAQ,KAAK,QAAQ;AAAA,MACvB,CAAC;AAAA,IACH,SAAS,GAAG;AACV,cAAQ,MAAM,iDAAiD,CAAC;AAChE,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,gBAAgB;AAAA,IAC5B;AAAA,IACA;AAAA,EACF,GAAsD;AACpD,UAAM,WAAW,MAAM,KAAK,iBAAiB,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACtE,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,wBAAwB;AAAA,IACpC;AAAA,IACA;AAAA,EACF,GAGkB;AAChB,UAAM,KAAK,iBAAiB,gBAAgB,QAAQ,KAAK;AAAA,EAC3D;AAAA,EAEA,MAAc,2BAA2B;AAAA,IACvC;AAAA,EACF,GAEkB;AAChB,UAAM,KAAK,iBAAiB,mBAAmB,MAAM;AAAA,EACvD;AAAA,EAEA,MAAc,oBAAoB,WAAuC;AACvE,WAAO,MAAM,KAAK,iBAAiB,YAAY,SAAS;AAAA,EAC1D;AAAA,EAEQ,eAAe,QAAyB;AAC9C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,2BAA2B;AAAA,IAC7C;AAAA,EACF;AACF;;;AFtIA,0BAAc,4BAbd;AAcA,sBAAiC;","names":["KeymasterModule","import_gatekeeper"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import CipherNode from '@mdip/cipher';
|
|
2
|
-
import { WalletBase, CreateAssetOptions, VerifiableCredential, CreateResponseOptions, IssueCredentialsOptions, ChallengeResponse, WalletFile } from '@mdip/keymaster';
|
|
2
|
+
import { WalletBase, CreateAssetOptions, VerifiableCredential, CreateResponseOptions, IssueCredentialsOptions, ChallengeResponse, WalletFile, StoredWallet } from '@mdip/keymaster';
|
|
3
3
|
export * from '@mdip/keymaster';
|
|
4
4
|
import { Operation, ResolveDIDOptions, MdipDocument } from '@mdip/gatekeeper';
|
|
5
5
|
import * as gatekeeper from '@mdip/gatekeeper';
|
|
@@ -195,6 +195,18 @@ declare class KeymasterReactNative {
|
|
|
195
195
|
* @returns A promise with the created schema data.
|
|
196
196
|
*/
|
|
197
197
|
static createSchema(schema?: unknown, options?: CreateAssetOptions): Promise<string>;
|
|
198
|
+
/**
|
|
199
|
+
* Loads the current wallet.
|
|
200
|
+
* @returns A promise with the loaded wallet file.
|
|
201
|
+
*/
|
|
202
|
+
static loadWallet(): Promise<WalletFile>;
|
|
203
|
+
/**
|
|
204
|
+
* Saves the wallet.
|
|
205
|
+
* @param wallet The wallet to save.
|
|
206
|
+
* @param overwrite Optional flag to overwrite the existing wallet (default: true).
|
|
207
|
+
* @returns A promise with a boolean indicating success.
|
|
208
|
+
*/
|
|
209
|
+
static saveWallet(wallet: StoredWallet, overwrite?: boolean): Promise<boolean>;
|
|
198
210
|
/**
|
|
199
211
|
* Creates a new wallet.
|
|
200
212
|
* @param mnemonic Optional mnemonic to initialize the wallet.
|
|
@@ -243,6 +255,8 @@ declare class KeymasterReactNative {
|
|
|
243
255
|
private resolveDIDInternal;
|
|
244
256
|
private setCurrentIdInternal;
|
|
245
257
|
private createSchemaInternal;
|
|
258
|
+
private loadWalletInternal;
|
|
259
|
+
private saveWalletInternal;
|
|
246
260
|
private newWalletInternal;
|
|
247
261
|
private recoverWalletInternal;
|
|
248
262
|
private validateConfig;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import CipherNode from '@mdip/cipher';
|
|
2
|
-
import { WalletBase, CreateAssetOptions, VerifiableCredential, CreateResponseOptions, IssueCredentialsOptions, ChallengeResponse, WalletFile } from '@mdip/keymaster';
|
|
2
|
+
import { WalletBase, CreateAssetOptions, VerifiableCredential, CreateResponseOptions, IssueCredentialsOptions, ChallengeResponse, WalletFile, StoredWallet } from '@mdip/keymaster';
|
|
3
3
|
export * from '@mdip/keymaster';
|
|
4
4
|
import { Operation, ResolveDIDOptions, MdipDocument } from '@mdip/gatekeeper';
|
|
5
5
|
import * as gatekeeper from '@mdip/gatekeeper';
|
|
@@ -195,6 +195,18 @@ declare class KeymasterReactNative {
|
|
|
195
195
|
* @returns A promise with the created schema data.
|
|
196
196
|
*/
|
|
197
197
|
static createSchema(schema?: unknown, options?: CreateAssetOptions): Promise<string>;
|
|
198
|
+
/**
|
|
199
|
+
* Loads the current wallet.
|
|
200
|
+
* @returns A promise with the loaded wallet file.
|
|
201
|
+
*/
|
|
202
|
+
static loadWallet(): Promise<WalletFile>;
|
|
203
|
+
/**
|
|
204
|
+
* Saves the wallet.
|
|
205
|
+
* @param wallet The wallet to save.
|
|
206
|
+
* @param overwrite Optional flag to overwrite the existing wallet (default: true).
|
|
207
|
+
* @returns A promise with a boolean indicating success.
|
|
208
|
+
*/
|
|
209
|
+
static saveWallet(wallet: StoredWallet, overwrite?: boolean): Promise<boolean>;
|
|
198
210
|
/**
|
|
199
211
|
* Creates a new wallet.
|
|
200
212
|
* @param mnemonic Optional mnemonic to initialize the wallet.
|
|
@@ -243,6 +255,8 @@ declare class KeymasterReactNative {
|
|
|
243
255
|
private resolveDIDInternal;
|
|
244
256
|
private setCurrentIdInternal;
|
|
245
257
|
private createSchemaInternal;
|
|
258
|
+
private loadWalletInternal;
|
|
259
|
+
private saveWalletInternal;
|
|
246
260
|
private newWalletInternal;
|
|
247
261
|
private recoverWalletInternal;
|
|
248
262
|
private validateConfig;
|
package/dist/index.js
CHANGED
|
@@ -278,6 +278,29 @@ var KeymasterReactNative = class _KeymasterReactNative {
|
|
|
278
278
|
options
|
|
279
279
|
);
|
|
280
280
|
}
|
|
281
|
+
// Load wallet
|
|
282
|
+
/**
|
|
283
|
+
* Loads the current wallet.
|
|
284
|
+
* @returns A promise with the loaded wallet file.
|
|
285
|
+
*/
|
|
286
|
+
static async loadWallet() {
|
|
287
|
+
_KeymasterReactNative.getInstance().ensureInitialized();
|
|
288
|
+
return _KeymasterReactNative.getInstance().loadWalletInternal();
|
|
289
|
+
}
|
|
290
|
+
// Save wallet
|
|
291
|
+
/**
|
|
292
|
+
* Saves the wallet.
|
|
293
|
+
* @param wallet The wallet to save.
|
|
294
|
+
* @param overwrite Optional flag to overwrite the existing wallet (default: true).
|
|
295
|
+
* @returns A promise with a boolean indicating success.
|
|
296
|
+
*/
|
|
297
|
+
static async saveWallet(wallet, overwrite = true) {
|
|
298
|
+
_KeymasterReactNative.getInstance().ensureInitialized();
|
|
299
|
+
return _KeymasterReactNative.getInstance().saveWalletInternal(
|
|
300
|
+
wallet,
|
|
301
|
+
overwrite
|
|
302
|
+
);
|
|
303
|
+
}
|
|
281
304
|
// Create a new wallet
|
|
282
305
|
/**
|
|
283
306
|
* Creates a new wallet.
|
|
@@ -444,6 +467,12 @@ var KeymasterReactNative = class _KeymasterReactNative {
|
|
|
444
467
|
async createSchemaInternal(...args) {
|
|
445
468
|
return this.keymasterService.createSchema(...args);
|
|
446
469
|
}
|
|
470
|
+
async loadWalletInternal() {
|
|
471
|
+
return this.keymasterService.loadWallet();
|
|
472
|
+
}
|
|
473
|
+
async saveWalletInternal(wallet, overwrite = true) {
|
|
474
|
+
return this.keymasterService.saveWallet(wallet, overwrite);
|
|
475
|
+
}
|
|
447
476
|
async newWalletInternal(...args) {
|
|
448
477
|
return this.keymasterService.newWallet(...args);
|
|
449
478
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/keymaster-react-native.ts","../src/gatekeeper-react-native.ts","../src/index.ts"],"sourcesContent":["// Imports\nimport CipherNode from \"@mdip/cipher\";\nimport {\n ChallengeResponse,\n CreateAssetOptions,\n CreateResponseOptions,\n IssueCredentialsOptions,\n VerifiableCredential,\n WalletBase,\n WalletFile,\n} from \"@mdip/keymaster\";\n\nimport {\n GatekeeperClient,\n MdipDocument,\n Operation,\n ResolveDIDOptions,\n} from \"@mdip/gatekeeper\";\nimport {\n CreateChallengeResponse,\n CreateChallengeSpec,\n SdkConfig,\n} from \"./types/index.js\";\nimport KeymasterModule from \"@mdip/keymaster\";\n\n// @ts-ignore\nconst Keymaster = KeymasterModule?.default || KeymasterModule;\n\n// Keymaster configuration interface\nexport interface KeymasterConfig {\n gatekeeperConfig?: SdkConfig;\n walletDb?: WalletBase;\n cipher?: CipherNode;\n passphrase: string;\n}\nexport class KeymasterReactNative {\n private static instance: KeymasterReactNative | null = null;\n private config: KeymasterConfig;\n private keymasterService!: typeof Keymaster;\n private gatekeeper: GatekeeperClient | null = null;\n\n private constructor(config: KeymasterConfig) {\n this.validateConfig(config);\n this.config = config;\n }\n\n // Initializes the instance if not already initialized\n /**\n * Initializes the KeymasterReactNative instance.\n * @param config The configuration object for the Keymaster service.\n */\n public static initialize(config: KeymasterConfig): void {\n if (!KeymasterReactNative.instance) {\n KeymasterReactNative.instance = new KeymasterReactNative(config);\n } else {\n console.warn(\n \"KeymasterReactNative already initialized, ignoring re-initialization.\"\n );\n }\n }\n\n // Ensures the instance is initialized\n private ensureInitialized(): void {\n if (!KeymasterReactNative.instance) {\n throw new Error(\n \"KeymasterReactNative not initialized. Call KeymasterReactNative.initialize() first.\"\n );\n }\n }\n\n /**\n * Starts the KeymasterReactNative service.\n * @returns A boolean indicating whether the service was started successfully.\n */\n public static async start(): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().startInternal();\n }\n\n // Method to create a challenge\n /**\n * Creates a challenge for the user to solve.\n * @param spec The challenge specifications.\n * @param options Additional options for creating the challenge (optional).\n * @returns A promise with the challenge response, including the challenge and its callback URL.\n */\n public static async createChallenge(\n spec: CreateChallengeSpec,\n options?: CreateAssetOptions\n ): Promise<CreateChallengeResponse> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createChallengeInternal(\n spec,\n options\n );\n }\n\n // Method to bind a credential to a user\n /**\n * Binds a credential to a subject.\n * @param schemaId The schema ID for the credential.\n * @param subjectId The subject's DID (Decentralized Identifier).\n * @param options Optional options, such as validity period and credential data.\n * @returns A promise with the verifiable credential that was bound.\n */\n public static async bindCredential(\n schemaId: string,\n subjectId: string,\n options?: {\n validFrom?: string;\n validUntil?: string;\n credential?: Record<string, unknown>;\n }\n ): Promise<VerifiableCredential> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().bindCredentialInternal(\n schemaId,\n subjectId,\n options\n );\n }\n\n // Method to create a response\n /**\n * Creates a response for the challenge.\n * @param challengeDID The DID of the challenge to respond to.\n * @param options Optional options for creating the response (optional).\n * @returns A promise with the response string.\n */\n public static async createResponse(\n challengeDID: string,\n options?: CreateResponseOptions\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createResponseInternal(\n challengeDID,\n options\n );\n }\n\n // Backup wallet\n /**\n * Backups the wallet data.\n * @param registry Optional registry URL for the wallet backup.\n * @returns A promise with a backup string (e.g., backup URL).\n */\n public static async backupWallet(registry?: string): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().backupWalletInternal(registry);\n }\n\n // Issue credential to a user\n /**\n * Issues a credential to the subject.\n * @param credential The credential to be issued.\n * @param options Optional parameters for issuing the credential.\n * @returns A promise with the credential ID or issuance result.\n */\n public static async issueCredential(\n credential: Partial<VerifiableCredential>,\n options?: IssueCredentialsOptions\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().issueCredentialInternal(\n credential,\n options\n );\n }\n\n // Publish a credential\n /**\n * Publishes a verifiable credential.\n * @param did The DID of the credential.\n * @param options Optional parameters, such as whether to reveal the credential.\n * @returns A promise with the published credential.\n */\n public static async publishCredential(\n did: string,\n options?: {\n reveal?: boolean;\n }\n ): Promise<VerifiableCredential> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().publishCredentialInternal(\n did,\n options\n );\n }\n\n // Accept a credential\n /**\n * Accepts a credential.\n * @param did The DID of the credential to accept.\n * @returns A promise indicating whether the credential was successfully accepted.\n */\n public static async acceptCredential(did: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().acceptCredentialInternal(did);\n }\n\n // Show mnemonic\n /**\n * Shows the mnemonic for the wallet.\n * @returns A promise with the mnemonic string.\n */\n public static async showMnemonic(): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().showMnemonicInternal();\n }\n\n // Verify a challenge response\n /**\n * Verifies a response to a challenge.\n * @param did The DID to verify the response for.\n * @param options Optional options, such as retry behavior.\n * @returns A promise with the response verification result.\n */\n public static async verifyResponse(\n did: string,\n options?: { retries?: number; delay?: number }\n ): Promise<ChallengeResponse> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().verifyResponseInternal(\n did,\n options\n );\n }\n\n // Decrypt a message\n /**\n * Decrypts a message using the current key.\n * @param did The DID of the message to decrypt.\n * @returns A promise with the decrypted message.\n */\n public static async decryptMessage(did: string): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().decryptMessageInternal(did);\n }\n\n // Decrypt mnemonic\n /**\n * Decrypts the mnemonic for the wallet.\n * @returns A promise with the decrypted mnemonic.\n */\n public static async decryptMnemonic(): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().decryptMnemonicInternal();\n }\n\n // Get a credential\n /**\n * Retrieves a verifiable credential.\n * @param id The credential ID to retrieve.\n * @returns A promise with the credential data or null if not found.\n */\n public static async getCredential(\n id: string\n ): Promise<VerifiableCredential | null> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().getCredentialInternal(id);\n }\n\n // Remove a credential\n /**\n * Removes a verifiable credential.\n * @param id The credential ID to remove.\n * @returns A promise indicating success or failure of the operation.\n */\n public static async removeCredential(id: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().removeCredentialInternal(id);\n }\n\n // Update a credential\n /**\n * Updates a verifiable credential.\n * @param did The DID of the credential to update.\n * @param credential The new credential data.\n * @returns A promise indicating success or failure of the update operation.\n */\n public static async updateCredential(\n did: string,\n credential: VerifiableCredential\n ): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().updateCredentialInternal(\n did,\n credential\n );\n }\n\n // Method to create an ID\n /**\n * Creates a new DID (Decentralized Identifier).\n * @param name The name for the DID.\n * @param options Optional options, such as registry URL.\n * @returns A promise with the newly created DID.\n */\n public static async createId(\n name: string,\n options?: {\n registry?: string;\n }\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createIdInternal(name, options);\n }\n\n // Method to create an ID\n /**\n * Creates a new DID (Decentralized Identifier).\n * @param name The name for the DID.\n * @param options Optional options, such as registry URL.\n * @returns A promise with the newly created DID.\n */\n public static async createIdOperation(\n name: string,\n account: number,\n options?: {\n registry?: string;\n }\n ): Promise<Operation> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createIdOperationInternal(name, account, options);\n }\n\n // Remove an ID\n /**\n * Removes an existing DID.\n * @param name The name of the DID to remove.\n * @returns A promise indicating success or failure of the operation.\n */\n public static async removeId(name: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().removeIdInternal(name);\n }\n\n // Resolve a DID\n /**\n * Resolves a DID to fetch associated data.\n * @param did The DID to resolve.\n * @param options Optional parameters for resolving the DID.\n * @returns A promise with the resolved DID data.\n */\n public static async resolveDID(\n did: string,\n options?: ResolveDIDOptions\n ): Promise<MdipDocument> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().resolveDIDInternal(did, options);\n }\n\n // Set the current DID\n /**\n * Sets the current DID in use.\n * @param name The DID name to set as the current one.\n * @returns A promise indicating success or failure of the operation.\n */\n public static async setCurrentId(name: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().setCurrentIdInternal(name);\n }\n\n // Create a schema\n /**\n * Creates a new schema for credentials.\n * @param schema The schema data to create.\n * @param options Optional options for creating the schema.\n * @returns A promise with the created schema data.\n */\n public static async createSchema(\n schema?: unknown,\n options?: CreateAssetOptions\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createSchemaInternal(\n schema,\n options\n );\n }\n\n // Create a new wallet\n /**\n * Creates a new wallet.\n * @param mnemonic Optional mnemonic to initialize the wallet.\n * @param overwrite Optional flag to overwrite the existing wallet.\n * @returns A promise with the wallet creation result.\n */\n public static async newWallet(\n mnemonic?: string,\n overwrite?: boolean\n ): Promise<WalletFile> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().newWalletInternal(\n mnemonic,\n overwrite\n );\n }\n\n /**\n * Adds a custom header to the GatekeeperClient instance.\n * @param header Header name\n * @param value Header value\n */\n public static addCustomHeader(header: string, value: string): void {\n KeymasterReactNative.getInstance().ensureInitialized();\n const gatekeeper = KeymasterReactNative.getInstance().getGatekeeper();\n return gatekeeper.addCustomHeader(header, value);\n }\n\n /**\n * Removes a custom header from the GatekeeperClient instance.\n * @param header Header name\n */\n public static removeCustomHeader(header: string): void {\n KeymasterReactNative.getInstance().ensureInitialized();\n const gatekeeper = KeymasterReactNative.getInstance().getGatekeeper();\n return gatekeeper.removeCustomHeader(header);\n }\n\n // Recover an existing wallet\n /**\n * Recovers a wallet from a backup.\n * @param did The DID to use for recovery (optional).\n * @returns A promise with the wallet recovery result.\n */\n public static async recoverWallet(did?: string): Promise<WalletFile> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().recoverWalletInternal(did);\n }\n\n // Helper method to retrieve the instance\n private static getInstance(): KeymasterReactNative {\n if (!KeymasterReactNative.instance) {\n throw new Error(\n \"KeymasterReactNative not initialized. Call KeymasterReactNative.initialize() first.\"\n );\n }\n return KeymasterReactNative.instance;\n }\n\n private getGatekeeper(): GatekeeperClient {\n if (!this.gatekeeper) {\n throw new Error(\"GatekeeperClient not initialized\");\n }\n return this.gatekeeper;\n }\n\n // -------- Internal instance methods (originals renamed with Internal) -------\n\n private async startInternal(): Promise<boolean> {\n if (this.config.gatekeeperConfig) {\n return await this.startIntegratedKeymaster();\n } else {\n throw \"Missing Gatekeeper config\";\n }\n }\n\n private async startIntegratedKeymaster(): Promise<boolean> {\n try {\n if (this.config.walletDb && this.config.cipher) {\n if (!this.gatekeeper) {\n this.gatekeeper = new GatekeeperClient();\n }\n await this.gatekeeper.connect({\n url: this.config.gatekeeperConfig?.url,\n waitUntilReady: this.config.gatekeeperConfig?.waitUntilReady,\n intervalSeconds: this.config.gatekeeperConfig?.intervalSeconds,\n chatty: this.config.gatekeeperConfig?.chatty,\n });\n if (this.config.gatekeeperConfig?.token) {\n this.gatekeeper.addCustomHeader(\n \"authorization\",\n `Bearer ${this.config.gatekeeperConfig.token}`\n );\n }\n this.keymasterService = new Keymaster({\n gatekeeper: this.gatekeeper,\n wallet: this.config.walletDb,\n cipher: this.config.cipher,\n passphrase: this.config.passphrase,\n });\n } else {\n return false;\n }\n } catch (e) {\n console.error(\"Error starting KeymasterReactNative service:\", e);\n return false;\n }\n return true;\n }\n\n private async createChallengeInternal(\n spec: CreateChallengeSpec,\n options?: CreateAssetOptions\n ): Promise<CreateChallengeResponse> {\n const challenge: string = await this.keymasterService.createChallenge(\n spec,\n options\n );\n return {\n challenge: challenge,\n challengeUrl: `${spec.callback}?challenge=${challenge}`,\n };\n }\n\n private async bindCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"bindCredential\"]>\n ) {\n return this.keymasterService.bindCredential(...args);\n }\n\n private async createResponseInternal(\n ...args: Parameters<(typeof Keymaster)[\"createResponse\"]>\n ) {\n return this.keymasterService.createResponse(...args);\n }\n\n private async backupWalletInternal(registry?: string): Promise<string> {\n return this.keymasterService.backupWallet(registry);\n }\n\n private async issueCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"issueCredential\"]>\n ) {\n return this.keymasterService.issueCredential(...args);\n }\n\n private async publishCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"publishCredential\"]>\n ) {\n return this.keymasterService.publishCredential(...args);\n }\n\n private async acceptCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"acceptCredential\"]>\n ) {\n return this.keymasterService.acceptCredential(...args);\n }\n\n private async showMnemonicInternal(): Promise<string> {\n return this.keymasterService.decryptMnemonic();\n }\n\n private async verifyResponseInternal(\n ...args: Parameters<(typeof Keymaster)[\"verifyResponse\"]>\n ) {\n return this.keymasterService.verifyResponse(...args);\n }\n\n private async decryptMessageInternal(\n ...args: Parameters<(typeof Keymaster)[\"decryptMessage\"]>\n ) {\n return this.keymasterService.decryptMessage(...args);\n }\n\n private async decryptMnemonicInternal() {\n return this.keymasterService.decryptMnemonic();\n }\n\n private async getCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"getCredential\"]>\n ) {\n return this.keymasterService.getCredential(...args);\n }\n\n private async removeCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"removeCredential\"]>\n ) {\n return this.keymasterService.removeCredential(...args);\n }\n\n private async updateCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"updateCredential\"]>\n ) {\n return this.keymasterService.updateCredential(...args);\n }\n\n private async createIdInternal(\n ...args: Parameters<(typeof Keymaster)[\"createId\"]>\n ) {\n return this.keymasterService.createId(...args);\n }\n\n private async createIdOperationInternal(\n ...args: Parameters<(typeof Keymaster)[\"createIdOperation\"]>\n ) {\n return this.keymasterService.createIdOperation(...args);\n }\n\n private async removeIdInternal(\n ...args: Parameters<(typeof Keymaster)[\"removeId\"]>\n ) {\n return this.keymasterService.removeId(...args);\n }\n\n private async resolveDIDInternal(\n ...args: Parameters<(typeof Keymaster)[\"resolveDID\"]>\n ) {\n return this.keymasterService.resolveDID(...args);\n }\n\n private async setCurrentIdInternal(\n ...args: Parameters<(typeof Keymaster)[\"setCurrentId\"]>\n ) {\n return this.keymasterService.setCurrentId(...args);\n }\n\n private async createSchemaInternal(\n ...args: Parameters<(typeof Keymaster)[\"createSchema\"]>\n ) {\n return this.keymasterService.createSchema(...args);\n }\n\n private async newWalletInternal(\n ...args: Parameters<(typeof Keymaster)[\"newWallet\"]>\n ) {\n return this.keymasterService.newWallet(...args);\n }\n\n private async recoverWalletInternal(\n ...args: Parameters<(typeof Keymaster)[\"recoverWallet\"]>\n ) {\n return this.keymasterService.recoverWallet(...args);\n }\n\n private validateConfig(config: KeymasterConfig): void {\n if (!config.gatekeeperConfig) {\n throw new Error(\"Missing Gatekeeper config\");\n }\n\n if (config.gatekeeperConfig) {\n if (!config.walletDb?.loadWallet) {\n throw new Error(\"Missing load wallet callback\");\n }\n if (!config.walletDb?.saveWallet) {\n throw new Error(\"Missing save wallet callback\");\n }\n if (!config.passphrase) {\n throw new Error(\"Missing passphrase\");\n }\n }\n }\n}\n","import { SdkConfig } from \"./types/index.js\";\nimport {\n GatekeeperClient,\n MdipDocument,\n GetDIDOptions,\n Operation,\n} from \"@mdip/gatekeeper\";\n\nexport class GatekeeperReactNative {\n private static instance: GatekeeperReactNative | null = null;\n\n private config: SdkConfig;\n private gatekeeperClient!: GatekeeperClient;\n\n private constructor(config: SdkConfig) {\n this.validateConfig(config);\n this.config = config;\n }\n\n public static initialize(config: SdkConfig) {\n if (!GatekeeperReactNative.instance) {\n GatekeeperReactNative.instance = new GatekeeperReactNative(config);\n } else {\n console.warn(\n \"GatekeeperReactNative already initialized, ignoring re-initialization.\"\n );\n }\n }\n\n private ensureInitialized() {\n if (!GatekeeperReactNative.instance) {\n throw new Error(\n \"GatekeeperReactNative not initialized. Call GatekeeperReactNative.initialize() first.\"\n );\n }\n }\n\n // Delegated STATIC methods\n\n public static async start() {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().startInternal();\n }\n\n public static async getDIDs(\n ...args: Parameters<GatekeeperReactNative[\"getDIDsInternal\"]>\n ) {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().getDIDsInternal(...args);\n }\n\n public static async addCustomHeader({\n header,\n value,\n }: {\n header: string;\n value: string;\n }) {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().addCustomHeaderInternal({\n header,\n value,\n });\n }\n\n public static async removeCustomHeader({ header }: { header: string }) {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().removeCustomHeaderInternal({\n header,\n });\n }\n\n public static async generateDID(operation: Operation): Promise<string> {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().generateDIDInternal(operation);\n }\n\n private static getInstance(): GatekeeperReactNative {\n if (!GatekeeperReactNative.instance) {\n throw new Error(\n \"GatekeeperReactNative not initialized. Call GatekeeperReactNative.initialize() first.\"\n );\n }\n return GatekeeperReactNative.instance;\n }\n\n // -------- Internal instance methods (originals renamed with Internal) -------\n\n private async startInternal(): Promise<boolean> {\n if (this.config) {\n return await this.startIntegratedGatekeeper();\n } else {\n throw \"Missing Gatekeeper config\";\n }\n }\n\n private async startIntegratedGatekeeper(): Promise<boolean> {\n try {\n this.gatekeeperClient = new GatekeeperClient();\n await this.gatekeeperClient.connect({\n url: this.config?.url,\n waitUntilReady: this.config?.waitUntilReady,\n intervalSeconds: this.config?.intervalSeconds,\n chatty: this.config?.chatty,\n });\n } catch (e) {\n console.error(\"Error starting GatekeeperReactNative service:\", e);\n return false;\n }\n return true;\n }\n\n private async getDIDsInternal({\n dids,\n resolve,\n }: GetDIDOptions): Promise<string[] | MdipDocument[]> {\n const response = await this.gatekeeperClient.getDIDs({ dids, resolve });\n return response;\n }\n\n private async addCustomHeaderInternal({\n header,\n value,\n }: {\n header: string;\n value: string;\n }): Promise<void> {\n await this.gatekeeperClient.addCustomHeader(header, value);\n }\n\n private async removeCustomHeaderInternal({\n header,\n }: {\n header: string;\n }): Promise<void> {\n await this.gatekeeperClient.removeCustomHeader(header);\n }\n\n private async generateDIDInternal(operation: Operation): Promise<string> {\n return await this.gatekeeperClient.generateDID(operation);\n }\n\n private validateConfig(config: SdkConfig): void {\n if (!config) {\n throw new Error(\"Missing Gatekeeper config\");\n }\n }\n}\n","export {\n KeymasterReactNative,\n KeymasterConfig as KeymasterReactNativeConfig,\n} from \"./keymaster-react-native.js\";\nexport { GatekeeperReactNative } from \"./gatekeeper-react-native.js\";\n\nexport {\n SdkConfig,\n WalletConfig,\n CreateChallengeResponse,\n CreateChallengeSpec,\n} from \"./types/index.js\";\n\nexport * from \"@mdip/keymaster\";\nimport * as GatekeeperTypes from \"@mdip/gatekeeper\";\n\nexport { GatekeeperTypes };\n"],"mappings":";AAYA;AAAA,EACE;AAAA,OAIK;AAMP,OAAO,qBAAqB;AAG5B,IAAM,YAAY,iBAAiB,WAAW;AASvC,IAAM,uBAAN,MAAM,sBAAqB;AAAA,EAChC,OAAe,WAAwC;AAAA,EAC/C;AAAA,EACA;AAAA,EACA,aAAsC;AAAA,EAEtC,YAAY,QAAyB;AAC3C,SAAK,eAAe,MAAM;AAC1B,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAc,WAAW,QAA+B;AACtD,QAAI,CAAC,sBAAqB,UAAU;AAClC,4BAAqB,WAAW,IAAI,sBAAqB,MAAM;AAAA,IACjE,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGQ,oBAA0B;AAChC,QAAI,CAAC,sBAAqB,UAAU;AAClC,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAoB,QAA0B;AAC5C,0BAAqB,YAAY,EAAE,kBAAkB;AACrD,WAAO,sBAAqB,Y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MAAM,KAAK,iBAAiB,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACtE,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,wBAAwB;AAAA,IACpC;AAAA,IACA;AAAA,EACF,GAGkB;AAChB,UAAM,KAAK,iBAAiB,gBAAgB,QAAQ,KAAK;AAAA,EAC3D;AAAA,EAEA,MAAc,2BAA2B;AAAA,IACvC;AAAA,EACF,GAEkB;AAChB,UAAM,KAAK,iBAAiB,mBAAmB,MAAM;AAAA,EACvD;AAAA,EAEA,MAAc,oBAAoB,WAAuC;AACvE,WAAO,MAAM,KAAK,iBAAiB,YAAY,SAAS;AAAA,EAC1D;AAAA,EAEQ,eAAe,QAAyB;AAC9C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,2BAA2B;AAAA,IAC7C;AAAA,EACF;AACF;;;ACtIA,cAAc;AACd,YAAY,qBAAqB;","names":["GatekeeperClient"]}
|
|
1
|
+
{"version":3,"sources":["../src/keymaster-react-native.ts","../src/gatekeeper-react-native.ts","../src/index.ts"],"sourcesContent":["// Imports\nimport CipherNode from \"@mdip/cipher\";\nimport {\n ChallengeResponse,\n CreateAssetOptions,\n CreateResponseOptions,\n IssueCredentialsOptions,\n StoredWallet,\n VerifiableCredential,\n WalletBase,\n WalletFile,\n} from \"@mdip/keymaster\";\n\nimport {\n GatekeeperClient,\n MdipDocument,\n Operation,\n ResolveDIDOptions,\n} from \"@mdip/gatekeeper\";\nimport {\n CreateChallengeResponse,\n CreateChallengeSpec,\n SdkConfig,\n} from \"./types/index.js\";\nimport KeymasterModule from \"@mdip/keymaster\";\n\n// @ts-ignore\nconst Keymaster = KeymasterModule?.default || KeymasterModule;\n\n// Keymaster configuration interface\nexport interface KeymasterConfig {\n gatekeeperConfig?: SdkConfig;\n walletDb?: WalletBase;\n cipher?: CipherNode;\n passphrase: string;\n}\nexport class KeymasterReactNative {\n private static instance: KeymasterReactNative | null = null;\n private config: KeymasterConfig;\n private keymasterService!: typeof Keymaster;\n private gatekeeper: GatekeeperClient | null = null;\n\n private constructor(config: KeymasterConfig) {\n this.validateConfig(config);\n this.config = config;\n }\n\n // Initializes the instance if not already initialized\n /**\n * Initializes the KeymasterReactNative instance.\n * @param config The configuration object for the Keymaster service.\n */\n public static initialize(config: KeymasterConfig): void {\n if (!KeymasterReactNative.instance) {\n KeymasterReactNative.instance = new KeymasterReactNative(config);\n } else {\n console.warn(\n \"KeymasterReactNative already initialized, ignoring re-initialization.\"\n );\n }\n }\n\n // Ensures the instance is initialized\n private ensureInitialized(): void {\n if (!KeymasterReactNative.instance) {\n throw new Error(\n \"KeymasterReactNative not initialized. Call KeymasterReactNative.initialize() first.\"\n );\n }\n }\n\n /**\n * Starts the KeymasterReactNative service.\n * @returns A boolean indicating whether the service was started successfully.\n */\n public static async start(): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().startInternal();\n }\n\n // Method to create a challenge\n /**\n * Creates a challenge for the user to solve.\n * @param spec The challenge specifications.\n * @param options Additional options for creating the challenge (optional).\n * @returns A promise with the challenge response, including the challenge and its callback URL.\n */\n public static async createChallenge(\n spec: CreateChallengeSpec,\n options?: CreateAssetOptions\n ): Promise<CreateChallengeResponse> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createChallengeInternal(\n spec,\n options\n );\n }\n\n // Method to bind a credential to a user\n /**\n * Binds a credential to a subject.\n * @param schemaId The schema ID for the credential.\n * @param subjectId The subject's DID (Decentralized Identifier).\n * @param options Optional options, such as validity period and credential data.\n * @returns A promise with the verifiable credential that was bound.\n */\n public static async bindCredential(\n schemaId: string,\n subjectId: string,\n options?: {\n validFrom?: string;\n validUntil?: string;\n credential?: Record<string, unknown>;\n }\n ): Promise<VerifiableCredential> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().bindCredentialInternal(\n schemaId,\n subjectId,\n options\n );\n }\n\n // Method to create a response\n /**\n * Creates a response for the challenge.\n * @param challengeDID The DID of the challenge to respond to.\n * @param options Optional options for creating the response (optional).\n * @returns A promise with the response string.\n */\n public static async createResponse(\n challengeDID: string,\n options?: CreateResponseOptions\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createResponseInternal(\n challengeDID,\n options\n );\n }\n\n // Backup wallet\n /**\n * Backups the wallet data.\n * @param registry Optional registry URL for the wallet backup.\n * @returns A promise with a backup string (e.g., backup URL).\n */\n public static async backupWallet(registry?: string): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().backupWalletInternal(registry);\n }\n\n // Issue credential to a user\n /**\n * Issues a credential to the subject.\n * @param credential The credential to be issued.\n * @param options Optional parameters for issuing the credential.\n * @returns A promise with the credential ID or issuance result.\n */\n public static async issueCredential(\n credential: Partial<VerifiableCredential>,\n options?: IssueCredentialsOptions\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().issueCredentialInternal(\n credential,\n options\n );\n }\n\n // Publish a credential\n /**\n * Publishes a verifiable credential.\n * @param did The DID of the credential.\n * @param options Optional parameters, such as whether to reveal the credential.\n * @returns A promise with the published credential.\n */\n public static async publishCredential(\n did: string,\n options?: {\n reveal?: boolean;\n }\n ): Promise<VerifiableCredential> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().publishCredentialInternal(\n did,\n options\n );\n }\n\n // Accept a credential\n /**\n * Accepts a credential.\n * @param did The DID of the credential to accept.\n * @returns A promise indicating whether the credential was successfully accepted.\n */\n public static async acceptCredential(did: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().acceptCredentialInternal(did);\n }\n\n // Show mnemonic\n /**\n * Shows the mnemonic for the wallet.\n * @returns A promise with the mnemonic string.\n */\n public static async showMnemonic(): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().showMnemonicInternal();\n }\n\n // Verify a challenge response\n /**\n * Verifies a response to a challenge.\n * @param did The DID to verify the response for.\n * @param options Optional options, such as retry behavior.\n * @returns A promise with the response verification result.\n */\n public static async verifyResponse(\n did: string,\n options?: { retries?: number; delay?: number }\n ): Promise<ChallengeResponse> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().verifyResponseInternal(\n did,\n options\n );\n }\n\n // Decrypt a message\n /**\n * Decrypts a message using the current key.\n * @param did The DID of the message to decrypt.\n * @returns A promise with the decrypted message.\n */\n public static async decryptMessage(did: string): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().decryptMessageInternal(did);\n }\n\n // Decrypt mnemonic\n /**\n * Decrypts the mnemonic for the wallet.\n * @returns A promise with the decrypted mnemonic.\n */\n public static async decryptMnemonic(): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().decryptMnemonicInternal();\n }\n\n // Get a credential\n /**\n * Retrieves a verifiable credential.\n * @param id The credential ID to retrieve.\n * @returns A promise with the credential data or null if not found.\n */\n public static async getCredential(\n id: string\n ): Promise<VerifiableCredential | null> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().getCredentialInternal(id);\n }\n\n // Remove a credential\n /**\n * Removes a verifiable credential.\n * @param id The credential ID to remove.\n * @returns A promise indicating success or failure of the operation.\n */\n public static async removeCredential(id: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().removeCredentialInternal(id);\n }\n\n // Update a credential\n /**\n * Updates a verifiable credential.\n * @param did The DID of the credential to update.\n * @param credential The new credential data.\n * @returns A promise indicating success or failure of the update operation.\n */\n public static async updateCredential(\n did: string,\n credential: VerifiableCredential\n ): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().updateCredentialInternal(\n did,\n credential\n );\n }\n\n // Method to create an ID\n /**\n * Creates a new DID (Decentralized Identifier).\n * @param name The name for the DID.\n * @param options Optional options, such as registry URL.\n * @returns A promise with the newly created DID.\n */\n public static async createId(\n name: string,\n options?: {\n registry?: string;\n }\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createIdInternal(name, options);\n }\n\n // Method to create an ID\n /**\n * Creates a new DID (Decentralized Identifier).\n * @param name The name for the DID.\n * @param options Optional options, such as registry URL.\n * @returns A promise with the newly created DID.\n */\n public static async createIdOperation(\n name: string,\n account: number,\n options?: {\n registry?: string;\n }\n ): Promise<Operation> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createIdOperationInternal(name, account, options);\n }\n\n // Remove an ID\n /**\n * Removes an existing DID.\n * @param name The name of the DID to remove.\n * @returns A promise indicating success or failure of the operation.\n */\n public static async removeId(name: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().removeIdInternal(name);\n }\n\n // Resolve a DID\n /**\n * Resolves a DID to fetch associated data.\n * @param did The DID to resolve.\n * @param options Optional parameters for resolving the DID.\n * @returns A promise with the resolved DID data.\n */\n public static async resolveDID(\n did: string,\n options?: ResolveDIDOptions\n ): Promise<MdipDocument> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().resolveDIDInternal(did, options);\n }\n\n // Set the current DID\n /**\n * Sets the current DID in use.\n * @param name The DID name to set as the current one.\n * @returns A promise indicating success or failure of the operation.\n */\n public static async setCurrentId(name: string): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().setCurrentIdInternal(name);\n }\n\n // Create a schema\n /**\n * Creates a new schema for credentials.\n * @param schema The schema data to create.\n * @param options Optional options for creating the schema.\n * @returns A promise with the created schema data.\n */\n public static async createSchema(\n schema?: unknown,\n options?: CreateAssetOptions\n ): Promise<string> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().createSchemaInternal(\n schema,\n options\n );\n }\n\n // Load wallet\n /**\n * Loads the current wallet.\n * @returns A promise with the loaded wallet file.\n */\n public static async loadWallet(): Promise<WalletFile> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().loadWalletInternal();\n }\n\n // Save wallet\n /**\n * Saves the wallet.\n * @param wallet The wallet to save.\n * @param overwrite Optional flag to overwrite the existing wallet (default: true).\n * @returns A promise with a boolean indicating success.\n */\n public static async saveWallet(\n wallet: StoredWallet,\n overwrite = true\n ): Promise<boolean> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().saveWalletInternal(\n wallet,\n overwrite\n );\n }\n\n // Create a new wallet\n /**\n * Creates a new wallet.\n * @param mnemonic Optional mnemonic to initialize the wallet.\n * @param overwrite Optional flag to overwrite the existing wallet.\n * @returns A promise with the wallet creation result.\n */\n public static async newWallet(\n mnemonic?: string,\n overwrite?: boolean\n ): Promise<WalletFile> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().newWalletInternal(\n mnemonic,\n overwrite\n );\n }\n\n /**\n * Adds a custom header to the GatekeeperClient instance.\n * @param header Header name\n * @param value Header value\n */\n public static addCustomHeader(header: string, value: string): void {\n KeymasterReactNative.getInstance().ensureInitialized();\n const gatekeeper = KeymasterReactNative.getInstance().getGatekeeper();\n return gatekeeper.addCustomHeader(header, value);\n }\n\n /**\n * Removes a custom header from the GatekeeperClient instance.\n * @param header Header name\n */\n public static removeCustomHeader(header: string): void {\n KeymasterReactNative.getInstance().ensureInitialized();\n const gatekeeper = KeymasterReactNative.getInstance().getGatekeeper();\n return gatekeeper.removeCustomHeader(header);\n }\n\n // Recover an existing wallet\n /**\n * Recovers a wallet from a backup.\n * @param did The DID to use for recovery (optional).\n * @returns A promise with the wallet recovery result.\n */\n public static async recoverWallet(did?: string): Promise<WalletFile> {\n KeymasterReactNative.getInstance().ensureInitialized();\n return KeymasterReactNative.getInstance().recoverWalletInternal(did);\n }\n\n // Helper method to retrieve the instance\n private static getInstance(): KeymasterReactNative {\n if (!KeymasterReactNative.instance) {\n throw new Error(\n \"KeymasterReactNative not initialized. Call KeymasterReactNative.initialize() first.\"\n );\n }\n return KeymasterReactNative.instance;\n }\n\n private getGatekeeper(): GatekeeperClient {\n if (!this.gatekeeper) {\n throw new Error(\"GatekeeperClient not initialized\");\n }\n return this.gatekeeper;\n }\n\n // -------- Internal instance methods (originals renamed with Internal) -------\n\n private async startInternal(): Promise<boolean> {\n if (this.config.gatekeeperConfig) {\n return await this.startIntegratedKeymaster();\n } else {\n throw \"Missing Gatekeeper config\";\n }\n }\n\n private async startIntegratedKeymaster(): Promise<boolean> {\n try {\n if (this.config.walletDb && this.config.cipher) {\n if (!this.gatekeeper) {\n this.gatekeeper = new GatekeeperClient();\n }\n await this.gatekeeper.connect({\n url: this.config.gatekeeperConfig?.url,\n waitUntilReady: this.config.gatekeeperConfig?.waitUntilReady,\n intervalSeconds: this.config.gatekeeperConfig?.intervalSeconds,\n chatty: this.config.gatekeeperConfig?.chatty,\n });\n if (this.config.gatekeeperConfig?.token) {\n this.gatekeeper.addCustomHeader(\n \"authorization\",\n `Bearer ${this.config.gatekeeperConfig.token}`\n );\n }\n this.keymasterService = new Keymaster({\n gatekeeper: this.gatekeeper,\n wallet: this.config.walletDb,\n cipher: this.config.cipher,\n passphrase: this.config.passphrase,\n });\n } else {\n return false;\n }\n } catch (e) {\n console.error(\"Error starting KeymasterReactNative service:\", e);\n return false;\n }\n return true;\n }\n\n private async createChallengeInternal(\n spec: CreateChallengeSpec,\n options?: CreateAssetOptions\n ): Promise<CreateChallengeResponse> {\n const challenge: string = await this.keymasterService.createChallenge(\n spec,\n options\n );\n return {\n challenge: challenge,\n challengeUrl: `${spec.callback}?challenge=${challenge}`,\n };\n }\n\n private async bindCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"bindCredential\"]>\n ) {\n return this.keymasterService.bindCredential(...args);\n }\n\n private async createResponseInternal(\n ...args: Parameters<(typeof Keymaster)[\"createResponse\"]>\n ) {\n return this.keymasterService.createResponse(...args);\n }\n\n private async backupWalletInternal(registry?: string): Promise<string> {\n return this.keymasterService.backupWallet(registry);\n }\n\n private async issueCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"issueCredential\"]>\n ) {\n return this.keymasterService.issueCredential(...args);\n }\n\n private async publishCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"publishCredential\"]>\n ) {\n return this.keymasterService.publishCredential(...args);\n }\n\n private async acceptCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"acceptCredential\"]>\n ) {\n return this.keymasterService.acceptCredential(...args);\n }\n\n private async showMnemonicInternal(): Promise<string> {\n return this.keymasterService.decryptMnemonic();\n }\n\n private async verifyResponseInternal(\n ...args: Parameters<(typeof Keymaster)[\"verifyResponse\"]>\n ) {\n return this.keymasterService.verifyResponse(...args);\n }\n\n private async decryptMessageInternal(\n ...args: Parameters<(typeof Keymaster)[\"decryptMessage\"]>\n ) {\n return this.keymasterService.decryptMessage(...args);\n }\n\n private async decryptMnemonicInternal() {\n return this.keymasterService.decryptMnemonic();\n }\n\n private async getCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"getCredential\"]>\n ) {\n return this.keymasterService.getCredential(...args);\n }\n\n private async removeCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"removeCredential\"]>\n ) {\n return this.keymasterService.removeCredential(...args);\n }\n\n private async updateCredentialInternal(\n ...args: Parameters<(typeof Keymaster)[\"updateCredential\"]>\n ) {\n return this.keymasterService.updateCredential(...args);\n }\n\n private async createIdInternal(\n ...args: Parameters<(typeof Keymaster)[\"createId\"]>\n ) {\n return this.keymasterService.createId(...args);\n }\n\n private async createIdOperationInternal(\n ...args: Parameters<(typeof Keymaster)[\"createIdOperation\"]>\n ) {\n return this.keymasterService.createIdOperation(...args);\n }\n\n private async removeIdInternal(\n ...args: Parameters<(typeof Keymaster)[\"removeId\"]>\n ) {\n return this.keymasterService.removeId(...args);\n }\n\n private async resolveDIDInternal(\n ...args: Parameters<(typeof Keymaster)[\"resolveDID\"]>\n ) {\n return this.keymasterService.resolveDID(...args);\n }\n\n private async setCurrentIdInternal(\n ...args: Parameters<(typeof Keymaster)[\"setCurrentId\"]>\n ) {\n return this.keymasterService.setCurrentId(...args);\n }\n\n private async createSchemaInternal(\n ...args: Parameters<(typeof Keymaster)[\"createSchema\"]>\n ) {\n return this.keymasterService.createSchema(...args);\n }\n\n private async loadWalletInternal(): Promise<WalletFile> {\n return this.keymasterService.loadWallet();\n }\n\n private async saveWalletInternal(\n wallet: StoredWallet,\n overwrite = true\n ): Promise<boolean> {\n return this.keymasterService.saveWallet(wallet, overwrite);\n }\n\n private async newWalletInternal(\n ...args: Parameters<(typeof Keymaster)[\"newWallet\"]>\n ) {\n return this.keymasterService.newWallet(...args);\n }\n\n private async recoverWalletInternal(\n ...args: Parameters<(typeof Keymaster)[\"recoverWallet\"]>\n ) {\n return this.keymasterService.recoverWallet(...args);\n }\n\n private validateConfig(config: KeymasterConfig): void {\n if (!config.gatekeeperConfig) {\n throw new Error(\"Missing Gatekeeper config\");\n }\n\n if (config.gatekeeperConfig) {\n if (!config.walletDb?.loadWallet) {\n throw new Error(\"Missing load wallet callback\");\n }\n if (!config.walletDb?.saveWallet) {\n throw new Error(\"Missing save wallet callback\");\n }\n if (!config.passphrase) {\n throw new Error(\"Missing passphrase\");\n }\n }\n }\n}\n","import { SdkConfig } from \"./types/index.js\";\nimport {\n GatekeeperClient,\n MdipDocument,\n GetDIDOptions,\n Operation,\n} from \"@mdip/gatekeeper\";\n\nexport class GatekeeperReactNative {\n private static instance: GatekeeperReactNative | null = null;\n\n private config: SdkConfig;\n private gatekeeperClient!: GatekeeperClient;\n\n private constructor(config: SdkConfig) {\n this.validateConfig(config);\n this.config = config;\n }\n\n public static initialize(config: SdkConfig) {\n if (!GatekeeperReactNative.instance) {\n GatekeeperReactNative.instance = new GatekeeperReactNative(config);\n } else {\n console.warn(\n \"GatekeeperReactNative already initialized, ignoring re-initialization.\"\n );\n }\n }\n\n private ensureInitialized() {\n if (!GatekeeperReactNative.instance) {\n throw new Error(\n \"GatekeeperReactNative not initialized. Call GatekeeperReactNative.initialize() first.\"\n );\n }\n }\n\n // Delegated STATIC methods\n\n public static async start() {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().startInternal();\n }\n\n public static async getDIDs(\n ...args: Parameters<GatekeeperReactNative[\"getDIDsInternal\"]>\n ) {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().getDIDsInternal(...args);\n }\n\n public static async addCustomHeader({\n header,\n value,\n }: {\n header: string;\n value: string;\n }) {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().addCustomHeaderInternal({\n header,\n value,\n });\n }\n\n public static async removeCustomHeader({ header }: { header: string }) {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().removeCustomHeaderInternal({\n header,\n });\n }\n\n public static async generateDID(operation: Operation): Promise<string> {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().generateDIDInternal(operation);\n }\n\n private static getInstance(): GatekeeperReactNative {\n if (!GatekeeperReactNative.instance) {\n throw new Error(\n \"GatekeeperReactNative not initialized. Call GatekeeperReactNative.initialize() first.\"\n );\n }\n return GatekeeperReactNative.instance;\n }\n\n // -------- Internal instance methods (originals renamed with Internal) -------\n\n private async startInternal(): Promise<boolean> {\n if (this.config) {\n return await this.startIntegratedGatekeeper();\n } else {\n throw \"Missing Gatekeeper config\";\n }\n }\n\n private async startIntegratedGatekeeper(): Promise<boolean> {\n try {\n this.gatekeeperClient = new GatekeeperClient();\n await this.gatekeeperClient.connect({\n url: this.config?.url,\n waitUntilReady: this.config?.waitUntilReady,\n intervalSeconds: this.config?.intervalSeconds,\n chatty: this.config?.chatty,\n });\n } catch (e) {\n console.error(\"Error starting GatekeeperReactNative service:\", e);\n return false;\n }\n return true;\n }\n\n private async getDIDsInternal({\n dids,\n resolve,\n }: GetDIDOptions): Promise<string[] | MdipDocument[]> {\n const response = await this.gatekeeperClient.getDIDs({ dids, resolve });\n return response;\n }\n\n private async addCustomHeaderInternal({\n header,\n value,\n }: {\n header: string;\n value: string;\n }): Promise<void> {\n await this.gatekeeperClient.addCustomHeader(header, value);\n }\n\n private async removeCustomHeaderInternal({\n header,\n }: {\n header: string;\n }): Promise<void> {\n await this.gatekeeperClient.removeCustomHeader(header);\n }\n\n private async generateDIDInternal(operation: Operation): Promise<string> {\n return await this.gatekeeperClient.generateDID(operation);\n }\n\n private validateConfig(config: SdkConfig): void {\n if (!config) {\n throw new Error(\"Missing Gatekeeper config\");\n }\n }\n}\n","export {\n KeymasterReactNative,\n KeymasterConfig as KeymasterReactNativeConfig,\n} from \"./keymaster-react-native.js\";\nexport { GatekeeperReactNative } from \"./gatekeeper-react-native.js\";\n\nexport {\n SdkConfig,\n WalletConfig,\n CreateChallengeResponse,\n CreateChallengeSpec,\n} from \"./types/index.js\";\n\nexport * from \"@mdip/keymaster\";\nimport * as GatekeeperTypes from \"@mdip/gatekeeper\";\n\nexport { GatekeeperTypes };\n"],"mappings":";AAaA;AAAA,EACE;AAAA,OAIK;AAMP,OAAO,qBAAqB;AAG5B,IAAM,YAAY,iBAAiB,WAAW;AASvC,IAAM,uBAAN,MAAM,sBAAqB;AAAA,EAChC,OAAe,WAAwC;AAAA,EAC/C;AAAA,EACA;AAAA,EACA,aAAsC;AAAA,EAEtC,YAAY,QAAyB;AAC3C,SAAK,eAAe,MAAM;AAC1B,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAc,WAAW,QAA+B;AACtD,QAAI,CAAC,sBAAqB,UAAU;AAClC,4BAAqB,WAAW,IAAI,sBAAqB,MAAM;AAAA,IACjE,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,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YAAM,IAAI,MAAM,2BAA2B;AAAA,IAC7C;AAAA,EACF;AACF;;;ACtIA,cAAc;AACd,YAAY,qBAAqB;","names":["GatekeeperClient"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yourself_id/siwys-react-native",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.7-feat-add-load-save-wallet.0+00a685b",
|
|
4
4
|
"description": "A React Native component library",
|
|
5
5
|
"repository": "https://github.com/selfidhq/siwys-js",
|
|
6
6
|
"type": "module",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"tsup": "^8.3.0",
|
|
42
42
|
"typescript": "4.9.4"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "00a685b633117814b288979095687a893136151c"
|
|
45
45
|
}
|