@learncard/core 6.2.0 → 6.3.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/core.d.ts CHANGED
@@ -4662,16 +4662,28 @@ declare const IDXCredentialValidator: z.ZodObject<{
4662
4662
  }>;
4663
4663
  /** @group IDXPlugin */
4664
4664
  export declare type IDXCredential = z.infer<typeof IDXCredentialValidator>;
4665
- /** @group DIDKit Plugin */
4666
- export declare type DidMethod = "key" | "tz" | "ethr" | `pkh:${"tz" | "tezos" | "sol" | "solana" | "eth" | "celo" | "poly" | "btc" | "doge" | "eip155" | "bip122"}` | `pkh:eip155:${string}` | `pkh:bip122:${string}`;
4667
- /** @group DIDKit Plugin */
4668
- export declare type KeyPair = {
4665
+ declare const JWKValidator: z.ZodObject<{
4666
+ kty: z.ZodString;
4667
+ crv: z.ZodString;
4668
+ x: z.ZodString;
4669
+ y: z.ZodOptional<z.ZodString>;
4670
+ d: z.ZodString;
4671
+ }, "strip", z.ZodTypeAny, {
4672
+ y?: string | undefined;
4669
4673
  kty: string;
4670
4674
  crv: string;
4671
4675
  x: string;
4672
- y?: string;
4673
4676
  d: string;
4674
- };
4677
+ }, {
4678
+ y?: string | undefined;
4679
+ kty: string;
4680
+ crv: string;
4681
+ x: string;
4682
+ d: string;
4683
+ }>;
4684
+ export declare type JWK = z.infer<typeof JWKValidator>;
4685
+ /** @group DIDKit Plugin */
4686
+ export declare type DidMethod = "key" | "tz" | "ethr" | `pkh:${"tz" | "tezos" | "sol" | "solana" | "eth" | "celo" | "poly" | "btc" | "doge" | "eip155" | "bip122"}` | `pkh:eip155:${string}` | `pkh:bip122:${string}`;
4675
4687
  /** @group DIDKit Plugin */
4676
4688
  export declare type ProofOptions = {
4677
4689
  type?: string;
@@ -4691,13 +4703,13 @@ export declare type InputMetadata = {
4691
4703
  };
4692
4704
  /** @group DIDKit Plugin */
4693
4705
  export declare type DidkitPluginMethods = {
4694
- generateEd25519KeyFromBytes: (bytes: Uint8Array) => KeyPair;
4695
- generateSecp256k1KeyFromBytes: (bytes: Uint8Array) => KeyPair;
4696
- keyToDid: (type: DidMethod, keypair: KeyPair) => string;
4697
- keyToVerificationMethod: (type: string, keypair: KeyPair) => Promise<string>;
4698
- issueCredential: (credential: UnsignedVC, options: ProofOptions, keypair: KeyPair) => Promise<VC>;
4706
+ generateEd25519KeyFromBytes: (bytes: Uint8Array) => JWK;
4707
+ generateSecp256k1KeyFromBytes: (bytes: Uint8Array) => JWK;
4708
+ keyToDid: (type: DidMethod, keypair: JWK) => string;
4709
+ keyToVerificationMethod: (type: string, keypair: JWK) => Promise<string>;
4710
+ issueCredential: (credential: UnsignedVC, options: ProofOptions, keypair: JWK) => Promise<VC>;
4699
4711
  verifyCredential: (credential: VC, options?: ProofOptions) => Promise<VerificationCheck>;
4700
- issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair: KeyPair) => Promise<VP>;
4712
+ issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair: JWK) => Promise<VP>;
4701
4713
  verifyPresentation: (presentation: VP, options?: ProofOptions) => Promise<VerificationCheck>;
4702
4714
  contextLoader: (url: string) => Promise<Record<string, any>>;
4703
4715
  resolveDid: (did: string, inputMetadata?: InputMetadata) => Promise<Record<string, any>>;
