@learncard/core 5.1.0 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/core.d.ts CHANGED
@@ -4590,7 +4590,26 @@ declare const VerificationItemValidator: z.ZodObject<{
4590
4590
  check: string;
4591
4591
  }>;
4592
4592
  export declare type VerificationItem = z.infer<typeof VerificationItemValidator>;
4593
+ declare const IDXCredentialValidator: z.ZodObject<{
4594
+ id: z.ZodString;
4595
+ title: z.ZodString;
4596
+ storageType: z.ZodOptional<z.ZodEnum<[
4597
+ "ceramic"
4598
+ ]>>;
4599
+ }, "strip", z.ZodTypeAny, {
4600
+ storageType?: "ceramic" | undefined;
4601
+ id: string;
4602
+ title: string;
4603
+ }, {
4604
+ storageType?: "ceramic" | undefined;
4605
+ id: string;
4606
+ title: string;
4607
+ }>;
4608
+ /** @group IDXPlugin */
4609
+ export declare type IDXCredential = z.infer<typeof IDXCredentialValidator>;
4610
+ /** @group DIDKit Plugin */
4593
4611
  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}`;
4612
+ /** @group DIDKit Plugin */
4594
4613
  export declare type KeyPair = {
4595
4614
  kty: string;
4596
4615
  crv: string;
@@ -4598,10 +4617,12 @@ export declare type KeyPair = {
4598
4617
  y?: string;
4599
4618
  d: string;
4600
4619
  };
4620
+ /** @group DIDKit Plugin */
4601
4621
  export declare type ProofOptions = {
4602
4622
  verificationMethod: string;
4603
4623
  proofPurpose: string;
4604
4624
  };
4625
+ /** @group DIDKit Plugin */
4605
4626
  export declare type DidkitPluginMethods = {
4606
4627
  generateEd25519KeyFromBytes: (bytes: Uint8Array) => KeyPair;
4607
4628
  generateSecp256k1KeyFromBytes: (bytes: Uint8Array) => KeyPair;
@@ -4612,8 +4633,34 @@ export declare type DidkitPluginMethods = {
4612
4633
  issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair: KeyPair) => Promise<VP>;
4613
4634
  verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
4614
4635
  contextLoader: (url: string) => Promise<Record<string, any>>;
4636
+ resolveDid: (did: string) => Promise<Record<string, any>>;
4615
4637
  };
4638
+ /** @group DidKey Plugin */
4616
4639
  export declare type Algorithm = "ed25519" | "secp256k1";
4640
+ /** @group DidKey Plugin */
4641
+ export declare type DependentMethods<T extends string> = {
4642
+ generateEd25519KeyFromBytes: (bytes: Uint8Array) => KeyPair;
4643
+ generateSecp256k1KeyFromBytes: (bytes: Uint8Array) => KeyPair;
4644
+ keyToDid: (type: T, keypair: KeyPair) => string;
4645
+ };
4646
+ /** @group DidKey Plugin */
4647
+ export declare type JWK = {
4648
+ id: string;
4649
+ type: string | string[];
4650
+ controller?: string;
4651
+ publicKeyJwk?: any;
4652
+ privateKeyJwk?: any;
4653
+ "@context": string[];
4654
+ name: string;
4655
+ image: string;
4656
+ description: string;
4657
+ tags: string[];
4658
+ value?: string;
4659
+ generatedFrom?: [
4660
+ string
4661
+ ];
4662
+ };
4663
+ /** @group DidKey Plugin */
4617
4664
  export declare type DidKeyPluginMethods<DidMethod extends string> = {
4618
4665
  getSubjectDid: (type: DidMethod) => string;
4619
4666
  getSubjectKeypair: (type?: Algorithm) => {
@@ -4625,6 +4672,7 @@ export declare type DidKeyPluginMethods<DidMethod extends string> = {
4625
4672
  };
4626
4673
  getKey: () => string;
4627
4674
  };
4675
+ /** @group Ethereum Plugin */
4628
4676
  export declare type EthereumPluginMethods = {
4629
4677
  getEthereumAddress: () => string;
4630
4678
  getBalance: (symbolOrAddress?: string) => Promise<string>;
@@ -4634,10 +4682,31 @@ export declare type EthereumPluginMethods = {
4634
4682
  changeNetwork: (network: providers.Networkish) => void;
4635
4683
  addInfuraProjectId: (infuraProjectIdToAdd: string) => void;
4636
4684
  };
4685
+ /** @group Ethereum Plugin */
4637
4686
  export declare type EthereumConfig = {
4638
4687
  infuraProjectId?: string;
4639
4688
  network?: providers.Networkish;
4640
4689
  };
4690
+ /** @group Ethereum Plugin */
4691
+ export declare type Token = {
4692
+ chainId: number;
4693
+ address: string;
4694
+ name: string;
4695
+ symbol: string;
4696
+ decimals: number;
4697
+ logoURI: string;
4698
+ extensions: any;
4699
+ };
4700
+ /** @group Ethereum Plugin */
4701
+ export declare type TokenList = Token[];
4702
+ /** @group IDXPlugin */
4703
+ export declare type CeramicIDXArgs = {
4704
+ modelData: ModelAliases;
4705
+ credentialAlias: string;
4706
+ ceramicEndpoint: string;
4707
+ defaultContentFamily: string;
4708
+ };
4709
+ /** @group IDXPlugin */
4641
4710
  export declare type IDXPluginMethods = {
4642
4711
  getCredentialsListFromIdx: (alias?: string) => Promise<CredentialsList>;
4643
4712
  publishContentToCeramic: (cred: any) => Promise<string>;
@@ -4647,18 +4716,40 @@ export declare type IDXPluginMethods = {
4647
4716
  addVerifiableCredentialInIdx: (cred: IDXCredential) => Promise<StreamID>;
4648
4717
  removeVerifiableCredentialInIdx: (title: string) => Promise<StreamID>;
4649
4718
  };
4650
- declare enum StorageType {
4651
- ceramic = "ceramic"
4652
- }
4653
- export declare type IDXCredential = {
4654
- id: string;
4655
- title: string;
4656
- storageType?: StorageType;
4657
- };
4658
- export declare type CredentialsList = {
4659
- credentials: IDXCredential[];
4660
- };
4661
- export declare type DependentMethods = {
4719
+ /** @group IDXPlugin */
4720
+ export declare const CredentialsListValidator: z.ZodObject<{
4721
+ credentials: z.ZodArray<z.ZodObject<{
4722
+ id: z.ZodString;
4723
+ title: z.ZodString;
4724
+ storageType: z.ZodOptional<z.ZodEnum<[
4725
+ "ceramic"
4726
+ ]>>;
4727
+ }, "strip", z.ZodTypeAny, {
4728
+ storageType?: "ceramic" | undefined;
4729
+ id: string;
4730
+ title: string;
4731
+ }, {
4732
+ storageType?: "ceramic" | undefined;
4733
+ id: string;
4734
+ title: string;
4735
+ }>, "many">;
4736
+ }, "strict", z.ZodTypeAny, {
4737
+ credentials: {
4738
+ storageType?: "ceramic" | undefined;
4739
+ id: string;
4740
+ title: string;
4741
+ }[];
4742
+ }, {
4743
+ credentials: {
4744
+ storageType?: "ceramic" | undefined;
4745
+ id: string;
4746
+ title: string;
4747
+ }[];
4748
+ }>;
4749
+ /** @group IDXPlugin */
4750
+ export declare type CredentialsList = z.infer<typeof CredentialsListValidator>;
4751
+ /** @group VC Plugin */
4752
+ export declare type VCPluginDependentMethods = {
4662
4753
  getSubjectDid: (type: "key") => string;
4663
4754
  getSubjectKeypair: () => KeyPair;
4664
4755
  keyToVerificationMethod: (type: string, keypair: KeyPair) => Promise<string>;
@@ -4667,7 +4758,8 @@ export declare type DependentMethods = {
4667
4758
  issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair: KeyPair) => Promise<VP>;
4668
4759
  verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
4669
4760
  };
4670
- export declare type VCPluginMethods = DependentMethods & {
4761
+ /** @group VC Plugin */
4762
+ export declare type VCPluginMethods = VCPluginDependentMethods & {
4671
4763
  issueCredential: (credential: UnsignedVC) => Promise<VC>;
4672
4764
  verifyCredential: (credential: VC) => Promise<VerificationCheck>;
4673
4765
  issuePresentation: (credential: UnsignedVP) => Promise<VP>;
@@ -4675,27 +4767,40 @@ export declare type VCPluginMethods = DependentMethods & {
4675
4767
  getTestVc: (subject?: string) => UnsignedVC;
4676
4768
  getTestVp: (credential?: VC) => Promise<UnsignedVP>;
4677
4769
  };
4770
+ /** @group VC Plugin */
4678
4771
  export declare type VerifyExtension = {
4679
4772
  verifyCredential: (credential: VC) => Promise<VerificationCheck>;
4680
4773
  };
4774
+ /** @group VPQR Plugin */
4681
4775
  export declare type VpqrPluginMethods = {
4682
4776
  vpFromQrCode: (text: string) => Promise<VP>;
4683
4777
  vpToQrCode: (vp: VP) => Promise<string>;
4684
4778
  };
4779
+ /** @group VPQR Plugin */
4780
+ export declare type VpqrPluginDependentMethods = {
4781
+ contextLoader: (url: string) => Promise<Record<string, any>>;
4782
+ };
4685
4783
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
4686
4784
  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>> = {
4687
4785
  args: undefined extends Args ? Partial<Pick<LearnCardConfig, Config>> : Args & Partial<Pick<LearnCardConfig, Config>>;
4688
4786
  returnValue: ReturnValue;
4689
4787
  };
4788
+ export declare type GenericInitFunction<InitFunctions extends InitFunction<any, any, any>[]> = {
4789
+ args: InitFunctions[number]["args"];
4790
+ returnValue: Promise<InitFunctions[number]["returnValue"]>;
4791
+ };
4792
+ /** @group Universal Wallets */
4690
4793
  export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
4691
4794
  name?: Name;
4692
4795
  pluginMethods: {
4693
4796
  [Key in keyof PublicMethods]: <T extends Wallet<any, PublicMethods>>(wallet: T, ...args: Parameters<PublicMethods[Key]>) => ReturnType<PublicMethods[Key]>;
4694
4797
  };
4695
4798
  };
4799
+ /** @group Universal Wallets */
4696
4800
  export declare type PublicFieldsObj<PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
4697
4801
  pluginMethods: PluginMethods;
4698
4802
  };
4803
+ /** @group Universal Wallets */
4699
4804
  export declare type Wallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = PublicFieldsObj<PluginMethods> & {
4700
4805
  contents: any[];
4701
4806
  plugins: Plugin<PluginNames, Record<string, (...args: any[]) => any>>[];
@@ -4703,152 +4808,317 @@ export declare type Wallet<PluginNames extends string = "", PluginMethods extend
4703
4808
  remove: (contentId: string) => Promise<Wallet<PluginNames, PluginMethods>>;
4704
4809
  addPlugin: <Name extends string, Methods extends Record<string, (...args: any[]) => any> = Record<never, never>>(plugin: Plugin<Name, Methods>) => Promise<Wallet<"" extends PluginNames ? Name : PluginNames | Name, Record<never, never> extends PluginMethods ? Methods : PluginMethods & Methods>>;
4705
4810
  };
4706
- export declare type LearnCardRawWallet = Wallet<"DIDKit" | "DID Key" | "VC" | "IDX" | "Expiration" | "Ethereum" | "Vpqr", DidKeyPluginMethods<DidMethod> & VCPluginMethods & IDXPluginMethods & EthereumPluginMethods & VpqrPluginMethods>;
4811
+ /**
4812
+ * Wallet holder's did
4813
+ *
4814
+ * @group LearnCard Methods
4815
+ */
4816
+ export declare type Did = (type?: DidMethod) => string;
4817
+ /**
4818
+ * Wallet holder's ed25519 key pair
4819
+ *
4820
+ * @group LearnCard Methods
4821
+ */
4822
+ export declare type Keypair = (type?: Algorithm) => {
4823
+ kty: string;
4824
+ crv: string;
4825
+ x: string;
4826
+ y?: string;
4827
+ d: string;
4828
+ };
4829
+ /**
4830
+ * Signs an unsigned Verifiable Credential, returning the signed VC
4831
+ *
4832
+ * @group LearnCard Methods
4833
+ */
4834
+ export declare type IssueCredential = (credential: UnsignedVC) => Promise<VC>;
4835
+ /**
4836
+ * Verifies a signed Verifiable Credential
4837
+ *
4838
+ * Empty error/warnings arrays means verification was successful
4839
+ *
4840
+ * @group LearnCard Methods
4841
+ */
4842
+ export declare type VerifyCredential = (credential: VC) => Promise<VerificationItem[]>;
4843
+ /**
4844
+ * Signs an unsigned Verifiable Presentation, returning the signed VP
4845
+ *
4846
+ * @group LearnCard Methods
4847
+ */
4848
+ export declare type IssuePresentation = (presentation: UnsignedVP) => Promise<VP>;
4849
+ /**
4850
+ * Verifies a signed Verifiable Presentation
4851
+ *
4852
+ * Empry error/warnings arrays means verification was successful
4853
+ *
4854
+ * @group LearnCard Methods
4855
+ */
4856
+ export declare type VerifyPresentation = (presentation: VP) => Promise<VerificationCheck>;
4857
+ /**
4858
+ * Returns the credential marked with `title` from IDX
4859
+ *
4860
+ * @group LearnCard Methods
4861
+ */
4862
+ export declare type GetCredential = (title: string) => Promise<VC>;
4863
+ /**
4864
+ * Returns all credentials from IDX
4865
+ *
4866
+ * @group LearnCard Methods
4867
+ */
4868
+ export declare type GetCredentials = () => Promise<VC[]>;
4869
+ /**
4870
+ * Returns all credentials from IDX
4871
+ *
4872
+ * @group LearnCard Methods
4873
+ */
4874
+ export declare type GetCredentialsList = () => Promise<IDXCredential[]>;
4875
+ /**
4876
+ * Publishes a credential to Ceramic, returning the credential's stream ID
4877
+ *
4878
+ * This stream ID may then be shared/persisted/resolved to gain access to the credential
4879
+ *
4880
+ * Resolving a stream ID can be done by passing the stream ID to `readFromCeramic`
4881
+ *
4882
+ * @group LearnCard Methods
4883
+ */
4884
+ export declare type PublishCredential = (credential: VC) => Promise<string>;
4885
+ /**
4886
+ * Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
4887
+ * to IDX with a bespoke title
4888
+ *
4889
+ * The credential may then be retrieved using `getCredential` and passing in that bespoke title,
4890
+ * or by using `getCredentials` to get a list of all credentials that have been added to IDX
4891
+ *
4892
+ * @group LearnCard Methods
4893
+ */
4894
+ export declare type AddCredential = (credential: IDXCredential) => Promise<void>;
4895
+ /**
4896
+ * Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
4897
+ * to IDX with a bespoke title
4898
+ *
4899
+ * The credential may then be retrieved using `getCredential` and passing in that bespoke title,
4900
+ * or by using `getCredentials` to get a list of all credentials that have been added to IDX
4901
+ *
4902
+ * @group LearnCard Methods
4903
+ */
4904
+ export declare type RemoveCredential = (title: string) => Promise<void>;
4905
+ /**
4906
+ * Resolves a did to its did document
4907
+ *
4908
+ * @group LearnCard Methods
4909
+ */
4910
+ export declare type ResolveDid = (did: string) => Promise<Record<string, any>>;
4911
+ /**
4912
+ * Resolves a stream ID, returning its contents
4913
+ *
4914
+ * This can be given the return value of `publishCredential` to gain access to the credential
4915
+ * that was published
4916
+ *
4917
+ * @group LearnCard Methods
4918
+ */
4919
+ export declare type ReadFromCeramic = (streamId: string) => Promise<any>;
4920
+ /**
4921
+ * Returns an example credential, optionally allowing a subject's did to be passed in
4922
+ *
4923
+ * You can use this to test out implementations that use this library!
4924
+ *
4925
+ * @group LearnCard Methods
4926
+ */
4927
+ export declare type GetTestVc = (subject?: string) => UnsignedVC;
4928
+ /**
4929
+ * Wraps a crednetial in an exmaple presentaion. If no credential is provided, a new one will be
4930
+ * generated using getTestVc
4931
+ *
4932
+ * You can use this to test out implementations that use this library!
4933
+ *
4934
+ * @group LearnCard Methods
4935
+ */
4936
+ export declare type GetTestVp = (credential?: VC) => Promise<UnsignedVP>;
4937
+ /**
4938
+ * Returns Ethereum public address
4939
+ *
4940
+ * @group LearnCard Methods
4941
+ */
4942
+ export declare type GetEthereumAddress = () => string;
4943
+ /**
4944
+ * Get the balance of an ERC20 token
4945
+ * Defaults to ETH if symbolOrAddress is not provided
4946
+ *
4947
+ * @group LearnCard Methods
4948
+ */
4949
+ export declare type GetBalance = (symbolOrAddress?: string) => Promise<string>;
4950
+ /**
4951
+ * Get the balance of an ERC20 token for a given address
4952
+ * Defaults to ETH if symbolOrAddress is not provided
4953
+ *
4954
+ * @group LearnCard Methods
4955
+ */
4956
+ export declare type GetBalanceForAddress = (walletAddress: string, symbolOrAddress?: string) => Promise<string>;
4957
+ /**
4958
+ * Transfer tokens to a given address
4959
+ *
4960
+ * @group LearnCard Methods
4961
+ */
4962
+ export declare type TransferTokens = (tokenSymbolOrAddress: string, amount: number, toAddress: string) => Promise<string>;
4963
+ /**
4964
+ * Get your current Ethereum network
4965
+ *
4966
+ * @group LearnCard Methods
4967
+ */
4968
+ export declare type GetCurrentNetwork = () => ethers.providers.Networkish;
4969
+ /**
4970
+ * Change your Ethereum network
4971
+ *
4972
+ * @group LearnCard Methods
4973
+ */
4974
+ export declare type ChangeNetwork = (network: ethers.providers.Networkish) => void;
4975
+ /**
4976
+ * Add an infura project id to an existing wallet.
4977
+ * Really only useful for testing with the CLI right now...
4978
+ *
4979
+ * @group LearnCard Methods
4980
+ */
4981
+ export declare type AddInfuraProjectId = (infuraProjectIdToAdd: string) => void;
4982
+ /**
4983
+ * Returns a Verifiable Presentation (VP) from a QR code base-64 image data string containing a VP compressed by CBOR-LD.
4984
+ *
4985
+ * @group LearnCard Methods
4986
+ */
4987
+ export declare type VpFromQrCode = (text: string) => Promise<VP>;
4988
+ /**
4989
+ * Returns a QR-embeddable base-64 image data string from a Verifiable Presentation, compressed using CBOR-LD.
4990
+ *
4991
+ * @group LearnCard Methods
4992
+ */
4993
+ export declare type VpToQrCode = (vp: VP) => Promise<string>;
4994
+ /**
4995
+ * @group LearnCard Methods
4996
+ */
4707
4997
  export declare type AllLearnCardMethods = {
4708
- /** Wallet holder's did */
4709
- did: (type?: DidMethod) => string;
4710
- /** Wallet holder's ed25519 key pair */
4711
- keypair: (type?: Algorithm) => {
4712
- kty: string;
4713
- crv: string;
4714
- x: string;
4715
- y?: string;
4716
- d: string;
4717
- };
4718
- /** Signs an unsigned Verifiable Credential, returning the signed VC */
4719
- issueCredential: (credential: UnsignedVC) => Promise<VC>;
4720
- /**
4721
- * Verifies a signed Verifiable Credential
4722
- *
4723
- * Empty error/warnings arrays means verification was successful
4724
- */
4725
- verifyCredential: (credential: VC) => Promise<VerificationItem[]>;
4726
- /** Creates a signed Verifiable Presentation from a signed Verifiable Credential */
4727
- issuePresentation: (presentation: UnsignedVP) => Promise<VP>;
4728
- /**
4729
- * Verifies a signed Verifiable Presentation
4730
- *
4731
- * Empry error/warnings arrays means verification was successful
4732
- */
4733
- verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
4734
- /** Returns the credential marked with `title` from IDX */
4735
- getCredential: (title: string) => Promise<VC>;
4736
- /** Returns all credentials from IDX */
4737
- getCredentials: () => Promise<VC[]>;
4738
- /** Returns all credentials from IDX */
4739
- getCredentialsList: () => Promise<IDXCredential[]>;
4740
- /**
4741
- * Publishes a credential to Ceramic, returning the credential's stream ID
4742
- *
4743
- * This stream ID may then be shared/persisted/resolved to gain access to the credential
4744
- *
4745
- * Resolving a stream ID can be done by passing the stream ID to `readFromCeramic`
4746
- */
4747
- publishCredential: (credential: VC) => Promise<string>;
4748
- /**
4749
- * Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
4750
- * to IDX with a bespoke title
4751
- *
4752
- * The credential may then be retrieved using `getCredential` and passing in that bespoke title,
4753
- * or by using `getCredentials` to get a list of all credentials that have been added to IDX
4754
- */
4755
- addCredential: (credential: IDXCredential) => Promise<void>;
4756
- /**
4757
- * Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
4758
- * to IDX with a bespoke title
4759
- *
4760
- * The credential may then be retrieved using `getCredential` and passing in that bespoke title,
4761
- * or by using `getCredentials` to get a list of all credentials that have been added to IDX
4762
- */
4763
- removeCredential: (title: string) => Promise<void>;
4764
- /**
4765
- * Resolves a stream ID, returning its contents
4766
- *
4767
- * This can be given the return value of `publishCredential` to gain access to the credential
4768
- * that was published
4769
- */
4770
- readFromCeramic: (streamId: string) => Promise<any>;
4771
- /**
4772
- * Returns an example credential, optionally allowing a subject's did to be passed in
4773
- *
4774
- * You can use this to test out implementations that use this library!
4775
- */
4776
- getTestVc: (subject?: string) => UnsignedVC;
4777
- /**
4778
- * Wraps a crednetial in an exmaple presentaion. If no credential is provided, a new one will be
4779
- * generated using getTestVc
4780
- *
4781
- * You can use this to test out implementations that use this library!
4782
- */
4783
- getTestVp: (credential?: VC) => Promise<UnsignedVP>;
4784
- /**
4785
- * Returns Ethereum public address
4786
- */
4787
- getEthereumAddress: () => string;
4788
- /**
4789
- * Get the balance of an ERC20 token
4790
- * Defaults to ETH if symbolOrAddress is not provided
4791
- */
4792
- getBalance: (symbolOrAddress?: string) => Promise<string>;
4793
- /**
4794
- * Get the balance of an ERC20 token for a given address
4795
- * Defaults to ETH if symbolOrAddress is not provided
4796
- */
4797
- getBalanceForAddress: (walletAddress: string, symbolOrAddress?: string) => Promise<string>;
4798
- /**
4799
- * Transfer tokens to a given address
4800
- */
4801
- transferTokens: (tokenSymbolOrAddress: string, amount: number, toAddress: string) => Promise<string>;
4802
- /**
4803
- * Get your current Ethereum network
4804
- */
4805
- getCurrentNetwork: () => ethers.providers.Networkish;
4806
- /**
4807
- * Change your Ethereum network
4808
- */
4809
- changeNetwork: (network: ethers.providers.Networkish) => void;
4810
- /**
4811
- * Add an infura project id to an existing wallet.
4812
- * Really only useful for testing with the CLI right now...
4813
- */
4814
- addInfuraProjectId: (infuraProjectIdToAdd: string) => void;
4815
- /**
4816
- * Returns a Verifiable Presentation (VP) from a QR code base-64 image data string containing a VP compressed by CBOR-LD.
4817
- */
4818
- vpFromQrCode: (text: string) => Promise<VP>;
4819
- /**
4820
- * Returns a QR-embeddable base-64 image data string from a Verifiable Presentation, compressed using CBOR-LD.
4821
- */
4822
- vpToQrCode: (vp: VP) => Promise<string>;
4998
+ did: Did;
4999
+ keypair: Keypair;
5000
+ issueCredential: IssueCredential;
5001
+ verifyCredential: VerifyCredential;
5002
+ issuePresentation: IssuePresentation;
5003
+ verifyPresentation: VerifyPresentation;
5004
+ getCredential: GetCredential;
5005
+ getCredentials: GetCredentials;
5006
+ getCredentialsList: GetCredentialsList;
5007
+ publishCredential: PublishCredential;
5008
+ addCredential: AddCredential;
5009
+ removeCredential: RemoveCredential;
5010
+ resolveDid: ResolveDid;
5011
+ readFromCeramic: ReadFromCeramic;
5012
+ getTestVc: GetTestVc;
5013
+ getTestVp: GetTestVp;
5014
+ getEthereumAddress: GetEthereumAddress;
5015
+ getBalance: GetBalance;
5016
+ getBalanceForAddress: GetBalanceForAddress;
5017
+ transferTokens: TransferTokens;
5018
+ getCurrentNetwork: GetCurrentNetwork;
5019
+ changeNetwork: ChangeNetwork;
5020
+ addInfuraProjectId: AddInfuraProjectId;
5021
+ vpFromQrCode: VpFromQrCode;
5022
+ vpToQrCode: VpToQrCode;
4823
5023
  };
5024
+ /** @group Universal Wallets */
5025
+ export declare type LearnCardRawWallet = Wallet<"DIDKit" | "DID Key" | "VC" | "IDX" | "Expiration" | "Ethereum" | "Vpqr", DidKeyPluginMethods<DidMethod> & VCPluginMethods & IDXPluginMethods & EthereumPluginMethods & VpqrPluginMethods>;
5026
+ /**
5027
+ * @group LearnCard
5028
+ */
4824
5029
  export declare type LearnCard<Methods extends keyof AllLearnCardMethods = keyof AllLearnCardMethods, RawWallet extends Wallet<any, any> = LearnCardRawWallet> = {
4825
5030
  /** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
4826
5031
  _wallet: RawWallet;
4827
5032
  } & Pick<AllLearnCardMethods, Methods>;
4828
- export declare type EmptyLearnCard = LearnCard<"verifyCredential" | "verifyPresentation", Wallet<"DIDKit" | "Expiration", DidkitPluginMethods & VerifyExtension>>;
4829
- export declare type CeramicIDXArgs = {
4830
- modelData: ModelAliases;
4831
- credentialAlias: string;
4832
- ceramicEndpoint: string;
4833
- defaultContentFamily: string;
4834
- };
5033
+ /**
5034
+ * @group LearnCard
5035
+ */
5036
+ export declare type EmptyLearnCard = LearnCard<"verifyCredential" | "verifyPresentation" | "resolveDid", Wallet<"DIDKit" | "Expiration", DidkitPluginMethods & VerifyExtension>>;
5037
+ /** @group LearnCard */
4835
5038
  export declare type LearnCardConfig = {
4836
5039
  ceramicIdx: CeramicIDXArgs;
4837
5040
  didkit: InitInput | Promise<InitInput>;
4838
5041
  defaultContents: any[];
4839
5042
  ethereumConfig: EthereumConfig;
4840
5043
  };
5044
+ /** @group Init Functions */
4841
5045
  export declare type EmptyWallet = InitFunction<undefined, "didkit", EmptyLearnCard>;
5046
+ /** @group Init Functions */
4842
5047
  export declare type WalletFromKey = InitFunction<{
4843
5048
  seed: string;
4844
5049
  }, keyof LearnCardConfig, LearnCard>;
4845
- /** Generates an empty wallet with no key material */
5050
+ /** @group Init Functions */
5051
+ export declare type InitLearnCard = GenericInitFunction<[
5052
+ EmptyWallet,
5053
+ WalletFromKey
5054
+ ]>;
5055
+ /**
5056
+ * Generates an empty wallet with no key material
5057
+ *
5058
+ * @group Init Functions
5059
+ */
4846
5060
  export declare const emptyWallet: ({ didkit }?: EmptyWallet["args"]) => Promise<EmptyWallet["returnValue"]>;
4847
- /** Generates a LearnCard Wallet from a 64 character seed string */
5061
+ /**
5062
+ * Generates a LearnCard Wallet from a 64 character seed string
5063
+ *
5064
+ * @group Init Functions
5065
+ */
4848
5066
  export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, ethereumConfig, }?: Partial<LearnCardConfig>) => Promise<LearnCard>;
5067
+ /**
5068
+ * Generates an Empty Wallet
5069
+ *
5070
+ * @group Init Functions
5071
+ */
4849
5072
  export declare function initLearnCard(config?: EmptyWallet["args"]): Promise<EmptyWallet["returnValue"]>;
5073
+ /**
5074
+ * Generates a full wallet from a 32 byte seed
5075
+ *
5076
+ * @group Init Functions
5077
+ */
4850
5078
  export declare function initLearnCard(config: WalletFromKey["args"]): Promise<WalletFromKey["returnValue"]>;
5079
+ export declare const passwordToKey: (password: string, salt?: string, iterations?: number, digest?: string) => Promise<Uint8Array>;
5080
+ export declare const seedToId: (seed: Uint8Array) => Promise<string>;
5081
+ /** @group Universal Wallets */
5082
+ 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>>;
5083
+ /**
5084
+ *
5085
+ * @group Plugins
5086
+ */
5087
+ export declare const getDidKitPlugin: (input?: InitInput | Promise<InitInput>) => Promise<Plugin<"DIDKit", DidkitPluginMethods>>;
5088
+ /**
5089
+ *
5090
+ * @group Plugins
5091
+ */
5092
+ export declare const getDidKeyPlugin: <DidMethod extends string>(wallet: Wallet<string, DependentMethods<DidMethod>>, key: string) => Promise<Plugin<"DID Key", DidKeyPluginMethods<DidMethod>>>;
5093
+ /**
5094
+ * @group Plugins
5095
+ */
5096
+ export declare const getVCPlugin: (wallet: Wallet<string, VCPluginDependentMethods>) => Promise<Plugin<"VC", VCPluginMethods>>;
5097
+ /**
5098
+ * @group Plugins
5099
+ */
5100
+ export declare const getIDXPlugin: (wallet: Wallet<any, {
5101
+ getKey: () => string;
5102
+ }>, { modelData, credentialAlias, ceramicEndpoint, defaultContentFamily }: CeramicIDXArgs) => Promise<Plugin<"IDX", IDXPluginMethods>>;
5103
+ /**
5104
+ * @group Plugins
5105
+ */
5106
+ export declare const ExpirationPlugin: (wallet: Wallet<any, VerifyExtension>) => Plugin<"Expiration", VerifyExtension>;
5107
+ /**
5108
+ * @group Plugins
5109
+ */
5110
+ export declare const getEthereumPlugin: (initWallet: Wallet<string, {
5111
+ getSubjectDid: (type: DidMethod) => string;
5112
+ getSubjectKeypair: (type?: Algorithm) => KeyPair;
5113
+ }>, config: EthereumConfig) => Plugin<"Ethereum", EthereumPluginMethods>;
5114
+ /**
5115
+ * @group Plugins
5116
+ */
5117
+ export declare const getVpqrPlugin: (wallet: Wallet<string, VpqrPluginDependentMethods>) => Plugin<"Vpqr", VpqrPluginMethods>;
4851
5118
  export * from "@wallet/init";
4852
5119
  export { Wallet, Plugin } from "types/wallet";
5120
+ export * from "types/LearnCard";
5121
+ export * from "@wallet/base";
5122
+ export * from "@wallet/plugins";
4853
5123
 
4854
5124
  export {};