@yourself_id/siwys-api-js 0.20.1-SAPP-406-4.1 → 0.21.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
@@ -31,7 +31,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  // src/index.ts
32
32
  var src_exports = {};
33
33
  __export(src_exports, {
34
- AbstractBase: () => import_keymaster3.AbstractBase,
35
34
  GatekeeperClient: () => GatekeeperClient2,
36
35
  Keymaster: () => Keymaster,
37
36
  KeymasterExternalClient: () => KeymasterExternalClient
@@ -628,17 +627,20 @@ var GatekeeperClient2 = class _GatekeeperClient {
628
627
  _GatekeeperClient.getInstance().ensureInitialized();
629
628
  return _GatekeeperClient.getInstance().startInternal();
630
629
  }
631
- static addCustomHeader(...args) {
630
+ static addCustomHeader(header, value) {
632
631
  _GatekeeperClient.getInstance().ensureInitialized();
633
- return _GatekeeperClient.getInstance().addCustomHeaderInternal(...args);
632
+ return _GatekeeperClient.getInstance().addCustomHeaderInternal(
633
+ header,
634
+ value
635
+ );
634
636
  }
635
- static removeCustomHeader(...args) {
637
+ static removeCustomHeader(header) {
636
638
  _GatekeeperClient.getInstance().ensureInitialized();
637
- return _GatekeeperClient.getInstance().removeCustomHeaderInternal(...args);
639
+ return _GatekeeperClient.getInstance().removeCustomHeaderInternal(header);
638
640
  }
639
- static async listRegistries(...args) {
641
+ static async listRegistries() {
640
642
  _GatekeeperClient.getInstance().ensureInitialized();
641
- return _GatekeeperClient.getInstance().listRegistriesInternal(...args);
643
+ return _GatekeeperClient.getInstance().listRegistriesInternal();
642
644
  }
643
645
  static async resetDb() {
644
646
  _GatekeeperClient.getInstance().ensureInitialized();
@@ -660,89 +662,92 @@ var GatekeeperClient2 = class _GatekeeperClient {
660
662
  _GatekeeperClient.getInstance().ensureInitialized();
661
663
  return _GatekeeperClient.getInstance().getStatusInternal();
662
664
  }
663
- static async createDID(...args) {
665
+ static async createDID(operation) {
664
666
  _GatekeeperClient.getInstance().ensureInitialized();
665
- return _GatekeeperClient.getInstance().createDIDInternal(...args);
667
+ return _GatekeeperClient.getInstance().createDIDInternal(operation);
666
668
  }
667
- static async resolveDID(...args) {
669
+ static async resolveDID(did, options) {
668
670
  _GatekeeperClient.getInstance().ensureInitialized();
669
- return _GatekeeperClient.getInstance().resolveDIDInternal(...args);
671
+ return _GatekeeperClient.getInstance().resolveDIDInternal(did, options);
670
672
  }
671
- static async updateDID(...args) {
673
+ static async updateDID(operation) {
672
674
  _GatekeeperClient.getInstance().ensureInitialized();
673
- return _GatekeeperClient.getInstance().updateDIDInternal(...args);
675
+ return _GatekeeperClient.getInstance().updateDIDInternal(operation);
674
676
  }
675
- static async deleteDID(...args) {
677
+ static async deleteDID(operation) {
676
678
  _GatekeeperClient.getInstance().ensureInitialized();
677
- return _GatekeeperClient.getInstance().deleteDIDInternal(...args);
679
+ return _GatekeeperClient.getInstance().deleteDIDInternal(operation);
678
680
  }
679
- static async getDIDs(...args) {
681
+ static async getDIDs({
682
+ dids,
683
+ resolve
684
+ }) {
680
685
  _GatekeeperClient.getInstance().ensureInitialized();
681
- return _GatekeeperClient.getInstance().getDIDsInternal(...args);
686
+ return _GatekeeperClient.getInstance().getDIDsInternal({ dids, resolve });
682
687
  }
683
- static async exportDIDs(...args) {
688
+ static async exportDIDs(dids) {
684
689
  _GatekeeperClient.getInstance().ensureInitialized();
685
- return _GatekeeperClient.getInstance().exportDIDsInternal(...args);
690
+ return _GatekeeperClient.getInstance().exportDIDsInternal(dids);
686
691
  }
687
- static async importDIDs(...args) {
692
+ static async importDIDs(dids) {
688
693
  _GatekeeperClient.getInstance().ensureInitialized();
689
- return _GatekeeperClient.getInstance().importDIDsInternal(...args);
694
+ return _GatekeeperClient.getInstance().importDIDsInternal(dids);
690
695
  }
691
- static async exportBatch(...args) {
696
+ static async exportBatch(dids) {
692
697
  _GatekeeperClient.getInstance().ensureInitialized();
693
- return _GatekeeperClient.getInstance().exportBatchInternal(...args);
698
+ return _GatekeeperClient.getInstance().exportBatchInternal(dids);
694
699
  }
695
- static async importBatch(...args) {
700
+ static async importBatch(batch) {
696
701
  _GatekeeperClient.getInstance().ensureInitialized();
697
- return _GatekeeperClient.getInstance().importBatchInternal(...args);
702
+ return _GatekeeperClient.getInstance().importBatchInternal(batch);
698
703
  }
699
- static async removeDIDs(...args) {
704
+ static async removeDIDs(dids) {
700
705
  _GatekeeperClient.getInstance().ensureInitialized();
701
- return _GatekeeperClient.getInstance().removeDIDsInternal(...args);
706
+ return _GatekeeperClient.getInstance().removeDIDsInternal(dids);
702
707
  }
703
- static async getQueue(...args) {
708
+ static async getQueue(registry) {
704
709
  _GatekeeperClient.getInstance().ensureInitialized();
705
- return _GatekeeperClient.getInstance().getQueueInternal(...args);
710
+ return _GatekeeperClient.getInstance().getQueueInternal(registry);
706
711
  }
707
- static async clearQueue(...args) {
712
+ static async clearQueue(registry, events) {
708
713
  _GatekeeperClient.getInstance().ensureInitialized();
709
- return _GatekeeperClient.getInstance().clearQueueInternal(...args);
714
+ return _GatekeeperClient.getInstance().clearQueueInternal(registry, events);
710
715
  }
711
- static async processEvents(...args) {
716
+ static async processEvents() {
712
717
  _GatekeeperClient.getInstance().ensureInitialized();
713
- return _GatekeeperClient.getInstance().processEventsInternal(...args);
718
+ return _GatekeeperClient.getInstance().processEventsInternal();
714
719
  }
715
- static async addJSON(...args) {
720
+ static async addJSON(data) {
716
721
  _GatekeeperClient.getInstance().ensureInitialized();
717
- return _GatekeeperClient.getInstance().addJSONInternal(...args);
722
+ return _GatekeeperClient.getInstance().addJSONInternal(data);
718
723
  }
719
- static async getJSON(...args) {
724
+ static async getJSON(cid) {
720
725
  _GatekeeperClient.getInstance().ensureInitialized();
721
- return _GatekeeperClient.getInstance().getJSONInternal(...args);
726
+ return _GatekeeperClient.getInstance().getJSONInternal(cid);
722
727
  }
723
- static async addText(...args) {
728
+ static async addText(data) {
724
729
  _GatekeeperClient.getInstance().ensureInitialized();
725
- return _GatekeeperClient.getInstance().addTextInternal(...args);
730
+ return _GatekeeperClient.getInstance().addTextInternal(data);
726
731
  }
727
- static async getText(...args) {
732
+ static async getText(cid) {
728
733
  _GatekeeperClient.getInstance().ensureInitialized();
729
- return _GatekeeperClient.getInstance().getTextInternal(...args);
734
+ return _GatekeeperClient.getInstance().getTextInternal(cid);
730
735
  }
731
- static async addData(...args) {
736
+ static async addData(data) {
732
737
  _GatekeeperClient.getInstance().ensureInitialized();
733
- return _GatekeeperClient.getInstance().addDataInternal(...args);
738
+ return _GatekeeperClient.getInstance().addDataInternal(data);
734
739
  }
735
740
  static async getData(...args) {
736
741
  _GatekeeperClient.getInstance().ensureInitialized();
737
742
  return _GatekeeperClient.getInstance().getDataInternal(...args);
738
743
  }
739
- static async getBlock(...args) {
744
+ static async getBlock(cid) {
740
745
  _GatekeeperClient.getInstance().ensureInitialized();
741
- return _GatekeeperClient.getInstance().getBlockInternal(...args);
746
+ return _GatekeeperClient.getInstance().getBlockInternal(cid);
742
747
  }
743
- static async addBlock(...args) {
748
+ static async addBlock(registry, block) {
744
749
  _GatekeeperClient.getInstance().ensureInitialized();
745
- return _GatekeeperClient.getInstance().addBlockInternal(...args);
750
+ return _GatekeeperClient.getInstance().addBlockInternal(registry, block);
746
751
  }
747
752
  static getInstance() {
748
753
  if (!_GatekeeperClient.instance) {
@@ -779,91 +784,88 @@ var GatekeeperClient2 = class _GatekeeperClient {
779
784
  this.gatekeeperClient.removeCustomHeader(header);
780
785
  }
781
786
  async listRegistriesInternal() {
782
- const response = await this.gatekeeperClient.listRegistries();
783
- return response;
787
+ return await this.gatekeeperClient.listRegistries();
784
788
  }
785
789
  async resetDbInternal() {
786
- return this.gatekeeperClient.resetDb();
790
+ return await this.gatekeeperClient.resetDb();
787
791
  }
788
792
  async verifyDbInternal() {
789
- return this.gatekeeperClient.verifyDb();
793
+ return await this.gatekeeperClient.verifyDb();
790
794
  }
791
795
  async isReadyInternal() {
792
- return this.gatekeeperClient.isReady();
796
+ return await this.gatekeeperClient.isReady();
793
797
  }
794
798
  async getVersionInternal() {
795
- return this.gatekeeperClient.getVersion();
799
+ return await this.gatekeeperClient.getVersion();
796
800
  }
797
801
  async getStatusInternal() {
798
- return this.gatekeeperClient.getStatus();
802
+ return await this.gatekeeperClient.getStatus();
799
803
  }
800
804
  async createDIDInternal(operation) {
801
- return this.gatekeeperClient.createDID(operation);
805
+ return await this.gatekeeperClient.createDID(operation);
802
806
  }
803
807
  async resolveDIDInternal(did, options) {
804
- const response = await this.gatekeeperClient.resolveDID(did, options);
805
- return response;
808
+ return await this.gatekeeperClient.resolveDID(did, options);
806
809
  }
807
810
  async updateDIDInternal(operation) {
808
- return this.gatekeeperClient.updateDID(operation);
811
+ return await this.gatekeeperClient.updateDID(operation);
809
812
  }
810
813
  async deleteDIDInternal(operation) {
811
- return this.gatekeeperClient.deleteDID(operation);
814
+ return await this.gatekeeperClient.deleteDID(operation);
812
815
  }
813
816
  async getDIDsInternal({
814
817
  dids,
815
818
  resolve
816
819
  }) {
817
- const response = await this.gatekeeperClient.getDIDs({ dids, resolve });
818
- return response;
820
+ return await this.gatekeeperClient.getDIDs({ dids, resolve });
819
821
  }
820
822
  async exportDIDsInternal(dids) {
821
- return this.gatekeeperClient.exportDIDs(dids);
823
+ return await this.gatekeeperClient.exportDIDs(dids);
822
824
  }
823
825
  async importDIDsInternal(dids) {
824
- return this.gatekeeperClient.importDIDs(dids);
826
+ return await this.gatekeeperClient.importDIDs(dids);
825
827
  }
826
828
  async exportBatchInternal(dids) {
827
- return this.gatekeeperClient.exportBatch(dids);
829
+ return await this.gatekeeperClient.exportBatch(dids);
828
830
  }
829
831
  async importBatchInternal(batch) {
830
- return this.gatekeeperClient.importBatch(batch);
832
+ return await this.gatekeeperClient.importBatch(batch);
831
833
  }
832
834
  async removeDIDsInternal(dids) {
833
- return this.gatekeeperClient.removeDIDs(dids);
835
+ return await this.gatekeeperClient.removeDIDs(dids);
834
836
  }
835
837
  async getQueueInternal(registry) {
836
- return this.gatekeeperClient.getQueue(registry);
838
+ return await this.gatekeeperClient.getQueue(registry);
837
839
  }
838
840
  async clearQueueInternal(registry, events) {
839
- return this.gatekeeperClient.clearQueue(registry, events);
841
+ return await this.gatekeeperClient.clearQueue(registry, events);
840
842
  }
841
843
  async processEventsInternal() {
842
- return this.gatekeeperClient.processEvents();
844
+ return await this.gatekeeperClient.processEvents();
843
845
  }
844
846
  async addJSONInternal(data) {
845
- return this.gatekeeperClient.addJSON(data);
847
+ return await this.gatekeeperClient.addJSON(data);
846
848
  }
847
849
  async getJSONInternal(cid) {
848
- return this.gatekeeperClient.getJSON(cid);
850
+ return await this.gatekeeperClient.getJSON(cid);
849
851
  }
850
852
  async addTextInternal(data) {
851
- return this.gatekeeperClient.addText(data);
853
+ return await this.gatekeeperClient.addText(data);
852
854
  }
853
855
  async getTextInternal(cid) {
854
- return this.gatekeeperClient.getText(cid);
856
+ return await this.gatekeeperClient.getText(cid);
855
857
  }
856
858
  async addDataInternal(data) {
857
- return this.gatekeeperClient.addData(data);
859
+ return await this.gatekeeperClient.addData(data);
858
860
  }
859
861
  async getDataInternal(cid) {
860
- return this.gatekeeperClient.getData(cid);
862
+ return await this.gatekeeperClient.getData(cid);
861
863
  }
862
864
  async getBlockInternal(registry, block) {
863
- return this.gatekeeperClient.getBlock(registry, block);
865
+ return await this.gatekeeperClient.getBlock(registry, block);
864
866
  }
865
867
  async addBlockInternal(registry, block) {
866
- return this.gatekeeperClient.addBlock(registry, block);
868
+ return await this.gatekeeperClient.addBlock(registry, block);
867
869
  }
868
870
  validateConfig(config) {
869
871
  if (!config) {
@@ -874,10 +876,8 @@ var GatekeeperClient2 = class _GatekeeperClient {
874
876
 
875
877
  // src/index.ts
876
878
  __reExport(src_exports, require("@mdip/keymaster"), module.exports);
877
- var import_keymaster3 = require("@mdip/keymaster");
878
879
  // Annotate the CommonJS export names for ESM import in node:
879
880
  0 && (module.exports = {
880
- AbstractBase,
881
881
  GatekeeperClient,
882
882
  Keymaster,
883
883
  KeymasterExternalClient,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/keymaster.ts","../src/keymasterClient.ts","../src/gatekepeerClient.ts"],"sourcesContent":["export { Keymaster, KeymasterConfig } from \"./keymaster.js\";\nexport { KeymasterExternalClient } from \"./keymasterClient.js\";\nexport { GatekeeperClient } from \"./gatekepeerClient.js\";\n\nexport {\n SdkConfig,\n WalletConfig,\n CreateChallengeResponse,\n CreateChallengeSpec,\n} from \"./types/index.js\";\n\nexport * from \"@mdip/keymaster\";\nexport { AbstractBase } from \"@mdip/keymaster\";\nimport type * as GatekeeperTypes from \"@mdip/gatekeeper\";\n\nexport { GatekeeperTypes };\n","// Imports\nimport { default as GatekeeperClient } from \"@mdip/gatekeeper/client\";\nimport { default as CipherNode } from \"@mdip/cipher/node\";\nimport { default as KeymasterLib } from \"@mdip/keymaster\";\nimport {\n CreateChallengeResponse,\n CreateChallengeSpec,\n SdkConfig,\n WalletConfig,\n} from \"./types/index.js\";\nimport {\n ChallengeResponse,\n CreateAssetOptions,\n CreateResponseOptions,\n IssueCredentialsOptions,\n StoredWallet,\n VerifiableCredential,\n WalletBase,\n WalletFile,\n} from \"@mdip/keymaster\";\nimport type { MdipDocument, ResolveDIDOptions } from \"@mdip/gatekeeper\";\n\n// Keymaster configuration interface\nexport interface KeymasterConfig {\n gatekeeperConfig?: SdkConfig;\n walletDb?: WalletBase;\n walletConfig?: WalletConfig;\n}\n\nexport class Keymaster {\n private static instance: Keymaster | null = null;\n\n private config: KeymasterConfig;\n private keymasterService!: KeymasterLib;\n private serviceStarted = false;\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 Keymaster instance.\n * @param config The configuration object for the Keymaster service.\n */\n public static initialize(config: KeymasterConfig) {\n if (!Keymaster.instance) {\n Keymaster.instance = new Keymaster(config);\n console.log(\"✅ Keymaster initialized\");\n } else {\n console.warn(\n \"Keymaster already initialized, ignoring re-initialization.\"\n );\n }\n }\n\n // Ensures the instance is initialized\n private ensureInitialized() {\n if (!Keymaster.instance) {\n throw new Error(\n \"Keymaster not initialized. Call Keymaster.initialize() first.\"\n );\n }\n }\n\n /**\n * Starts the Keymaster service.\n * @returns A boolean indicating whether the service was started successfully.\n */\n public static async start() {\n Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().createChallengeInternal(spec, options);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().issueCredentialInternal(credential, options);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().publishCredentialInternal(did, options);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().verifyResponseInternal(did, options);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().updateCredentialInternal(did, credential);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().createIdInternal(name, 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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().createSchemaInternal(schema, options);\n }\n\n // Update a schema\n /**\n * Updates an schema for credentials given a schemaDID.\n * @param id The ID of the schema to update.\n * @param schema The schema data to update.\n * @returns A promise with a boolean.\n */\n public static async updateSchema(\n id: string,\n schema?: unknown\n ): Promise<boolean> {\n Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().setSchemaInternal(id, schema);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().newWalletInternal(mnemonic, overwrite);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().recoverWalletInternal(did);\n }\n\n // Helper method to retrieve the instance\n private static getInstance(): Keymaster {\n if (!Keymaster.instance) {\n throw new Error(\n \"Keymaster not initialized. Call Keymaster.initialize() first.\"\n );\n }\n return Keymaster.instance;\n }\n\n // -------- Internal instance methods (originals renamed with Internal) -------\n\n private async ensureServiceIsRunning() {\n if (!(await this.serviceRunning())) {\n throw new Error(\"Keymaster service not running\");\n }\n }\n\n private async startInternal(): Promise<boolean> {\n if (this.config.gatekeeperConfig) {\n this.serviceStarted = await this.startIntegratedKeymaster();\n } else {\n throw \"Missing Gatekeeper config\";\n }\n return this.serviceStarted;\n }\n\n private async startIntegratedKeymaster(): Promise<boolean> {\n try {\n if (this.config.walletDb) {\n const gatekeeper = await GatekeeperClient.create({\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\n const cipher = new CipherNode();\n this.keymasterService = new KeymasterLib({\n gatekeeper,\n wallet: this.config.walletDb,\n cipher,\n });\n await this.ensureWalletExists();\n } else {\n return false;\n }\n } catch (e) {\n console.error(\"Error starting Keymaster service:\", e);\n return false;\n }\n\n console.log(\"✅ Keymaster Started\");\n return true;\n }\n\n private async createChallengeInternal(\n spec: CreateChallengeSpec,\n options?: CreateAssetOptions\n ): Promise<CreateChallengeResponse> {\n await this.ensureServiceIsRunning();\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 schemaId: string,\n subjectId: string,\n options: {\n validFrom?: string;\n validUntil?: string;\n credential?: Record<string, unknown>;\n } = {}\n ): Promise<VerifiableCredential> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.bindCredential(schemaId, subjectId, options);\n }\n\n private async createResponseInternal(\n challengeDID: string,\n options?: CreateResponseOptions\n ): Promise<string> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.createResponse(challengeDID, options);\n }\n\n private async backupWalletInternal(registry?: string): Promise<string> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.backupWallet(registry);\n }\n\n private async issueCredentialInternal(\n credential: Partial<VerifiableCredential>,\n options: IssueCredentialsOptions = {}\n ): Promise<string> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.issueCredential(credential, options);\n }\n\n private async publishCredentialInternal(\n did: string,\n options: { reveal?: boolean } = {}\n ): Promise<VerifiableCredential> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.publishCredential(did, options);\n }\n\n private async acceptCredentialInternal(did: string): Promise<boolean> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.acceptCredential(did);\n }\n\n private async showMnemonicInternal(): Promise<string> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.decryptMnemonic();\n }\n\n private async verifyResponseInternal(\n did: string,\n options?: { retries?: number; delay?: number }\n ): Promise<ChallengeResponse> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.verifyResponse(did, options);\n }\n\n private async decryptMessageInternal(\n ...args: Parameters<KeymasterLib[\"decryptMessage\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.decryptMessage(...args);\n }\n\n private async decryptMnemonicInternal(\n ...args: Parameters<KeymasterLib[\"decryptMnemonic\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.decryptMnemonic(...args);\n }\n\n private async getCredentialInternal(\n ...args: Parameters<KeymasterLib[\"getCredential\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.getCredential(...args);\n }\n\n private async removeCredentialInternal(\n ...args: Parameters<KeymasterLib[\"removeCredential\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.removeCredential(...args);\n }\n\n private async updateCredentialInternal(\n ...args: Parameters<KeymasterLib[\"updateCredential\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.updateCredential(...args);\n }\n\n private async createIdInternal(\n ...args: Parameters<KeymasterLib[\"createId\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.createId(...args);\n }\n\n private async removeIdInternal(\n ...args: Parameters<KeymasterLib[\"removeId\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.removeId(...args);\n }\n\n private async resolveDIDInternal(\n ...args: Parameters<KeymasterLib[\"resolveDID\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.resolveDID(...args);\n }\n\n private async setCurrentIdInternal(\n ...args: Parameters<KeymasterLib[\"setCurrentId\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.setCurrentId(...args);\n }\n\n private async createSchemaInternal(\n ...args: Parameters<KeymasterLib[\"createSchema\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.createSchema(...args);\n }\n\n private async setSchemaInternal(\n ...args: Parameters<KeymasterLib[\"setSchema\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.setSchema(...args);\n }\n\n private async newWalletInternal(\n ...args: Parameters<KeymasterLib[\"newWallet\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.newWallet(...args);\n }\n\n private async recoverWalletInternal(\n ...args: Parameters<KeymasterLib[\"recoverWallet\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.recoverWallet(...args);\n }\n\n private async ensureWalletExists(): Promise<void> {\n const existing: StoredWallet | null =\n (await this.config?.walletDb?.loadWallet()) || null;\n if (existing && \"current\" in existing) {\n console.log(`Using existing wallet with ID ${existing.current}`);\n return;\n }\n\n const walletConfig = this.config.walletConfig;\n if (walletConfig?.mnemonic) {\n await this.keymasterService.newWallet(walletConfig.mnemonic, true);\n }\n\n if (walletConfig?.id) {\n await this.keymasterService.createId(walletConfig.id, {\n registry: walletConfig.registry,\n });\n }\n }\n\n private async serviceRunning(): Promise<boolean> {\n return this.serviceStarted || (await this.startInternal());\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.walletConfig) {\n throw new Error(\"Missing wallet config\");\n }\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 }\n }\n}\n","import KeymasterClient from \"@mdip/keymaster/client\";\nimport {\n ChallengeResponse,\n CreateAssetOptions,\n IssueCredentialsOptions,\n VerifiableCredential,\n} from \"@mdip/keymaster\";\nimport {\n CreateChallengeResponse,\n CreateChallengeSpec,\n SdkConfig,\n} from \"./types/index.js\";\n\nexport interface KeymasterConfig {\n keymasterConfig?: SdkConfig;\n}\n\nexport class KeymasterExternalClient {\n private config: KeymasterConfig;\n private keymasterService!: KeymasterClient;\n private serviceStarted = false;\n\n constructor(config: KeymasterConfig) {\n this.validateConfig(config);\n this.config = config;\n }\n\n public async start(): Promise<boolean> {\n if (this.config.keymasterConfig) {\n this.serviceStarted = await this.startExternalKeymaster();\n } else {\n throw \"Missing Keymaster config\";\n }\n return this.serviceStarted;\n }\n\n public async startExternal(): Promise<boolean> {\n if (this.config.keymasterConfig) {\n this.serviceStarted = await this.startExternalKeymaster();\n } else {\n throw \"Missing Gatekeeper or Keymaster config\";\n }\n return this.serviceStarted;\n }\n\n private async startExternalKeymaster(): Promise<boolean> {\n try {\n this.keymasterService = new KeymasterClient();\n await this.keymasterService.connect(this.config.keymasterConfig);\n } catch (e) {\n console.error(`Error starting Keymaster service:`, e);\n return false;\n }\n\n return true;\n }\n\n async createChallenge(\n spec: CreateChallengeSpec,\n options?: CreateAssetOptions\n ): Promise<CreateChallengeResponse> {\n if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\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 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 if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\n\n return this.keymasterService.bindCredential(schemaId, subjectId, options);\n }\n\n async issueCredential(\n credential: Partial<VerifiableCredential>,\n options: IssueCredentialsOptions = {}\n ): Promise<string> {\n if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\n\n return this.keymasterService.issueCredential(credential, options);\n }\n\n async publishCredential(\n did: string,\n options: { reveal?: boolean } = {}\n ): Promise<boolean> {\n if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\n\n return this.keymasterService.publishCredential(did, options);\n }\n\n async acceptCredential(did: string): Promise<boolean> {\n if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\n\n return this.keymasterService.acceptCredential(did);\n }\n\n async showMnemonic(): Promise<string> {\n if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\n return this.keymasterService.decryptMnemonic();\n }\n\n async verifyResponse(\n did: string,\n options?: {\n retries?: number;\n delay?: number;\n }\n ): Promise<ChallengeResponse> {\n if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\n const response: ChallengeResponse =\n await this.keymasterService.verifyResponse(did, options);\n return response;\n }\n\n private async serviceRunning(): Promise<boolean> {\n return this.serviceStarted || (await this.start());\n }\n\n private validateConfig(config: KeymasterConfig): void {\n if (!config.keymasterConfig) {\n throw new Error(\"Missing Keymaster config\");\n }\n }\n}\n","import {\n GatekeeperClient as GatekeeperClientMdip,\n MdipDocument,\n GetDIDOptions,\n VerifyDbResult,\n GetStatusResult,\n Operation,\n ResolveDIDOptions,\n GatekeeperEvent,\n ImportBatchResult,\n ProcessEventsResult,\n BlockId,\n BlockInfo,\n GatekeeperClientOptions,\n} from \"@mdip/gatekeeper\";\n\nexport class GatekeeperClient {\n private static instance: GatekeeperClient | null = null;\n\n private config: GatekeeperClientOptions;\n private gatekeeperClient!: GatekeeperClientMdip;\n\n private constructor(config: GatekeeperClientOptions) {\n this.validateConfig(config);\n this.config = config;\n }\n\n public static initialize(config: GatekeeperClientOptions) {\n if (!GatekeeperClient.instance) {\n GatekeeperClient.instance = new GatekeeperClient(config);\n } else {\n console.warn(\n \"GatekeeperClient already initialized, ignoring re-initialization.\"\n );\n }\n }\n\n private ensureInitialized() {\n if (!GatekeeperClient.instance) {\n throw new Error(\n \"GatekeeperClient not initialized. Call GatekeeperClient.initialize() first.\"\n );\n }\n }\n\n // Delegated STATIC methods\n\n public static async start() {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().startInternal();\n }\n\n public static addCustomHeader(\n ...args: Parameters<GatekeeperClient[\"addCustomHeaderInternal\"]>\n ): void {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().addCustomHeaderInternal(...args);\n }\n\n public static removeCustomHeader(\n ...args: Parameters<GatekeeperClient[\"removeCustomHeaderInternal\"]>\n ): void {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().removeCustomHeaderInternal(...args);\n }\n\n public static async listRegistries(\n ...args: Parameters<GatekeeperClient[\"listRegistriesInternal\"]>\n ) {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().listRegistriesInternal(...args);\n }\n\n public static async resetDb(): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().resetDbInternal();\n }\n\n public static async verifyDb(): Promise<VerifyDbResult> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().verifyDbInternal();\n }\n\n public static async isReady(): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().isReadyInternal();\n }\n\n public static async getVersion(): Promise<number> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getVersionInternal();\n }\n\n public static async getStatus(): Promise<GetStatusResult> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getStatusInternal();\n }\n\n public static async createDID(\n ...args: Parameters<GatekeeperClient[\"createDIDInternal\"]>\n ): Promise<string> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().createDIDInternal(...args);\n }\n\n public static async resolveDID(\n ...args: Parameters<GatekeeperClient[\"resolveDIDInternal\"]>\n ): Promise<MdipDocument> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().resolveDIDInternal(...args);\n }\n\n public static async updateDID(\n ...args: Parameters<GatekeeperClient[\"updateDIDInternal\"]>\n ): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().updateDIDInternal(...args);\n }\n\n public static async deleteDID(\n ...args: Parameters<GatekeeperClient[\"deleteDIDInternal\"]>\n ): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().deleteDIDInternal(...args);\n }\n\n public static async getDIDs(\n ...args: Parameters<GatekeeperClient[\"getDIDsInternal\"]>\n ): Promise<string[] | MdipDocument[]> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getDIDsInternal(...args);\n }\n\n public static async exportDIDs(\n ...args: Parameters<GatekeeperClient[\"exportDIDsInternal\"]>\n ): Promise<GatekeeperEvent[][]> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().exportDIDsInternal(...args);\n }\n\n public static async importDIDs(\n ...args: Parameters<GatekeeperClient[\"importDIDsInternal\"]>\n ): Promise<ImportBatchResult> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().importDIDsInternal(...args);\n }\n\n public static async exportBatch(\n ...args: Parameters<GatekeeperClient[\"exportBatchInternal\"]>\n ): Promise<GatekeeperEvent[]> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().exportBatchInternal(...args);\n }\n\n public static async importBatch(\n ...args: Parameters<GatekeeperClient[\"importBatchInternal\"]>\n ): Promise<ImportBatchResult> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().importBatchInternal(...args);\n }\n\n public static async removeDIDs(\n ...args: Parameters<GatekeeperClient[\"removeDIDsInternal\"]>\n ): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().removeDIDsInternal(...args);\n }\n\n public static async getQueue(\n ...args: Parameters<GatekeeperClient[\"getQueueInternal\"]>\n ): Promise<Operation[]> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getQueueInternal(...args);\n }\n\n public static async clearQueue(\n ...args: Parameters<GatekeeperClient[\"clearQueueInternal\"]>\n ): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().clearQueueInternal(...args);\n }\n\n public static async processEvents(\n ...args: Parameters<GatekeeperClient[\"processEventsInternal\"]>\n ): Promise<ProcessEventsResult> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().processEventsInternal(...args);\n }\n\n public static async addJSON(\n ...args: Parameters<GatekeeperClient[\"addJSONInternal\"]>\n ): Promise<string> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().addJSONInternal(...args);\n }\n\n public static async getJSON(\n ...args: Parameters<GatekeeperClient[\"getJSONInternal\"]>\n ): Promise<object> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getJSONInternal(...args);\n }\n\n public static async addText(\n ...args: Parameters<GatekeeperClient[\"addTextInternal\"]>\n ): Promise<string> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().addTextInternal(...args);\n }\n\n public static async getText(\n ...args: Parameters<GatekeeperClient[\"getTextInternal\"]>\n ): Promise<string> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getTextInternal(...args);\n }\n\n public static async addData(\n ...args: Parameters<GatekeeperClient[\"addDataInternal\"]>\n ): Promise<string> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().addDataInternal(...args);\n }\n\n public static async getData(\n ...args: Parameters<GatekeeperClient[\"getDataInternal\"]>\n ): Promise<Buffer> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getDataInternal(...args);\n }\n\n public static async getBlock(\n ...args: Parameters<GatekeeperClient[\"getBlockInternal\"]>\n ): Promise<BlockInfo | null> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getBlockInternal(...args);\n }\n\n public static async addBlock(\n ...args: Parameters<GatekeeperClient[\"addBlockInternal\"]>\n ): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().addBlockInternal(...args);\n }\n\n private static getInstance(): GatekeeperClient {\n if (!GatekeeperClient.instance) {\n throw new Error(\n \"GatekeeperClient not initialized. Call GatekeeperClient.initialize() first.\"\n );\n }\n return GatekeeperClient.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 GatekeeperClientMdip();\n await this.gatekeeperClient.connect({\n ...this.config,\n });\n } catch (e) {\n console.error(\"Error starting GatekeeperClient service:\", e);\n return false;\n }\n return true;\n }\n\n private addCustomHeaderInternal(header: string, value: string): void {\n this.gatekeeperClient.addCustomHeader(header, value);\n }\n\n private removeCustomHeaderInternal(header: string): void {\n this.gatekeeperClient.removeCustomHeader(header);\n }\n\n private async listRegistriesInternal(): Promise<string[]> {\n const response = await this.gatekeeperClient.listRegistries();\n return response;\n }\n\n private async resetDbInternal(): Promise<boolean> {\n return this.gatekeeperClient.resetDb();\n }\n\n private async verifyDbInternal(): Promise<VerifyDbResult> {\n return this.gatekeeperClient.verifyDb();\n }\n\n private async isReadyInternal(): Promise<boolean> {\n return this.gatekeeperClient.isReady();\n }\n\n private async getVersionInternal(): Promise<number> {\n return this.gatekeeperClient.getVersion();\n }\n\n private async getStatusInternal(): Promise<GetStatusResult> {\n return this.gatekeeperClient.getStatus();\n }\n\n private async createDIDInternal(operation: Operation): Promise<string> {\n return this.gatekeeperClient.createDID(operation);\n }\n\n private async resolveDIDInternal(\n did: string,\n options?: ResolveDIDOptions\n ): Promise<MdipDocument> {\n const response = await this.gatekeeperClient.resolveDID(did, options);\n return response;\n }\n\n private async updateDIDInternal(operation: Operation): Promise<boolean> {\n return this.gatekeeperClient.updateDID(operation);\n }\n\n private async deleteDIDInternal(operation: Operation): Promise<boolean> {\n return this.gatekeeperClient.deleteDID(operation);\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 exportDIDsInternal(\n dids?: string[]\n ): Promise<GatekeeperEvent[][]> {\n return this.gatekeeperClient.exportDIDs(dids);\n }\n\n private async importDIDsInternal(\n dids: GatekeeperEvent[][]\n ): Promise<ImportBatchResult> {\n return this.gatekeeperClient.importDIDs(dids);\n }\n\n private async exportBatchInternal(\n dids?: string[]\n ): Promise<GatekeeperEvent[]> {\n return this.gatekeeperClient.exportBatch(dids);\n }\n\n private async importBatchInternal(\n batch: GatekeeperEvent[]\n ): Promise<ImportBatchResult> {\n return this.gatekeeperClient.importBatch(batch);\n }\n\n private async removeDIDsInternal(dids: string[]): Promise<boolean> {\n return this.gatekeeperClient.removeDIDs(dids);\n }\n\n private async getQueueInternal(registry: string): Promise<Operation[]> {\n return this.gatekeeperClient.getQueue(registry);\n }\n\n private async clearQueueInternal(\n registry: string,\n events: Operation[]\n ): Promise<boolean> {\n return this.gatekeeperClient.clearQueue(registry, events);\n }\n\n private async processEventsInternal(): Promise<ProcessEventsResult> {\n return this.gatekeeperClient.processEvents();\n }\n\n private async addJSONInternal(data: object): Promise<string> {\n return this.gatekeeperClient.addJSON(data);\n }\n\n private async getJSONInternal(cid: string): Promise<object> {\n return this.gatekeeperClient.getJSON(cid);\n }\n\n private async addTextInternal(data: string): Promise<string> {\n return this.gatekeeperClient.addText(data);\n }\n\n private async getTextInternal(cid: string): Promise<string> {\n return this.gatekeeperClient.getText(cid);\n }\n\n private async addDataInternal(data: Buffer): Promise<string> {\n return this.gatekeeperClient.addData(data);\n }\n\n private async getDataInternal(cid: string): Promise<Buffer> {\n return this.gatekeeperClient.getData(cid);\n }\n\n private async getBlockInternal(\n registry: string,\n block?: BlockId\n ): Promise<BlockInfo | null> {\n return this.gatekeeperClient.getBlock(registry, block);\n }\n\n private async addBlockInternal(\n registry: string,\n block: BlockInfo\n ): Promise<boolean> {\n return this.gatekeeperClient.addBlock(registry, block);\n }\n\n private validateConfig(config: GatekeeperClientOptions): void {\n if (!config) {\n throw new Error(\"Missing Gatekeeper config\");\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,0BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;;;ACCA,oBAA4C;AAC5C,kBAAsC;AACtC,uBAAwC;AA0BjC,IAAM,YAAN,MAAM,WAAU;AAAA,EACrB,OAAe,WAA6B;AAAA,EAEpC;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EAEjB,YAAY,QAAyB;AAC3C,SAAK,eAAe,MAAM;AAC1B,SAAK,SAAS;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAc,WAAW,QAAyB;AAChD,QAAI,CAAC,WAAU,UAAU;AACvB,iBAAU,WAAW,IAAI,WAAU,MAAM;AACzC,cAAQ,IAAI,8BAAyB;AAAA,IACvC,OAAO;AACL,cAAQ;AAAA,QACN;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGQ,oBAAoB;AAC1B,QAAI,CAAC,WAAU,UAAU;AACvB,YAAM,IAAI;AAAA,QACR;AAAA,MACF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aster"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/keymaster.ts","../src/keymasterClient.ts","../src/gatekepeerClient.ts"],"sourcesContent":["export { Keymaster, KeymasterConfig } from \"./keymaster.js\";\nexport { KeymasterExternalClient } from \"./keymasterClient.js\";\nexport { GatekeeperClient } from \"./gatekepeerClient.js\";\n\nexport {\n SdkConfig,\n WalletConfig,\n CreateChallengeResponse,\n CreateChallengeSpec,\n} from \"./types/index.js\";\n\nexport * from \"@mdip/keymaster\";\nimport type * as GatekeeperTypes from \"@mdip/gatekeeper\";\n\nexport { GatekeeperTypes };\n","// Imports\nimport { default as GatekeeperClient } from \"@mdip/gatekeeper/client\";\nimport { default as CipherNode } from \"@mdip/cipher/node\";\nimport { default as KeymasterLib } from \"@mdip/keymaster\";\nimport {\n CreateChallengeResponse,\n CreateChallengeSpec,\n SdkConfig,\n WalletConfig,\n} from \"./types/index.js\";\nimport {\n ChallengeResponse,\n CreateAssetOptions,\n CreateResponseOptions,\n IssueCredentialsOptions,\n StoredWallet,\n VerifiableCredential,\n WalletBase,\n WalletFile,\n} from \"@mdip/keymaster\";\nimport type { MdipDocument, ResolveDIDOptions } from \"@mdip/gatekeeper\";\n\n// Keymaster configuration interface\nexport interface KeymasterConfig {\n gatekeeperConfig?: SdkConfig;\n walletDb?: WalletBase;\n walletConfig?: WalletConfig;\n}\n\nexport class Keymaster {\n private static instance: Keymaster | null = null;\n\n private config: KeymasterConfig;\n private keymasterService!: KeymasterLib;\n private serviceStarted = false;\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 Keymaster instance.\n * @param config The configuration object for the Keymaster service.\n */\n public static initialize(config: KeymasterConfig) {\n if (!Keymaster.instance) {\n Keymaster.instance = new Keymaster(config);\n console.log(\"✅ Keymaster initialized\");\n } else {\n console.warn(\n \"Keymaster already initialized, ignoring re-initialization.\"\n );\n }\n }\n\n // Ensures the instance is initialized\n private ensureInitialized() {\n if (!Keymaster.instance) {\n throw new Error(\n \"Keymaster not initialized. Call Keymaster.initialize() first.\"\n );\n }\n }\n\n /**\n * Starts the Keymaster service.\n * @returns A boolean indicating whether the service was started successfully.\n */\n public static async start() {\n Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().createChallengeInternal(spec, options);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().issueCredentialInternal(credential, options);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().publishCredentialInternal(did, options);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().verifyResponseInternal(did, options);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().updateCredentialInternal(did, credential);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().createIdInternal(name, 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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().createSchemaInternal(schema, options);\n }\n\n // Update a schema\n /**\n * Updates an schema for credentials given a schemaDID.\n * @param id The ID of the schema to update.\n * @param schema The schema data to update.\n * @returns A promise with a boolean.\n */\n public static async updateSchema(\n id: string,\n schema?: unknown\n ): Promise<boolean> {\n Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().setSchemaInternal(id, schema);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().newWalletInternal(mnemonic, overwrite);\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 Keymaster.getInstance().ensureInitialized();\n return Keymaster.getInstance().recoverWalletInternal(did);\n }\n\n // Helper method to retrieve the instance\n private static getInstance(): Keymaster {\n if (!Keymaster.instance) {\n throw new Error(\n \"Keymaster not initialized. Call Keymaster.initialize() first.\"\n );\n }\n return Keymaster.instance;\n }\n\n // -------- Internal instance methods (originals renamed with Internal) -------\n\n private async ensureServiceIsRunning() {\n if (!(await this.serviceRunning())) {\n throw new Error(\"Keymaster service not running\");\n }\n }\n\n private async startInternal(): Promise<boolean> {\n if (this.config.gatekeeperConfig) {\n this.serviceStarted = await this.startIntegratedKeymaster();\n } else {\n throw \"Missing Gatekeeper config\";\n }\n return this.serviceStarted;\n }\n\n private async startIntegratedKeymaster(): Promise<boolean> {\n try {\n if (this.config.walletDb) {\n const gatekeeper = await GatekeeperClient.create({\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\n const cipher = new CipherNode();\n this.keymasterService = new KeymasterLib({\n gatekeeper,\n wallet: this.config.walletDb,\n cipher,\n });\n await this.ensureWalletExists();\n } else {\n return false;\n }\n } catch (e) {\n console.error(\"Error starting Keymaster service:\", e);\n return false;\n }\n\n console.log(\"✅ Keymaster Started\");\n return true;\n }\n\n private async createChallengeInternal(\n spec: CreateChallengeSpec,\n options?: CreateAssetOptions\n ): Promise<CreateChallengeResponse> {\n await this.ensureServiceIsRunning();\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 schemaId: string,\n subjectId: string,\n options: {\n validFrom?: string;\n validUntil?: string;\n credential?: Record<string, unknown>;\n } = {}\n ): Promise<VerifiableCredential> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.bindCredential(schemaId, subjectId, options);\n }\n\n private async createResponseInternal(\n challengeDID: string,\n options?: CreateResponseOptions\n ): Promise<string> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.createResponse(challengeDID, options);\n }\n\n private async backupWalletInternal(registry?: string): Promise<string> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.backupWallet(registry);\n }\n\n private async issueCredentialInternal(\n credential: Partial<VerifiableCredential>,\n options: IssueCredentialsOptions = {}\n ): Promise<string> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.issueCredential(credential, options);\n }\n\n private async publishCredentialInternal(\n did: string,\n options: { reveal?: boolean } = {}\n ): Promise<VerifiableCredential> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.publishCredential(did, options);\n }\n\n private async acceptCredentialInternal(did: string): Promise<boolean> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.acceptCredential(did);\n }\n\n private async showMnemonicInternal(): Promise<string> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.decryptMnemonic();\n }\n\n private async verifyResponseInternal(\n did: string,\n options?: { retries?: number; delay?: number }\n ): Promise<ChallengeResponse> {\n await this.ensureServiceIsRunning();\n return this.keymasterService.verifyResponse(did, options);\n }\n\n private async decryptMessageInternal(\n ...args: Parameters<KeymasterLib[\"decryptMessage\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.decryptMessage(...args);\n }\n\n private async decryptMnemonicInternal(\n ...args: Parameters<KeymasterLib[\"decryptMnemonic\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.decryptMnemonic(...args);\n }\n\n private async getCredentialInternal(\n ...args: Parameters<KeymasterLib[\"getCredential\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.getCredential(...args);\n }\n\n private async removeCredentialInternal(\n ...args: Parameters<KeymasterLib[\"removeCredential\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.removeCredential(...args);\n }\n\n private async updateCredentialInternal(\n ...args: Parameters<KeymasterLib[\"updateCredential\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.updateCredential(...args);\n }\n\n private async createIdInternal(\n ...args: Parameters<KeymasterLib[\"createId\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.createId(...args);\n }\n\n private async removeIdInternal(\n ...args: Parameters<KeymasterLib[\"removeId\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.removeId(...args);\n }\n\n private async resolveDIDInternal(\n ...args: Parameters<KeymasterLib[\"resolveDID\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.resolveDID(...args);\n }\n\n private async setCurrentIdInternal(\n ...args: Parameters<KeymasterLib[\"setCurrentId\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.setCurrentId(...args);\n }\n\n private async createSchemaInternal(\n ...args: Parameters<KeymasterLib[\"createSchema\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.createSchema(...args);\n }\n\n private async setSchemaInternal(\n ...args: Parameters<KeymasterLib[\"setSchema\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.setSchema(...args);\n }\n\n private async newWalletInternal(\n ...args: Parameters<KeymasterLib[\"newWallet\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.newWallet(...args);\n }\n\n private async recoverWalletInternal(\n ...args: Parameters<KeymasterLib[\"recoverWallet\"]>\n ) {\n await this.ensureServiceIsRunning();\n return this.keymasterService.recoverWallet(...args);\n }\n\n private async ensureWalletExists(): Promise<void> {\n const existing: StoredWallet | null =\n (await this.config?.walletDb?.loadWallet()) || null;\n if (existing && \"current\" in existing) {\n console.log(`Using existing wallet with ID ${existing.current}`);\n return;\n }\n\n const walletConfig = this.config.walletConfig;\n if (walletConfig?.mnemonic) {\n await this.keymasterService.newWallet(walletConfig.mnemonic, true);\n }\n\n if (walletConfig?.id) {\n await this.keymasterService.createId(walletConfig.id, {\n registry: walletConfig.registry,\n });\n }\n }\n\n private async serviceRunning(): Promise<boolean> {\n return this.serviceStarted || (await this.startInternal());\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.walletConfig) {\n throw new Error(\"Missing wallet config\");\n }\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 }\n }\n}\n","import KeymasterClient from \"@mdip/keymaster/client\";\nimport {\n ChallengeResponse,\n CreateAssetOptions,\n IssueCredentialsOptions,\n VerifiableCredential,\n} from \"@mdip/keymaster\";\nimport {\n CreateChallengeResponse,\n CreateChallengeSpec,\n SdkConfig,\n} from \"./types/index.js\";\n\nexport interface KeymasterConfig {\n keymasterConfig?: SdkConfig;\n}\n\nexport class KeymasterExternalClient {\n private config: KeymasterConfig;\n private keymasterService!: KeymasterClient;\n private serviceStarted = false;\n\n constructor(config: KeymasterConfig) {\n this.validateConfig(config);\n this.config = config;\n }\n\n public async start(): Promise<boolean> {\n if (this.config.keymasterConfig) {\n this.serviceStarted = await this.startExternalKeymaster();\n } else {\n throw \"Missing Keymaster config\";\n }\n return this.serviceStarted;\n }\n\n public async startExternal(): Promise<boolean> {\n if (this.config.keymasterConfig) {\n this.serviceStarted = await this.startExternalKeymaster();\n } else {\n throw \"Missing Gatekeeper or Keymaster config\";\n }\n return this.serviceStarted;\n }\n\n private async startExternalKeymaster(): Promise<boolean> {\n try {\n this.keymasterService = new KeymasterClient();\n await this.keymasterService.connect(this.config.keymasterConfig);\n } catch (e) {\n console.error(`Error starting Keymaster service:`, e);\n return false;\n }\n\n return true;\n }\n\n async createChallenge(\n spec: CreateChallengeSpec,\n options?: CreateAssetOptions\n ): Promise<CreateChallengeResponse> {\n if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\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 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 if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\n\n return this.keymasterService.bindCredential(schemaId, subjectId, options);\n }\n\n async issueCredential(\n credential: Partial<VerifiableCredential>,\n options: IssueCredentialsOptions = {}\n ): Promise<string> {\n if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\n\n return this.keymasterService.issueCredential(credential, options);\n }\n\n async publishCredential(\n did: string,\n options: { reveal?: boolean } = {}\n ): Promise<boolean> {\n if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\n\n return this.keymasterService.publishCredential(did, options);\n }\n\n async acceptCredential(did: string): Promise<boolean> {\n if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\n\n return this.keymasterService.acceptCredential(did);\n }\n\n async showMnemonic(): Promise<string> {\n if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\n return this.keymasterService.decryptMnemonic();\n }\n\n async verifyResponse(\n did: string,\n options?: {\n retries?: number;\n delay?: number;\n }\n ): Promise<ChallengeResponse> {\n if (!this.serviceRunning()) {\n throw new Error(\"Keymaster service not running\");\n }\n const response: ChallengeResponse =\n await this.keymasterService.verifyResponse(did, options);\n return response;\n }\n\n private async serviceRunning(): Promise<boolean> {\n return this.serviceStarted || (await this.start());\n }\n\n private validateConfig(config: KeymasterConfig): void {\n if (!config.keymasterConfig) {\n throw new Error(\"Missing Keymaster config\");\n }\n }\n}\n","import {\n GatekeeperClient as GatekeeperClientMdip,\n MdipDocument,\n GetDIDOptions,\n VerifyDbResult,\n GetStatusResult,\n Operation,\n ResolveDIDOptions,\n GatekeeperEvent,\n ImportBatchResult,\n ProcessEventsResult,\n BlockId,\n BlockInfo,\n GatekeeperClientOptions,\n} from \"@mdip/gatekeeper\";\n\nexport class GatekeeperClient {\n private static instance: GatekeeperClient | null = null;\n\n private config: GatekeeperClientOptions;\n private gatekeeperClient!: GatekeeperClientMdip;\n\n private constructor(config: GatekeeperClientOptions) {\n this.validateConfig(config);\n this.config = config;\n }\n\n public static initialize(config: GatekeeperClientOptions) {\n if (!GatekeeperClient.instance) {\n GatekeeperClient.instance = new GatekeeperClient(config);\n } else {\n console.warn(\n \"GatekeeperClient already initialized, ignoring re-initialization.\"\n );\n }\n }\n\n private ensureInitialized() {\n if (!GatekeeperClient.instance) {\n throw new Error(\n \"GatekeeperClient not initialized. Call GatekeeperClient.initialize() first.\"\n );\n }\n }\n\n // Delegated STATIC methods\n\n public static async start() {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().startInternal();\n }\n\n public static addCustomHeader(header: string, value: string): void {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().addCustomHeaderInternal(\n header,\n value\n );\n }\n\n public static removeCustomHeader(header: string): void {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().removeCustomHeaderInternal(header);\n }\n\n public static async listRegistries(): Promise<string[]> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().listRegistriesInternal();\n }\n\n public static async resetDb(): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().resetDbInternal();\n }\n\n public static async verifyDb(): Promise<VerifyDbResult> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().verifyDbInternal();\n }\n\n public static async isReady(): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().isReadyInternal();\n }\n\n public static async getVersion(): Promise<number> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getVersionInternal();\n }\n\n public static async getStatus(): Promise<GetStatusResult> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getStatusInternal();\n }\n\n public static async createDID(operation: Operation): Promise<string> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().createDIDInternal(operation);\n }\n\n public static async resolveDID(\n did: string,\n options?: ResolveDIDOptions\n ): Promise<MdipDocument> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().resolveDIDInternal(did, options);\n }\n\n public static async updateDID(operation: Operation): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().updateDIDInternal(operation);\n }\n\n public static async deleteDID(operation: Operation): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().deleteDIDInternal(operation);\n }\n\n public static async getDIDs({\n dids,\n resolve,\n }: GetDIDOptions): Promise<string[] | MdipDocument[]> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getDIDsInternal({ dids, resolve });\n }\n\n public static async exportDIDs(\n dids?: string[]\n ): Promise<GatekeeperEvent[][]> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().exportDIDsInternal(dids);\n }\n\n public static async importDIDs(\n dids: GatekeeperEvent[][]\n ): Promise<ImportBatchResult> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().importDIDsInternal(dids);\n }\n\n public static async exportBatch(dids?: string[]): Promise<GatekeeperEvent[]> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().exportBatchInternal(dids);\n }\n\n public static async importBatch(\n batch: GatekeeperEvent[]\n ): Promise<ImportBatchResult> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().importBatchInternal(batch);\n }\n\n public static async removeDIDs(dids: string[]): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().removeDIDsInternal(dids);\n }\n\n public static async getQueue(registry: string): Promise<Operation[]> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getQueueInternal(registry);\n }\n\n public static async clearQueue(\n registry: string,\n events: Operation[]\n ): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().clearQueueInternal(registry, events);\n }\n\n public static async processEvents(): Promise<ProcessEventsResult> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().processEventsInternal();\n }\n\n public static async addJSON(data: object): Promise<string> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().addJSONInternal(data);\n }\n\n public static async getJSON(cid: string): Promise<object> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getJSONInternal(cid);\n }\n\n public static async addText(data: string): Promise<string> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().addTextInternal(data);\n }\n\n public static async getText(cid: string): Promise<string> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getTextInternal(cid);\n }\n\n public static async addData(data: Buffer): Promise<string> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().addDataInternal(data);\n }\n\n public static async getData(\n ...args: Parameters<GatekeeperClient[\"getDataInternal\"]>\n ): Promise<Buffer> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getDataInternal(...args);\n }\n\n public static async getBlock(cid: string): Promise<BlockInfo | null> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().getBlockInternal(cid);\n }\n\n public static async addBlock(\n registry: string,\n block: BlockInfo\n ): Promise<boolean> {\n GatekeeperClient.getInstance().ensureInitialized();\n return GatekeeperClient.getInstance().addBlockInternal(registry, block);\n }\n\n private static getInstance(): GatekeeperClient {\n if (!GatekeeperClient.instance) {\n throw new Error(\n \"GatekeeperClient not initialized. Call GatekeeperClient.initialize() first.\"\n );\n }\n return GatekeeperClient.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 GatekeeperClientMdip();\n await this.gatekeeperClient.connect({\n ...this.config,\n });\n } catch (e) {\n console.error(\"Error starting GatekeeperClient service:\", e);\n return false;\n }\n return true;\n }\n\n private addCustomHeaderInternal(header: string, value: string): void {\n this.gatekeeperClient.addCustomHeader(header, value);\n }\n\n private removeCustomHeaderInternal(header: string): void {\n this.gatekeeperClient.removeCustomHeader(header);\n }\n\n private async listRegistriesInternal(): Promise<string[]> {\n return await this.gatekeeperClient.listRegistries();\n }\n\n private async resetDbInternal(): Promise<boolean> {\n return await this.gatekeeperClient.resetDb();\n }\n\n private async verifyDbInternal(): Promise<VerifyDbResult> {\n return await this.gatekeeperClient.verifyDb();\n }\n\n private async isReadyInternal(): Promise<boolean> {\n return await this.gatekeeperClient.isReady();\n }\n\n private async getVersionInternal(): Promise<number> {\n return await this.gatekeeperClient.getVersion();\n }\n\n private async getStatusInternal(): Promise<GetStatusResult> {\n return await this.gatekeeperClient.getStatus();\n }\n\n private async createDIDInternal(operation: Operation): Promise<string> {\n return await this.gatekeeperClient.createDID(operation);\n }\n\n private async resolveDIDInternal(\n did: string,\n options?: ResolveDIDOptions\n ): Promise<MdipDocument> {\n return await this.gatekeeperClient.resolveDID(did, options);\n }\n\n private async updateDIDInternal(operation: Operation): Promise<boolean> {\n return await this.gatekeeperClient.updateDID(operation);\n }\n\n private async deleteDIDInternal(operation: Operation): Promise<boolean> {\n return await this.gatekeeperClient.deleteDID(operation);\n }\n\n private async getDIDsInternal({\n dids,\n resolve,\n }: GetDIDOptions): Promise<string[] | MdipDocument[]> {\n return await this.gatekeeperClient.getDIDs({ dids, resolve });\n }\n\n private async exportDIDsInternal(\n dids?: string[]\n ): Promise<GatekeeperEvent[][]> {\n return await this.gatekeeperClient.exportDIDs(dids);\n }\n\n private async importDIDsInternal(\n dids: GatekeeperEvent[][]\n ): Promise<ImportBatchResult> {\n return await this.gatekeeperClient.importDIDs(dids);\n }\n\n private async exportBatchInternal(\n dids?: string[]\n ): Promise<GatekeeperEvent[]> {\n return await this.gatekeeperClient.exportBatch(dids);\n }\n\n private async importBatchInternal(\n batch: GatekeeperEvent[]\n ): Promise<ImportBatchResult> {\n return await this.gatekeeperClient.importBatch(batch);\n }\n\n private async removeDIDsInternal(dids: string[]): Promise<boolean> {\n return await this.gatekeeperClient.removeDIDs(dids);\n }\n\n private async getQueueInternal(registry: string): Promise<Operation[]> {\n return await this.gatekeeperClient.getQueue(registry);\n }\n\n private async clearQueueInternal(\n registry: string,\n events: Operation[]\n ): Promise<boolean> {\n return await this.gatekeeperClient.clearQueue(registry, events);\n }\n\n private async processEventsInternal(): Promise<ProcessEventsResult> {\n return await this.gatekeeperClient.processEvents();\n }\n\n private async addJSONInternal(data: object): Promise<string> {\n return await this.gatekeeperClient.addJSON(data);\n }\n\n private async getJSONInternal(cid: string): Promise<object> {\n return await this.gatekeeperClient.getJSON(cid);\n }\n\n private async addTextInternal(data: string): Promise<string> {\n return await this.gatekeeperClient.addText(data);\n }\n\n private async getTextInternal(cid: string): Promise<string> {\n return await this.gatekeeperClient.getText(cid);\n }\n\n private async addDataInternal(data: Buffer): Promise<string> {\n return await this.gatekeeperClient.addData(data);\n }\n\n private async getDataInternal(cid: string): Promise<Buffer> {\n return await this.gatekeeperClient.getData(cid);\n }\n\n private async getBlockInternal(\n registry: string,\n block?: BlockId\n ): Promise<BlockInfo | null> {\n return await this.gatekeeperClient.getBlock(registry, block);\n }\n\n private async addBlockInternal(\n registry: string,\n block: BlockInfo\n ): Promise<boolean> {\n return await this.gatekeeperClient.addBlock(registry, block);\n }\n\n private validateConfig(config: GatekeeperClientOptions): void {\n if (!config) {\n throw new Error(\"Missing Gatekeeper config\");\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;;;ACCA,oBAA4C;AAC5C,kBAAsC;AACtC,uBAAwC;AA0BjC,IAAM,YAAN,MAAM,WAAU;AAAA,EACrB,OAAe,WAA6B;AAAA,EAEpC;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EAEjB,Y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