@@ -4706,37 +4718,14 @@ export declare type DidkitPluginMethods = {
4706
4718
  export declare type Algorithm = "ed25519" | "secp256k1";
4707
4719
  /** @group DidKey Plugin */
4708
4720
  export declare type DependentMethods<T extends string> = {
4709
- generateEd25519KeyFromBytes: (bytes: Uint8Array) => KeyPair;
4710
- generateSecp256k1KeyFromBytes: (bytes: Uint8Array) => KeyPair;
4711
- keyToDid: (type: T, keypair: KeyPair) => string;
4712
- };
4713
- /** @group DidKey Plugin */
4714
- export declare type JWK = {
4715
- id: string;
4716
- type: string | string[];
4717
- controller?: string;
4718
- publicKeyJwk?: any;
4719
- privateKeyJwk?: any;
4720
- "@context": string[];
4721
- name: string;
4722
- image: string;
4723
- description: string;
4724
- tags: string[];
4725
- value?: string;
4726
- generatedFrom?: [
4727
- string
4728
- ];
4721
+ generateEd25519KeyFromBytes: (bytes: Uint8Array) => JWK;
4722
+ generateSecp256k1KeyFromBytes: (bytes: Uint8Array) => JWK;
4723
+ keyToDid: (type: T, keypair: JWK) => string;
4729
4724
  };
4730
4725
  /** @group DidKey Plugin */
4731
4726
  export declare type DidKeyPluginMethods<DidMethod extends string> = {
4732
4727
  getSubjectDid: (type: DidMethod) => string;
4733
- getSubjectKeypair: (type?: Algorithm) => {
4734
- kty: string;
4735
- crv: string;
4736
- x: string;
4737
- y?: string;
4738
- d: string;
4739
- };
4728
+ getSubjectKeypair: (type?: Algorithm) => JWK;
4740
4729
  getKey: () => string;
4741
4730
  };
4742
4731
  /** @group Ethereum Plugin */
@@ -4851,11 +4840,11 @@ export declare type Wallet<PluginNames extends string = "", PluginMethods extend
4851
4840
  /** @group VC Plugin */
4852
4841
  export declare type VCPluginDependentMethods = {
4853
4842
  getSubjectDid: (type: "key") => string;
4854
- getSubjectKeypair: () => KeyPair;
4855
- keyToVerificationMethod: (type: string, keypair: KeyPair) => Promise<string>;
4856
- issueCredential: (credential: UnsignedVC, options: ProofOptions, keypair: KeyPair) => Promise<VC>;
4843
+ getSubjectKeypair: () => JWK;
4844
+ keyToVerificationMethod: (type: string, keypair: JWK) => Promise<string>;
4845
+ issueCredential: (credential: UnsignedVC, options: ProofOptions, keypair: JWK) => Promise<VC>;
4857
4846
  verifyCredential: (credential: VC, options?: ProofOptions) => Promise<VerificationCheck>;
4858
- issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair: KeyPair) => Promise<VP>;
4847
+ issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair: JWK) => Promise<VP>;
4859
4848
  verifyPresentation: (presentation: VP, options?: ProofOptions) => Promise<VerificationCheck>;
4860
4849
  };
4861
4850
  /** @group VC Plugin */
@@ -4963,14 +4952,14 @@ export declare type CHAPIPluginMethods = {
4963
4952
  success: false;
4964
4953
  reason: "did not auth" | "auth failed verification" | "did not store";
4965
4954
  }>;
4966
- storePresentationViaChapi: (presentation: VP) => Promise<Credential | undefined>;
4955
+ storePresentationViaChapi: (presentation: UnsignedVP | VP) => Promise<Credential | undefined>;
4967
4956
  };
4968
4957
  /**
4969
4958
  * @group Plugins
4970
4959
  */
4971
4960
  export declare const getCHAPIPlugin: () => Promise<Plugin<"CHAPI", CHAPIPluginMethods, CHAPIPluginDependentMethods>>;
