@learncard/core 8.4.2 → 8.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. package/dist/core.cjs.development.js +2949 -1722
  2. package/dist/core.cjs.development.js.map +4 -4
  3. package/dist/core.cjs.production.min.js +124 -118
  4. package/dist/core.cjs.production.min.js.map +4 -4
  5. package/dist/core.esm.js +2949 -1722
  6. package/dist/core.esm.js.map +4 -4
  7. package/dist/didkit/didkit_wasm.d.ts +15 -2
  8. package/dist/didkit/didkit_wasm.js +44 -19
  9. package/dist/didkit/didkit_wasm_bg.wasm +0 -0
  10. package/dist/didkit/didkit_wasm_bg.wasm.d.ts +4 -2
  11. package/dist/didkit/index.d.ts +4 -0
  12. package/dist/didkit_wasm.d.ts +15 -2
  13. package/dist/didkit_wasm.js +44 -19
  14. package/dist/didkit_wasm_bg.wasm +0 -0
  15. package/dist/didkit_wasm_bg.wasm.d.ts +4 -2
  16. package/dist/index.d.ts +7 -0
  17. package/dist/polyfills.d.ts +2 -0
  18. package/dist/types/LearnCard.d.ts +63 -0
  19. package/dist/types/helpers.d.ts +18 -0
  20. package/dist/types/planes.d.ts +77 -0
  21. package/dist/types/utilities.d.ts +14 -0
  22. package/dist/types/wallet.d.ts +52 -0
  23. package/dist/wallet/base/crypto.d.ts +2 -0
  24. package/dist/wallet/base/helpers.d.ts +16 -0
  25. package/dist/wallet/base/index.d.ts +2 -0
  26. package/dist/wallet/base/wallet.d.ts +15 -0
  27. package/dist/wallet/defaults.d.ts +5 -0
  28. package/dist/wallet/init.d.ts +29 -0
  29. package/dist/wallet/initializers/apiLearnCard.d.ts +14 -0
  30. package/dist/wallet/initializers/customLearnCard.d.ts +7 -0
  31. package/dist/wallet/initializers/emptyLearnCard.d.ts +7 -0
  32. package/dist/wallet/initializers/learnCardFromSeed.d.ts +7 -0
  33. package/dist/wallet/plugins/EthereumPlugin/hardcodedTokens.d.ts +22 -0
  34. package/dist/wallet/plugins/EthereumPlugin/helpers.d.ts +7 -0
  35. package/dist/wallet/plugins/EthereumPlugin/index.d.ts +7 -0
  36. package/dist/wallet/plugins/EthereumPlugin/types.d.ts +32 -0
  37. package/dist/wallet/plugins/ceramic/ceramic.d.ts +215 -0
  38. package/dist/wallet/plugins/ceramic/helpers.d.ts +3 -0
  39. package/dist/wallet/plugins/ceramic/index.d.ts +4 -0
  40. package/dist/wallet/plugins/ceramic/types.d.ts +43 -0
  41. package/dist/wallet/plugins/chapi/chapi.d.ts +5 -0
  42. package/dist/wallet/plugins/chapi/index.d.ts +2 -0
  43. package/dist/wallet/plugins/chapi/types.d.ts +88 -0
  44. package/dist/wallet/plugins/didkey/helpers.d.ts +4 -0
  45. package/dist/wallet/plugins/didkey/index.d.ts +217 -0
  46. package/dist/wallet/plugins/didkey/types.d.ts +18 -0
  47. package/dist/wallet/plugins/didkit/index.d.ts +8 -0
  48. package/dist/wallet/plugins/didkit/types.d.ts +40 -0
  49. package/dist/wallet/plugins/expiration/index.d.ts +7 -0
  50. package/dist/wallet/plugins/expiration/types.d.ts +3 -0
  51. package/dist/wallet/plugins/idx/idx.d.ts +6 -0
  52. package/dist/wallet/plugins/idx/index.d.ts +4 -0
  53. package/dist/wallet/plugins/idx/types.d.ts +54 -0
  54. package/dist/wallet/plugins/index.d.ts +14 -0
  55. package/dist/wallet/plugins/learn-card/index.d.ts +7 -0
  56. package/dist/wallet/plugins/learn-card/types.d.ts +17 -0
  57. package/dist/wallet/plugins/learn-card/verify.d.ts +215 -0
  58. package/dist/wallet/plugins/test-cache/index.d.ts +2 -0
  59. package/dist/wallet/plugins/test-cache/types.d.ts +2 -0
  60. package/dist/wallet/plugins/test-index/index.d.ts +2 -0
  61. package/dist/wallet/plugins/test-index/types.d.ts +2 -0
  62. package/dist/wallet/plugins/test-storage/index.d.ts +2 -0
  63. package/dist/wallet/plugins/test-storage/types.d.ts +2 -0
  64. package/dist/wallet/plugins/vc/index.d.ts +2 -0
  65. package/dist/wallet/plugins/vc/issueCredential.d.ts +98 -0
  66. package/dist/wallet/plugins/vc/issuePresentation.d.ts +220 -0
  67. package/dist/wallet/plugins/vc/types.d.ts +35 -0
  68. package/dist/wallet/plugins/vc/vc.d.ts +5 -0
  69. package/dist/wallet/plugins/vc/verifyCredential.d.ts +8 -0
  70. package/dist/wallet/plugins/vc/verifyPresentation.d.ts +8 -0
  71. package/dist/wallet/plugins/vc-api/helpers.d.ts +8 -0
  72. package/dist/wallet/plugins/vc-api/index.d.ts +8 -0
  73. package/dist/wallet/plugins/vc-api/types.d.ts +20 -0
  74. package/dist/wallet/plugins/vc-resolution/index.d.ts +6 -0
  75. package/dist/wallet/plugins/vc-resolution/types.d.ts +13 -0
  76. package/dist/wallet/plugins/vc-templates/index.d.ts +2 -0
  77. package/dist/wallet/plugins/vc-templates/templates.d.ts +6 -0
  78. package/dist/wallet/plugins/vc-templates/types.d.ts +40 -0
  79. package/dist/wallet/plugins/vc-templates/vc-templates.d.ts +5 -0
  80. package/dist/wallet/plugins/vpqr/index.d.ts +7 -0
  81. package/dist/wallet/plugins/vpqr/types.d.ts +12 -0
  82. package/package.json +13 -11
  83. package/dist/core.d.ts +0 -6009
