@learncard/core 8.4.0 → 8.4.1

Sign up to get free protection for your applications and to get access to all the features.
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;
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(await readContentFromCeramic(streamId));
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;
@@ -67772,7 +67774,9 @@ var getIDXPlugin = /* @__PURE__ */ __name(async (learnCard, { modelData, credent
67772
67774
  getVerifiableCredentialFromIdx: async (_learnCard, id) => {
67773
67775
  const credentialList = await getCredentialsListFromIdx();
67774
67776
  const credential = credentialList?.credentials?.find((cred) => cred?.id === id);
67775
- return credential?.uri ? _learnCard.read.get(credential.uri) : void 0;
67777
+ const result = _learnCard.read.get(credential?.uri);
67778
+ const validationResult = await VCValidator.safeParseAsync(result);
67779
+ return validationResult.success ? validationResult.data : void 0;
67776
67780
  },
67777
67781
  getVerifiableCredentialsFromIdx: async (_learnCard) => {
67778
67782
  const credentialList = await getCredentialsListFromIdx();