@learncard/core 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +6 -8
- package/dist/core.cjs.development.js +1747 -226
- package/dist/core.cjs.development.js.map +3 -3
- package/dist/core.cjs.production.min.js +175 -175
- package/dist/core.cjs.production.min.js.map +3 -3
- package/dist/core.d.ts +17 -37
- package/dist/core.esm.js +1747 -226
- package/dist/core.esm.js.map +3 -3
- package/package.json +3 -3
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
154
|
-
remove: (contentId: string) => Promise<UnlockedWallet<PluginNames, PluginMethods
|
155
|
-
addPlugin: <Name extends string, Methods extends Record<string, (...args: any[]) => any> = Record<never, never
|
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
|
158
|
-
export declare type LearnCardRawWallet = UnlockedWallet<"DID Key" | "VC" | "IDX" | "Expiration", DidKeyPluginMethods & VCPluginMethods & IDXPluginMethods
|
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
|
-
|
227
|
-
|
228
|
-
export
|
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 {};
|