4972
- export declare type InitFunction<Args extends Record<string, any> | undefined = Record<string, any>, Config extends keyof LearnCardConfig = keyof LearnCardConfig, ReturnValue extends LearnCard<any, any> = LearnCard<any, any>> = {
4973
- args: undefined extends Args ? Partial<Pick<LearnCardConfig, Config>> : Args & Partial<Pick<LearnCardConfig, Config>>;
4961
+ export declare type InitFunction<Args extends Record<string, any> = Record<string, any>, Config extends keyof LearnCardConfig = keyof LearnCardConfig, ReturnValue extends LearnCard<any, any> = LearnCard<any, any>> = {
4962
+ args: Args & Partial<Pick<LearnCardConfig, Config>>;
4974
4963
  returnValue: ReturnValue;
4975
4964
  };
4976
4965
  export declare type GenericInitFunction<InitFunctions extends InitFunction<any, any, any>[]> = {
@@ -5008,6 +4997,22 @@ export declare type VCTemplatePluginMethods = {
5008
4997
  did?: string;
5009
4998
  }) => Promise<UnsignedVP>;
5010
4999
  };
5000
+ /** @group VC-API Plugin */
5001
+ export declare type APIOptions = {
5002
+ created?: string;
5003
+ challenge?: string;
5004
+ domain?: string;
5005
+ };
5006
+ /** @group VC-API Plugin */
5007
+ export declare type VCAPIPluginMethods = {
5008
+ getSubjectDid: (type: string) => string;
5009
+ issueCredential: (credential: UnsignedVC, signingOptions?: APIOptions) => Promise<VC>;
5010
+ verifyCredential: (credential: VC, options?: Omit<APIOptions, "created">) => Promise<VerificationCheck>;
5011
+ issuePresentation: (presentation: UnsignedVP, signingOptions?: APIOptions) => Promise<VP>;
5012
+ verifyPresentation: (presentation: VP, options?: Omit<APIOptions, "created">) => Promise<VerificationCheck>;
5013
+ getTestVc: (subject?: string) => UnsignedVC;
5014
+ getTestVp: (credential?: VC) => Promise<UnsignedVP>;
5015
+ };
5011
5016
  /**
5012
5017
  * Wallet holder's did
5013
5018
  *
@@ -5307,6 +5312,15 @@ export declare type EmptyLearnCard = LearnCard<"newCredential" | "newPresentatio
5307
5312
  VCTemplatePluginMethods,
5308
5313
  CHAPIPluginMethods
5309
5314
  ]>>>;
5315
+ /**
5316
+ * @group LearnCard
5317
+ */
5318
+ export declare type VCAPILearnCard = LearnCard<"did" | "newCredential" | "newPresentation" | "issueCredential" | "verifyCredential" | "issuePresentation" | "verifyPresentation" | "getTestVc" | "getTestVp" | "installChapiHandler" | "activateChapiHandler" | "receiveChapiEvent" | "storePresentationViaChapi" | "storeCredentialViaChapiDidAuth", Wallet<"VC API" | "Expiration" | "VC Templates" | "CHAPI", MergeObjects<[
5319
+ VCAPIPluginMethods,
5320
+ VerifyExtension,
5321
+ VCTemplatePluginMethods,
5322
+ CHAPIPluginMethods
5323
+ ]>>>;
5310
5324
  /** @group LearnCard */
