@learncard/core 3.0.0 → 4.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
@@ -4602,6 +4602,16 @@ export declare type ProofOptions = {
4602
4602
  verificationMethod: string;
4603
4603
  proofPurpose: string;
4604
4604
  };
4605
+ export declare type DidkitPluginMethods = {
4606
+ generateEd25519KeyFromBytes: (bytes: Uint8Array) => KeyPair;
4607
+ generateSecp256k1KeyFromBytes: (bytes: Uint8Array) => KeyPair;
4608
+ keyToDid: (type: DidMethod, keypair: KeyPair) => string;
4609
+ keyToVerificationMethod: (type: string, keypair: KeyPair) => Promise<string>;
4610
+ issueCredential: (credential: UnsignedVC, options: ProofOptions, keypair: KeyPair) => Promise<VC>;
4611
+ verifyCredential: (credential: VC) => Promise<VerificationCheck>;
4612
+ issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair: KeyPair) => Promise<VP>;
4613
+ verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
4614
+ };
4605
4615
  export declare type Algorithm = "ed25519" | "secp256k1";
4606
4616
  export declare type DidKeyPluginMethods<DidMethod extends string> = {
4607
4617
  getSubjectDid: (type: DidMethod) => string;
@@ -4661,6 +4671,9 @@ export declare type VCPluginMethods = DependentMethods & {
4661
4671
  getTestVc: (subject?: string) => UnsignedVC;
4662
4672
  getTestVp: (credential?: VC) => Promise<UnsignedVP>;
4663
4673
  };
4674
+ export declare type VerifyExtension = {
4675
+ verifyCredential: (credential: VC) => Promise<VerificationCheck>;
4676
+ };
4664
4677
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
4665
4678
  export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
4666
4679
  name?: Name;
@@ -4679,9 +4692,7 @@ export declare type Wallet<PluginNames extends string = "", PluginMethods extend
4679
4692
  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>>;
4680
4693
  };
4681
4694
  export declare type LearnCardRawWallet = Wallet<"DIDKit" | "DID Key" | "VC" | "IDX" | "Expiration" | "Ethereum", DidKeyPluginMethods<DidMethod> & VCPluginMethods & IDXPluginMethods & EthereumPluginMethods>;
4682
- export declare type LearnCardWallet = {
4683
- /** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
4684
- _wallet: LearnCardRawWallet;
4695
+ export declare type AllLearnCardMethods = {
4685
4696
  /** Wallet holder's did */
4686
4697
  did: (type?: DidMethod) => string;
4687
4698
  /** Wallet holder's ed25519 key pair */
@@ -4771,6 +4782,11 @@ export declare type LearnCardWallet = {
4771
4782
  */
4772
4783
  checkMyUsdc: () => Promise<string>;
4773
4784
  };
4785
+ export declare type LearnCard<Methods extends keyof AllLearnCardMethods = keyof AllLearnCardMethods, RawWallet extends Wallet<any, any> = LearnCardRawWallet> = {
4786
+ /** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
4787
+ _wallet: RawWallet;
4788
+ } & Pick<AllLearnCardMethods, Methods>;
4789
+ export declare type EmptyLearnCard = LearnCard<"verifyCredential" | "verifyPresentation", Wallet<"DIDKit" | "Expiration", DidkitPluginMethods & VerifyExtension>>;
4774
4790
  export declare type CeramicIDXArgs = {
4775
4791
  modelData: ModelAliases;
4776
4792
  credentialAlias: string;
@@ -4783,9 +4799,11 @@ export declare type LearnCardConfig = {
4783
4799
  defaultContents: any[];
4784
4800
  ethereumConfig: EthereumConfig;
4785
4801
  };
4802
+ /** Generates an empty wallet with no key material */
4803
+ export declare const emptyWallet: ({ didkit, }?: Partial<Pick<LearnCardConfig, "didkit">>) => Promise<EmptyLearnCard>;
4786
4804
  /** Generates a LearnCard Wallet from a 64 character seed string */
4787
- export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, ethereumConfig, }?: Partial<LearnCardConfig>) => Promise<LearnCardWallet>;
4788
- export { walletFromKey } from "@wallet/init";
4805
+ export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, ethereumConfig, }?: Partial<LearnCardConfig>) => Promise<LearnCard>;
4806
+ export * from "@wallet/init";
4789
4807
  export { Wallet, Plugin } from "types/wallet";
4790
4808
 
4791
4809
  export {};