@learncard/core 5.1.1 → 6.0.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/core.d.ts CHANGED
@@ -4605,8 +4605,11 @@ declare const IDXCredentialValidator: z.ZodObject<{
4605
4605
  id: string;
4606
4606
  title: string;
4607
4607
  }>;
4608
+ /** @group IDXPlugin */
4608
4609
  export declare type IDXCredential = z.infer<typeof IDXCredentialValidator>;
4610
+ /** @group DIDKit Plugin */
4609
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 */
4610
4613
  export declare type KeyPair = {
4611
4614
  kty: string;
4612
4615
  crv: string;
@@ -4614,10 +4617,12 @@ export declare type KeyPair = {
4614
4617
  y?: string;
4615
4618
  d: string;
4616
4619
  };
4620
+ /** @group DIDKit Plugin */
4617
4621
  export declare type ProofOptions = {
4618
4622
  verificationMethod: string;
4619
4623
  proofPurpose: string;
4620
4624
  };
4625
+ /** @group DIDKit Plugin */
4621
4626
  export declare type DidkitPluginMethods = {
4622
4627
  generateEd25519KeyFromBytes: (bytes: Uint8Array) => KeyPair;
4623
4628
  generateSecp256k1KeyFromBytes: (bytes: Uint8Array) => KeyPair;
@@ -4630,7 +4635,32 @@ export declare type DidkitPluginMethods = {
4630
4635
  contextLoader: (url: string) => Promise<Record<string, any>>;
4631
4636
  resolveDid: (did: string) => Promise<Record<string, any>>;
4632
4637
  };
4638
+ /** @group DidKey Plugin */
4633
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 */
4634
4664
  export declare type DidKeyPluginMethods<DidMethod extends string> = {
4635
4665
  getSubjectDid: (type: DidMethod) => string;
4636
4666
  getSubjectKeypair: (type?: Algorithm) => {
@@ -4642,6 +4672,7 @@ export declare type DidKeyPluginMethods<DidMethod extends string> = {
4642
4672
  };
4643
4673
  getKey: () => string;
4644
4674
  };
4675
+ /** @group Ethereum Plugin */
4645
4676
  export declare type EthereumPluginMethods = {
4646
4677
  getEthereumAddress: () => string;
4647
4678
  getBalance: (symbolOrAddress?: string) => Promise<string>;
@@ -4651,10 +4682,31 @@ export declare type EthereumPluginMethods = {
4651
4682
  changeNetwork: (network: providers.Networkish) => void;
4652
4683
  addInfuraProjectId: (infuraProjectIdToAdd: string) => void;
4653
4684
  };
4685
+ /** @group Ethereum Plugin */
4654
4686
  export declare type EthereumConfig = {
4655
4687
  infuraProjectId?: string;
4656
4688
  network?: providers.Networkish;
4657
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 */
4658
4710
  export declare type IDXPluginMethods = {
4659
4711
  getCredentialsListFromIdx: (alias?: string) => Promise<CredentialsList>;
4660
4712
  publishContentToCeramic: (cred: any) => Promise<string>;
@@ -4664,107 +4716,40 @@ export declare type IDXPluginMethods = {
4664
4716
  addVerifiableCredentialInIdx: (cred: IDXCredential) => Promise<StreamID>;
4665
4717
  removeVerifiableCredentialInIdx: (title: string) => Promise<StreamID>;
4666
4718
  };
4667
- declare const IDXCredentialValidator: z.ZodObject<{
4668
- id: z.ZodString;
4669
- title: z.ZodString;
4670
- storageType: z.ZodOptional<z.ZodEnum<[
4671
- "ceramic"
4672
- ]>>;
4673
- metadata: z.ZodOptional<z.ZodObject<{
4674
- name: z.ZodOptional<z.ZodString>;
4675
- image: z.ZodOptional<z.ZodString>;
4676
- }, "strip", z.ZodAny, {
4677
- [x: string]: any;
4678
- name?: string | undefined;
4679
- image?: string | undefined;
4680
- }, {
4681
- [x: string]: any;
4682
- name?: string | undefined;
4683
- image?: string | undefined;
4684
- }>>;
4685
- }, "strict", z.ZodTypeAny, {
4686
- storageType?: "ceramic" | undefined;
4687
- metadata?: {
4688
- [x: string]: any;
4689
- name?: string | undefined;
4690
- image?: string | undefined;
4691
- } | undefined;
4692
- id: string;
4693
- title: string;
4694
- }, {
4695
- storageType?: "ceramic" | undefined;
4696
- metadata?: {
4697
- [x: string]: any;
4698
- name?: string | undefined;
4699
- image?: string | undefined;
4700
- } | undefined;
4701
- id: string;
4702
- title: string;
4703
- }>;
4704
- export declare type IDXCredential = z.infer<typeof IDXCredentialValidator>;
4705
- declare const CredentialsListValidator: z.ZodObject<{
4719
+ /** @group IDXPlugin */
4720
+ export declare const CredentialsListValidator: z.ZodObject<{
4706
4721
  credentials: z.ZodArray<z.ZodObject<{
4707
4722
  id: z.ZodString;
4708
4723
  title: z.ZodString;
4709
4724
  storageType: z.ZodOptional<z.ZodEnum<[
4710
4725
  "ceramic"
4711
4726
  ]>>;
4712
- metadata: z.ZodOptional<z.ZodObject<{
4713
- name: z.ZodOptional<z.ZodString>;
4714
- image: z.ZodOptional<z.ZodString>;
4715
- }, "strip", z.ZodAny, {
4716
- [x: string]: any;
4717
- name?: string | undefined;
4718
- image?: string | undefined;
4719
- }, {
4720
- [x: string]: any;
4721
- name?: string | undefined;
4722
- image?: string | undefined;
4723
- }>>;
4724
- }, "strict", z.ZodTypeAny, {
4727
+ }, "strip", z.ZodTypeAny, {
4725
4728
  storageType?: "ceramic" | undefined;
4726
- metadata?: {
4727
- [x: string]: any;
4728
- name?: string | undefined;
4729
- image?: string | undefined;
4730
- } | undefined;
4731
4729
  id: string;
4732
4730
  title: string;
4733
4731
  }, {
4734
4732
  storageType?: "ceramic" | undefined;
4735
- metadata?: {
4736
- [x: string]: any;
4737
- name?: string | undefined;
4738
- image?: string | undefined;
4739
- } | undefined;
4740
4733
  id: string;
4741
4734
  title: string;
4742
4735
  }>, "many">;
4743
4736
  }, "strict", z.ZodTypeAny, {
4744
4737
  credentials: {
4745
4738
  storageType?: "ceramic" | undefined;
4746
- metadata?: {
4747
- [x: string]: any;
4748
- name?: string | undefined;
4749
- image?: string | undefined;
4750
- } | undefined;
4751
4739
  id: string;
4752
4740
  title: string;
4753
4741
  }[];
4754
4742
  }, {
4755
4743
  credentials: {
4756
4744
  storageType?: "ceramic" | undefined;
4757
- metadata?: {
4758
- [x: string]: any;
4759
- name?: string | undefined;
4760
- image?: string | undefined;
4761
- } | undefined;
4762
4745
  id: string;
4763
4746
  title: string;
4764
4747
  }[];
4765
4748
  }>;
4749
+ /** @group IDXPlugin */
4766
4750
  export declare type CredentialsList = z.infer<typeof CredentialsListValidator>;
4767
- export declare type DependentMethods = {
4751
+ /** @group VC Plugin */
4752
+ export declare type VCPluginDependentMethods = {
4768
4753
  getSubjectDid: (type: "key") => string;
4769
4754
  getSubjectKeypair: () => KeyPair;
4770
4755
  keyToVerificationMethod: (type: string, keypair: KeyPair) => Promise<string>;
@@ -4773,7 +4758,8 @@ export declare type DependentMethods = {
4773
4758
  issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair: KeyPair) => Promise<VP>;
4774
4759
  verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
4775
4760
  };
4776
- export declare type VCPluginMethods = DependentMethods & {
4761
+ /** @group VC Plugin */
4762
+ export declare type VCPluginMethods = VCPluginDependentMethods & {
4777
4763
  issueCredential: (credential: UnsignedVC) => Promise<VC>;
4778
4764
  verifyCredential: (credential: VC) => Promise<VerificationCheck>;
4779
4765
  issuePresentation: (credential: UnsignedVP) => Promise<VP>;
@@ -4781,27 +4767,40 @@ export declare type VCPluginMethods = DependentMethods & {
4781
4767
  getTestVc: (subject?: string) => UnsignedVC;
4782
4768
  getTestVp: (credential?: VC) => Promise<UnsignedVP>;
4783
4769
  };
4770
+ /** @group VC Plugin */
4784
4771
  export declare type VerifyExtension = {
4785
4772
  verifyCredential: (credential: VC) => Promise<VerificationCheck>;
4786
4773
  };
4774
+ /** @group VPQR Plugin */
4787
4775
  export declare type VpqrPluginMethods = {
4788
4776
  vpFromQrCode: (text: string) => Promise<VP>;
4789
4777
  vpToQrCode: (vp: VP) => Promise<string>;
4790
4778
  };
4779
+ /** @group VPQR Plugin */
4780
+ export declare type VpqrPluginDependentMethods = {
4781
+ contextLoader: (url: string) => Promise<Record<string, any>>;
4782
+ };
4791
4783
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
4792
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>> = {
4793
4785
  args: undefined extends Args ? Partial<Pick<LearnCardConfig, Config>> : Args & Partial<Pick<LearnCardConfig, Config>>;
4794
4786
  returnValue: ReturnValue;
4795
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 */
4796
4793
  export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
4797
4794
  name?: Name;
4798
4795
  pluginMethods: {
4799
4796
  [Key in keyof PublicMethods]: <T extends Wallet<any, PublicMethods>>(wallet: T, ...args: Parameters<PublicMethods[Key]>) => ReturnType<PublicMethods[Key]>;
4800
4797
  };
4801
4798
  };
4799
+ /** @group Universal Wallets */
4802
4800
  export declare type PublicFieldsObj<PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
4803
4801
  pluginMethods: PluginMethods;
4804
4802
  };
4803
+ /** @group Universal Wallets */
4805
4804
  export declare type Wallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = PublicFieldsObj<PluginMethods> & {
4806
4805
  contents: any[];
4807
4806
  plugins: Plugin<PluginNames, Record<string, (...args: any[]) => any>>[];
@@ -4809,153 +4808,317 @@ export declare type Wallet<PluginNames extends string = "", PluginMethods extend
4809
4808
  remove: (contentId: string) => Promise<Wallet<PluginNames, PluginMethods>>;
4810
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>>;
4811
4810
  };
4812
- 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
+ */
4813
4997
  export declare type AllLearnCardMethods = {
4814
- /** Wallet holder's did */
4815
- did: (type?: DidMethod) => string;
4816
- /** Wallet holder's ed25519 key pair */
4817
- keypair: (type?: Algorithm) => {
4818
- kty: string;
4819
- crv: string;
4820
- x: string;
4821
- y?: string;
4822
- d: string;
4823
- };
4824
- /** Signs an unsigned Verifiable Credential, returning the signed VC */
4825
- issueCredential: (credential: UnsignedVC) => Promise<VC>;
4826
- /**
4827
- * Verifies a signed Verifiable Credential
4828
- *
4829
- * Empty error/warnings arrays means verification was successful
4830
- */
4831
- verifyCredential: (credential: VC) => Promise<VerificationItem[]>;
4832
- /** Signs an unsigned Verifiable Presentation, returning the signed VP */
4833
- issuePresentation: (presentation: UnsignedVP) => Promise<VP>;
4834
- /**
4835
- * Verifies a signed Verifiable Presentation
4836
- *
4837
- * Empry error/warnings arrays means verification was successful
4838
- */
4839
- verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
4840
- /** Returns the credential marked with `title` from IDX */
4841
- getCredential: (title: string) => Promise<VC>;
4842
- /** Returns all credentials from IDX */
4843
- getCredentials: () => Promise<VC[]>;
4844
- /** Returns all credentials from IDX */
4845
- getCredentialsList: () => Promise<IDXCredential[]>;
4846
- /**
4847
- * Publishes a credential to Ceramic, returning the credential's stream ID
4848
- *
4849
- * This stream ID may then be shared/persisted/resolved to gain access to the credential
4850
- *
4851
- * Resolving a stream ID can be done by passing the stream ID to `readFromCeramic`
4852
- */
4853
- publishCredential: (credential: VC) => Promise<string>;
4854
- /**
4855
- * Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
4856
- * to IDX with a bespoke title
4857
- *
4858
- * The credential may then be retrieved using `getCredential` and passing in that bespoke title,
4859
- * or by using `getCredentials` to get a list of all credentials that have been added to IDX
4860
- */
4861
- addCredential: (credential: IDXCredential) => Promise<void>;
4862
- /**
4863
- * Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
4864
- * to IDX with a bespoke title
4865
- *
4866
- * The credential may then be retrieved using `getCredential` and passing in that bespoke title,
4867
- * or by using `getCredentials` to get a list of all credentials that have been added to IDX
4868
- */
4869
- removeCredential: (title: string) => Promise<void>;
4870
- resolveDid: (did: string) => Promise<Record<string, any>>;
4871
- /**
4872
- * Resolves a stream ID, returning its contents
4873
- *
4874
- * This can be given the return value of `publishCredential` to gain access to the credential
4875
- * that was published
4876
- */
4877
- readFromCeramic: (streamId: string) => Promise<any>;
4878
- /**
4879
- * Returns an example credential, optionally allowing a subject's did to be passed in
4880
- *
4881
- * You can use this to test out implementations that use this library!
4882
- */
4883
- getTestVc: (subject?: string) => UnsignedVC;
4884
- /**
4885
- * Wraps a crednetial in an exmaple presentaion. If no credential is provided, a new one will be
4886
- * generated using getTestVc
4887
- *
4888
- * You can use this to test out implementations that use this library!
4889
- */
4890
- getTestVp: (credential?: VC) => Promise<UnsignedVP>;
4891
- /**
4892
- * Returns Ethereum public address
4893
- */
4894
- getEthereumAddress: () => string;
4895
- /**
4896
- * Get the balance of an ERC20 token
4897
- * Defaults to ETH if symbolOrAddress is not provided
4898
- */
4899
- getBalance: (symbolOrAddress?: string) => Promise<string>;
4900
- /**
4901
- * Get the balance of an ERC20 token for a given address
4902
- * Defaults to ETH if symbolOrAddress is not provided
4903
- */
4904
- getBalanceForAddress: (walletAddress: string, symbolOrAddress?: string) => Promise<string>;
4905
- /**
4906
- * Transfer tokens to a given address
4907
- */
4908
- transferTokens: (tokenSymbolOrAddress: string, amount: number, toAddress: string) => Promise<string>;
4909
- /**
4910
- * Get your current Ethereum network
4911
- */
4912
- getCurrentNetwork: () => ethers.providers.Networkish;
4913
- /**
4914
- * Change your Ethereum network
4915
- */
4916
- changeNetwork: (network: ethers.providers.Networkish) => void;
4917
- /**
4918
- * Add an infura project id to an existing wallet.
4919
- * Really only useful for testing with the CLI right now...
4920
- */
4921
- addInfuraProjectId: (infuraProjectIdToAdd: string) => void;
4922
- /**
4923
- * Returns a Verifiable Presentation (VP) from a QR code base-64 image data string containing a VP compressed by CBOR-LD.
4924
- */
4925
- vpFromQrCode: (text: string) => Promise<VP>;
4926
- /**
4927
- * Returns a QR-embeddable base-64 image data string from a Verifiable Presentation, compressed using CBOR-LD.
4928
- */
4929
- 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;
4930
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
+ */
4931
5029
  export declare type LearnCard<Methods extends keyof AllLearnCardMethods = keyof AllLearnCardMethods, RawWallet extends Wallet<any, any> = LearnCardRawWallet> = {
4932
5030
  /** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
4933
5031
  _wallet: RawWallet;
4934
5032
  } & Pick<AllLearnCardMethods, Methods>;
5033
+ /**
5034
+ * @group LearnCard
5035
+ */
4935
5036
  export declare type EmptyLearnCard = LearnCard<"verifyCredential" | "verifyPresentation" | "resolveDid", Wallet<"DIDKit" | "Expiration", DidkitPluginMethods & VerifyExtension>>;
4936
- export declare type CeramicIDXArgs = {
4937
- modelData: ModelAliases;
4938
- credentialAlias: string;
4939
- ceramicEndpoint: string;
4940
- defaultContentFamily: string;
4941
- };
5037
+ /** @group LearnCard */
4942
5038
  export declare type LearnCardConfig = {
4943
5039
  ceramicIdx: CeramicIDXArgs;
4944
5040
  didkit: InitInput | Promise<InitInput>;
4945
5041
  defaultContents: any[];
4946
5042
  ethereumConfig: EthereumConfig;
4947
5043
  };
5044
+ /** @group Init Functions */
4948
5045
  export declare type EmptyWallet = InitFunction<undefined, "didkit", EmptyLearnCard>;
5046
+ /** @group Init Functions */
4949
5047
  export declare type WalletFromKey = InitFunction<{
4950
5048
  seed: string;
4951
5049
  }, keyof LearnCardConfig, LearnCard>;
4952
- /** 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
+ */
4953
5060
  export declare const emptyWallet: ({ didkit }?: EmptyWallet["args"]) => Promise<EmptyWallet["returnValue"]>;
4954
- /** 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
+ */
4955
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
+ */
4956
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
+ */
4957
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>;
4958
5118
  export * from "@wallet/init";
4959
5119
  export { Wallet, Plugin } from "types/wallet";
5120
+ export * from "types/LearnCard";
5121
+ export * from "@wallet/base";
5122
+ export * from "@wallet/plugins";
4960
5123
 
4961
5124
  export {};