@@ -0,0 +1,2 @@
1
+ import { TestStoragePlugin } from './types';
2
+ export declare const getTestStorage: () => TestStoragePlugin;
@@ -0,0 +1,2 @@
1
+ import { Plugin } from '../../../types/wallet';
2
+ export type TestStoragePlugin = Plugin<'Test Storage', 'read' | 'store' | 'index'>;
@@ -0,0 +1,2 @@
1
+ export { getVCPlugin } from './vc';
2
+ export * from './types';
@@ -0,0 +1,98 @@
1
+ import { UnsignedVC } from '@learncard/types';
2
+ import { ProofOptions } from '../../plugins/didkit/types';
3
+ import { VCDependentLearnCard, VCImplicitLearnCard } from './types';
4
+ export declare const issueCredential: (initLearnCard: VCDependentLearnCard) => (learnCard: VCImplicitLearnCard, credential: UnsignedVC, signingOptions?: Partial<ProofOptions>) => Promise<{
5
+ [x: string]: any;
6
+ id?: string | undefined;
7
+ expirationDate?: string | undefined;
8
+ credentialStatus?: {
9
+ type: string;
10
+ id: string;
11
+ } | undefined;
12
+ credentialSchema?: {
13
+ type: string;
14
+ id: string;
15
+ }[] | undefined;
16
+ refreshService?: {
17
+ [x: string]: any;
18
+ type: string;
19
+ id: string;
20
+ } | undefined;
21
+ type: [string, ...string[]];
22
+ '@context': (string | Record<string, any>)[];
23
+ issuer: string | {
24
+ [x: string]: any;
25
+ type?: string | [string, ...string[]] | undefined;
26
+ id?: string | undefined;
27
+ name?: string | undefined;
28
+ url?: string | undefined;
29
+ phone?: string | undefined;
30
+ description?: string | undefined;
31
+ endorsement?: any[] | undefined;
32
+ image?: string | {
33
+ caption?: string | undefined;
34
+ type: string;
35
+ id: string;
36
+ } | undefined;
37
+ email?: string | undefined;
38
+ address?: {
39
+ addressCountry?: string | undefined;
40
+ addressCountryCode?: string | undefined;
41
+ addressRegion?: string | undefined;
42
+ addressLocality?: string | undefined;
43
+ streetAddress?: string | undefined;
44
+ postOfficeBoxNumber?: string | undefined;
45
+ postalCode?: string | undefined;
46
+ geo?: {
47
+ type: string | [string, ...string[]];
48
+ latitude: number;
49
+ longitude: number;
50
+ } | undefined;
51
+ type: string | [string, ...string[]];
52
+ } | undefined;
53
+ otherIdentifier?: {
54
+ type: string | [string, ...string[]];
55
+ identifier: string;
56
+ identifierType: string;
57
+ }[] | undefined;
58
+ official?: string | undefined;
59
+ parentOrg?: any;
60
+ familyName?: string | undefined;
61
+ givenName?: string | undefined;
62
+ additionalName?: string | undefined;
63
+ patronymicName?: string | undefined;
64
+ honorificPrefix?: string | undefined;
65
+ honorificSuffix?: string | undefined;
66
+ familyNamePrefix?: string | undefined;
67
+ dateOfBirth?: string | undefined;
68
+ };
69
+ issuanceDate: string;
70
+ credentialSubject: {
71
+ [x: string]: any;
72
+ id?: string | undefined;
73
+ } | {
74
+ [x: string]: any;
75
+ id?: string | undefined;
76
+ }[];
77
+ proof: {
78
+ [x: string]: any;
79
+ challenge?: string | undefined;
80
+ domain?: string | undefined;
81
+ nonce?: string | undefined;
82
+ jws?: string | undefined;
83
+ type: string;
84
+ created: string;
85
+ proofPurpose: string;
86
+ verificationMethod: string;
87
+ } | {
88
+ [x: string]: any;
89
+ challenge?: string | undefined;
90
+ domain?: string | undefined;
91
+ nonce?: string | undefined;
92
+ jws?: string | undefined;
93
+ type: string;
94
+ created: string;
95
+ proofPurpose: string;
96
+ verificationMethod: string;
97
+ }[];
98
+ }>;
@@ -0,0 +1,220 @@
1
+ import { UnsignedVP } from '@learncard/types';
2
+ import { ProofOptions } from '../../plugins/didkit/types';
3
+ import { VCDependentLearnCard, VCImplicitLearnCard } from './types';
4
+ export declare const issuePresentation: (initLearnCard: VCDependentLearnCard) => (learnCard: VCImplicitLearnCard, presentation: UnsignedVP, signingOptions?: Partial<ProofOptions>) => Promise<{
5
+ [x: string]: any;
6
+ id?: string | undefined;
7
+ verifiableCredential?: {
8
+ [x: string]: any;
9
+ id?: string | undefined;
10
+ expirationDate?: string | undefined;
11
+ credentialStatus?: {
12
+ type: string;
13
+ id: string;
14
+ } | undefined;
15
+ credentialSchema?: {
16
+ type: string;
17
+ id: string;
18
+ }[] | undefined;
19
+ refreshService?: {
20
+ [x: string]: any;
21
+ type: string;
22
+ id: string;
23
+ } | undefined;
24
+ type: [string, ...string[]];
25
+ '@context': (string | Record<string, any>)[];
26
+ issuer: string | {
27
+ [x: string]: any;
28
+ type?: string | [string, ...string[]] | undefined;
29
+ id?: string | undefined;
30
+ name?: string | undefined;
31
+ url?: string | undefined;
32
+ phone?: string | undefined;
33
+ description?: string | undefined;
34
+ endorsement?: any[] | undefined;
35
+ image?: string | {
36
+ caption?: string | undefined;
37
+ type: string;
38
+ id: string;
39
+ } | undefined;
40
+ email?: string | undefined;
41
+ address?: {
42
+ addressCountry?: string | undefined;
43
+ addressCountryCode?: string | undefined;
44
+ addressRegion?: string | undefined;
45
+ addressLocality?: string | undefined;
46
+ streetAddress?: string | undefined;
47
+ postOfficeBoxNumber?: string | undefined;
48
+ postalCode?: string | undefined;
49
+ geo?: {
50
+ type: string | [string, ...string[]];
51
+ latitude: number;
52
+ longitude: number;
53
+ } | undefined;
54
+ type: string | [string, ...string[]];
55
+ } | undefined;
56
+ otherIdentifier?: {
57
+ type: string | [string, ...string[]];
58
+ identifier: string;
59
+ identifierType: string;
60
+ }[] | undefined;
61
+ official?: string | undefined;
62
+ parentOrg?: any;
63
+ familyName?: string | undefined;
64
+ givenName?: string | undefined;
65
+ additionalName?: string | undefined;
66
+ patronymicName?: string | undefined;
67
+ honorificPrefix?: string | undefined;
68
+ honorificSuffix?: string | undefined;
69
+ familyNamePrefix?: string | undefined;
70
+ dateOfBirth?: string | undefined;
71
+ };
72
+ issuanceDate: string;
73
+ credentialSubject: {
74
+ [x: string]: any;
75
+ id?: string | undefined;
76
+ } | {
77
+ [x: string]: any;
78
+ id?: string | undefined;
79
+ }[];
80
+ proof: {
81
+ [x: string]: any;
82
+ challenge?: string | undefined;
83
+ domain?: string | undefined;
84
+ nonce?: string | undefined;
85
+ jws?: string | undefined;
86
+ type: string;
87
+ created: string;
88
+ proofPurpose: string;
89
+ verificationMethod: string;
90
+ } | {
91
+ [x: string]: any;
92
+ challenge?: string | undefined;
93
+ domain?: string | undefined;
94
+ nonce?: string | undefined;
95
+ jws?: string | undefined;
96
+ type: string;
97
+ created: string;
98
+ proofPurpose: string;
99
+ verificationMethod: string;
100
+ }[];
101
+ } | {
102
+ [x: string]: any;
103
+ id?: string | undefined;
104
+ expirationDate?: string | undefined;
105
+ credentialStatus?: {
106
+ type: string;
107
+ id: string;
108
+ } | undefined;
109
+ credentialSchema?: {
110
+ type: string;
111
+ id: string;
112
+ }[] | undefined;
113
+ refreshService?: {
114
+ [x: string]: any;
115
+ type: string;
116
+ id: string;
117
+ } | undefined;
118
+ type: [string, ...string[]];
119
+ '@context': (string | Record<string, any>)[];
120
+ issuer: string | {
121
+ [x: string]: any;
122
+ type?: string | [string, ...string[]] | undefined;
123
+ id?: string | undefined;
124
+ name?: string | undefined;
125
+ url?: string | undefined;
126
+ phone?: string | undefined;
127
+ description?: string | undefined;
128
+ endorsement?: any[] | undefined;
129
+ image?: string | {
130
+ caption?: string | undefined;
131
+ type: string;
132
+ id: string;
133
+ } | undefined;
134
+ email?: string | undefined;
135
+ address?: {
136
+ addressCountry?: string | undefined;
137
+ addressCountryCode?: string | undefined;
138
+ addressRegion?: string | undefined;
139
+ addressLocality?: string | undefined;
140
+ streetAddress?: string | undefined;
141
+ postOfficeBoxNumber?: string | undefined;
142
+ postalCode?: string | undefined;
143
+ geo?: {
144
+ type: string | [string, ...string[]];
145
+ latitude: number;
146
+ longitude: number;
147
+ } | undefined;
148
+ type: string | [string, ...string[]];
149
+ } | undefined;
150
+ otherIdentifier?: {
151
+ type: string | [string, ...string[]];
152
+ identifier: string;
153
+ identifierType: string;
154
+ }[] | undefined;
155
+ official?: string | undefined;
156
+ parentOrg?: any;
157
+ familyName?: string | undefined;
158
+ givenName?: string | undefined;
159
+ additionalName?: string | undefined;
160
+ patronymicName?: string | undefined;
161
+ honorificPrefix?: string | undefined;
162
+ honorificSuffix?: string | undefined;
163
+ familyNamePrefix?: string | undefined;
164
+ dateOfBirth?: string | undefined;
165
+ };
166
+ issuanceDate: string;
167
+ credentialSubject: {
168
+ [x: string]: any;
169
+ id?: string | undefined;
170
+ } | {
171
+ [x: string]: any;
172
+ id?: string | undefined;
173
+ }[];
174
+ proof: {
175
+ [x: string]: any;
176
+ challenge?: string | undefined;
177
+ domain?: string | undefined;
178
+ nonce?: string | undefined;
179
+ jws?: string | undefined;
180
+ type: string;
181
+ created: string;
182
+ proofPurpose: string;
183
+ verificationMethod: string;
184
+ } | {
185
+ [x: string]: any;
186
+ challenge?: string | undefined;
187
+ domain?: string | undefined;
188
+ nonce?: string | undefined;
189
+ jws?: string | undefined;
190
+ type: string;
191
+ created: string;
192
+ proofPurpose: string;
193
+ verificationMethod: string;
194
+ }[];
195
+ }[] | undefined;
196
+ holder?: string | undefined;
197
+ type: [string, ...string[]];
198
+ '@context': (string | Record<string, any>)[];
199
+ proof: {
200
+ [x: string]: any;
201
+ challenge?: string | undefined;
202
+ domain?: string | undefined;
203
+ nonce?: string | undefined;
204
+ jws?: string | undefined;
205
+ type: string;
206
+ created: string;
207
+ proofPurpose: string;
208
+ verificationMethod: string;
209
+ } | {
210
+ [x: string]: any;
211
+ challenge?: string | undefined;
212
+ domain?: string | undefined;
213
+ nonce?: string | undefined;
214
+ jws?: string | undefined;
215
+ type: string;
216
+ created: string;
217
+ proofPurpose: string;
218
+ verificationMethod: string;
219
+ }[];
220
+ }>;
@@ -0,0 +1,35 @@
1
+ import { JWK, UnsignedVC, VC, UnsignedVP, VP, VerificationCheck } from '@learncard/types';
2
+ import { Plugin, LearnCard } from '../../../types/wallet';
3
+ import { ProofOptions, InputMetadata } from '../didkit/types';
4
+ /** @group VC Plugin */
5
+ export type VCPluginDependentMethods = {
6
+ getSubjectDid: (type: 'key') => string;
7
+ getSubjectKeypair: () => JWK;
8
+ keyToVerificationMethod: (type: string, keypair: JWK) => Promise<string>;
9
+ didToVerificationMethod: (did: string) => Promise<string>;
10
+ issueCredential: (credential: UnsignedVC, options: ProofOptions, keypair: JWK) => Promise<VC>;
11
+ verifyCredential: (credential: VC, options?: ProofOptions) => Promise<VerificationCheck>;
12
+ issuePresentation: (presentation: UnsignedVP, options: ProofOptions, keypair: JWK) => Promise<VP>;
13
+ verifyPresentation: (presentation: VP | string, options?: ProofOptions) => Promise<VerificationCheck>;
14
+ resolveDid: (did: string, inputMetadata?: InputMetadata) => Promise<Record<string, any>>;
15
+ };
16
+ /** @group VC Plugin */
17
+ export type VCPluginMethods = {
18
+ issueCredential: (credential: UnsignedVC, signingOptions?: Partial<ProofOptions>) => Promise<VC>;
19
+ verifyCredential: (credential: VC, options?: Partial<ProofOptions>) => Promise<VerificationCheck>;
20
+ issuePresentation: (credential: UnsignedVP, signingOptions?: Partial<ProofOptions>) => Promise<VP>;
21
+ verifyPresentation: (presentation: VP | string, options?: Partial<ProofOptions>) => Promise<VerificationCheck>;
22
+ getTestVc: (subject?: string) => UnsignedVC;
23
+ getTestVp: (credential?: VC) => Promise<UnsignedVP>;
24
+ getDidAuthVp: (options?: ProofOptions) => Promise<VP | string>;
25
+ };
26
+ /** @group VC Plugin */
27
+ export type VCDependentLearnCard = LearnCard<any, 'id', VCPluginDependentMethods>;
28
+ /** @group VC Plugin */
29
+ export type VCImplicitLearnCard = LearnCard<any, 'id', VCPluginMethods & VCPluginDependentMethods>;
30
+ /** @group VC Plugin */
31
+ export type VerifyExtension = {
32
+ verifyCredential: (credential: VC) => Promise<VerificationCheck>;
33
+ };
34
+ /** @group VC Plugin */
35
+ export type VCPlugin = Plugin<'VC', any, VCPluginMethods, 'id', VCPluginDependentMethods>;
@@ -0,0 +1,5 @@
1
+ import { VCDependentLearnCard, VCPlugin } from './types';
2
+ /**
3
+ * @group Plugins
4
+ */
5
+ export declare const getVCPlugin: (learnCard: VCDependentLearnCard) => VCPlugin;
@@ -0,0 +1,8 @@
1
+ import { VC } from '@learncard/types';
2
+ import { ProofOptions } from '../../plugins/didkit/types';
3
+ import { VCDependentLearnCard, VCImplicitLearnCard } from './types';
4
+ export declare const verifyCredential: (initLearnCard: VCDependentLearnCard) => (_learnCard: VCImplicitLearnCard, credential: VC, options?: Partial<ProofOptions>) => Promise<{
5
+ checks: string[];
6
+ warnings: string[];
7
+ errors: string[];
8
+ }>;
@@ -0,0 +1,8 @@
1
+ import { VP } from '@learncard/types';
2
+ import { ProofOptions } from '../../plugins/didkit/types';
3
+ import { VCDependentLearnCard, VCImplicitLearnCard } from './types';
4
+ export declare const verifyPresentation: (initLearnCard: VCDependentLearnCard) => (_learnCard: VCImplicitLearnCard, presentation: VP | string, options?: Partial<ProofOptions>) => Promise<{
5
+ checks: string[];
6
+ warnings: string[];
7
+ errors: string[];
8
+ }>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Sends a POST request via fetch
3
+ */
4
+ export declare const post: (url: string, data: Record<string, any>) => Promise<Response>;
5
+ /**
6
+ * Returns whether or not an HTTP status code is successful
7
+ */
8
+ export declare const isSuccessful: (status: number) => boolean;
@@ -0,0 +1,8 @@
1
+ import { VCAPIPlugin } from './types';
2
+ /**
3
+ * @group Plugins
4
+ */
5
+ export declare const getVCAPIPlugin: ({ url: _url, did: _did, }: {
6
+ url: string;
7
+ did?: string;
8
+ }) => Promise<VCAPIPlugin>;
@@ -0,0 +1,20 @@
1
+ import { UnsignedVC, UnsignedVP, VC, VP, VerificationCheck } from '@learncard/types';
2
+ import { Plugin } from '../../../types/wallet';
3
+ /** @group VC-API Plugin */
4
+ export type APIOptions = {
5
+ created?: string;
6
+ challenge?: string;
7
+ domain?: string;
8
+ };
9
+ /** @group VC-API Plugin */
10
+ export type VCAPIPluginMethods = {
11
+ getSubjectDid: (type: string) => string;
12
+ issueCredential: (credential: UnsignedVC, signingOptions?: APIOptions) => Promise<VC>;
13
+ verifyCredential: (credential: VC, options?: Omit<APIOptions, 'created'>) => Promise<VerificationCheck>;
14
+ issuePresentation: (presentation: UnsignedVP, signingOptions?: APIOptions) => Promise<VP>;
15
+ verifyPresentation: (presentation: VP, options?: Omit<APIOptions, 'created'>) => Promise<VerificationCheck>;
16
+ getTestVc: (subject?: string) => UnsignedVC;
17
+ getTestVp: (credential?: VC) => Promise<UnsignedVP>;
18
+ };
19
+ /** @group VC-API Plugin */
20
+ export type VCAPIPlugin = Plugin<'VC API', 'id', VCAPIPluginMethods>;
@@ -0,0 +1,6 @@
1
+ import { VCResolutionPluginType } from './types';
2
+ export * from './types';
3
+ /**
4
+ * @group Plugins
5
+ */
6
+ export declare const VCResolutionPlugin: VCResolutionPluginType;
@@ -0,0 +1,13 @@
1
+ import { VC } from '@learncard/types';
2
+ import { Plugin } from '../../../types/wallet';
3
+ /** @group VC Resolution Plugin */
4
+ export type LC_URI<URI extends string = ''> = string | URI;
5
+ /** @group VC Resolution Plugin */
6
+ export type VCResolutionPluginMethods = {
7
+ resolveCredential: (uri?: LC_URI) => Promise<VC | undefined>;
8
+ };
9
+ /** @group VC Resolution Plugin */
10
+ export type ResolutionExtension<URI extends string> = {
11
+ resolveCredential: (uri?: LC_URI<URI>) => Promise<VC | undefined>;
12
+ };
13
+ export type VCResolutionPluginType = Plugin<'VC Resolution', any, VCResolutionPluginMethods>;
@@ -0,0 +1,2 @@
1
+ export { getVCTemplatesPlugin } from './vc-templates';
2
+ export * from './types';
@@ -0,0 +1,6 @@
1
+ import { UnsignedVC } from '@learncard/types';
2
+ import { VcTemplates } from './types';
3
+ /** @group VC Templates Plugin */
4
+ export declare const VC_TEMPLATES: {
5
+ [Key in keyof VcTemplates]: (args: VcTemplates[Key]) => UnsignedVC;
6
+ };
@@ -0,0 +1,40 @@
1
+ import { UnsignedVC, VC, UnsignedVP } from '@learncard/types';
2
+ import { DiscriminatedUnionize } from '../../../types/helpers';
3
+ import { Plugin } from '../../../types/wallet';
4
+ /** @group VC Templates Plugin */
5
+ export type VcTemplates = {
6
+ basic: {
7
+ did?: string;
8
+ subject?: string;
9
+ issuanceDate?: string;
10
+ };
11
+ achievement: {
12
+ did?: string;
13
+ subject?: string;
14
+ name?: string;
15
+ achievementName?: string;
16
+ description?: string;
17
+ criteriaNarrative?: string;
18
+ issuanceDate?: string;
19
+ };
20
+ jff2: {
21
+ did?: string;
22
+ subject?: string;
23
+ issuanceDate?: string;
24
+ };
25
+ };
26
+ /** @group VC Templates Plugin */
27
+ export type NewCredentialFunction = (args?: DiscriminatedUnionize<VcTemplates>) => UnsignedVC;
28
+ /** @group VC Templates Plugin */
29
+ export type VCTemplatePluginDependentMethods = {
30
+ getSubjectDid?: (type: 'key') => string;
31
+ };
32
+ /** @group VC Templates Plugin */
33
+ export type VCTemplatePluginMethods = {
34
+ newCredential: NewCredentialFunction;
35
+ newPresentation: (credential: VC, args?: {
36
+ did?: string;
37
+ }) => Promise<UnsignedVP>;
38
+ };
39
+ /** @group VC Templates Plugin */
40
+ export type VCTemplatePlugin = Plugin<'VC Templates', any, VCTemplatePluginMethods, 'id', VCTemplatePluginDependentMethods>;
@@ -0,0 +1,5 @@
1
+ import { VCTemplatePlugin } from './types';
2
+ /**
3
+ * @group Plugins
4
+ */
5
+ export declare const getVCTemplatesPlugin: () => VCTemplatePlugin;
@@ -0,0 +1,7 @@
1
+ import { VpqrPlugin, VpqrPluginDependentMethods } from './types';
2
+ import { LearnCard } from '../../../types/wallet';
3
+ export * from './types';
4
+ /**
5
+ * @group Plugins
6
+ */
7
+ export declare const getVpqrPlugin: (learnCard: LearnCard<any, any, VpqrPluginDependentMethods>) => VpqrPlugin;
@@ -0,0 +1,12 @@
1
+ import { VP } from '@learncard/types';
2
+ import { Plugin } from '../../../types/wallet';
3
+ /** @group VPQR Plugin */
4
+ export type VpqrPluginMethods = {
5
+ vpFromQrCode: (text: string) => Promise<VP>;
6
+ vpToQrCode: (vp: VP) => Promise<string>;
7
+ };
8
+ /** @group VPQR Plugin */
9
+ export type VpqrPluginDependentMethods = {
10
+ contextLoader: (url: string) => Promise<Record<string, any>>;
11
+ };
12
+ export type VpqrPlugin = Plugin<'Vpqr', any, VpqrPluginMethods, any, VpqrPluginDependentMethods>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learncard/core",
3
- "version": "8.4.2",
3
+ "version": "8.5.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/core.esm.js",
@@ -26,30 +26,32 @@
26
26
  "esbuild-jest": "^0.5.0",
