@learncard/core 1.1.1 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/dist/core.cjs.development.js +7758 -1785
  2. package/dist/core.cjs.development.js.map +3 -3
  3. package/dist/core.cjs.production.min.js +206 -206
  4. package/dist/core.cjs.production.min.js.map +3 -3
  5. package/dist/core.esm.js +7758 -1785
  6. package/dist/core.esm.js.map +3 -3
  7. package/dist/didkit/index.d.ts +4 -0
  8. package/dist/index.d.ts +3 -0
  9. package/dist/types/LearnCard.d.ts +77 -0
  10. package/dist/types/wallet.d.ts +27 -0
  11. package/dist/wallet/base/crypto.d.ts +3 -0
  12. package/dist/wallet/base/functions/index.d.ts +2 -0
  13. package/dist/wallet/base/functions/passwordToKey.d.ts +1 -0
  14. package/dist/wallet/base/functions/seedToId.d.ts +1 -0
  15. package/dist/wallet/base/index.d.ts +2 -0
  16. package/dist/wallet/base/wallet.d.ts +2 -0
  17. package/dist/wallet/defaults.d.ts +2 -0
  18. package/dist/wallet/init.d.ts +3 -0
  19. package/dist/wallet/plugins/didkey/index.d.ts +3 -0
  20. package/dist/wallet/plugins/didkey/types.d.ts +19 -0
  21. package/dist/wallet/plugins/expiration/index.d.ts +3 -0
  22. package/dist/wallet/plugins/idx/idx.d.ts +6 -0
  23. package/dist/wallet/plugins/idx/index.d.ts +4 -0
  24. package/dist/wallet/plugins/idx/types.d.ts +20 -0
  25. package/dist/wallet/plugins/vc/index.d.ts +2 -0
  26. package/dist/wallet/plugins/vc/issueCredential.d.ts +5 -0
  27. package/dist/wallet/plugins/vc/issuePresentation.d.ts +6 -0
  28. package/dist/wallet/plugins/vc/types.d.ts +18 -0
  29. package/dist/wallet/plugins/vc/vc.d.ts +6 -0
  30. package/dist/wallet/plugins/vc/verifyCredential.d.ts +2 -0
  31. package/dist/wallet/plugins/vc/verifyPresentation.d.ts +2 -0
  32. package/dist/wallet/verify.d.ts +3 -0
  33. package/package.json +5 -4
  34. package/dist/core.d.ts +0 -212
