@learncard/core 6.1.0 → 6.3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/core.cjs.development.js +3520 -186
- package/dist/core.cjs.development.js.map +3 -3
- package/dist/core.cjs.production.min.js +196 -120
- package/dist/core.cjs.production.min.js.map +3 -3
- package/dist/core.d.ts +293 -92
- package/dist/core.esm.js +3520 -186
- package/dist/core.esm.js.map +3 -3
- package/package.json +5 -2
package/dist/core.d.ts
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
import { StreamID } from '@ceramicnetwork/streamid';
|
6
6
|
import { ModelAliases } from '@glazed/types';
|
7
7
|
|
8
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
8
9
|
declare const UnsignedVCValidator: z.ZodObject<{
|
9
10
|
"@context": z.ZodArray<z.ZodString, "many">;
|
10
11
|
id: z.ZodOptional<z.ZodString>;
|
@@ -4661,69 +4662,70 @@ declare const IDXCredentialValidator: z.ZodObject<{
|
|
4661
4662
|
}>;
|
4662
4663
|
/** @group IDXPlugin */
|
4663
4664
|
export declare type IDXCredential = z.infer<typeof IDXCredentialValidator>;
|
4664
|
-
|
4665
|
-
|
4666
|
-
|
4667
|
-
|
4665
|
+
declare const JWKValidator: z.ZodObject<{
|
4666
|
+
kty: z.ZodString;
|
4667
|
+
crv: z.ZodString;
|
4668
|
+
x: z.ZodString;
|
4669
|
+
y: z.ZodOptional<z.ZodString>;
|
4670
|
+
d: z.ZodString;
|
4671
|
+
}, "strip", z.ZodTypeAny, {
|
4672
|
+
y?: string | undefined;
|
4668
4673
|
kty: string;
|
4669
4674
|
crv: string;
|
4670
4675
|
x: string;
|
4671
|
-
y?: string;
|
4672
4676
|
d: string;
|
4673
|
-
}
|
4677
|
+
}, {
|
4678
|
+
y?: string | undefined;
|
4679
|
+
kty: string;
|
4680
|
+
crv: string;
|
4681
|
+
x: string;
|
4682
|
+
d: string;
|
4683
|
+
}>;
|
4684
|
+
export declare type JWK = z.infer<typeof JWKValidator>;
|
4685
|
+
/** @group DIDKit Plugin */
|
4686
|
+
export declare type DidMethod = "key" | "tz" | "ethr" | `pkh:${"tz" | "tezos" | "sol" | "solana" | "eth" | "celo" | "poly" | "btc" | "doge" | "eip155" | "bip122"}` | `pkh:eip155:${string}` | `pkh:bip122:${string}`;
|
4674
4687
|
/** @group DIDKit Plugin */
|
4675
4688
|
export declare type ProofOptions = {
|
4676
|
-
|
4677
|
-
|
4689
|
+
type?: string;
|
4690
|
+
verificationMethod?: string;
|
4691
|
+
proofPurpose?: string;
|
4692
|
+
created?: string;
|
4693
|
+
challenge?: string;
|
4694
|
+
domain?: string;
|
4695
|
+
checks?: ("Proof" | "JWS" | "CredentialStatus")[];
|
4696
|
+
};
|
4697
|
+
/** @group DIDKit Plugin */
|
4698
|
+
export declare type InputMetadata = {
|
4699
|
+
accept?: string;
|
4700
|
+
versionId?: string;
|
4701
|
+
versionTime?: string;
|
4702
|
+
noCache?: boolean;
|
4678
4703
|
};
|
4679
4704
|
/** @group DIDKit Plugin */
|
4680
4705
|
export declare type DidkitPluginMethods = {
|
4681
|
-
generateEd25519KeyFromBytes: (bytes: Uint8Array) =>
|
4682
|
-
generateSecp256k1KeyFromBytes: (bytes: Uint8Array) =>
|
4683
|
-
keyToDid: (type: DidMethod, keypair:
|
4684
|
-
keyToVerificationMethod: (type: string, keypair:
|
4685
|
-
issueCredential: (credential: UnsignedVC, options: ProofOptions, keypair:
|
4686
|
-
verifyCredential: (credential: VC) => Promise<VerificationCheck>;
|
4687
|
-
issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair:
|
4688
|
-
verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
|
4706
|
+
generateEd25519KeyFromBytes: (bytes: Uint8Array) => JWK;
|
4707
|
+
generateSecp256k1KeyFromBytes: (bytes: Uint8Array) => JWK;
|
4708
|
+
keyToDid: (type: DidMethod, keypair: JWK) => string;
|
4709
|
+
keyToVerificationMethod: (type: string, keypair: JWK) => Promise<string>;
|
4710
|
+
issueCredential: (credential: UnsignedVC, options: ProofOptions, keypair: JWK) => Promise<VC>;
|
4711
|
+
verifyCredential: (credential: VC, options?: ProofOptions) => Promise<VerificationCheck>;
|
4712
|
+
issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair: JWK) => Promise<VP>;
|
4713
|
+
verifyPresentation: (presentation: VP, options?: ProofOptions) => Promise<VerificationCheck>;
|
4689
4714
|
contextLoader: (url: string) => Promise<Record<string, any>>;
|
4690
|
-
resolveDid: (did: string) => Promise<Record<string, any>>;
|
4715
|
+
resolveDid: (did: string, inputMetadata?: InputMetadata) => Promise<Record<string, any>>;
|
4691
4716
|
};
|
4692
4717
|
/** @group DidKey Plugin */
|
4693
4718
|
export declare type Algorithm = "ed25519" | "secp256k1";
|
4694
4719
|
/** @group DidKey Plugin */
|
4695
4720
|
export declare type DependentMethods<T extends string> = {
|
4696
|
-
generateEd25519KeyFromBytes: (bytes: Uint8Array) =>
|
4697
|
-
generateSecp256k1KeyFromBytes: (bytes: Uint8Array) =>
|
4698
|
-
keyToDid: (type: T, keypair:
|
4699
|
-
};
|
4700
|
-
/** @group DidKey Plugin */
|
4701
|
-
export declare type JWK = {
|
4702
|
-
id: string;
|
4703
|
-
type: string | string[];
|
4704
|
-
controller?: string;
|
4705
|
-
publicKeyJwk?: any;
|
4706
|
-
privateKeyJwk?: any;
|
4707
|
-
"@context": string[];
|
4708
|
-
name: string;
|
4709
|
-
image: string;
|
4710
|
-
description: string;
|
4711
|
-
tags: string[];
|
4712
|
-
value?: string;
|
4713
|
-
generatedFrom?: [
|
4714
|
-
string
|
4715
|
-
];
|
4721
|
+
generateEd25519KeyFromBytes: (bytes: Uint8Array) => JWK;
|
4722
|
+
generateSecp256k1KeyFromBytes: (bytes: Uint8Array) => JWK;
|
4723
|
+
keyToDid: (type: T, keypair: JWK) => string;
|
4716
4724
|
};
|
4717
4725
|
/** @group DidKey Plugin */
|
4718
4726
|
export declare type DidKeyPluginMethods<DidMethod extends string> = {
|
4719
4727
|
getSubjectDid: (type: DidMethod) => string;
|
4720
|
-
getSubjectKeypair: (type?: Algorithm) =>
|
4721
|
-
kty: string;
|
4722
|
-
crv: string;
|
4723
|
-
x: string;
|
4724
|
-
y?: string;
|
4725
|
-
d: string;
|
4726
|
-
};
|
4728
|
+
getSubjectKeypair: (type?: Algorithm) => JWK;
|
4727
4729
|
getKey: () => string;
|
4728
4730
|
};
|
4729
4731
|
/** @group Ethereum Plugin */
|
@@ -4802,26 +4804,61 @@ export declare const CredentialsListValidator: z.ZodObject<{
|
|
4802
4804
|
}>;
|
4803
4805
|
/** @group IDXPlugin */
|
4804
4806
|
export declare type CredentialsList = z.infer<typeof CredentialsListValidator>;
|
4807
|
+
export declare type Last<T extends any[]> = T extends [
|
4808
|
+
...any[],
|
4809
|
+
infer R
|
4810
|
+
] ? R : never;
|
4811
|
+
export declare type RemoveLast<T extends any[]> = T extends [
|
4812
|
+
...infer R,
|
4813
|
+
any
|
4814
|
+
] ? R : [
|
4815
|
+
];
|
4816
|
+
/** @group Utility Types */
|
4817
|
+
export declare type MergeObjects<Objects extends Record<string, any>[]> = undefined extends Objects[2] ? Omit<Objects[0], keyof Objects[1]> & Objects[1] : Omit<MergeObjects<RemoveLast<Objects>>, keyof Last<Objects>> & Last<Objects>;
|
4818
|
+
/** @group Universal Wallets */
|
4819
|
+
export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>, DependentMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
|
4820
|
+
name?: Name;
|
4821
|
+
pluginMethods: {
|
4822
|
+
[Key in keyof PublicMethods]: <T extends Wallet<any, PublicMethods & DependentMethods>>(wallet: T, ...args: Parameters<PublicMethods[Key]>) => ReturnType<PublicMethods[Key]>;
|
4823
|
+
};
|
4824
|
+
};
|
4825
|
+
/** @group Universal Wallets */
|
4826
|
+
export declare type PublicFieldsObj<PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
|
4827
|
+
pluginMethods: PluginMethods;
|
4828
|
+
};
|
4829
|
+
/** @group Universal Wallets */
|
4830
|
+
export declare type Wallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = PublicFieldsObj<PluginMethods> & {
|
4831
|
+
contents: any[];
|
4832
|
+
plugins: Plugin<PluginNames, Record<string, (...args: any[]) => any>>[];
|
4833
|
+
add: (content: any) => Promise<Wallet<PluginNames, PluginMethods>>;
|
4834
|
+
remove: (contentId: string) => Promise<Wallet<PluginNames, PluginMethods>>;
|
4835
|
+
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 : MergeObjects<[
|
4836
|
+
PluginMethods,
|
4837
|
+
Methods
|
4838
|
+
]>>>;
|
4839
|
+
};
|
4805
4840
|
/** @group VC Plugin */
|
4806
4841
|
export declare type VCPluginDependentMethods = {
|
4807
4842
|
getSubjectDid: (type: "key") => string;
|
4808
|
-
getSubjectKeypair: () =>
|
4809
|
-
keyToVerificationMethod: (type: string, keypair:
|
4810
|
-
issueCredential: (credential: UnsignedVC, options: ProofOptions, keypair:
|
4811
|
-
verifyCredential: (credential: VC) => Promise<VerificationCheck>;
|
4812
|
-
issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair:
|
4813
|
-
verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
|
4843
|
+
getSubjectKeypair: () => JWK;
|
4844
|
+
keyToVerificationMethod: (type: string, keypair: JWK) => Promise<string>;
|
4845
|
+
issueCredential: (credential: UnsignedVC, options: ProofOptions, keypair: JWK) => Promise<VC>;
|
4846
|
+
verifyCredential: (credential: VC, options?: ProofOptions) => Promise<VerificationCheck>;
|
4847
|
+
issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair: JWK) => Promise<VP>;
|
4848
|
+
verifyPresentation: (presentation: VP, options?: ProofOptions) => Promise<VerificationCheck>;
|
4814
4849
|
};
|
4815
4850
|
/** @group VC Plugin */
|
4816
|
-
export declare type VCPluginMethods =
|
4817
|
-
issueCredential: (credential: UnsignedVC) => Promise<VC>;
|
4818
|
-
verifyCredential: (credential: VC) => Promise<VerificationCheck>;
|
4819
|
-
issuePresentation: (credential: UnsignedVP) => Promise<VP>;
|
4820
|
-
verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
|
4851
|
+
export declare type VCPluginMethods = {
|
4852
|
+
issueCredential: (credential: UnsignedVC, signingOptions?: Partial<ProofOptions>) => Promise<VC>;
|
4853
|
+
verifyCredential: (credential: VC, options?: Partial<ProofOptions>) => Promise<VerificationCheck>;
|
4854
|
+
issuePresentation: (credential: UnsignedVP, signingOptions?: Partial<ProofOptions>) => Promise<VP>;
|
4855
|
+
verifyPresentation: (presentation: VP, options?: Partial<ProofOptions>) => Promise<VerificationCheck>;
|
4821
4856
|
getTestVc: (subject?: string) => UnsignedVC;
|
4822
4857
|
getTestVp: (credential?: VC) => Promise<UnsignedVP>;
|
4823
4858
|
};
|
4824
4859
|
/** @group VC Plugin */
|
4860
|
+
export declare type VCImplicitWallet = Wallet<string, VCPluginMethods & VCPluginDependentMethods>;
|
4861
|
+
/** @group VC Plugin */
|
4825
4862
|
export declare type VerifyExtension = {
|
4826
4863
|
verifyCredential: (credential: VC) => Promise<VerificationCheck>;
|
4827
4864
|
};
|
@@ -4834,9 +4871,95 @@ export declare type VpqrPluginMethods = {
|
|
4834
4871
|
export declare type VpqrPluginDependentMethods = {
|
4835
4872
|
contextLoader: (url: string) => Promise<Record<string, any>>;
|
4836
4873
|
};
|
4837
|
-
|
4838
|
-
export declare type
|
4839
|
-
|
4874
|
+
/** @group CHAPI Plugin */
|
4875
|
+
export declare type WebCredential = {
|
4876
|
+
new (dataType: string, data: VP, options?: {
|
4877
|
+
recommendedHandlerOrigins: string[];
|
4878
|
+
}): WebCredential;
|
4879
|
+
type: string;
|
4880
|
+
dataType: string;
|
4881
|
+
data: VP;
|
4882
|
+
options: {
|
4883
|
+
recommendedHandlerOrigins: string[];
|
4884
|
+
};
|
4885
|
+
};
|
4886
|
+
/** @group CHAPI Plugin */
|
4887
|
+
export declare type CredentialRequestEvent = {
|
4888
|
+
new (args: {
|
4889
|
+
credentialHandler: any;
|
4890
|
+
credentialRequestOrigin: string;
|
4891
|
+
credentialRequestOptions: any;
|
4892
|
+
hintKey: string;
|
4893
|
+
}): CredentialRequestEvent;
|
4894
|
+
type: string;
|
4895
|
+
_credentialHandler: any;
|
4896
|
+
credentialRequestOrigin: string;
|
4897
|
+
credentialRequestOptions: any;
|
4898
|
+
hintKey: string;
|
4899
|
+
openWindow: (url: string) => Promise<any>;
|
4900
|
+
respondWith: (handlerResponse: Promise<null | {
|
4901
|
+
dataType: string;
|
4902
|
+
data: any;
|
4903
|
+
}>) => void;
|
4904
|
+
};
|
4905
|
+
/** @group CHAPI Plugin */
|
4906
|
+
export declare type CredentialStoreEvent = {
|
4907
|
+
new (args: {
|
4908
|
+
credentialHandler: any;
|
4909
|
+
credentialRequestOrigin: string;
|
4910
|
+
credential: WebCredential;
|
4911
|
+
hintKey: string;
|
4912
|
+
}): CredentialStoreEvent;
|
4913
|
+
type: string;
|
4914
|
+
_credentialHandler: any;
|
4915
|
+
credentialRequestOrigin: string;
|
4916
|
+
credential: WebCredential;
|
4917
|
+
hintKey: string;
|
4918
|
+
openWindow: (url: string) => Promise<any>;
|
4919
|
+
respondWith: (handlerResponse: Promise<null | {
|
4920
|
+
dataType: string;
|
4921
|
+
data: any;
|
4922
|
+
}>) => void;
|
4923
|
+
};
|
4924
|
+
/** @group CHAPI Plugin */
|
4925
|
+
export declare type HandlerResponse = {
|
4926
|
+
type: "redirect";
|
4927
|
+
url: string;
|
4928
|
+
} | {
|
4929
|
+
type: "response";
|
4930
|
+
dataType: string;
|
4931
|
+
data: any;
|
4932
|
+
};
|
4933
|
+
/** @group CHAPI Plugin */
|
4934
|
+
export declare type CHAPIPluginDependentMethods = {
|
4935
|
+
issueCredential: (credential: UnsignedVC, signingOptions?: Partial<ProofOptions>) => Promise<VC>;
|
4936
|
+
issuePresentation: (credential: UnsignedVP, signingOptions?: Partial<ProofOptions>) => Promise<VP>;
|
4937
|
+
verifyPresentation: (presentation: VP, options?: Partial<ProofOptions>) => Promise<VerificationCheck>;
|
4938
|
+
getTestVp: (credential?: VC) => Promise<UnsignedVP>;
|
4939
|
+
};
|
4940
|
+
/** @group CHAPI Plugin */
|
4941
|
+
export declare type CHAPIPluginMethods = {
|
4942
|
+
installChapiHandler: () => Promise<void>;
|
4943
|
+
activateChapiHandler: (args: {
|
4944
|
+
mediatorOrigin?: string;
|
4945
|
+
get?: (event: CredentialRequestEvent) => Promise<HandlerResponse>;
|
4946
|
+
store?: (event: CredentialStoreEvent) => Promise<HandlerResponse>;
|
4947
|
+
}) => Promise<void>;
|
4948
|
+
receiveChapiEvent: () => Promise<CredentialRequestEvent | CredentialStoreEvent>;
|
4949
|
+
storeCredentialViaChapiDidAuth: (credential: UnsignedVC) => Promise<{
|
4950
|
+
success: true;
|
4951
|
+
} | {
|
4952
|
+
success: false;
|
4953
|
+
reason: "did not auth" | "auth failed verification" | "did not store";
|
4954
|
+
}>;
|
4955
|
+
storePresentationViaChapi: (presentation: UnsignedVP | VP) => Promise<Credential | undefined>;
|
4956
|
+
};
|
4957
|
+
/**
|
4958
|
+
* @group Plugins
|
4959
|
+
*/
|
4960
|
+
export declare const getCHAPIPlugin: () => Promise<Plugin<"CHAPI", CHAPIPluginMethods, CHAPIPluginDependentMethods>>;
|
4961
|
+
export declare type InitFunction<Args extends Record<string, any> = Record<string, any>, Config extends keyof LearnCardConfig = keyof LearnCardConfig, ReturnValue extends LearnCard<any, any> = LearnCard<any, any>> = {
|
4962
|
+
args: Args & Partial<Pick<LearnCardConfig, Config>>;
|
4840
4963
|
returnValue: ReturnValue;
|
4841
4964
|
};
|
4842
4965
|
export declare type GenericInitFunction<InitFunctions extends InitFunction<any, any, any>[]> = {
|
@@ -4848,25 +4971,6 @@ export declare type DiscriminatedUnionize<T extends object = {}, K extends strin
|
|
4848
4971
|
[Key2 in K]: Key;
|
4849
4972
|
} & T[Key];
|
4850
4973
|
}[keyof T];
|
4851
|
-
/** @group Universal Wallets */
|
4852
|
-
export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
|
4853
|
-
name?: Name;
|
4854
|
-
pluginMethods: {
|
4855
|
-
[Key in keyof PublicMethods]: <T extends Wallet<any, PublicMethods>>(wallet: T, ...args: Parameters<PublicMethods[Key]>) => ReturnType<PublicMethods[Key]>;
|
4856
|
-
};
|
4857
|
-
};
|
4858
|
-
/** @group Universal Wallets */
|
4859
|
-
export declare type PublicFieldsObj<PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
|
4860
|
-
pluginMethods: PluginMethods;
|
4861
|
-
};
|
4862
|
-
/** @group Universal Wallets */
|
4863
|
-
export declare type Wallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = PublicFieldsObj<PluginMethods> & {
|
4864
|
-
contents: any[];
|
4865
|
-
plugins: Plugin<PluginNames, Record<string, (...args: any[]) => any>>[];
|
4866
|
-
add: (content: any) => Promise<Wallet<PluginNames, PluginMethods>>;
|
4867
|
-
remove: (contentId: string) => Promise<Wallet<PluginNames, PluginMethods>>;
|
4868
|
-
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>>;
|
4869
|
-
};
|
4870
4974
|
/** @group VC Templates Plugin */
|
4871
4975
|
export declare type VcTemplates = {
|
4872
4976
|
basic: {
|
@@ -4888,12 +4992,27 @@ export declare type VcTemplates = {
|
|
4888
4992
|
export declare type NewCredentialFunction = (args?: DiscriminatedUnionize<VcTemplates>) => UnsignedVC;
|
4889
4993
|
/** @group VC Templates Plugin */
|
4890
4994
|
export declare type VCTemplatePluginMethods = {
|
4891
|
-
getSubjectDid?: (type: "key") => string;
|
4892
4995
|
newCredential: NewCredentialFunction;
|
4893
4996
|
newPresentation: (credential: VC, args?: {
|
4894
4997
|
did?: string;
|
4895
4998
|
}) => Promise<UnsignedVP>;
|
4896
4999
|
};
|
5000
|
+
/** @group VC-API Plugin */
|
5001
|
+
export declare type APIOptions = {
|
5002
|
+
created?: string;
|
5003
|
+
challenge?: string;
|
5004
|
+
domain?: string;
|
5005
|
+
};
|
5006
|
+
/** @group VC-API Plugin */
|
5007
|
+
export declare type VCAPIPluginMethods = {
|
5008
|
+
getSubjectDid: (type: string) => string;
|
5009
|
+
issueCredential: (credential: UnsignedVC, signingOptions?: APIOptions) => Promise<VC>;
|
5010
|
+
verifyCredential: (credential: VC, options?: Omit<APIOptions, "created">) => Promise<VerificationCheck>;
|
5011
|
+
issuePresentation: (presentation: UnsignedVP, signingOptions?: APIOptions) => Promise<VP>;
|
5012
|
+
verifyPresentation: (presentation: VP, options?: Omit<APIOptions, "created">) => Promise<VerificationCheck>;
|
5013
|
+
getTestVc: (subject?: string) => UnsignedVC;
|
5014
|
+
getTestVp: (credential?: VC) => Promise<UnsignedVP>;
|
5015
|
+
};
|
4897
5016
|
/**
|
4898
5017
|
* Wallet holder's did
|
4899
5018
|
*
|
@@ -4931,7 +5050,7 @@ export declare type NewPresentation = (credential: VC, args?: {
|
|
4931
5050
|
*
|
4932
5051
|
* @group LearnCard Methods
|
4933
5052
|
*/
|
4934
|
-
export declare type IssueCredential = (credential: UnsignedVC) => Promise<VC>;
|
5053
|
+
export declare type IssueCredential = (credential: UnsignedVC, signingOptions?: Partial<ProofOptions>) => Promise<VC>;
|
4935
5054
|
/**
|
4936
5055
|
* Verifies a signed Verifiable Credential
|
4937
5056
|
*
|
@@ -4939,13 +5058,13 @@ export declare type IssueCredential = (credential: UnsignedVC) => Promise<VC>;
|
|
4939
5058
|
*
|
4940
5059
|
* @group LearnCard Methods
|
4941
5060
|
*/
|
4942
|
-
export declare type VerifyCredential = (credential: VC) => Promise<VerificationItem[]>;
|
5061
|
+
export declare type VerifyCredential = (credential: VC, options?: Partial<ProofOptions>) => Promise<VerificationItem[]>;
|
4943
5062
|
/**
|
4944
5063
|
* Signs an unsigned Verifiable Presentation, returning the signed VP
|
4945
5064
|
*
|
4946
5065
|
* @group LearnCard Methods
|
4947
5066
|
*/
|
4948
|
-
export declare type IssuePresentation = (presentation: UnsignedVP) => Promise<VP>;
|
5067
|
+
export declare type IssuePresentation = (presentation: UnsignedVP, signingOptions?: Partial<ProofOptions>) => Promise<VP>;
|
4949
5068
|
/**
|
4950
5069
|
* Verifies a signed Verifiable Presentation
|
4951
5070
|
*
|
@@ -4953,7 +5072,7 @@ export declare type IssuePresentation = (presentation: UnsignedVP) => Promise<VP
|
|
4953
5072
|
*
|
4954
5073
|
* @group LearnCard Methods
|
4955
5074
|
*/
|
4956
|
-
export declare type VerifyPresentation = (presentation: VP) => Promise<VerificationCheck>;
|
5075
|
+
export declare type VerifyPresentation = (presentation: VP, options?: Partial<ProofOptions>) => Promise<VerificationCheck>;
|
4957
5076
|
/**
|
4958
5077
|
* Returns the credential marked with `title` from IDX
|
4959
5078
|
*
|
@@ -5007,7 +5126,7 @@ export declare type RemoveCredential = (title: string) => Promise<void>;
|
|
5007
5126
|
*
|
5008
5127
|
* @group LearnCard Methods
|
5009
5128
|
*/
|
5010
|
-
export declare type ResolveDid = (did: string) => Promise<Record<string, any>>;
|
5129
|
+
export declare type ResolveDid = (did: string, inputMetadata?: InputMetadata) => Promise<Record<string, any>>;
|
5011
5130
|
/**
|
5012
5131
|
* Resolves a stream ID, returning its contents
|
5013
5132
|
*
|
@@ -5091,6 +5210,45 @@ export declare type VpFromQrCode = (text: string) => Promise<VP>;
|
|
5091
5210
|
* @group LearnCard Methods
|
5092
5211
|
*/
|
5093
5212
|
export declare type VpToQrCode = (vp: VP) => Promise<string>;
|
5213
|
+
/**
|
5214
|
+
* Sets up CHAPI
|
5215
|
+
*
|
5216
|
+
* @group LearnCard Methods
|
5217
|
+
*/
|
5218
|
+
export declare type InstallChapiHandler = () => Promise<void>;
|
5219
|
+
/**
|
5220
|
+
* Activates CHAPI
|
5221
|
+
*
|
5222
|
+
* @group LearnCard Methods
|
5223
|
+
*/
|
5224
|
+
export declare type ActivateChapiHandler = (args: {
|
5225
|
+
mediatorOrigin?: string;
|
5226
|
+
get?: (event: CredentialRequestEvent) => Promise<HandlerResponse>;
|
5227
|
+
store?: (event: CredentialStoreEvent) => Promise<HandlerResponse>;
|
5228
|
+
}) => Promise<void>;
|
5229
|
+
/**
|
5230
|
+
* Receives a CHAPI Event
|
5231
|
+
*
|
5232
|
+
* @group LearnCard Methods
|
5233
|
+
*/
|
5234
|
+
export declare type ReceiveChapiEvent = () => Promise<CredentialRequestEvent | CredentialStoreEvent>;
|
5235
|
+
/**
|
5236
|
+
* Stores a VP via CHAPI
|
5237
|
+
*
|
5238
|
+
* @group LearnCard Methods
|
5239
|
+
*/
|
5240
|
+
export declare type StorePresentationViaChapi = (presentation: VP) => Promise<Credential | undefined>;
|
5241
|
+
/**
|
5242
|
+
* Stores a Credential via CHAPI using DIDAuth
|
5243
|
+
*
|
5244
|
+
* @group LearnCard Methods
|
5245
|
+
*/
|
5246
|
+
export declare type StoreCredentialViaChapiDidAuth = (credential: UnsignedVC) => Promise<{
|
5247
|
+
success: true;
|
5248
|
+
} | {
|
5249
|
+
success: false;
|
5250
|
+
reason: "did not auth" | "auth failed verification" | "did not store";
|
5251
|
+
}>;
|
5094
5252
|
/**
|
5095
5253
|
* @group LearnCard Methods
|
5096
5254
|
*/
|
@@ -5122,9 +5280,22 @@ export declare type AllLearnCardMethods = {
|
|
5122
5280
|
addInfuraProjectId: AddInfuraProjectId;
|
5123
5281
|
vpFromQrCode: VpFromQrCode;
|
5124
5282
|
vpToQrCode: VpToQrCode;
|
5283
|
+
installChapiHandler: InstallChapiHandler;
|
5284
|
+
activateChapiHandler: ActivateChapiHandler;
|
5285
|
+
receiveChapiEvent: ReceiveChapiEvent;
|
5286
|
+
storePresentationViaChapi: StorePresentationViaChapi;
|
5287
|
+
storeCredentialViaChapiDidAuth: StoreCredentialViaChapiDidAuth;
|
5125
5288
|
};
|
5126
5289
|
/** @group Universal Wallets */
|
5127
|
-
export declare type LearnCardRawWallet = Wallet<"DIDKit" | "DID Key" | "VC" | "VC Templates" | "IDX" | "Expiration" | "Ethereum" | "Vpqr",
|
5290
|
+
export declare type LearnCardRawWallet = Wallet<"DIDKit" | "DID Key" | "VC" | "VC Templates" | "IDX" | "Expiration" | "Ethereum" | "Vpqr" | "CHAPI", MergeObjects<[
|
5291
|
+
DidKeyPluginMethods<DidMethod>,
|
5292
|
+
VCPluginMethods,
|
5293
|
+
VCTemplatePluginMethods,
|
5294
|
+
IDXPluginMethods,
|
5295
|
+
EthereumPluginMethods,
|
5296
|
+
VpqrPluginMethods,
|
5297
|
+
CHAPIPluginMethods
|
5298
|
+
]>>;
|
5128
5299
|
/**
|
5129
5300
|
* @group LearnCard
|
5130
5301
|
*/
|
@@ -5135,7 +5306,21 @@ export declare type LearnCard<Methods extends keyof AllLearnCardMethods = keyof
|
|
5135
5306
|
/**
|
5136
5307
|
* @group LearnCard
|
5137
5308
|
*/
|
5138
|
-
export declare type EmptyLearnCard = LearnCard<"newCredential" | "newPresentation" | "verifyCredential" | "verifyPresentation" | "resolveDid", Wallet<"DIDKit" | "Expiration" | "VC Templates"
|
5309
|
+
export declare type EmptyLearnCard = LearnCard<"newCredential" | "newPresentation" | "verifyCredential" | "verifyPresentation" | "resolveDid" | "installChapiHandler" | "activateChapiHandler" | "receiveChapiEvent" | "storePresentationViaChapi" | "storeCredentialViaChapiDidAuth", Wallet<"DIDKit" | "Expiration" | "VC Templates" | "CHAPI", MergeObjects<[
|
5310
|
+
DidkitPluginMethods,
|
5311
|
+
VerifyExtension,
|
5312
|
+
VCTemplatePluginMethods,
|
5313
|
+
CHAPIPluginMethods
|
5314
|
+
]>>>;
|
5315
|
+
/**
|
5316
|
+
* @group LearnCard
|
5317
|
+
*/
|
5318
|
+
export declare type VCAPILearnCard = LearnCard<"did" | "newCredential" | "newPresentation" | "issueCredential" | "verifyCredential" | "issuePresentation" | "verifyPresentation" | "getTestVc" | "getTestVp" | "installChapiHandler" | "activateChapiHandler" | "receiveChapiEvent" | "storePresentationViaChapi" | "storeCredentialViaChapiDidAuth", Wallet<"VC API" | "Expiration" | "VC Templates" | "CHAPI", MergeObjects<[
|
5319
|
+
VCAPIPluginMethods,
|
5320
|
+
VerifyExtension,
|
5321
|
+
VCTemplatePluginMethods,
|
5322
|
+
CHAPIPluginMethods
|
5323
|
+
]>>>;
|
5139
5324
|
/** @group LearnCard */
|
5140
5325
|
export declare type LearnCardConfig = {
|
5141
5326
|
ceramicIdx: CeramicIDXArgs;
|
@@ -5144,15 +5329,21 @@ export declare type LearnCardConfig = {
|
|
5144
5329
|
ethereumConfig: EthereumConfig;
|
5145
5330
|
};
|
5146
5331
|
/** @group Init Functions */
|
5147
|
-
export declare type EmptyWallet = InitFunction<
|
5332
|
+
export declare type EmptyWallet = InitFunction<{}, "didkit", EmptyLearnCard>;
|
5148
5333
|
/** @group Init Functions */
|
5149
5334
|
export declare type WalletFromKey = InitFunction<{
|
5150
5335
|
seed: string;
|
5151
5336
|
}, keyof LearnCardConfig, LearnCard>;
|
5152
5337
|
/** @group Init Functions */
|
5338
|
+
export declare type WalletFromVcApi = InitFunction<{
|
5339
|
+
vcApi: true | string;
|
5340
|
+
did?: string;
|
5341
|
+
}, "defaultContents", VCAPILearnCard>;
|
5342
|
+
/** @group Init Functions */
|
5153
5343
|
export declare type InitLearnCard = GenericInitFunction<[
|
5154
5344
|
EmptyWallet,
|
5155
|
-
WalletFromKey
|
5345
|
+
WalletFromKey,
|
5346
|
+
WalletFromVcApi
|
5156
5347
|
]>;
|
5157
5348
|
/**
|
5158
5349
|
* Generates an empty wallet with no key material
|
@@ -5166,6 +5357,12 @@ export declare const emptyWallet: ({ didkit }?: EmptyWallet["args"]) => Promise<
|
|
5166
5357
|
* @group Init Functions
|
5167
5358
|
*/
|
5168
5359
|
export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, ethereumConfig, }?: Partial<LearnCardConfig>) => Promise<LearnCard>;
|
5360
|
+
/**
|
5361
|
+
* Generates a LearnCard Wallet from a 64 character seed string
|
5362
|
+
*
|
5363
|
+
* @group Init Functions
|
5364
|
+
*/
|
5365
|
+
export declare const walletFromApiUrl: (url: string, did?: string, { defaultContents }?: Partial<LearnCardConfig>) => Promise<WalletFromVcApi["returnValue"]>;
|
5169
5366
|
/**
|
5170
5367
|
* Generates an Empty Wallet
|
5171
5368
|
*
|
@@ -5178,8 +5375,12 @@ export declare function initLearnCard(config?: EmptyWallet["args"]): Promise<Emp
|
|
5178
5375
|
* @group Init Functions
|
5179
5376
|
*/
|
5180
5377
|
export declare function initLearnCard(config: WalletFromKey["args"]): Promise<WalletFromKey["returnValue"]>;
|
5181
|
-
|
5182
|
-
|
5378
|
+
/**
|
5379
|
+
* Generates a wallet that can sign VCs/VPs from a VC API
|
5380
|
+
*
|
5381
|
+
* @group Init Functions
|
5382
|
+
*/
|
5383
|
+
export declare function initLearnCard(config: WalletFromVcApi["args"]): Promise<WalletFromVcApi["returnValue"]>;
|
5183
5384
|
/** @group Universal Wallets */
|
5184
5385
|
export declare const generateWallet: <PluginNames extends string, PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>>(contents?: any[], _wallet?: Partial<Wallet<any, PluginMethods>>) => Promise<Wallet<PluginNames, PluginMethods>>;
|
5185
5386
|
/**
|
@@ -5191,11 +5392,11 @@ export declare const getDidKitPlugin: (input?: InitInput | Promise<InitInput>) =
|
|
5191
5392
|
*
|
5192
5393
|
* @group Plugins
|
5193
5394
|
*/
|
5194
|
-
export declare const getDidKeyPlugin: <DidMethod extends string>(wallet: Wallet<string, DependentMethods<DidMethod>>, key: string) => Promise<Plugin<"DID Key", DidKeyPluginMethods<DidMethod>>>;
|
5395
|
+
export declare const getDidKeyPlugin: <DidMethod extends string>(wallet: Wallet<string, DependentMethods<DidMethod>>, key: string) => Promise<Plugin<"DID Key", DidKeyPluginMethods<DidMethod>, Record<never, never>>>;
|
5195
5396
|
/**
|
5196
5397
|
* @group Plugins
|
5197
5398
|
*/
|
5198
|
-
export declare const getVCPlugin: (wallet: Wallet<string, VCPluginDependentMethods>) => Plugin<"VC", VCPluginMethods>;
|
5399
|
+
export declare const getVCPlugin: (wallet: Wallet<string, VCPluginDependentMethods>) => Plugin<"VC", VCPluginMethods, VCPluginDependentMethods>;
|
5199
5400
|
/**
|
5200
5401
|
* @group Plugins
|
5201
5402
|
*/
|
@@ -5211,7 +5412,7 @@ export declare const ExpirationPlugin: (wallet: Wallet<any, VerifyExtension>) =>
|
|
5211
5412
|
*/
|
5212
5413
|
export declare const getEthereumPlugin: (initWallet: Wallet<string, {
|
5213
5414
|
getSubjectDid: (type: DidMethod) => string;
|
5214
|
-
getSubjectKeypair: (type?: Algorithm) =>
|
5415
|
+
getSubjectKeypair: (type?: Algorithm) => JWK;
|
5215
5416
|
}>, config: EthereumConfig) => Plugin<"Ethereum", EthereumPluginMethods>;
|
5216
5417
|
/**
|
5217
5418
|
* @group Plugins
|