@learncard/core 3.0.0 → 5.0.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/README.md +4 -4
- package/dist/core.cjs.development.js +23533 -17639
- package/dist/core.cjs.development.js.map +3 -3
- package/dist/core.cjs.production.min.js +221 -221
- package/dist/core.cjs.production.min.js.map +3 -3
- package/dist/core.d.ts +66 -15
- package/dist/core.esm.js +23318 -17424
- package/dist/core.esm.js.map +3 -3
- package/dist/didkit/didkit_wasm.d.ts +17 -2
- package/dist/didkit/didkit_wasm.js +332 -383
- package/dist/didkit/didkit_wasm_bg.wasm +0 -0
- package/dist/didkit/didkit_wasm_bg.wasm.d.ts +3 -2
- package/dist/didkit_wasm.d.ts +17 -2
- package/dist/didkit_wasm.js +332 -383
- package/dist/didkit_wasm_bg.wasm +0 -0
- package/dist/didkit_wasm_bg.wasm.d.ts +3 -2
- package/package.json +2 -1
package/dist/core.d.ts
CHANGED
@@ -4602,6 +4602,17 @@ 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
|
+
contextLoader: (url: string) => Promise<Record<string, any>>;
|
4615
|
+
};
|
4605
4616
|
export declare type Algorithm = "ed25519" | "secp256k1";
|
4606
4617
|
export declare type DidKeyPluginMethods<DidMethod extends string> = {
|
4607
4618
|
getSubjectDid: (type: DidMethod) => string;
|
@@ -4615,12 +4626,15 @@ export declare type DidKeyPluginMethods<DidMethod extends string> = {
|
|
4615
4626
|
getKey: () => string;
|
4616
4627
|
};
|
4617
4628
|
export declare type EthereumPluginMethods = {
|
4618
|
-
|
4619
|
-
|
4620
|
-
|
4629
|
+
getEthereumAddress: () => string;
|
4630
|
+
getBalance: (symbolOrAddress?: string) => Promise<string>;
|
4631
|
+
getBalanceForAddress: (walletAddress: string, symbolOrAddress?: string) => Promise<string>;
|
4632
|
+
transferTokens: (tokenSymbolOrAddress: string, amount: number, toAddress: string) => Promise<string>;
|
4633
|
+
getCurrentNetwork: () => providers.Networkish;
|
4634
|
+
changeNetwork: (network: providers.Networkish) => void;
|
4635
|
+
addInfuraProjectId: (infuraProjectIdToAdd: string) => void;
|
4621
4636
|
};
|
4622
4637
|
export declare type EthereumConfig = {
|
4623
|
-
address: string;
|
4624
4638
|
infuraProjectId?: string;
|
4625
4639
|
network?: providers.Networkish;
|
4626
4640
|
};
|
@@ -4661,7 +4675,14 @@ export declare type VCPluginMethods = DependentMethods & {
|
|
4661
4675
|
getTestVc: (subject?: string) => UnsignedVC;
|
4662
4676
|
getTestVp: (credential?: VC) => Promise<UnsignedVP>;
|
4663
4677
|
};
|
4678
|
+
export declare type VerifyExtension = {
|
4679
|
+
verifyCredential: (credential: VC) => Promise<VerificationCheck>;
|
4680
|
+
};
|
4664
4681
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
4682
|
+
export declare type InitFunction<Args extends Record<string, any> | undefined = Record<string, any>, Config extends keyof LearnCardConfig = keyof LearnCardConfig, ReturnValue extends LearnCard<any, any> = LearnCard<any, any>> = {
|
4683
|
+
args: undefined extends Args ? Partial<Pick<LearnCardConfig, Config>> : Args & Partial<Pick<LearnCardConfig, Config>>;
|
4684
|
+
returnValue: ReturnValue;
|
4685
|
+
};
|
4665
4686
|
export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
|
4666
4687
|
name?: Name;
|
4667
4688
|
pluginMethods: {
|
@@ -4679,9 +4700,7 @@ export declare type Wallet<PluginNames extends string = "", PluginMethods extend
|
|
4679
4700
|
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
4701
|
};
|
4681
4702
|
export declare type LearnCardRawWallet = Wallet<"DIDKit" | "DID Key" | "VC" | "IDX" | "Expiration" | "Ethereum", DidKeyPluginMethods<DidMethod> & VCPluginMethods & IDXPluginMethods & EthereumPluginMethods>;
|
4682
|
-
export declare type
|
4683
|
-
/** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
|
4684
|
-
_wallet: LearnCardRawWallet;
|
4703
|
+
export declare type AllLearnCardMethods = {
|
4685
4704
|
/** Wallet holder's did */
|
4686
4705
|
did: (type?: DidMethod) => string;
|
4687
4706
|
/** Wallet holder's ed25519 key pair */
|
@@ -4759,18 +4778,42 @@ export declare type LearnCardWallet = {
|
|
4759
4778
|
*/
|
4760
4779
|
getTestVp: (credential?: VC) => Promise<UnsignedVP>;
|
4761
4780
|
/**
|
4762
|
-
* Returns
|
4781
|
+
* Returns Ethereum public address
|
4763
4782
|
*/
|
4764
|
-
|
4783
|
+
getEthereumAddress: () => string;
|
4765
4784
|
/**
|
4766
|
-
*
|
4785
|
+
* Get the balance of an ERC20 token
|
4786
|
+
* Defaults to ETH if symbolOrAddress is not provided
|
4767
4787
|
*/
|
4768
|
-
|
4788
|
+
getBalance: (symbolOrAddress?: string) => Promise<string>;
|
4769
4789
|
/**
|
4770
|
-
*
|
4790
|
+
* Get the balance of an ERC20 token for a given address
|
4791
|
+
* Defaults to ETH if symbolOrAddress is not provided
|
4771
4792
|
*/
|
4772
|
-
|
4793
|
+
getBalanceForAddress: (walletAddress: string, symbolOrAddress?: string) => Promise<string>;
|
4794
|
+
/**
|
4795
|
+
* Transfer tokens to a given address
|
4796
|
+
*/
|
4797
|
+
transferTokens: (tokenSymbolOrAddress: string, amount: number, toAddress: string) => Promise<string>;
|
4798
|
+
/**
|
4799
|
+
* Get your current Ethereum network
|
4800
|
+
*/
|
4801
|
+
getCurrentNetwork: () => ethers.providers.Networkish;
|
4802
|
+
/**
|
4803
|
+
* Change your Ethereum network
|
4804
|
+
*/
|
4805
|
+
changeNetwork: (network: ethers.providers.Networkish) => void;
|
4806
|
+
/**
|
4807
|
+
* Add an infura project id to an existing wallet.
|
4808
|
+
* Really only useful for testing with the CLI right now...
|
4809
|
+
*/
|
4810
|
+
addInfuraProjectId: (infuraProjectIdToAdd: string) => void;
|
4773
4811
|
};
|
4812
|
+
export declare type LearnCard<Methods extends keyof AllLearnCardMethods = keyof AllLearnCardMethods, RawWallet extends Wallet<any, any> = LearnCardRawWallet> = {
|
4813
|
+
/** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
|
4814
|
+
_wallet: RawWallet;
|
4815
|
+
} & Pick<AllLearnCardMethods, Methods>;
|
4816
|
+
export declare type EmptyLearnCard = LearnCard<"verifyCredential" | "verifyPresentation", Wallet<"DIDKit" | "Expiration", DidkitPluginMethods & VerifyExtension>>;
|
4774
4817
|
export declare type CeramicIDXArgs = {
|
4775
4818
|
modelData: ModelAliases;
|
4776
4819
|
credentialAlias: string;
|
@@ -4783,9 +4826,17 @@ export declare type LearnCardConfig = {
|
|
4783
4826
|
defaultContents: any[];
|
4784
4827
|
ethereumConfig: EthereumConfig;
|
4785
4828
|
};
|
4829
|
+
export declare type EmptyWallet = InitFunction<undefined, "didkit", EmptyLearnCard>;
|
4830
|
+
export declare type WalletFromKey = InitFunction<{
|
4831
|
+
seed: string;
|
4832
|
+
}, keyof LearnCardConfig, LearnCard>;
|
4833
|
+
/** Generates an empty wallet with no key material */
|
4834
|
+
export declare const emptyWallet: ({ didkit }?: EmptyWallet["args"]) => Promise<EmptyWallet["returnValue"]>;
|
4786
4835
|
/** Generates a LearnCard Wallet from a 64 character seed string */
|
4787
|
-
export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, ethereumConfig, }?: Partial<LearnCardConfig>) => Promise<
|
4788
|
-
export
|
4836
|
+
export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, ethereumConfig, }?: Partial<LearnCardConfig>) => Promise<LearnCard>;
|
4837
|
+
export declare function initLearnCard(config?: EmptyWallet["args"]): Promise<EmptyWallet["returnValue"]>;
|
4838
|
+
export declare function initLearnCard(config: WalletFromKey["args"]): Promise<WalletFromKey["returnValue"]>;
|
4839
|
+
export * from "@wallet/init";
|
4789
4840
|
export { Wallet, Plugin } from "types/wallet";
|
4790
4841
|
|
4791
4842
|
export {};
|