@@ -0,0 +1,4 @@
1
+ import { InitInput } from './pkg/didkit_wasm';
2
+ export * from './pkg/didkit_wasm';
3
+ export declare const init: (arg?: InitInput | Promise<InitInput>) => Promise<import("./pkg/didkit_wasm").InitOutput | undefined>;
4
+ export default init;
@@ -0,0 +1,3 @@
1
+ /// <reference types="types/global" />
2
+ export { walletFromKey } from './wallet/init';
3
+ export { Wallet, UnlockedWallet, LockedWallet, Plugin } from './types/wallet';
@@ -0,0 +1,77 @@
1
+ import { ModelAliases } from '@glazed/types';
2
+ import { VerificationItem, UnsignedVC, VC, VP } from '@learncard/types';
3
+ import { DidKeyPluginMethods } from '../wallet/plugins/didkey/types';
4
+ import { IDXCredential, IDXPluginMethods } from '../wallet/plugins/idx/types';
5
+ import { VCPluginMethods, VerificationCheck } from '../wallet/plugins/vc/types';
6
+ import { InitInput } from '../didkit';
7
+ import { UnlockedWallet } from './wallet';
8
+ export * from '@learncard/types';
9
+ export declare type LearnCardRawWallet = UnlockedWallet<'DID Key' | 'VC' | 'IDX' | 'Expiration', DidKeyPluginMethods & VCPluginMethods & IDXPluginMethods>;
10
+ export declare type LearnCardWallet = {
11
+ /** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
12
+ _wallet: LearnCardRawWallet;
13
+ /** Wallet holder's did */
14
+ did: string;
15
+ /** Wallet holder's ed25519 key pair */
16
+ keypair: Record<string, string>;
17
+ /** Signs an unsigned Verifiable Credential, returning the signed VC */
18
+ issueCredential: (credential: UnsignedVC) => Promise<VC>;
19
+ /**
20
+ * Verifies a signed Verifiable Credential
21
+ *
22
+ * Empty error/warnings arrays means verification was successful
23
+ */
24
+ verifyCredential: (credential: VC) => Promise<VerificationItem[]>;
25
+ /** Creates a signed Verifiable Presentation from a signed Verifiable Credential */
26
+ issuePresentation: (credential: VC) => Promise<VP>;
27
+ /**
28
+ * Verifies a signed Verifiable Presentation
29
+ *
30
+ * Empry error/warnings arrays means verification was successful
31
+ */
32
+ verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
33
+ /** Returns the credential marked with `title` from IDX */
34
+ getCredential: (title: string) => Promise<any>;
35
+ /** Returns all credentials from IDX */
36
+ getCredentials: () => Promise<any[]>;
37
+ /**
38
+ * Publishes a credential to Ceramic, returning the credential's stream ID
39
+ *
40
+ * This stream ID may then be shared/persisted/resolved to gain access to the credential
41
+ *
42
+ * Resolving a stream ID can be done by passing the stream ID to `readFromCeramic`
43
+ */
44
+ publishCredential: (credential: any) => Promise<string>;
45
+ /**
46
+ * Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
47
+ * to IDX with a bespoke title
48
+ *
49
+ * The credential may then be retrieved using `getCredential` and passing in that bespoke title,
50
+ * or by using `getCredentials` to get a list of all credentials that have been added to IDX
51
+ */
52
+ addCredential: (credential: IDXCredential) => Promise<void>;
53
+ /**
54
+ * Resolves a stream ID, returning its contents
55
+ *
56
+ * This can be given the return value of `publishCredential` to gain access to the credential
57
+ * that was published
58
+ */
59
+ readFromCeramic: (streamId: string) => Promise<any>;
60
+ /**
61
+ * Returns an example credential, optionally allowing a subject's did to be passed in
62
+ *
63
+ * You can use this to test out implementations that use this library!
64
+ */
65
+ getTestVc: (subject?: string) => UnsignedVC;
66
+ };
67
+ export declare type CeramicIDXArgs = {
68
+ modelData: ModelAliases;
69
+ credentialAlias: string;
70
+ ceramicEndpoint: string;
71
+ defaultContentFamily: string;
72
+ };
73
+ export declare type LearnCardConfig = {
74
+ ceramicIdx: CeramicIDXArgs;
75
+ didkit: InitInput | Promise<InitInput>;
76
+ defaultContents: any[];
77
+ };
@@ -0,0 +1,27 @@
1
+ export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
2
+ name?: Name;
3
+ pluginMethods: {
4
+ [Key in keyof PublicMethods]: <T extends UnlockedWallet<any, PublicMethods>>(wallet: T, ...args: Parameters<PublicMethods[Key]>) => ReturnType<PublicMethods[Key]>;
5
+ };
6
+ };
7
+ export declare type PublicFieldsObj<PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
8
+ pluginMethods: PluginMethods;
9
+ };
10
+ export declare enum WalletStatus {
11
+ Locked = "LOCKED",
12
+ Unlocked = "UNLOCKED"
13
+ }
14
+ export declare type BaseWallet<PluginNames extends string = '', PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = PublicFieldsObj<PluginMethods> & {
15
+ contents: any[];
16
+ plugins: Plugin<PluginNames, Record<string, (...args: any[]) => any>>[];
17
+ };
18
+ export declare type LockedWallet<PluginNames extends string = '', PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = BaseWallet<PluginNames, PluginMethods> & {
19
+ status: WalletStatus.Locked;
20
+ };
21
+ export declare type UnlockedWallet<PluginNames extends string = '', PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = BaseWallet<PluginNames, PluginMethods> & {
22
+ status: WalletStatus.Unlocked;
23
+ add: (content: any) => Promise<UnlockedWallet<PluginNames, PluginMethods>>;
24
+ remove: (contentId: string) => Promise<UnlockedWallet<PluginNames, PluginMethods>>;
25
+ addPlugin: <Name extends string, Methods extends Record<string, (...args: any[]) => any> = Record<never, never>>(plugin: Plugin<Name, Methods>) => Promise<UnlockedWallet<'' extends PluginNames ? Name : PluginNames | Name, Record<never, never> extends PluginMethods ? Methods : PluginMethods & Methods>>;
26
+ };
27
+ export declare type Wallet<PluginNames extends string = '', PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = LockedWallet<PluginNames, PluginMethods> | UnlockedWallet<PluginNames, PluginMethods>;
@@ -0,0 +1,3 @@
1
+ import { Crypto } from '@peculiar/webcrypto';
2
+ declare let crypto: Crypto;
3
+ export default crypto;
@@ -0,0 +1,2 @@
1
+ export * from './passwordToKey';
2
+ export * from './seedToId';
@@ -0,0 +1 @@
1
+ export declare const passwordToKey: (password: string, salt?: string, iterations?: number, digest?: string) => Promise<Uint8Array>;
@@ -0,0 +1 @@
1
+ export declare const seedToId: (seed: Uint8Array) => Promise<string>;
@@ -0,0 +1,2 @@
1
+ export * from './functions';
2
+ export * from './wallet';
@@ -0,0 +1,2 @@
1
+ import { UnlockedWallet } from '../../types/wallet';
2
+ export declare const generateWallet: <PluginNames extends string, PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>>(contents?: any[], _wallet?: Partial<UnlockedWallet<any, PluginMethods>>) => Promise<UnlockedWallet<PluginNames, PluginMethods>>;
@@ -0,0 +1,2 @@
1
+ import { CeramicIDXArgs } from '../types/LearnCard';
2
+ export declare const defaultCeramicIDXArgs: CeramicIDXArgs;
@@ -0,0 +1,3 @@
1
+ import { LearnCardConfig, LearnCardWallet } from '../types/LearnCard';
2
+ /** Generates a LearnCard Wallet from a 64 character seed string */
3
+ export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, }?: Partial<LearnCardConfig>) => Promise<LearnCardWallet>;
@@ -0,0 +1,3 @@
1
+ import { DidKeyPluginMethods } from './types';
2
+ import { Plugin } from '../../../types/wallet';
3
+ export declare const getDidKeyPlugin: (key: string) => Promise<Plugin<'DID Key', DidKeyPluginMethods>>;
@@ -0,0 +1,19 @@
1
+ export declare type JWK = {
2
+ id: string;
3
+ type: string | string[];
4
+ controller?: string;
5
+ publicKeyJwk?: any;
6
+ privateKeyJwk?: any;
7
+ '@context': string[];
8
+ name: string;
9
+ image: string;
10
+ description: string;
11
+ tags: string[];
12
+ value?: string;
13
+ generatedFrom?: [string];
14
+ };
15
+ export declare type DidKeyPluginMethods = {
16
+ getSubjectDid: () => string;
17
+ getSubjectKeypair: () => Record<string, string>;
18
+ getKey: () => string;
19
+ };
@@ -0,0 +1,3 @@
1
+ import { VerifyExtension } from '../vc/types';
2
+ import { Plugin, UnlockedWallet } from '../../../types/wallet';
3
+ export declare const ExpirationPlugin: (wallet: UnlockedWallet<any, VerifyExtension>) => Plugin<'Expiration', VerifyExtension>;
@@ -0,0 +1,6 @@
1
+ import { IDXPluginMethods } from './types';
2
+ import { Plugin, UnlockedWallet } from '../../../types/wallet';
3
+ import { CeramicIDXArgs } from '../../../types/LearnCard';
4
+ export declare const getIDXPlugin: (wallet: UnlockedWallet<any, {
5
+ getKey: () => string;
6
+ }>, { modelData, credentialAlias, ceramicEndpoint, defaultContentFamily }: CeramicIDXArgs) => Promise<Plugin<'IDX', IDXPluginMethods>>;
@@ -0,0 +1,4 @@
1
+ import { getIDXPlugin } from './idx';
2
+ export { getIDXPlugin } from './idx';
3
+ export * from './types';
4
+ export default getIDXPlugin;
@@ -0,0 +1,20 @@
1
+ import { StreamID } from '@ceramicnetwork/streamid';
2
+ export declare type IDXPluginMethods = {
3
+ getCredentialsListFromIndex: (alias?: string) => Promise<CredentialsList>;
4
+ publishContentToCeramic: (cred: any) => Promise<string>;
5
+ readContentFromCeramic: (streamId: string) => Promise<any>;
6
+ getVerifiableCredentialFromIndex: (title: string) => Promise<any>;
7
+ getVerifiableCredentialsFromIndex: () => Promise<any>;
8
+ addVerifiableCredentialInIdx: (cred: IDXCredential) => Promise<StreamID>;
9
+ };
10
+ export declare enum StorageType {
11
+ ceramic = "ceramic"
12
+ }
13
+ export declare type IDXCredential = {
14
+ id: string;
15
+ title: string;
16
+ storageType?: StorageType;
17
+ };
18
+ export declare type CredentialsList = {
19
+ credentials: IDXCredential[];
20
+ };
@@ -0,0 +1,2 @@
1
+ export { getVCPlugin } from './vc';
2
+ export * from './types';
@@ -0,0 +1,5 @@
1
+ import { UnsignedVC } from '@learncard/types';
2
+ import { UnlockedWallet } from '../../../types/wallet';
3
+ export declare const issueCredential: (wallet: UnlockedWallet<any, {
4
+ getSubjectKeypair: () => Record<string, string>;
5
+ }>, credential: UnsignedVC) => Promise<any>;
@@ -0,0 +1,6 @@
1
+ import { VC } from '@learncard/types';
2
+ import { UnlockedWallet } from '../../../types/wallet';
3
+ export declare const issuePresentation: (wallet: UnlockedWallet<any, {
4
+ getSubjectDid: () => string;
5
+ getSubjectKeypair: () => Record<string, string>;
6
+ }>, credential: VC) => Promise<any>;
@@ -0,0 +1,18 @@
1
+ import { UnsignedVC, VC, VP } from '@learncard/types';
2
+ export declare type VerificationCheck = {
3
+ checks: string[];
4
+ warnings: string[];
5
+ errors: string[];
6
+ };
7
+ export declare type VCPluginMethods = {
8
+ issueCredential: (credential: UnsignedVC) => Promise<VC>;
9
+ verifyCredential: (credential: VC) => Promise<VerificationCheck>;
10
+ issuePresentation: (credential: VC) => Promise<VP>;
11
+ verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
12
+ getTestVc: (subject?: string) => UnsignedVC;
13
+ getSubjectDid: () => string;
14
+ getSubjectKeypair: () => Record<string, string>;
15
+ };
16
+ export declare type VerifyExtension = {
17
+ verifyCredential: (credential: VC) => Promise<VerificationCheck>;
18
+ };
@@ -0,0 +1,6 @@
1
+ import { VCPluginMethods } from './types';
2
+ import { Plugin, UnlockedWallet } from '../../../types/wallet';
3
+ export declare const getVCPlugin: (wallet: UnlockedWallet<any, {
4
+ getSubjectDid: () => string;
5
+ getSubjectKeypair: () => Record<string, string>;
6
+ }>) => Promise<Plugin<'VC', VCPluginMethods>>;
@@ -0,0 +1,2 @@
1
+ import { VC } from '@learncard/types';
2
+ export declare const verifyCredential: (credential: VC) => Promise<any>;
@@ -0,0 +1,2 @@
1
+ import { VP } from '@learncard/types';
2
+ export declare const verifyPresentation: (presentation: VP) => Promise<any>;
@@ -0,0 +1,3 @@
1
+ import { VC, VerificationItem } from '@learncard/types';
2
+ import { LearnCardRawWallet } from '../types/LearnCard';
3
+ export declare const verifyCredential: (wallet: LearnCardRawWallet) => (credential: VC) => Promise<VerificationItem[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learncard/core",
3
- "version": "1.1.1",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/core.esm.js",
@@ -19,14 +19,15 @@
19
19
  },
