@learncard/core 1.5.0 → 2.1.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
@@ -4625,12 +4625,13 @@ export declare type EthereumConfig = {
4625
4625
  network?: providers.Networkish;
4626
4626
  };
4627
4627
  export declare type IDXPluginMethods = {
4628
- getCredentialsListFromIndex: (alias?: string) => Promise<CredentialsList>;
4628
+ getCredentialsListFromIdx: (alias?: string) => Promise<CredentialsList>;
4629
4629
  publishContentToCeramic: (cred: any) => Promise<string>;
4630
4630
  readContentFromCeramic: (streamId: string) => Promise<any>;
4631
- getVerifiableCredentialFromIndex: (title: string) => Promise<any>;
4632
- getVerifiableCredentialsFromIndex: () => Promise<any>;
4631
+ getVerifiableCredentialFromIdx: (title: string) => Promise<VC>;
4632
+ getVerifiableCredentialsFromIdx: () => Promise<VC[]>;
4633
4633
  addVerifiableCredentialInIdx: (cred: IDXCredential) => Promise<StreamID>;
4634
+ removeVerifiableCredentialInIdx: (title: string) => Promise<StreamID>;
4634
4635
  };
4635
4636
  declare enum StorageType {
4636
4637
  ceramic = "ceramic"
@@ -4663,31 +4664,20 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
4663
4664
  export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
4664
4665
  name?: Name;
4665
4666
  pluginMethods: {
4666
- [Key in keyof PublicMethods]: <T extends UnlockedWallet<any, PublicMethods>>(wallet: T, ...args: Parameters<PublicMethods[Key]>) => ReturnType<PublicMethods[Key]>;
4667
+ [Key in keyof PublicMethods]: <T extends Wallet<any, PublicMethods>>(wallet: T, ...args: Parameters<PublicMethods[Key]>) => ReturnType<PublicMethods[Key]>;
4667
4668
  };
4668
4669
  };
4669
4670
  export declare type PublicFieldsObj<PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
4670
4671
  pluginMethods: PluginMethods;
4671
4672
  };
4672
- declare enum WalletStatus {
4673
- Locked = "LOCKED",
4674
- Unlocked = "UNLOCKED"
4675
- }
4676
- export declare type BaseWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = PublicFieldsObj<PluginMethods> & {
4673
+ export declare type Wallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = PublicFieldsObj<PluginMethods> & {
4677
4674
  contents: any[];
4678
4675
  plugins: Plugin<PluginNames, Record<string, (...args: any[]) => any>>[];
4676
+ add: (content: any) => Promise<Wallet<PluginNames, PluginMethods>>;
4677
+ remove: (contentId: string) => Promise<Wallet<PluginNames, PluginMethods>>;
4678
+ 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>>;
4679
4679
  };
4680
- export declare type LockedWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = BaseWallet<PluginNames, PluginMethods> & {
4681
- status: WalletStatus.Locked;
4682
- };
4683
- export declare type UnlockedWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = BaseWallet<PluginNames, PluginMethods> & {
4684
- status: WalletStatus.Unlocked;
4685
- add: (content: any) => Promise<UnlockedWallet<PluginNames, PluginMethods>>;
4686
- remove: (contentId: string) => Promise<UnlockedWallet<PluginNames, PluginMethods>>;
4687
- addPlugin: <Name extends string, Methods extends Record<string, (...args: any[]) => any> = Record<never, never>>(plugin: Plugin<Name, Methods>) => Promise<UnlockedWallet<"" extends PluginNames ? Name : PluginNames | Name, Record<never, never> extends PluginMethods ? Methods : PluginMethods & Methods>>;
4688
- };
4689
- export declare type Wallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = LockedWallet<PluginNames, PluginMethods> | UnlockedWallet<PluginNames, PluginMethods>;
4690
- export declare type LearnCardRawWallet = UnlockedWallet<"DIDKit" | "DID Key" | "VC" | "IDX" | "Expiration" | "Ethereum", DidKeyPluginMethods<DidMethod> & VCPluginMethods & IDXPluginMethods & EthereumPluginMethods>;
4680
+ export declare type LearnCardRawWallet = Wallet<"DIDKit" | "DID Key" | "VC" | "IDX" | "Expiration" | "Ethereum", DidKeyPluginMethods<DidMethod> & VCPluginMethods & IDXPluginMethods & EthereumPluginMethods>;
4691
4681
  export declare type LearnCardWallet = {
4692
4682
  /** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
4693
4683
  _wallet: LearnCardRawWallet;
@@ -4718,9 +4708,11 @@ export declare type LearnCardWallet = {
4718
4708
  */
4719
4709
  verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
4720
4710
  /** Returns the credential marked with `title` from IDX */
4721
- getCredential: (title: string) => Promise<any>;
4711
+ getCredential: (title: string) => Promise<VC>;
4722
4712
  /** Returns all credentials from IDX */
4723
- getCredentials: () => Promise<any[]>;
4713
+ getCredentials: () => Promise<VC[]>;
4714
+ /** Returns all credentials from IDX */
4715
+ getCredentialsList: () => Promise<IDXCredential[]>;
4724
4716
  /**
4725
4717
  * Publishes a credential to Ceramic, returning the credential's stream ID
4726
4718
  *
@@ -4728,7 +4720,7 @@ export declare type LearnCardWallet = {
4728
4720
  *
4729
4721
  * Resolving a stream ID can be done by passing the stream ID to `readFromCeramic`
4730
4722
  */
4731
- publishCredential: (credential: any) => Promise<string>;
4723
+ publishCredential: (credential: VC) => Promise<string>;
4732
4724
  /**
4733
4725
  * Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
4734
4726
  * to IDX with a bespoke title
@@ -4737,6 +4729,14 @@ export declare type LearnCardWallet = {
4737
4729
  * or by using `getCredentials` to get a list of all credentials that have been added to IDX
4738
4730
  */
4739
4731
  addCredential: (credential: IDXCredential) => Promise<void>;
4732
+ /**
4733
+ * Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
4734
+ * to IDX with a bespoke title
4735
+ *
4736
+ * The credential may then be retrieved using `getCredential` and passing in that bespoke title,
4737
+ * or by using `getCredentials` to get a list of all credentials that have been added to IDX
4738
+ */
4739
+ removeCredential: (title: string) => Promise<void>;
4740
4740
  /**
4741
4741
  * Resolves a stream ID, returning its contents
4742
4742
  *
@@ -4778,6 +4778,6 @@ export declare type LearnCardConfig = {
4778
4778
  /** Generates a LearnCard Wallet from a 64 character seed string */
4779
4779
  export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, ethereumConfig, }?: Partial<LearnCardConfig>) => Promise<LearnCardWallet>;
4780
4780
  export { walletFromKey } from "@wallet/init";
4781
- export { Wallet, UnlockedWallet, LockedWallet, Plugin } from "types/wallet";
4781
+ export { Wallet, Plugin } from "types/wallet";
4782
4782
 
4783
4783
  export {};