@learncard/core 1.5.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/core.cjs.development.js +1592 -15425
- package/dist/core.cjs.development.js.map +3 -3
- package/dist/core.cjs.production.min.js +135 -137
- package/dist/core.cjs.production.min.js.map +3 -3
- package/dist/core.d.ts +34 -26
- package/dist/core.esm.js +1592 -15425
- package/dist/core.esm.js.map +3 -3
- package/package.json +2 -2
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
|
-
|
4628
|
+
getCredentialsListFromIdx: (alias?: string) => Promise<CredentialsList>;
|
4629
4629
|
publishContentToCeramic: (cred: any) => Promise<string>;
|
4630
4630
|
readContentFromCeramic: (streamId: string) => Promise<any>;
|
4631
|
-
|
4632
|
-
|
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"
|
@@ -4655,39 +4656,29 @@ export declare type DependentMethods = {
|
|
4655
4656
|
export declare type VCPluginMethods = DependentMethods & {
|
4656
4657
|
issueCredential: (credential: UnsignedVC) => Promise<VC>;
|
4657
4658
|
verifyCredential: (credential: VC) => Promise<VerificationCheck>;
|
4658
|
-
issuePresentation: (credential:
|
4659
|
+
issuePresentation: (credential: UnsignedVP) => Promise<VP>;
|
4659
4660
|
verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
|
4660
4661
|
getTestVc: (subject?: string) => UnsignedVC;
|
4662
|
+
getTestVp: (credential?: VC) => Promise<UnsignedVP>;
|
4661
4663
|
};
|
4662
4664
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
4663
4665
|
export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
|
4664
4666
|
name?: Name;
|
4665
4667
|
pluginMethods: {
|
4666
|
-
[Key in keyof PublicMethods]: <T extends
|
4668
|
+
[Key in keyof PublicMethods]: <T extends Wallet<any, PublicMethods>>(wallet: T, ...args: Parameters<PublicMethods[Key]>) => ReturnType<PublicMethods[Key]>;
|
4667
4669
|
};
|
4668
4670
|
};
|
4669
4671
|
export declare type PublicFieldsObj<PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
|
4670
4672
|
pluginMethods: PluginMethods;
|
4671
4673
|
};
|
4672
|
-
declare
|
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> & {
|
4674
|
+
export declare type Wallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = PublicFieldsObj<PluginMethods> & {
|
4677
4675
|
contents: any[];
|
4678
4676
|
plugins: Plugin<PluginNames, Record<string, (...args: any[]) => any>>[];
|
4677
|
+
add: (content: any) => Promise<Wallet<PluginNames, PluginMethods>>;
|
4678
|
+
remove: (contentId: string) => Promise<Wallet<PluginNames, PluginMethods>>;
|
4679
|
+
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
4680
|
};
|
4680
|
-
export declare type
|
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>;
|
4681
|
+
export declare type LearnCardRawWallet = Wallet<"DIDKit" | "DID Key" | "VC" | "IDX" | "Expiration" | "Ethereum", DidKeyPluginMethods<DidMethod> & VCPluginMethods & IDXPluginMethods & EthereumPluginMethods>;
|
4691
4682
|
export declare type LearnCardWallet = {
|
4692
4683
|
/** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
|
4693
4684
|
_wallet: LearnCardRawWallet;
|
@@ -4710,7 +4701,7 @@ export declare type LearnCardWallet = {
|
|
4710
4701
|
*/
|
4711
4702
|
verifyCredential: (credential: VC) => Promise<VerificationItem[]>;
|
4712
4703
|
/** Creates a signed Verifiable Presentation from a signed Verifiable Credential */
|
4713
|
-
issuePresentation: (
|
4704
|
+
issuePresentation: (presentation: UnsignedVP) => Promise<VP>;
|
4714
4705
|
/**
|
4715
4706
|
* Verifies a signed Verifiable Presentation
|
4716
4707
|
*
|
@@ -4718,9 +4709,11 @@ export declare type LearnCardWallet = {
|
|
4718
4709
|
*/
|
4719
4710
|
verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
|
4720
4711
|
/** Returns the credential marked with `title` from IDX */
|
4721
|
-
getCredential: (title: string) => Promise<
|
4712
|
+
getCredential: (title: string) => Promise<VC>;
|
4713
|
+
/** Returns all credentials from IDX */
|
4714
|
+
getCredentials: () => Promise<VC[]>;
|
4722
4715
|
/** Returns all credentials from IDX */
|
4723
|
-
|
4716
|
+
getCredentialsList: () => Promise<IDXCredential[]>;
|
4724
4717
|
/**
|
4725
4718
|
* Publishes a credential to Ceramic, returning the credential's stream ID
|
4726
4719
|
*
|
@@ -4728,7 +4721,7 @@ export declare type LearnCardWallet = {
|
|
4728
4721
|
*
|
4729
4722
|
* Resolving a stream ID can be done by passing the stream ID to `readFromCeramic`
|
4730
4723
|
*/
|
4731
|
-
publishCredential: (credential:
|
4724
|
+
publishCredential: (credential: VC) => Promise<string>;
|
4732
4725
|
/**
|
4733
4726
|
* Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
|
4734
4727
|
* to IDX with a bespoke title
|
@@ -4737,6 +4730,14 @@ export declare type LearnCardWallet = {
|
|
4737
4730
|
* or by using `getCredentials` to get a list of all credentials that have been added to IDX
|
4738
4731
|
*/
|
4739
4732
|
addCredential: (credential: IDXCredential) => Promise<void>;
|
4733
|
+
/**
|
4734
|
+
* Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
|
4735
|
+
* to IDX with a bespoke title
|
4736
|
+
*
|
4737
|
+
* The credential may then be retrieved using `getCredential` and passing in that bespoke title,
|
4738
|
+
* or by using `getCredentials` to get a list of all credentials that have been added to IDX
|
4739
|
+
*/
|
4740
|
+
removeCredential: (title: string) => Promise<void>;
|
4740
4741
|
/**
|
4741
4742
|
* Resolves a stream ID, returning its contents
|
4742
4743
|
*
|
@@ -4750,6 +4751,13 @@ export declare type LearnCardWallet = {
|
|
4750
4751
|
* You can use this to test out implementations that use this library!
|
4751
4752
|
*/
|
4752
4753
|
getTestVc: (subject?: string) => UnsignedVC;
|
4754
|
+
/**
|
4755
|
+
* Wraps a crednetial in an exmaple presentaion. If no credential is provided, a new one will be
|
4756
|
+
* generated using getTestVc
|
4757
|
+
*
|
4758
|
+
* You can use this to test out implementations that use this library!
|
4759
|
+
*/
|
4760
|
+
getTestVp: (credential?: VC) => Promise<UnsignedVP>;
|
4753
4761
|
/**
|
4754
4762
|
* Returns your ETH balance
|
4755
4763
|
*/
|
@@ -4778,6 +4786,6 @@ export declare type LearnCardConfig = {
|
|
4778
4786
|
/** Generates a LearnCard Wallet from a 64 character seed string */
|
4779
4787
|
export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, ethereumConfig, }?: Partial<LearnCardConfig>) => Promise<LearnCardWallet>;
|
4780
4788
|
export { walletFromKey } from "@wallet/init";
|
4781
|
-
export { Wallet,
|
4789
|
+
export { Wallet, Plugin } from "types/wallet";
|
4782
4790
|
|
4783
4791
|
export {};
|