5311
5325
  export declare type LearnCardConfig = {
5312
5326
  ceramicIdx: CeramicIDXArgs;
@@ -5315,15 +5329,21 @@ export declare type LearnCardConfig = {
5315
5329
  ethereumConfig: EthereumConfig;
5316
5330
  };
5317
5331
  /** @group Init Functions */
5318
- export declare type EmptyWallet = InitFunction<undefined, "didkit", EmptyLearnCard>;
5332
+ export declare type EmptyWallet = InitFunction<{}, "didkit", EmptyLearnCard>;
5319
5333
  /** @group Init Functions */
5320
5334
  export declare type WalletFromKey = InitFunction<{
5321
5335
  seed: string;
5322
5336
  }, keyof LearnCardConfig, LearnCard>;
5323
5337
  /** @group Init Functions */
5338
+ export declare type WalletFromVcApi = InitFunction<{
5339
+ vcApi: true | string;
5340
+ did?: string;
5341
+ }, "defaultContents", VCAPILearnCard>;
5342
+ /** @group Init Functions */
5324
5343
  export declare type InitLearnCard = GenericInitFunction<[
5325
5344
  EmptyWallet,
5326
- WalletFromKey
5345
+ WalletFromKey,
5346
+ WalletFromVcApi
5327
5347
  ]>;
5328
5348
  /**
5329
5349
  * Generates an empty wallet with no key material
@@ -5337,6 +5357,12 @@ export declare const emptyWallet: ({ didkit }?: EmptyWallet["args"]) => Promise<
5337
5357
  * @group Init Functions
5338
5358
  */
5339
5359
  export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, ethereumConfig, }?: Partial<LearnCardConfig>) => Promise<LearnCard>;
5360
+ /**
5361
+ * Generates a LearnCard Wallet from a 64 character seed string
5362
+ *
5363
+ * @group Init Functions
5364
+ */
5365
+ export declare const walletFromApiUrl: (url: string, did?: string, { defaultContents }?: Partial<LearnCardConfig>) => Promise<WalletFromVcApi["returnValue"]>;
5340
5366
  /**
5341
5367
  * Generates an Empty Wallet
5342
5368
  *
@@ -5349,8 +5375,12 @@ export declare function initLearnCard(config?: EmptyWallet["args"]): Promise<Emp
5349
5375
  * @group Init Functions
5350
5376
  */
5351
5377
  export declare function initLearnCard(config: WalletFromKey["args"]): Promise<WalletFromKey["returnValue"]>;
5352
- export declare const passwordToKey: (password: string, salt?: string, iterations?: number, digest?: string) => Promise<Uint8Array>;
5353
- export declare const seedToId: (seed: Uint8Array) => Promise<string>;
5378
+ /**
5379
+ * Generates a wallet that can sign VCs/VPs from a VC API
5380
+ *
5381
+ * @group Init Functions
5382
+ */
5383
+ export declare function initLearnCard(config: WalletFromVcApi["args"]): Promise<WalletFromVcApi["returnValue"]>;
5354
5384
  /** @group Universal Wallets */
5355
5385
  export declare const generateWallet: <PluginNames extends string, PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>>(contents?: any[], _wallet?: Partial<Wallet<any, PluginMethods>>) => Promise<Wallet<PluginNames, PluginMethods>>;
5356
5386
  /**
@@ -5382,7 +5412,7 @@ export declare const ExpirationPlugin: (wallet: Wallet<any, VerifyExtension>) =>
5382
5412
  */
5383
5413
  export declare const getEthereumPlugin: (initWallet: Wallet<string, {
5384
5414
  getSubjectDid: (type: DidMethod) => string;
5385
- getSubjectKeypair: (type?: Algorithm) => KeyPair;
5415
+ getSubjectKeypair: (type?: Algorithm) => JWK;
5386
5416
  }>, config: EthereumConfig) => Plugin<"Ethereum", EthereumPluginMethods>;
