@yourself_id/siwys-react-native 0.28.2 → 0.28.3-mdip-beta3.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 CHANGED
@@ -540,6 +540,10 @@ var GatekeeperReactNative = class _GatekeeperReactNative {
540
540
  _GatekeeperReactNative.getInstance().ensureInitialized();
541
541
  return _GatekeeperReactNative.getInstance().getDIDsInternal(...args);
542
542
  }
543
+ static async generateDID(operation) {
544
+ _GatekeeperReactNative.getInstance().ensureInitialized();
545
+ return _GatekeeperReactNative.getInstance().generateDIDInternal(operation);
546
+ }
543
547
  static async addCustomHeader({
544
548
  header,
545
549
  value
@@ -594,6 +598,9 @@ var GatekeeperReactNative = class _GatekeeperReactNative {
594
598
  const response = await this.gatekeeperClient.getDIDs({ dids, resolve });
595
599
  return response;
596
600
  }
601
+ async generateDIDInternal(operation) {
602
+ return await this.gatekeeperClient.generateDID(operation);
603
+ }
597
604
  async addCustomHeaderInternal({
598
605
  header,
599
606
  value
@@ -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 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<string> {\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} 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 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 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,wBAIO;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,aAAoB,eAClB,UACA,WACA,SAK+B;AAC/B,0BAAqB,YAAY,EAAE,k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atekeeper"]}
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 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<string> {\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 generateDID(operation: Operation): Promise<string> {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().generateDIDInternal(operation);\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 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 generateDIDInternal(operation: Operation): Promise<string> {\n return await this.gatekeeperClient.generateDID(operation);\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 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,wBAIO;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;AAA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ACF,WAAK,mBAAmB,IAAI,oCAAiB;AAC7C,YAAM,KAAK,iBAAiB,QAAQ;AAAA,QAClC,KAAK,KAAK,QAAQ;AAAA,QAClB,gBAAgB,KAAK,QAAQ;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,oBAAoB,WAAuC;AACvE,WAAO,MAAM,KAAK,iBAAiB,YAAY,SAAS;AAAA,EAC1D;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,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,7 +1,7 @@
1
1
  import CipherNode from '@mdip/cipher';
2
2
  import { WalletBase, CreateAssetOptions, VerifiableCredential, CreateResponseOptions, IssueCredentialsOptions, ChallengeResponse, WalletFile } from '@mdip/keymaster';
3
3
  export * from '@mdip/keymaster';
4
- import { ResolveDIDOptions, MdipDocument } from '@mdip/gatekeeper';
4
+ import { ResolveDIDOptions, MdipDocument, Operation } from '@mdip/gatekeeper';
5
5
  import * as gatekeeper from '@mdip/gatekeeper';
6
6
  export { gatekeeper as GatekeeperTypes };
7
7
 
@@ -257,6 +257,7 @@ declare class GatekeeperReactNative {
257
257
  private ensureInitialized;
258
258
  static start(): Promise<boolean>;
259
259
  static getDIDs(...args: Parameters<GatekeeperReactNative["getDIDsInternal"]>): Promise<string[] | MdipDocument[]>;
260
+ static generateDID(operation: Operation): Promise<string>;
260
261
  static addCustomHeader({ header, value, }: {
261
262
  header: string;
262
263
  value: string;
@@ -268,6 +269,7 @@ declare class GatekeeperReactNative {
268
269
  private startInternal;
269
270
  private startIntegratedGatekeeper;
270
271
  private getDIDsInternal;
272
+ private generateDIDInternal;
271
273
  private addCustomHeaderInternal;
272
274
  private removeCustomHeaderInternal;
273
275
  private validateConfig;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import CipherNode from '@mdip/cipher';
2
2
  import { WalletBase, CreateAssetOptions, VerifiableCredential, CreateResponseOptions, IssueCredentialsOptions, ChallengeResponse, WalletFile } from '@mdip/keymaster';
3
3
  export * from '@mdip/keymaster';
4
- import { ResolveDIDOptions, MdipDocument } from '@mdip/gatekeeper';
4
+ import { ResolveDIDOptions, MdipDocument, Operation } from '@mdip/gatekeeper';
5
5
  import * as gatekeeper from '@mdip/gatekeeper';
6
6
  export { gatekeeper as GatekeeperTypes };
7
7
 
@@ -257,6 +257,7 @@ declare class GatekeeperReactNative {
257
257
  private ensureInitialized;
258
258
  static start(): Promise<boolean>;
259
259
  static getDIDs(...args: Parameters<GatekeeperReactNative["getDIDsInternal"]>): Promise<string[] | MdipDocument[]>;
260
+ static generateDID(operation: Operation): Promise<string>;
260
261
  static addCustomHeader({ header, value, }: {
261
262
  header: string;
262
263
  value: string;
@@ -268,6 +269,7 @@ declare class GatekeeperReactNative {
268
269
  private startInternal;
269
270
  private startIntegratedGatekeeper;
270
271
  private getDIDsInternal;
272
+ private generateDIDInternal;
271
273
  private addCustomHeaderInternal;
272
274
  private removeCustomHeaderInternal;
273
275
  private validateConfig;
package/dist/index.js CHANGED
@@ -505,6 +505,10 @@ var GatekeeperReactNative = class _GatekeeperReactNative {
505
505
  _GatekeeperReactNative.getInstance().ensureInitialized();
506
506
  return _GatekeeperReactNative.getInstance().getDIDsInternal(...args);
507
507
  }
508
+ static async generateDID(operation) {
509
+ _GatekeeperReactNative.getInstance().ensureInitialized();
510
+ return _GatekeeperReactNative.getInstance().generateDIDInternal(operation);
511
+ }
508
512
  static async addCustomHeader({
509
513
  header,
510
514
  value
@@ -559,6 +563,9 @@ var GatekeeperReactNative = class _GatekeeperReactNative {
559
563
  const response = await this.gatekeeperClient.getDIDs({ dids, resolve });
560
564
  return response;
561
565
  }
566
+ async generateDIDInternal(operation) {
567
+ return await this.gatekeeperClient.generateDID(operation);
568
+ }
562
569
  async addCustomHeaderInternal({
563
570
  header,
564
571
  value
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 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<string> {\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} 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 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 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\";\n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R;AAAA,MACF;AAAA,IACF;AACA,WAAO,uBAAsB;AAAA,EAC/B;AAAA;AAAA,EAIA,MAAc,gBAAkC;AAC9C,QAAI,KAAK,QAAQ;AACf,aAAO,MAAM,KAAK,0BAA0B;AAAA,IAC9C,OAAO;AACL,YAAM;AAAA,IACR;AAAA,EACF;AAAA,EAEA,MAAc,4BAA8C;AAC1D,QAAI;AACF,WAAK,mBAAmB,IAAIA,kBAAiB;AAC7C,YAAM,KAAK,iBAAiB,QAAQ;AAAA,QAClC,KAAK,KAAK,QAAQ;AAAA,QAClB,gBAAgB,KAAK,QAAQ;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,EAEQ,eAAe,QAAyB;AAC9C,QAAI,CAAC,QAAQ;AACX,YAAM,IAAI,MAAM,2BAA2B;AAAA,IAC7C;AAAA,EACF;AACF;;;AC5HA,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 VerifiableCredential,\n WalletBase,\n WalletFile,\n} from \"@mdip/keymaster\";\n\nimport {\n GatekeeperClient,\n MdipDocument,\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<string> {\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 generateDID(operation: Operation): Promise<string> {\n GatekeeperReactNative.getInstance().ensureInitialized();\n return GatekeeperReactNative.getInstance().generateDIDInternal(operation);\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 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 generateDIDInternal(operation: Operation): Promise<string> {\n return await this.gatekeeperClient.generateDID(operation);\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 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,OAGK;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,EAC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,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,oBAAoB,WAAuC;AACvE,WAAO,MAAM,KAAK,iBAAiB,YAAY,SAAS;AAAA,EAC1D;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,EAEQ,eAAe,QAAyB;AAC9C,QAAI,CAAC,QAAQ;AACX,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.2",
3
+ "version": "0.28.3-mdip-beta3.0+c50413f",
4
4
  "description": "A React Native component library",
5
5
  "repository": "https://github.com/selfidhq/siwys-js",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@mdip/cipher": "^1.3.0",
29
- "@mdip/gatekeeper": "^1.3.0",
29
+ "@mdip/gatekeeper": "1.4.0-beta.3",
30
30
  "@mdip/keymaster": "1.4.0-beta.2"
31
31
  },
32
32
  "devDependencies": {
@@ -41,5 +41,5 @@
41
41
  "tsup": "^8.3.0",
42
42
  "typescript": "4.9.4"
43
43
  },
44
- "gitHead": "d88abc839676d02c93fcb6e355d8756ef51dd72a"
44
+ "gitHead": "c50413f7d72d9212df8a745f43cf787f050bca02"
45
45
  }