@learncard/core 5.0.0 → 5.1.1

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/dist/core.d.ts CHANGED
@@ -4590,6 +4590,22 @@ declare const VerificationItemValidator: z.ZodObject<{
4590
4590
  check: string;
4591
4591
  }>;
4592
4592
  export declare type VerificationItem = z.infer<typeof VerificationItemValidator>;
4593
+ declare const IDXCredentialValidator: z.ZodObject<{
4594
+ id: z.ZodString;
4595
+ title: z.ZodString;
4596
+ storageType: z.ZodOptional<z.ZodEnum<[
4597
+ "ceramic"
4598
+ ]>>;
4599
+ }, "strip", z.ZodTypeAny, {
4600
+ storageType?: "ceramic" | undefined;
4601
+ id: string;
4602
+ title: string;
4603
+ }, {
4604
+ storageType?: "ceramic" | undefined;
4605
+ id: string;
4606
+ title: string;
4607
+ }>;
4608
+ export declare type IDXCredential = z.infer<typeof IDXCredentialValidator>;
4593
4609
  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}`;
4594
4610
  export declare type KeyPair = {
4595
4611
  kty: string;
@@ -4612,6 +4628,7 @@ export declare type DidkitPluginMethods = {
4612
4628
  issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair: KeyPair) => Promise<VP>;
4613
4629
  verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
4614
4630
  contextLoader: (url: string) => Promise<Record<string, any>>;
4631
+ resolveDid: (did: string) => Promise<Record<string, any>>;
4615
4632
  };
4616
4633
  export declare type Algorithm = "ed25519" | "secp256k1";
4617
4634
  export declare type DidKeyPluginMethods<DidMethod extends string> = {
@@ -4647,17 +4664,106 @@ export declare type IDXPluginMethods = {
4647
4664
  addVerifiableCredentialInIdx: (cred: IDXCredential) => Promise<StreamID>;
4648
4665
  removeVerifiableCredentialInIdx: (title: string) => Promise<StreamID>;
4649
4666
  };
4650
- declare enum StorageType {
4651
- ceramic = "ceramic"
4652
- }
4653
- export declare type IDXCredential = {
4667
+ declare const IDXCredentialValidator: z.ZodObject<{
4668
+ id: z.ZodString;
4669
+ title: z.ZodString;
4670
+ storageType: z.ZodOptional<z.ZodEnum<[
4671
+ "ceramic"
4672
+ ]>>;
4673
+ metadata: z.ZodOptional<z.ZodObject<{
4674
+ name: z.ZodOptional<z.ZodString>;
4675
+ image: z.ZodOptional<z.ZodString>;
4676
+ }, "strip", z.ZodAny, {
4677
+ [x: string]: any;
4678
+ name?: string | undefined;
4679
+ image?: string | undefined;
4680
+ }, {
4681
+ [x: string]: any;
4682
+ name?: string | undefined;
4683
+ image?: string | undefined;
4684
+ }>>;
4685
+ }, "strict", z.ZodTypeAny, {
4686
+ storageType?: "ceramic" | undefined;
4687
+ metadata?: {
4688
+ [x: string]: any;
4689
+ name?: string | undefined;
4690
+ image?: string | undefined;
4691
+ } | undefined;
4654
4692
  id: string;
4655
4693
  title: string;
4656
- storageType?: StorageType;
4657
- };
4658
- export declare type CredentialsList = {
4659
- credentials: IDXCredential[];
4660
- };
4694
+ }, {
4695
+ storageType?: "ceramic" | undefined;
4696
+ metadata?: {
4697
+ [x: string]: any;
4698
+ name?: string | undefined;
4699
+ image?: string | undefined;
4700
+ } | undefined;
4701
+ id: string;
4702
+ title: string;
4703
+ }>;
4704
+ export declare type IDXCredential = z.infer<typeof IDXCredentialValidator>;
4705
+ declare const CredentialsListValidator: z.ZodObject<{
4706
+ credentials: z.ZodArray<z.ZodObject<{
4707
+ id: z.ZodString;
4708
+ title: z.ZodString;
4709
+ storageType: z.ZodOptional<z.ZodEnum<[
4710
+ "ceramic"
4711
+ ]>>;
4712
+ metadata: z.ZodOptional<z.ZodObject<{
4713
+ name: z.ZodOptional<z.ZodString>;
4714
+ image: z.ZodOptional<z.ZodString>;
4715
+ }, "strip", z.ZodAny, {
4716
+ [x: string]: any;
4717
+ name?: string | undefined;
4718
+ image?: string | undefined;
4719
+ }, {
4720
+ [x: string]: any;
4721
+ name?: string | undefined;
4722
+ image?: string | undefined;
4723
+ }>>;
4724
+ }, "strict", z.ZodTypeAny, {
4725
+ storageType?: "ceramic" | undefined;
4726
+ metadata?: {
4727
+ [x: string]: any;
4728
+ name?: string | undefined;
4729
+ image?: string | undefined;
4730
+ } | undefined;
4731
+ id: string;
4732
+ title: string;
4733
+ }, {
4734
+ storageType?: "ceramic" | undefined;
4735
+ metadata?: {
4736
+ [x: string]: any;
4737
+ name?: string | undefined;
4738
+ image?: string | undefined;
4739
+ } | undefined;
4740
+ id: string;
4741
+ title: string;
4742
+ }>, "many">;
4743
+ }, "strict", z.ZodTypeAny, {
4744
+ credentials: {
4745
+ storageType?: "ceramic" | undefined;
4746
+ metadata?: {
4747
+ [x: string]: any;
4748
+ name?: string | undefined;
4749
+ image?: string | undefined;
4750
+ } | undefined;
4751
+ id: string;
4752
+ title: string;
4753
+ }[];
4754
+ }, {
4755
+ credentials: {
4756
+ storageType?: "ceramic" | undefined;
4757
+ metadata?: {
4758
+ [x: string]: any;
4759
+ name?: string | undefined;
4760
+ image?: string | undefined;
4761
+ } | undefined;
4762
+ id: string;
4763
+ title: string;
4764
+ }[];
4765
+ }>;
4766
+ export declare type CredentialsList = z.infer<typeof CredentialsListValidator>;
4661
4767
  export declare type DependentMethods = {
4662
4768
  getSubjectDid: (type: "key") => string;
4663
4769
  getSubjectKeypair: () => KeyPair;
@@ -4678,6 +4784,10 @@ export declare type VCPluginMethods = DependentMethods & {
4678
4784
  export declare type VerifyExtension = {
4679
4785
  verifyCredential: (credential: VC) => Promise<VerificationCheck>;
4680
4786
  };
4787
+ export declare type VpqrPluginMethods = {
4788
+ vpFromQrCode: (text: string) => Promise<VP>;
4789
+ vpToQrCode: (vp: VP) => Promise<string>;
4790
+ };
4681
4791
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
4682
4792
  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
4793
  args: undefined extends Args ? Partial<Pick<LearnCardConfig, Config>> : Args & Partial<Pick<LearnCardConfig, Config>>;
@@ -4699,7 +4809,7 @@ export declare type Wallet<PluginNames extends string = "", PluginMethods extend
4699
4809
  remove: (contentId: string) => Promise<Wallet<PluginNames, PluginMethods>>;
4700
4810
  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>>;
4701
4811
  };
4702
- export declare type LearnCardRawWallet = Wallet<"DIDKit" | "DID Key" | "VC" | "IDX" | "Expiration" | "Ethereum", DidKeyPluginMethods<DidMethod> & VCPluginMethods & IDXPluginMethods & EthereumPluginMethods>;
4812
+ export declare type LearnCardRawWallet = Wallet<"DIDKit" | "DID Key" | "VC" | "IDX" | "Expiration" | "Ethereum" | "Vpqr", DidKeyPluginMethods<DidMethod> & VCPluginMethods & IDXPluginMethods & EthereumPluginMethods & VpqrPluginMethods>;
4703
4813
  export declare type AllLearnCardMethods = {
4704
4814
  /** Wallet holder's did */
4705
4815
  did: (type?: DidMethod) => string;
@@ -4719,7 +4829,7 @@ export declare type AllLearnCardMethods = {
4719
4829
  * Empty error/warnings arrays means verification was successful
4720
4830
  */
4721
4831
  verifyCredential: (credential: VC) => Promise<VerificationItem[]>;
4722
- /** Creates a signed Verifiable Presentation from a signed Verifiable Credential */
4832
+ /** Signs an unsigned Verifiable Presentation, returning the signed VP */
4723
4833
  issuePresentation: (presentation: UnsignedVP) => Promise<VP>;
4724
4834
  /**
4725
4835
  * Verifies a signed Verifiable Presentation
@@ -4757,6 +4867,7 @@ export declare type AllLearnCardMethods = {
4757
4867
  * or by using `getCredentials` to get a list of all credentials that have been added to IDX
4758
4868
  */
4759
4869
  removeCredential: (title: string) => Promise<void>;
4870
+ resolveDid: (did: string) => Promise<Record<string, any>>;
4760
4871
  /**
4761
4872
  * Resolves a stream ID, returning its contents
4762
4873
  *
@@ -4808,12 +4919,20 @@ export declare type AllLearnCardMethods = {
4808
4919
  * Really only useful for testing with the CLI right now...
4809
4920
  */
4810
4921
  addInfuraProjectId: (infuraProjectIdToAdd: string) => void;
4922
+ /**
4923
+ * Returns a Verifiable Presentation (VP) from a QR code base-64 image data string containing a VP compressed by CBOR-LD.
4924
+ */
4925
+ vpFromQrCode: (text: string) => Promise<VP>;
4926
+ /**
4927
+ * Returns a QR-embeddable base-64 image data string from a Verifiable Presentation, compressed using CBOR-LD.
4928
+ */
4929
+ vpToQrCode: (vp: VP) => Promise<string>;
4811
4930
  };
4812
4931
  export declare type LearnCard<Methods extends keyof AllLearnCardMethods = keyof AllLearnCardMethods, RawWallet extends Wallet<any, any> = LearnCardRawWallet> = {
4813
4932
  /** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
4814
4933
  _wallet: RawWallet;
4815
4934
  } & Pick<AllLearnCardMethods, Methods>;
4816
- export declare type EmptyLearnCard = LearnCard<"verifyCredential" | "verifyPresentation", Wallet<"DIDKit" | "Expiration", DidkitPluginMethods & VerifyExtension>>;
4935
+ export declare type EmptyLearnCard = LearnCard<"verifyCredential" | "verifyPresentation" | "resolveDid", Wallet<"DIDKit" | "Expiration", DidkitPluginMethods & VerifyExtension>>;
4817
4936
  export declare type CeramicIDXArgs = {
4818
4937
  modelData: ModelAliases;
4819
4938
  credentialAlias: string;