5387
5417
  /**
5388
5418
  * @group Plugins
package/dist/core.esm.js CHANGED
@@ -36939,34 +36939,6 @@ import "abort-controller/polyfill";
36939
36939
  import crypto2 from "isomorphic-webcrypto";
36940
36940
  if (typeof window === "undefined" && !globalThis.crypto)
36941
36941
  globalThis.crypto = crypto2;
36942
- var crypto_default = crypto2;
36943
-
36944
- // src/wallet/base/functions/passwordToKey.ts
36945
- var passwordToKey = /* @__PURE__ */ __name((password, salt = "salt", iterations = 1e5, digest2 = "SHA-256") => __async(void 0, null, function* () {
36946
- var saltBuffer = Buffer.from(salt);
36947
- var passphraseKey = Buffer.from(password);
36948
- return crypto_default.subtle.importKey("raw", passphraseKey, { name: "PBKDF2" }, false, [
36949
- "deriveBits",
36950
- "deriveKey"
36951
- ]).then(function(key2) {
36952
- return crypto_default.subtle.deriveKey({
36953
- name: "PBKDF2",
36954
- salt: saltBuffer,
36955
- iterations,
36956
- hash: digest2
36957
- }, key2, { name: "AES-CBC", length: 256 }, true, ["encrypt", "decrypt"]);
36958
- }).then((webKey) => {
36959
- return crypto_default.subtle.exportKey("raw", webKey);
36960
- }).then((buffer2) => {
36961
- return new Uint8Array(buffer2);
36962
- });
36963
- }), "passwordToKey");
36964
-
36965
- // src/wallet/base/functions/seedToId.ts
36966
- var seedToId = /* @__PURE__ */ __name((seed) => __async(void 0, null, function* () {
36967
- const buffer2 = yield crypto_default.subtle.digest("SHA-256", seed);
36968
- return `urn:digest:${Buffer.from(new Int8Array(buffer2)).toString("hex")}`;
36969
- }), "seedToId");
36970
36942
 
36971
36943
  // src/wallet/base/wallet.ts
