@learncard/core 1.0.0 → 1.1.1

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
@@ -69,28 +69,10 @@ export declare type UnsignedVP = {
69
69
  export declare type VP = UnsignedVP & {
70
70
  proof: Proof;
71
71
  };
72
- export declare type JWK = {
73
- id: string;
74
- type: string | string[];
75
- controller?: string;
76
- publicKeyJwk?: any;
77
- privateKeyJwk?: any;
78
- "@context": string[];
79
- name: string;
80
- image: string;
81
- description: string;
82
- tags: string[];
83
- value?: string;
84
- generatedFrom?: [
85
- string
86
- ];
87
- };
88
72
  export declare type DidKeyPluginMethods = {
89
73
  getSubjectDid: () => string;
90
74
  getSubjectKeypair: () => Record<string, string>;
91
- };
92
- export declare type DidKeyPluginConstants = {
93
- generateContentFromSeed: (seed: Uint8Array) => Promise<JWK[]>;
75
+ getKey: () => string;
94
76
  };
95
77
  export declare type IDXPluginMethods = {
96
78
  getCredentialsListFromIndex: (alias?: string) => Promise<CredentialsList>;
@@ -126,36 +108,34 @@ export declare type VCPluginMethods = {
126
108
  getSubjectKeypair: () => Record<string, string>;
127
109
  };
128
110
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
129
- export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>, PublicConstants extends Record<string, any> = Record<never, never>> = {
111
+ export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
130
112
  name?: Name;
131
113
  pluginMethods: {
132
- [Key in keyof PublicMethods]: <T extends UnlockedWallet<any, PublicMethods, PublicConstants>>(wallet: T, ...args: Parameters<PublicMethods[Key]>) => ReturnType<PublicMethods[Key]>;
114
+ [Key in keyof PublicMethods]: <T extends UnlockedWallet<any, PublicMethods>>(wallet: T, ...args: Parameters<PublicMethods[Key]>) => ReturnType<PublicMethods[Key]>;
133
115
  };
134
- pluginConstants: PublicConstants;
135
116
  };
136
- export declare type PublicFieldsObj<PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>, PluginConstants extends Record<string, any> = Record<never, never>> = {
117
+ export declare type PublicFieldsObj<PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
137
118
  pluginMethods: PluginMethods;
138
- pluginConstants: PluginConstants;
139
119
  };
140
120
  declare enum WalletStatus {
141
121
  Locked = "LOCKED",
142
122
  Unlocked = "UNLOCKED"
143
123
  }
144
- export declare type BaseWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>, PluginConstants extends Record<string, any> = Record<never, never>> = PublicFieldsObj<PluginMethods, PluginConstants> & {
124
+ export declare type BaseWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = PublicFieldsObj<PluginMethods> & {
145
125
  contents: any[];
146
- plugins: Plugin<PluginNames, Record<string, (...args: any[]) => any>, Record<string, any>>[];
126
+ plugins: Plugin<PluginNames, Record<string, (...args: any[]) => any>>[];
147
127
  };
148
- export declare type LockedWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>, PluginConstants extends Record<string, any> = Record<never, never>> = BaseWallet<PluginNames, PluginMethods, PluginConstants> & {
128
+ export declare type LockedWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = BaseWallet<PluginNames, PluginMethods> & {
149
129
  status: WalletStatus.Locked;
150
130
  };
151
- export declare type UnlockedWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>, PluginConstants extends Record<string, any> = Record<never, never>> = BaseWallet<PluginNames, PluginMethods, PluginConstants> & {
131
+ export declare type UnlockedWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = BaseWallet<PluginNames, PluginMethods> & {
152
132
  status: WalletStatus.Unlocked;
153
- add: (content: any) => Promise<UnlockedWallet<PluginNames, PluginMethods, PluginConstants>>;
154
- remove: (contentId: string) => Promise<UnlockedWallet<PluginNames, PluginMethods, PluginConstants>>;
155
- addPlugin: <Name extends string, Methods extends Record<string, (...args: any[]) => any> = Record<never, never>, Constants extends Record<string, any> = Record<never, never>>(plugin: Plugin<Name, Methods, Constants>) => Promise<UnlockedWallet<"" extends PluginNames ? Name : PluginNames | Name, Record<never, never> extends PluginMethods ? Methods : PluginMethods & Methods, Record<never, never> extends PluginConstants ? Constants : PluginConstants & Constants>>;
133
+ add: (content: any) => Promise<UnlockedWallet<PluginNames, PluginMethods>>;
134
+ remove: (contentId: string) => Promise<UnlockedWallet<PluginNames, PluginMethods>>;
135
+ 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>>;
156
136
  };
157
- export declare type Wallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>, PluginConstants extends Record<string, any> = Record<never, never>> = LockedWallet<PluginNames, PluginMethods, PluginConstants> | UnlockedWallet<PluginNames, PluginMethods, PluginConstants>;
158
- export declare type LearnCardRawWallet = UnlockedWallet<"DID Key" | "VC" | "IDX" | "Expiration", DidKeyPluginMethods & VCPluginMethods & IDXPluginMethods, DidKeyPluginConstants>;
137
+ export declare type Wallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = LockedWallet<PluginNames, PluginMethods> | UnlockedWallet<PluginNames, PluginMethods>;
138
+ export declare type LearnCardRawWallet = UnlockedWallet<"DID Key" | "VC" | "IDX" | "Expiration", DidKeyPluginMethods & VCPluginMethods & IDXPluginMethods>;
159
139
  export declare type LearnCardWallet = {
160
140
  /** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
161
141
  _wallet: LearnCardRawWallet;
@@ -222,11 +202,11 @@ export declare type CeramicIDXArgs = {
222
202
  export declare type LearnCardConfig = {
223
203
  ceramicIdx: CeramicIDXArgs;
224
204
  didkit: InitInput | Promise<InitInput>;
205
+ defaultContents: any[];
225
206
  };
226
- export declare const createWallet: (defaultContents: any[], { ceramicIdx, didkit }?: Partial<LearnCardConfig>) => Promise<LearnCardWallet>;
227
- /** Generates did documents from key and returns default wallet */
228
- export declare const walletFromKey: (key: string, { ceramicIdx, didkit }?: Partial<LearnCardConfig>) => Promise<LearnCardWallet>;
229
- export { createWallet, walletFromKey } from "@wallet/init";
207
+ /** Generates a LearnCard Wallet from a 64 character seed string */
208
+ export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, }?: Partial<LearnCardConfig>) => Promise<LearnCardWallet>;
209
+ export { walletFromKey } from "@wallet/init";
230
210
  export { Wallet, UnlockedWallet, LockedWallet, Plugin } from "types/wallet";
231
211
 
232
212
  export {};