27
27
  "esbuild-plugin-copy": "^1.3.0",
28
28
  "jest": "^29.3.0",
29
+ "jest-resolver-enhanced": "^1.1.0",
29
30
  "jimp": "^0.16.1",
31
+ "multiformats": "^11.0.1",
30
32
  "qrcode-reader": "^1.0.4",
31
33
  "shx": "^0.3.4",
32
34
  "ts-jest": "^29.0.3",
33
35
  "tsc-alias": "^1.6.9",
34
36
  "typescript": "^4.6.4",
35
- "@learncard/types": "5.1.1"
37
+ "@learncard/types": "5.2.0"
36
38
  },
37
- "types": "./dist/core.d.ts",
39
+ "types": "./dist/index.d.ts",
38
40
  "dependencies": {
39
- "@ceramicnetwork/common": "^2.2.1",
41
+ "@ceramicnetwork/common": "2.13.0",
40
42
  "@ceramicnetwork/http-client": "2.7.0",
41
- "@ceramicnetwork/stream-tile": "^2.2.2",
42
- "@ceramicnetwork/streamid": "^2.1.0",
43
+ "@ceramicnetwork/stream-tile": "2.9.0",
44
+ "@ceramicnetwork/streamid": "2.7.0",
43
45
  "@digitalbazaar/vpqr": "^3.0.0",
44
- "@glazed/did-datastore": "^0.3.2",
45
- "@glazed/tile-loader": "^0.2.1",
46
+ "@glazed/did-datastore": "0.3.2",
47
+ "@glazed/tile-loader": "0.2.1",
46
48
  "@uniswap/default-token-list": "^4.1.0",
47
49
  "abort-controller": "^3.0.0",
48
50
  "core-js": "^3.25.5",
49
51
  "credential-handler-polyfill": "^3.0.0",
50
52
  "cross-fetch": "^3.1.5",
51
53
  "date-fns": "^2.28.0",
52
- "dids": "^3.2.0",
54
+ "dids": "3.4.0",
53
55
  "ethers": "^5.6.9",
54
56
  "hex-lite": "^1.5.0",
55
57
  "isomorphic-fetch": "^3.0.0",
@@ -57,11 +59,11 @@
57
59
  "key-did-provider-ed25519": "^2.0.0",
58
60
  "key-did-resolver": "2.3.0",
59
61
  "web-credential-handler": "^2.0.0",
60
- "zod": "^3.17.3",
62
+ "zod": "^3.20.2",
61
63
  "@learncard/helpers": "1.0.1"
62
64
  },
63
65
  "scripts": {
64
- "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && dts-bundle-generator src/index.ts -o dist/core.d.ts --no-check && tsc-alias && shx sed -i \"s/import\\(\\\\\\\"\\.\\\\\\\"\\)\\.//g\" dist/core.d.ts",
66
+ "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && tsc --p tsconfig.build.json && tsc-alias",
65
67
  "start": "aqu watch",
66
68
  "lint": "aqu lint",
67
69
  "lint:fix": "aqu lint --fix",