36972
36944
  var addPluginToWallet = /* @__PURE__ */ __name((wallet, plugin) => __async(void 0, null, function* () {
@@ -39240,7 +39212,8 @@ var getCHAPIPlugin = /* @__PURE__ */ __name(() => __async(void 0, null, function
39240
39212
  return { success: false, reason: "did not auth" };
39241
39213
  const verification = yield wallet.pluginMethods.verifyPresentation(res.data, {
39242
39214
  challenge,
39243
- domain
39215
+ domain,
39216
+ proofPurpose: "authentication"
39244
39217
  });
39245
39218
  if (verification.warnings.length > 0 || verification.errors.length > 0) {
39246
39219
  return { success: false, reason: "auth failed verification" };
@@ -39249,7 +39222,7 @@ var getCHAPIPlugin = /* @__PURE__ */ __name(() => __async(void 0, null, function
39249
39222
  if (!Array.isArray(credential.credentialSubject)) {
39250
39223
  credential.credentialSubject.id = subject;
39251
39224
  }
39252
- const vp = yield wallet.pluginMethods.issuePresentation(yield wallet.pluginMethods.getTestVp(yield wallet.pluginMethods.issueCredential(credential)));
39225
+ const vp = yield wallet.pluginMethods.getTestVp(yield wallet.pluginMethods.issueCredential(credential));
39253
39226
  const success = yield wallet.pluginMethods.storePresentationViaChapi(vp);
39254
39227
  if (success)
39255
39228
  return { success: true };
@@ -42400,6 +42373,13 @@ var IDXCredentialValidator = mod.object({
42400
42373
  title: mod.string(),
42401
42374
  storageType: StorageTypeValidator.optional()
42402
42375
  });
42376
+ var JWKValidator = mod.object({
42377
+ kty: mod.string(),
42378
+ crv: mod.string(),
42379
+ x: mod.string(),
42380
+ y: mod.string().optional(),
42381
+ d: mod.string()
42382
+ });
42403
42383
 
42404
42384
  // ../../node_modules/.pnpm/date-fns@2.28.0/node_modules/date-fns/esm/_lib/toInteger/index.js
42405
42385
  function toInteger(dirtyNumber) {
@@ -60375,11 +60355,131 @@ var walletFromKey = /* @__PURE__ */ __name((_0, ..._1) => __async(void 0, [_0, .
60375
60355
  };
60376
60356
  }), "walletFromKey");
60377
60357
 
60358
+ // src/wallet/plugins/vc-api/helpers.ts
60359
+ var post = /* @__PURE__ */ __name((url, data) => __async(void 0, null, function* () {
60360
+ return fetch(url, {
60361
+ method: "POST",
60362
+ headers: { "Content-Type": "application/json" },
60363
+ body: JSON.stringify(data)
60364
+ });
60365
+ }), "post");
60366
+ var isSuccessful = /* @__PURE__ */ __name((status) => status.toString().startsWith("2"), "isSuccessful");
60367
+
60368
+ // src/wallet/plugins/vc-api/index.ts
60369
+ var getVCAPIPlugin = /* @__PURE__ */ __name((_0) => __async(void 0, [_0], function* ({
60370
+ url: _url,
60371
+ did: _did
60372
+ }) {
60373
+ const url = _url.endsWith("/") ? _url.slice(0, -1) : _url;
60374
+ let did = _did;
60375
+ if (!did) {
60376
+ const res = yield fetch(`${url}/did`);
60377
+ if (res.status === 200)
60378
+ did = yield res.text();
60379
+ }
60380
+ if (!did)
60381
+ throw new Error("Could not retrieve did from VC API! Please suppy a did.");
60382
+ return {
60383
+ pluginMethods: {
60384
+ getSubjectDid: () => did,
60385
+ issueCredential: (_wallet, credential, options) => __async(void 0, null, function* () {
60386
+ yield UnsignedVCValidator.parseAsync(credential);
60387
+ const response = yield post(`${url}/credentials/issue`, { credential, options });
60388
+ if (!isSuccessful(response.status)) {
60389
+ throw new Error(`API Error: ${response.status} ${response.statusText}`);
60390
+ }
60391
+ return VCValidator.parseAsync(yield response.json());
60392
+ }),
60393
+ verifyCredential: (_wallet, verifiableCredential, options) => __async(void 0, null, function* () {
60394
+ yield VCValidator.parseAsync(verifiableCredential);
60395
+ const response = yield post(`${url}/credentials/verify`, {
60396
+ verifiableCredential,
60397
+ options
60398
+ });
60399
+ if (!isSuccessful(response.status)) {
60400
+ throw new Error(`API Error: ${response.status} ${response.statusText}`);
60401
+ }
60402
+ return VerificationCheckValidator.parseAsync(yield response.json());
60403
+ }),
60404
+ issuePresentation: (_wallet, presentation, options) => __async(void 0, null, function* () {
60405
+ yield UnsignedVPValidator.parseAsync(presentation);
60406
+ const response = yield post(`${url}/presentations/issue`, {
60407
+ presentation,
60408
+ options
60409
+ });
60410
+ if (!isSuccessful(response.status)) {
60411
+ throw new Error(`API Error: ${response.status} ${response.statusText}`);
60412
+ }
60413
+ return VPValidator.parseAsync(yield response.json());
60414
+ }),
60415
+ verifyPresentation: (_wallet, verifiablePresentation, options) => __async(void 0, null, function* () {
60416
+ yield VPValidator.parseAsync(verifiablePresentation);
60417
+ const response = yield post(`${url}/presentations/verify`, {
60418
+ verifiablePresentation,
60419
+ options
60420
+ });
60421
+ if (!isSuccessful(response.status)) {
60422
+ throw new Error(`API Error: ${response.status} ${response.statusText}`);
60423
+ }
60424
+ return VerificationCheckValidator.parseAsync(yield response.json());
60425
+ }),
60426
+ getTestVc: (_wallet, subject = "did:example:d23dd687a7dc6787646f2eb98d0") => {
60427
+ return {
60428
+ "@context": ["https://www.w3.org/2018/credentials/v1"],
60429
+ id: "http://example.org/credentials/3731",
60430
+ type: ["VerifiableCredential"],
60431
+ issuer: did,
60432
+ issuanceDate: "2020-08-19T21:41:50Z",
60433
+ credentialSubject: { id: subject }
60434
+ };
60435
+ },
60436
+ getTestVp: (_wallet, _credential) => __async(void 0, null, function* () {
60437
+ const credential = _credential || (yield _wallet.pluginMethods.issueCredential(_wallet.pluginMethods.getTestVc()));
60438
+ return {
60439
+ "@context": ["https://www.w3.org/2018/credentials/v1"],
60440
+ type: ["VerifiablePresentation"],
60441
+ holder: did,
60442
+ verifiableCredential: credential
60443
+ };
60444
+ })
60445
+ }
60446
+ };
60447
+ }), "getVCAPIPlugin");
60448
+
60449
+ // src/wallet/initializers/apiWallet.ts
60450
+ var walletFromApiUrl = /* @__PURE__ */ __name((_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (url, did, { defaultContents = [] } = {}) {
60451
+ const apiWallet = yield (yield generateWallet(defaultContents)).addPlugin(yield getVCAPIPlugin({ url, did }));
60452
+ const expirationWallet = yield apiWallet.addPlugin(ExpirationPlugin(apiWallet));
60453
+ const templateWallet = yield expirationWallet.addPlugin(getVCTemplatesPlugin());
60454
+ const wallet = yield templateWallet.addPlugin(yield getCHAPIPlugin());
60455
+ return {
60456
+ _wallet: wallet,
60457
+ did: (type = "key") => wallet.pluginMethods.getSubjectDid(type),
60458
+ newCredential: wallet.pluginMethods.newCredential,
60459
+ newPresentation: wallet.pluginMethods.newPresentation,
60460
+ issueCredential: wallet.pluginMethods.issueCredential,
60461
+ verifyCredential: verifyCredential2(wallet),
60462
+ issuePresentation: wallet.pluginMethods.issuePresentation,
60463
+ verifyPresentation: wallet.pluginMethods.verifyPresentation,
60464
+ getTestVc: wallet.pluginMethods.getTestVc,
60465
+ getTestVp: wallet.pluginMethods.getTestVp,
60466
+ installChapiHandler: wallet.pluginMethods.installChapiHandler,
60467
+ activateChapiHandler: wallet.pluginMethods.activateChapiHandler,
60468
+ receiveChapiEvent: wallet.pluginMethods.receiveChapiEvent,
60469
+ storePresentationViaChapi: wallet.pluginMethods.storePresentationViaChapi,
60470
+ storeCredentialViaChapiDidAuth: wallet.pluginMethods.storeCredentialViaChapiDidAuth
60471
+ };
60472
+ }), "walletFromApiUrl");
60473
+
60378
60474
  // src/wallet/init.ts
60379
60475
  function initLearnCard() {
60380
60476
  return __async(this, arguments, function* (config2 = {}) {
60477
+ if ("vcApi" in config2) {
60478
+ const _a = config2, { vcApi, did } = _a, apiConfig = __objRest(_a, ["vcApi", "did"]);
60479
+ return walletFromApiUrl(typeof vcApi === "string" ? vcApi : "https://bridge.learncard.com", vcApi === true ? "did:key:z6MkjSz4mYqcn7dePGuktJ5PxecMkXQQHWRg8Lm6okATyFVh" : did, apiConfig);
60480
+ }
60381
60481
  if ("seed" in config2) {
60382
- const _a = config2, { seed } = _a, keyConfig = __objRest(_a, ["seed"]);
60482
+ const _b = config2, { seed } = _b, keyConfig = __objRest(_b, ["seed"]);
60383
60483
  return walletFromKey(seed, keyConfig);
60384
60484
  }
60385
60485
  return emptyWallet(config2);
@@ -60399,8 +60499,7 @@ export {
60399
60499
  getVCPlugin,
60400
60500
  getVpqrPlugin,
60401
60501
  initLearnCard,
60402
- passwordToKey,
60403
- seedToId,
60502
+ walletFromApiUrl,
60404
60503
  walletFromKey
60405
60504
  };
60406
60505
  /*!