@learncard/core 8.3.1 → 8.4.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/core.cjs.development.js +13 -5
- package/dist/core.cjs.development.js.map +2 -2
- package/dist/core.cjs.production.min.js +70 -70
- package/dist/core.cjs.production.min.js.map +3 -3
- package/dist/core.d.ts +12 -6
- package/dist/core.esm.js +13 -5
- package/dist/core.esm.js.map +2 -2
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
@@ -4755,7 +4755,7 @@ export declare type GetPlaneProviders<Plugins extends Plugin[], Plane extends Co
|
|
4755
4755
|
}>;
|
4756
4756
|
}[number];
|
4757
4757
|
export declare type ReadPlane = {
|
4758
|
-
get: (uri?: string, options?: PlaneOptions) => Promise<VC | undefined>;
|
4758
|
+
get: (uri?: string, options?: PlaneOptions) => Promise<VC | VP | undefined>;
|
4759
4759
|
};
|
4760
4760
|
export declare type PluginReadPlane = ReadPlane;
|
4761
4761
|
export declare type LearnCardReadPlane<Plugins extends Plugin[]> = ReadPlane & {
|
@@ -4765,9 +4765,9 @@ export declare type EncryptionParams = {
|
|
4765
4765
|
recipients: string[];
|
4766
4766
|
};
|
4767
4767
|
export declare type StorePlane = {
|
4768
|
-
upload: (vc: VC, options?: PlaneOptions) => Promise<string>;
|
4769
|
-
uploadMany?: (vcs: VC[], options?: PlaneOptions) => Promise<string[]>;
|
4770
|
-
uploadEncrypted?: (vc: VC, params?: EncryptionParams, options?: PlaneOptions) => Promise<string>;
|
4768
|
+
upload: (vc: VC | VP, options?: PlaneOptions) => Promise<string>;
|
4769
|
+
uploadMany?: (vcs: (VC | VP)[], options?: PlaneOptions) => Promise<string[]>;
|
4770
|
+
uploadEncrypted?: (vc: VC | VP, params?: EncryptionParams, options?: PlaneOptions) => Promise<string>;
|
4771
4771
|
};
|
4772
4772
|
export declare type PluginStorePlane = StorePlane;
|
4773
4773
|
export declare type LearnCardStorePlane<Plugins extends Plugin[]> = Record<FilterForPlane<Plugins, "store">, StorePlane> & {
|
@@ -4790,8 +4790,8 @@ export declare type CachePlane = {
|
|
4790
4790
|
getIndex: <Metadata extends Record<string, any> = Record<never, never>>(name: string, query: Record<string, any>) => Promise<CredentialRecord<Metadata>[] | undefined>;
|
4791
4791
|
setIndex: <Metadata extends Record<string, any> = Record<never, never>>(name: string, query: Record<string, any>, value: CredentialRecord<Metadata>[]) => Promise<boolean>;
|
4792
4792
|
flushIndex: () => Promise<boolean>;
|
4793
|
-
getVc: (uri: string) => Promise<VC | undefined>;
|
4794
|
-
setVc: (uri: string, value: VC | undefined) => Promise<boolean>;
|
4793
|
+
getVc: (uri: string) => Promise<VC | VP | undefined>;
|
4794
|
+
setVc: (uri: string, value: VC | VP | undefined) => Promise<boolean>;
|
4795
4795
|
flushVc: () => Promise<boolean>;
|
4796
4796
|
};
|
4797
4797
|
export declare type PluginCachePlane = CachePlane;
|
@@ -5060,6 +5060,10 @@ export declare type CeramicPluginDependentMethods<URI extends string = ""> = {
|
|
5060
5060
|
/** @group CeramicPlugin */
|
5061
5061
|
export declare type CeramicPlugin = Plugin<"Ceramic", "read" | "store", CeramicPluginMethods>;
|
5062
5062
|
/** @group IDXPlugin */
|
5063
|
+
export declare type IDXIndexObject<IDXMetadata extends Record<string, any>, Metadata extends Record<string, any>> = {
|
5064
|
+
credentials: CredentialRecord<Metadata>[];
|
5065
|
+
} & IDXMetadata;
|
5066
|
+
/** @group IDXPlugin */
|
5063
5067
|
export declare type IDXArgs = {
|
5064
5068
|
modelData: ModelAliases;
|
5065
5069
|
credentialAlias: string;
|
@@ -5072,6 +5076,8 @@ export declare type IDXPluginMethods = {
|
|
5072
5076
|
addVerifiableCredentialInIdx: <Metadata extends Record<string, any> = Record<never, never>>(cred: CredentialRecord<Metadata>) => Promise<string>;
|
5073
5077
|
removeVerifiableCredentialInIdx: (title: string) => Promise<StreamID>;
|
5074
5078
|
removeAllVerifiableCredentialsInIdx: () => Promise<StreamID>;
|
5079
|
+
getIDXIndex: <IDXMetadata extends Record<string, any>, Metadata extends Record<string, any>>() => Promise<IDXIndexObject<IDXMetadata, Metadata> | null>;
|
5080
|
+
setIDXIndex: <IDXMetadata extends Record<string, any>, Metadata extends Record<string, any>>(index: IDXIndexObject<IDXMetadata, Metadata>) => Promise<StreamID>;
|
5075
5081
|
};
|
5076
5082
|
/** @group IDXPlugin */
|
5077
5083
|
export declare type IDXPluginDependentMethods<URI extends string = ""> = {
|
package/dist/core.esm.js
CHANGED
@@ -66924,7 +66924,7 @@ var getCeramicPlugin = /* @__PURE__ */ __name(async (learnCard, { ceramicEndpoin
|
|
66924
66924
|
return content;
|
66925
66925
|
}, "readContentFromCeramic");
|
66926
66926
|
const uploadCredential = /* @__PURE__ */ __name(async (vc, encryption) => {
|
66927
|
-
await VCValidator.parseAsync(vc);
|
66927
|
+
await VCValidator.or(VPValidator).parseAsync(vc);
|
66928
66928
|
return streamIdToCeramicURI(await publishContentToCeramic(vc, {}, {}, encryption));
|
66929
66929
|
}, "uploadCredential");
|
66930
66930
|
const resolveCredential = /* @__PURE__ */ __name(async (uri = "") => {
|
@@ -66967,7 +66967,9 @@ var getCeramicPlugin = /* @__PURE__ */ __name(async (learnCard, { ceramicEndpoin
|
|
66967
66967
|
return void 0;
|
66968
66968
|
const streamId = verificationResult.data.split(":")[2];
|
66969
66969
|
try {
|
66970
|
-
return await VCValidator.parseAsync(
|
66970
|
+
return await VCValidator.or(VPValidator).parseAsync(
|
66971
|
+
await readContentFromCeramic(streamId)
|
66972
|
+
);
|
66971
66973
|
} catch (e2) {
|
66972
66974
|
_learnCard.debug?.(e2);
|
66973
66975
|
return void 0;
|
@@ -67623,7 +67625,9 @@ var DIDDataStore = class {
|
|
67623
67625
|
__name(DIDDataStore, "DIDDataStore");
|
67624
67626
|
|
67625
67627
|
// src/wallet/plugins/idx/types.ts
|
67626
|
-
var CredentialsListValidator = mod.object({
|
67628
|
+
var CredentialsListValidator = mod.object({
|
67629
|
+
credentials: CredentialRecordValidator.array()
|
67630
|
+
});
|
67627
67631
|
var BackwardsCompatIDXCredentialValidator = mod.object({ id: mod.string(), title: mod.string(), storageType: mod.literal("ceramic").optional() }).catchall(mod.any());
|
67628
67632
|
var BackwardsCompatCredentialsListValidator = mod.object({
|
67629
67633
|
credentials: CredentialRecordValidator.or(BackwardsCompatIDXCredentialValidator).array()
|
@@ -67770,7 +67774,9 @@ var getIDXPlugin = /* @__PURE__ */ __name(async (learnCard, { modelData, credent
|
|
67770
67774
|
getVerifiableCredentialFromIdx: async (_learnCard, id) => {
|
67771
67775
|
const credentialList = await getCredentialsListFromIdx();
|
67772
67776
|
const credential = credentialList?.credentials?.find((cred) => cred?.id === id);
|
67773
|
-
|
67777
|
+
const result = _learnCard.read.get(credential?.uri);
|
67778
|
+
const validationResult = await VCValidator.safeParseAsync(result);
|
67779
|
+
return validationResult.success ? validationResult.data : void 0;
|
67774
67780
|
},
|
67775
67781
|
getVerifiableCredentialsFromIdx: async (_learnCard) => {
|
67776
67782
|
const credentialList = await getCredentialsListFromIdx();
|
@@ -67801,7 +67807,9 @@ var getIDXPlugin = /* @__PURE__ */ __name(async (learnCard, { modelData, credent
|
|
67801
67807
|
},
|
67802
67808
|
removeAllVerifiableCredentialsInIdx: async () => {
|
67803
67809
|
return removeAllCredentialsFromIdx();
|
67804
|
-
}
|
67810
|
+
},
|
67811
|
+
getIDXIndex: async () => dataStore.get(credentialAlias),
|
67812
|
+
setIDXIndex: async (_learnCard, index) => dataStore.set(credentialAlias, index)
|
67805
67813
|
}
|
67806
67814
|
};
|
67807
67815
|
}, "getIDXPlugin");
|