20
20
  "devDependencies": {
21
21
  "@glazed/types": "^0.2.0",
22
- "@learncard/types": "2.0.1",
22
+ "@learncard/types": "2.1.1",
23
23
  "@types/node": "^17.0.31",
24
24
  "aqu": "0.3.2",
25
25
  "esbuild": "^0.14.38",
26
26
  "esbuild-plugin-copy": "^1.3.0",
27
+ "tsc-alias": "^1.6.9",
27
28
  "typescript": "^4.6.4"
28
29
  },
29
- "types": "./dist/core.d.ts",
30
+ "types": "./dist/index.d.ts",
30
31
  "dependencies": {
31
32
  "@ceramicnetwork/common": "^2.0.4",
32
33
  "@ceramicnetwork/http-client": "2.0.4",
@@ -42,7 +43,7 @@
42
43
  "key-did-resolver": "1.2.1"
43
44
  },
44
45
  "scripts": {
45
- "build": "aqu build",
46
+ "build": "aqu build && tsc-alias",
46
47
  "start": "aqu watch",
47
48
  "lint": "aqu lint",
48
49
  "lint:fix": "aqu lint --fix",
package/dist/core.d.ts DELETED
@@ -1,212 +0,0 @@
1
- // Generated by dts-bundle-generator v5.9.0
2
-
3
- /// <reference types="node" />
4
-
5
- import { StreamID } from '@ceramicnetwork/streamid';
6
- import { ModelAliases } from '@glazed/types';
7
-
8
- declare enum VerificationStatus {
9
- Success = "Success",
10
- Failed = "Failed",
11
- Error = "Error"
12
- }
13
- export declare type VerificationItem = {
14
- check: string;
15
- status: VerificationStatus;
16
- message?: string;
17
- details?: string;
18
- };
19
- export declare type AchievementCriteria = {
20
- type?: string;
21
- narrative?: string;
22
- };
23
- export declare type CredentialSubjectAchievement = {
24
- type?: string;
25
- name?: string;
26
- description?: string;
27
- criteria?: AchievementCriteria;
28
- image?: string;
29
- };
30
- export declare type CredentialSubject = {
31
- type?: string;
32
- id?: string;
33
- achievement?: CredentialSubjectAchievement;
34
- };
35
- export declare type Issuer = string | {
36
- type?: string;
37
- id?: string;
38
- name?: string;
39
- url?: string;
40
- image?: string;
41
- };
42
- export declare type Proof = {
43
- type: string;
44
- proofPurpose: string;
45
- verificationMethod: string;
46
- jws: string;
47
- created: string;
48
- };
49
- export declare type UnsignedVC = {
50
- [key: string]: any;
51
- "@context": string | string[];
52
- credentialSubject: CredentialSubject;
53
- id: string;
54
- issuanceDate: string;
55
- expirationDate?: string;
56
- issuer: Issuer;
57
- type: string[];
58
- };
59
- export declare type VC = UnsignedVC & {
60
- proof: Proof;
61
- };
62
- export declare type UnsignedVP = {
63
- [key: string]: any;
64
- "@context": string | string[];
65
- holder: string;
66
- type: string[];
67
- verifiableCredential: VC;
68
- };
69
- export declare type VP = UnsignedVP & {
70
- proof: Proof;
71
- };
72
- export declare type DidKeyPluginMethods = {
73
- getSubjectDid: () => string;
74
- getSubjectKeypair: () => Record<string, string>;
75
- getKey: () => string;
76
- };
77
- export declare type IDXPluginMethods = {
78
- getCredentialsListFromIndex: (alias?: string) => Promise<CredentialsList>;
79
- publishContentToCeramic: (cred: any) => Promise<string>;
80
- readContentFromCeramic: (streamId: string) => Promise<any>;
81
- getVerifiableCredentialFromIndex: (title: string) => Promise<any>;
82
- getVerifiableCredentialsFromIndex: () => Promise<any>;
83
- addVerifiableCredentialInIdx: (cred: IDXCredential) => Promise<StreamID>;
84
- };
85
- declare enum StorageType {
86
- ceramic = "ceramic"
87
- }
88
- export declare type IDXCredential = {
89
- id: string;
90
- title: string;
91
- storageType?: StorageType;
92
- };
93
- export declare type CredentialsList = {
94
- credentials: IDXCredential[];
95
- };
96
- export declare type VerificationCheck = {
97
- checks: string[];
98
- warnings: string[];
99
- errors: string[];
100
- };
101
- export declare type VCPluginMethods = {
102
- issueCredential: (credential: UnsignedVC) => Promise<VC>;
103
- verifyCredential: (credential: VC) => Promise<VerificationCheck>;
104
- issuePresentation: (credential: VC) => Promise<VP>;
105
- verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
106
- getTestVc: (subject?: string) => UnsignedVC;
107
- getSubjectDid: () => string;
108
- getSubjectKeypair: () => Record<string, string>;
109
- };
110
- export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
111
- export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
112
- name?: Name;
113
- pluginMethods: {
114
- [Key in keyof PublicMethods]: <T extends UnlockedWallet<any, PublicMethods>>(wallet: T, ...args: Parameters<PublicMethods[Key]>) => ReturnType<PublicMethods[Key]>;
115
- };
116
- };
117
- export declare type PublicFieldsObj<PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
118
- pluginMethods: PluginMethods;
119
- };
120
- declare enum WalletStatus {
121
- Locked = "LOCKED",
122
- Unlocked = "UNLOCKED"
123
- }
124
- export declare type BaseWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = PublicFieldsObj<PluginMethods> & {
125
- contents: any[];
126
- plugins: Plugin<PluginNames, Record<string, (...args: any[]) => any>>[];
127
- };
128
- export declare type LockedWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = BaseWallet<PluginNames, PluginMethods> & {
129
- status: WalletStatus.Locked;
130
- };
131
- export declare type UnlockedWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = BaseWallet<PluginNames, PluginMethods> & {
132
- status: WalletStatus.Unlocked;
133
- add: (content: any) => Promise<UnlockedWallet<PluginNames, PluginMethods>>;
134
- remove: (contentId: string) => Promise<UnlockedWallet<PluginNames, PluginMethods>>;
135
- addPlugin: <Name extends string, Methods extends Record<string, (...args: any[]) => any> = Record<never, never>>(plugin: Plugin<Name, Methods>) => Promise<UnlockedWallet<"" extends PluginNames ? Name : PluginNames | Name, Record<never, never> extends PluginMethods ? Methods : PluginMethods & Methods>>;
136
- };
137
- export declare type Wallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = LockedWallet<PluginNames, PluginMethods> | UnlockedWallet<PluginNames, PluginMethods>;
138
- export declare type LearnCardRawWallet = UnlockedWallet<"DID Key" | "VC" | "IDX" | "Expiration", DidKeyPluginMethods & VCPluginMethods & IDXPluginMethods>;
139
- export declare type LearnCardWallet = {
140
- /** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
141
- _wallet: LearnCardRawWallet;
142
- /** Wallet holder's did */
143
- did: string;
144
- /** Wallet holder's ed25519 key pair */
145
- keypair: Record<string, string>;
146
- /** Signs an unsigned Verifiable Credential, returning the signed VC */
147
- issueCredential: (credential: UnsignedVC) => Promise<VC>;
148
- /**
149
- * Verifies a signed Verifiable Credential
150
- *
151
- * Empty error/warnings arrays means verification was successful
152
- */
153
- verifyCredential: (credential: VC) => Promise<VerificationItem[]>;
154
- /** Creates a signed Verifiable Presentation from a signed Verifiable Credential */
155
- issuePresentation: (credential: VC) => Promise<VP>;
156
- /**
157
- * Verifies a signed Verifiable Presentation
158
- *
159
- * Empry error/warnings arrays means verification was successful
160
- */
161
- verifyPresentation: (presentation: VP) => Promise<VerificationCheck>;
162
- /** Returns the credential marked with `title` from IDX */
163
- getCredential: (title: string) => Promise<any>;
164
- /** Returns all credentials from IDX */
165
- getCredentials: () => Promise<any[]>;
166
- /**
167
- * Publishes a credential to Ceramic, returning the credential's stream ID
168
- *
169
- * This stream ID may then be shared/persisted/resolved to gain access to the credential
170
- *
171
- * Resolving a stream ID can be done by passing the stream ID to `readFromCeramic`
172
- */
173
- publishCredential: (credential: any) => Promise<string>;
174
- /**
175
- * Adds a stream ID pointing to a credential (such as the one returned by `publishCredential`)
176
- * to IDX with a bespoke title
177
- *
178
- * The credential may then be retrieved using `getCredential` and passing in that bespoke title,
179
- * or by using `getCredentials` to get a list of all credentials that have been added to IDX
180
- */
181
- addCredential: (credential: IDXCredential) => Promise<void>;
182
- /**
183
- * Resolves a stream ID, returning its contents
184
- *
185
- * This can be given the return value of `publishCredential` to gain access to the credential
186
- * that was published
187
- */
188
- readFromCeramic: (streamId: string) => Promise<any>;
189
- /**
190
- * Returns an example credential, optionally allowing a subject's did to be passed in
191
- *
192
- * You can use this to test out implementations that use this library!
193
- */
194
- getTestVc: (subject?: string) => UnsignedVC;
195
- };
196
- export declare type CeramicIDXArgs = {
197
- modelData: ModelAliases;
198
- credentialAlias: string;
199
- ceramicEndpoint: string;
200
- defaultContentFamily: string;
201
- };
202
- export declare type LearnCardConfig = {
203
- ceramicIdx: CeramicIDXArgs;
204
- didkit: InitInput | Promise<InitInput>;
205
- defaultContents: any[];
206
- };
207
- /** Generates a LearnCard Wallet from a 64 character seed string */
208
- export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, }?: Partial<LearnCardConfig>) => Promise<LearnCardWallet>;
209
- export { walletFromKey } from "@wallet/init";
210
- export { Wallet, UnlockedWallet, LockedWallet, Plugin } from "types/wallet";
211
-
212
- export {};