@learncard/learn-cloud-plugin 2.3.29 → 2.3.31
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/README.md +11 -6
- package/dist/learn-cloud-plugin.cjs.development.cjs +117 -102
- package/dist/learn-cloud-plugin.cjs.development.cjs.map +3 -3
- package/dist/learn-cloud-plugin.cjs.production.min.cjs +42 -42
- package/dist/learn-cloud-plugin.cjs.production.min.cjs.map +4 -4
- package/dist/learn-cloud-plugin.esm.js +117 -102
- package/dist/learn-cloud-plugin.esm.js.map +3 -3
- package/package.json +65 -63
- package/src/helpers.ts +87 -0
- package/src/index.ts +2 -0
- package/src/plugin.ts +711 -0
- package/src/test/index.test.ts +84 -0
- package/src/test/mocks/sample-vcs.ts +579 -0
- package/src/types.ts +69 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const mockGetClient = jest.fn();
|
|
2
|
+
|
|
3
|
+
const mockClient = {
|
|
4
|
+
user: {
|
|
5
|
+
getDids: { query: jest.fn().mockResolvedValue([]) },
|
|
6
|
+
},
|
|
7
|
+
utilities: {
|
|
8
|
+
getDid: { query: jest.fn().mockResolvedValue('did:key:z6MkLearnCloud') },
|
|
9
|
+
},
|
|
10
|
+
storage: {
|
|
11
|
+
batchResolve: { query: jest.fn() },
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
jest.mock('@learncard/learn-cloud-client', () => ({
|
|
16
|
+
getClient: (...args: unknown[]) => mockGetClient(...args),
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
import { getLearnCloudPlugin } from '../';
|
|
20
|
+
|
|
21
|
+
const makeW3cVc = () => ({
|
|
22
|
+
'@context': ['https://www.w3.org/ns/credentials/v2'],
|
|
23
|
+
type: ['VerifiableCredential', 'TestCredential'],
|
|
24
|
+
issuer: 'did:web:issuer.example',
|
|
25
|
+
credentialSubject: { id: 'did:key:holder', name: 'Ada' },
|
|
26
|
+
validFrom: '2024-01-01T00:00:00.000Z',
|
|
27
|
+
proof: {
|
|
28
|
+
type: 'Ed25519Signature2020',
|
|
29
|
+
created: '2024-01-01T00:00:00.000Z',
|
|
30
|
+
proofPurpose: 'assertionMethod',
|
|
31
|
+
verificationMethod: 'did:web:issuer.example#key-1',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const makeLearnCard = () => ({
|
|
36
|
+
id: {
|
|
37
|
+
did: () => 'did:key:z6MkHolder',
|
|
38
|
+
},
|
|
39
|
+
invoke: {
|
|
40
|
+
getDidAuthVp: jest.fn().mockResolvedValue('did-auth-jwt'),
|
|
41
|
+
decryptDagJwe: jest.fn(async value => value),
|
|
42
|
+
},
|
|
43
|
+
debug: jest.fn(),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('LearnCloud Plugin', () => {
|
|
47
|
+
beforeEach(() => {
|
|
48
|
+
jest.clearAllMocks();
|
|
49
|
+
mockGetClient.mockResolvedValue(mockClient);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('exposes a function', () => {
|
|
53
|
+
expect(getLearnCloudPlugin).toBeDefined();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('projects envelope-backed credentials in learnCloudBatchResolve', async () => {
|
|
57
|
+
const compact =
|
|
58
|
+
'eyJhbGciOiJFZERTQSIsInR5cCI6ImRjK3NkLWp3dCJ9.eyJpc3MiOiJkaWQ6d2ViOmlzc3Vlci5leGFtcGxlIiwiaWF0IjoxNzAwMDAwMDAwLCJ2Y3QiOiJodHRwczovL2V4YW1wbGUuY29tL2NyZWRlbnRpYWxzL2VtcGxveW1lbnQiLCJuYW1lIjoiQWRhIn0.AAAA~';
|
|
59
|
+
|
|
60
|
+
mockClient.storage.batchResolve.query.mockResolvedValue([
|
|
61
|
+
makeW3cVc(),
|
|
62
|
+
{ format: 'dc+sd-jwt', data: compact },
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
const learnCard = makeLearnCard();
|
|
66
|
+
const plugin = await getLearnCloudPlugin(learnCard as never, 'https://cloud.example');
|
|
67
|
+
|
|
68
|
+
const results = await plugin.methods.learnCloudBatchResolve(learnCard as never, [
|
|
69
|
+
'lc:cloud:https%3A%2F%2Fcloud.example:cred:1',
|
|
70
|
+
'lc:cloud:https%3A%2F%2Fcloud.example:cred:2',
|
|
71
|
+
]);
|
|
72
|
+
|
|
73
|
+
expect(results).toHaveLength(2);
|
|
74
|
+
expect(results[0]).toMatchObject({
|
|
75
|
+
issuer: 'did:web:issuer.example',
|
|
76
|
+
type: ['VerifiableCredential', 'TestCredential'],
|
|
77
|
+
});
|
|
78
|
+
expect(results[1]).toMatchObject({
|
|
79
|
+
issuer: 'did:web:issuer.example',
|
|
80
|
+
type: ['VerifiableCredential', 'SdJwtVcCredential', 'Employment'],
|
|
81
|
+
credentialSubject: { name: 'Ada' },
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1,579 @@
|
|
|
1
|
+
import { VC, CredentialRecord } from '@learncard/types';
|
|
2
|
+
|
|
3
|
+
export const SAMPLE_VCS: Record<string, VC> = {
|
|
4
|
+
VALID_BOOST: {
|
|
5
|
+
'@context': [
|
|
6
|
+
'https://www.w3.org/2018/credentials/v1',
|
|
7
|
+
{
|
|
8
|
+
'lcn': 'https://docs.learncard.com/definitions#',
|
|
9
|
+
'id': '@id',
|
|
10
|
+
'type': '@type',
|
|
11
|
+
'cred': 'https://www.w3.org/2018/credentials#',
|
|
12
|
+
'CertifiedBoostCredential': {
|
|
13
|
+
'@context': {
|
|
14
|
+
'@version': 1.1,
|
|
15
|
+
'boostCredential': {
|
|
16
|
+
'@container': '@graph',
|
|
17
|
+
'@id': 'cred:VerifiableCredential',
|
|
18
|
+
'@type': '@id',
|
|
19
|
+
},
|
|
20
|
+
'boostId': { '@id': 'lcn:boostId', '@type': 'xsd:string' },
|
|
21
|
+
},
|
|
22
|
+
'@id': 'lcn:certifiedBoostCredential',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
'id': 'urn:uuid:8f6579d1-e217-4ad7-bb65-1d2dad2fc9b4',
|
|
27
|
+
'type': ['VerifiableCredential', 'CertifiedBoostCredential'],
|
|
28
|
+
'issuer': 'did:web:localhost%3A3000',
|
|
29
|
+
'issuanceDate': '2023-03-03T17:35:21.531Z',
|
|
30
|
+
'credentialSubject': { 'id': 'did:web:localhost%3A3000' },
|
|
31
|
+
'proof': {
|
|
32
|
+
'type': 'Ed25519Signature2020',
|
|
33
|
+
'created': '2023-03-03T17:35:21.654Z',
|
|
34
|
+
'proofPurpose': 'assertionMethod',
|
|
35
|
+
'verificationMethod': 'did:web:localhost%3A3000#owner',
|
|
36
|
+
'@context': ['https://w3id.org/security/suites/ed25519-2020/v1'],
|
|
37
|
+
'proofValue':
|
|
38
|
+
'z53MJtv7bdGWVkcNkUZyy8xzDQWQkSUx8nY9B7ETdAgLejJGARYQdParKCsV6tNig3k13qP4nFJDfTLWMp94hsN2q',
|
|
39
|
+
},
|
|
40
|
+
'boostCredential': {
|
|
41
|
+
'@context': [
|
|
42
|
+
'https://www.w3.org/2018/credentials/v1',
|
|
43
|
+
'https://purl.imsglobal.org/spec/ob/v3p0/context.json',
|
|
44
|
+
{
|
|
45
|
+
'BoostCredential': {
|
|
46
|
+
'@context': {
|
|
47
|
+
'attachments': {
|
|
48
|
+
'@container': '@set',
|
|
49
|
+
'@context': {
|
|
50
|
+
'title': {
|
|
51
|
+
'@id': 'lcn:boostAttachmentTitle',
|
|
52
|
+
'@type': 'xsd:string',
|
|
53
|
+
},
|
|
54
|
+
'type': {
|
|
55
|
+
'@id': 'lcn:boostAttachmentType',
|
|
56
|
+
'@type': 'xsd:string',
|
|
57
|
+
},
|
|
58
|
+
'url': {
|
|
59
|
+
'@id': 'lcn:boostAttachmentUrl',
|
|
60
|
+
'@type': 'xsd:string',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
'@id': 'lcn:boostAttachments',
|
|
64
|
+
},
|
|
65
|
+
'boostId': { '@id': 'lcn:boostId', '@type': 'xsd:string' },
|
|
66
|
+
'display': {
|
|
67
|
+
'@context': {
|
|
68
|
+
'backgroundColor': {
|
|
69
|
+
'@id': 'lcn:boostBackgroundColor',
|
|
70
|
+
'@type': 'xsd:string',
|
|
71
|
+
},
|
|
72
|
+
'backgroundImage': {
|
|
73
|
+
'@id': 'lcn:boostBackgroundImage',
|
|
74
|
+
'@type': 'xsd:string',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
'@id': 'lcn:boostDisplay',
|
|
78
|
+
},
|
|
79
|
+
'image': { '@id': 'lcn:boostImage', '@type': 'xsd:string' },
|
|
80
|
+
},
|
|
81
|
+
'@id': 'lcn:boostCredential',
|
|
82
|
+
},
|
|
83
|
+
'lcn': 'https://docs.learncard.com/definitions#',
|
|
84
|
+
'type': '@type',
|
|
85
|
+
'xsd': 'https://www.w3.org/2001/XMLSchema#',
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
'boostId':
|
|
89
|
+
'lc:network:localhost%3A3000/trpc:boost:8adff1c1-696d-49b3-bffc-8eea89f72e26',
|
|
90
|
+
'credentialSubject': {
|
|
91
|
+
'achievement': {
|
|
92
|
+
'achievementType': 'Influencer',
|
|
93
|
+
'criteria': { 'narrative': 'Earned by being Goody.' },
|
|
94
|
+
'description': 'Goody People Earn Goody Badge',
|
|
95
|
+
'id': 'urn:uuid:123',
|
|
96
|
+
'image': '',
|
|
97
|
+
'name': 'Goodynwaa',
|
|
98
|
+
'type': ['Achievement'],
|
|
99
|
+
},
|
|
100
|
+
'id': 'did:web:localhost%3A3000:users:bbb',
|
|
101
|
+
'type': ['AchievementSubject'],
|
|
102
|
+
},
|
|
103
|
+
'issuanceDate': '2020-08-19T21:41:50Z',
|
|
104
|
+
'issuer': 'did:web:localhost%3A3000:users:test',
|
|
105
|
+
'name': 'Goody Boost',
|
|
106
|
+
'proof': {
|
|
107
|
+
'@context': ['https://w3id.org/security/suites/ed25519-2020/v1'],
|
|
108
|
+
'created': '2023-03-03T17:35:19.948Z',
|
|
109
|
+
'proofPurpose': 'assertionMethod',
|
|
110
|
+
'proofValue':
|
|
111
|
+
'z53NHZJJWogLSDRT8Pqmkd2zkTz7bMhA1FbULc6GWshTDiJgQyu9tQ3VtHMdB7vyHnyaUtczKZWFo57fS5tWfuo6L',
|
|
112
|
+
'type': 'Ed25519Signature2020',
|
|
113
|
+
'verificationMethod': 'did:web:localhost%3A3000:users:test#owner',
|
|
114
|
+
},
|
|
115
|
+
'type': ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'],
|
|
116
|
+
},
|
|
117
|
+
'boostId': 'lc:network:localhost%3A3000/trpc:boost:8adff1c1-696d-49b3-bffc-8eea89f72e26',
|
|
118
|
+
},
|
|
119
|
+
VALID_BOOST_OUTSIDE_REGISTRY: {
|
|
120
|
+
'@context': [
|
|
121
|
+
'https://www.w3.org/2018/credentials/v1',
|
|
122
|
+
{
|
|
123
|
+
'lcn': 'https://docs.learncard.com/definitions#',
|
|
124
|
+
'id': '@id',
|
|
125
|
+
'type': '@type',
|
|
126
|
+
'cred': 'https://www.w3.org/2018/credentials#',
|
|
127
|
+
'CertifiedBoostCredential': {
|
|
128
|
+
'@context': {
|
|
129
|
+
'@version': 1.1,
|
|
130
|
+
'boostCredential': {
|
|
131
|
+
'@container': '@graph',
|
|
132
|
+
'@id': 'cred:VerifiableCredential',
|
|
133
|
+
'@type': '@id',
|
|
134
|
+
},
|
|
135
|
+
'boostId': { '@id': 'lcn:boostId', '@type': 'xsd:string' },
|
|
136
|
+
},
|
|
137
|
+
'@id': 'lcn:certifiedBoostCredential',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
'id': 'urn:uuid:8f6579d1-e217-4ad7-bb65-1d2dad2fc9b4',
|
|
142
|
+
'type': ['VerifiableCredential', 'CertifiedBoostCredential'],
|
|
143
|
+
'issuer': 'did:web:localhost%3A3000',
|
|
144
|
+
'issuanceDate': '2023-03-03T17:35:21.531Z',
|
|
145
|
+
'credentialSubject': { 'id': 'did:web:localhost%3A3000' },
|
|
146
|
+
'proof': {
|
|
147
|
+
'type': 'Ed25519Signature2020',
|
|
148
|
+
'created': '2023-03-03T17:35:21.654Z',
|
|
149
|
+
'proofPurpose': 'assertionMethod',
|
|
150
|
+
'verificationMethod': 'did:web:localhost%3A3000#owner',
|
|
151
|
+
'@context': ['https://w3id.org/security/suites/ed25519-2020/v1'],
|
|
152
|
+
'proofValue':
|
|
153
|
+
'z53MJtv7bdGWVkcNkUZyy8xzDQWQkSUx8nY9B7ETdAgLejJGARYQdParKCsV6tNig3k13qP4nFJDfTLWMp94hsN2q',
|
|
154
|
+
},
|
|
155
|
+
'boostCredential': {
|
|
156
|
+
'@context': [
|
|
157
|
+
'https://www.w3.org/2018/credentials/v1',
|
|
158
|
+
'https://purl.imsglobal.org/spec/ob/v3p0/context.json',
|
|
159
|
+
{
|
|
160
|
+
'BoostCredential': {
|
|
161
|
+
'@context': {
|
|
162
|
+
'attachments': {
|
|
163
|
+
'@container': '@set',
|
|
164
|
+
'@context': {
|
|
165
|
+
'title': {
|
|
166
|
+
'@id': 'lcn:boostAttachmentTitle',
|
|
167
|
+
'@type': 'xsd:string',
|
|
168
|
+
},
|
|
169
|
+
'type': {
|
|
170
|
+
'@id': 'lcn:boostAttachmentType',
|
|
171
|
+
'@type': 'xsd:string',
|
|
172
|
+
},
|
|
173
|
+
'url': {
|
|
174
|
+
'@id': 'lcn:boostAttachmentUrl',
|
|
175
|
+
'@type': 'xsd:string',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
'@id': 'lcn:boostAttachments',
|
|
179
|
+
},
|
|
180
|
+
'boostId': { '@id': 'lcn:boostId', '@type': 'xsd:string' },
|
|
181
|
+
'display': {
|
|
182
|
+
'@context': {
|
|
183
|
+
'backgroundColor': {
|
|
184
|
+
'@id': 'lcn:boostBackgroundColor',
|
|
185
|
+
'@type': 'xsd:string',
|
|
186
|
+
},
|
|
187
|
+
'backgroundImage': {
|
|
188
|
+
'@id': 'lcn:boostBackgroundImage',
|
|
189
|
+
'@type': 'xsd:string',
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
'@id': 'lcn:boostDisplay',
|
|
193
|
+
},
|
|
194
|
+
'image': { '@id': 'lcn:boostImage', '@type': 'xsd:string' },
|
|
195
|
+
},
|
|
196
|
+
'@id': 'lcn:boostCredential',
|
|
197
|
+
},
|
|
198
|
+
'lcn': 'https://docs.learncard.com/definitions#',
|
|
199
|
+
'type': '@type',
|
|
200
|
+
'xsd': 'https://www.w3.org/2001/XMLSchema#',
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
'boostId':
|
|
204
|
+
'lc:network:localhost%3A3000/trpc:boost:8adff1c1-696d-49b3-bffc-8eea89f72e26',
|
|
205
|
+
'credentialSubject': {
|
|
206
|
+
'achievement': {
|
|
207
|
+
'achievementType': 'Influencer',
|
|
208
|
+
'criteria': { 'narrative': 'Earned by being Goody.' },
|
|
209
|
+
'description': 'Goody People Earn Goody Badge',
|
|
210
|
+
'id': 'urn:uuid:123',
|
|
211
|
+
'image': '',
|
|
212
|
+
'name': 'Goodynwaa',
|
|
213
|
+
'type': ['Achievement'],
|
|
214
|
+
},
|
|
215
|
+
'id': 'did:web:localhost%3A3000:users:bbb',
|
|
216
|
+
'type': ['AchievementSubject'],
|
|
217
|
+
},
|
|
218
|
+
'issuanceDate': '2020-08-19T21:41:50Z',
|
|
219
|
+
'issuer': 'did:web:localhost%3A3000:users:test',
|
|
220
|
+
'name': 'Goody Boost',
|
|
221
|
+
'proof': {
|
|
222
|
+
'@context': ['https://w3id.org/security/suites/ed25519-2020/v1'],
|
|
223
|
+
'created': '2023-03-03T17:35:19.948Z',
|
|
224
|
+
'proofPurpose': 'assertionMethod',
|
|
225
|
+
'proofValue':
|
|
226
|
+
'z53NHZJJWogLSDRT8Pqmkd2zkTz7bMhA1FbULc6GWshTDiJgQyu9tQ3VtHMdB7vyHnyaUtczKZWFo57fS5tWfuo6L',
|
|
227
|
+
'type': 'Ed25519Signature2020',
|
|
228
|
+
'verificationMethod': 'did:web:localhost%3A3000:users:test#owner',
|
|
229
|
+
},
|
|
230
|
+
'type': ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'],
|
|
231
|
+
},
|
|
232
|
+
'boostId': 'lc:network:localhost%3A3000/trpc:boost:8adff1c1-696d-49b3-bffc-8eea89f72e26',
|
|
233
|
+
},
|
|
234
|
+
TAMPERED_BOOST_CERTIFICATE: {
|
|
235
|
+
'@context': [
|
|
236
|
+
'https://www.w3.org/2018/credentials/v1',
|
|
237
|
+
{
|
|
238
|
+
'lcn': 'https://docs.learncard.com/definitions#',
|
|
239
|
+
'id': '@id',
|
|
240
|
+
'type': '@type',
|
|
241
|
+
'cred': 'https://www.w3.org/2018/credentials#',
|
|
242
|
+
'CertifiedBoostCredential': {
|
|
243
|
+
'@context': {
|
|
244
|
+
'@version': 1.1,
|
|
245
|
+
'boostCredential': {
|
|
246
|
+
'@container': '@graph',
|
|
247
|
+
'@id': 'cred:VerifiableCredential',
|
|
248
|
+
'@type': '@id',
|
|
249
|
+
},
|
|
250
|
+
'boostId': { '@id': 'lcn:boostId', '@type': 'xsd:string' },
|
|
251
|
+
},
|
|
252
|
+
'@id': 'lcn:certifiedBoostCredential',
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
],
|
|
256
|
+
'id': 'urn:uuid:8f6579d1-e217-4ad7-bb65-1d2dad2fc9b4',
|
|
257
|
+
'type': ['VerifiableCredential', 'CertifiedBoostCredential'],
|
|
258
|
+
'issuer': 'did:web:localhost%3A3000',
|
|
259
|
+
'issuanceDate': '2023-03-03T17:35:21.531Z',
|
|
260
|
+
'credentialSubject': { 'id': 'did:web:localhost%3A3000' },
|
|
261
|
+
'proof': {
|
|
262
|
+
'type': 'Ed25519Signature2020',
|
|
263
|
+
'created': '2023-03-03T17:35:21.654Z',
|
|
264
|
+
'proofPurpose': 'assertionMethod',
|
|
265
|
+
'verificationMethod': 'did:web:localhost%3A3000#owner',
|
|
266
|
+
'@context': ['https://w3id.org/security/suites/ed25519-2020/v1'],
|
|
267
|
+
'proofValue':
|
|
268
|
+
'z53MJtv7bdGWVkcNkUZyy8xzDQWQkSUx8nY9B7ETdAgLejJGARYQdParKCsV6tNig3k13qP4nFJDfTLWMp94hsN2q',
|
|
269
|
+
},
|
|
270
|
+
'boostCredential': {
|
|
271
|
+
'@context': [
|
|
272
|
+
'https://www.w3.org/2018/credentials/v1',
|
|
273
|
+
'https://purl.imsglobal.org/spec/ob/v3p0/context.json',
|
|
274
|
+
{
|
|
275
|
+
'BoostCredential': {
|
|
276
|
+
'@context': {
|
|
277
|
+
'attachments': {
|
|
278
|
+
'@container': '@set',
|
|
279
|
+
'@context': {
|
|
280
|
+
'title': {
|
|
281
|
+
'@id': 'lcn:boostAttachmentTitle',
|
|
282
|
+
'@type': 'xsd:string',
|
|
283
|
+
},
|
|
284
|
+
'type': {
|
|
285
|
+
'@id': 'lcn:boostAttachmentType',
|
|
286
|
+
'@type': 'xsd:string',
|
|
287
|
+
},
|
|
288
|
+
'url': {
|
|
289
|
+
'@id': 'lcn:boostAttachmentUrl',
|
|
290
|
+
'@type': 'xsd:string',
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
'@id': 'lcn:boostAttachments',
|
|
294
|
+
},
|
|
295
|
+
'boostId': { '@id': 'lcn:boostId', '@type': 'xsd:string' },
|
|
296
|
+
'display': {
|
|
297
|
+
'@context': {
|
|
298
|
+
'backgroundColor': {
|
|
299
|
+
'@id': 'lcn:boostBackgroundColor',
|
|
300
|
+
'@type': 'xsd:string',
|
|
301
|
+
},
|
|
302
|
+
'backgroundImage': {
|
|
303
|
+
'@id': 'lcn:boostBackgroundImage',
|
|
304
|
+
'@type': 'xsd:string',
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
'@id': 'lcn:boostDisplay',
|
|
308
|
+
},
|
|
309
|
+
'image': { '@id': 'lcn:boostImage', '@type': 'xsd:string' },
|
|
310
|
+
},
|
|
311
|
+
'@id': 'lcn:boostCredential',
|
|
312
|
+
},
|
|
313
|
+
'lcn': 'https://docs.learncard.com/definitions#',
|
|
314
|
+
'type': '@type',
|
|
315
|
+
'xsd': 'https://www.w3.org/2001/XMLSchema#',
|
|
316
|
+
},
|
|
317
|
+
],
|
|
318
|
+
'boostId': 'lc:network:localhost%3A3000/trpc:boost:8adff1c1-696d-49b3-bffc-TAMPER',
|
|
319
|
+
'credentialSubject': {
|
|
320
|
+
'achievement': {
|
|
321
|
+
'achievementType': 'Influencer',
|
|
322
|
+
'criteria': { 'narrative': 'Earned by being Goody.' },
|
|
323
|
+
'description': 'Goody People Earn Goody Badge',
|
|
324
|
+
'id': 'urn:uuid:123',
|
|
325
|
+
'image': '',
|
|
326
|
+
'name': 'Goodynwaa',
|
|
327
|
+
'type': ['Achievement'],
|
|
328
|
+
},
|
|
329
|
+
'id': 'did:web:localhost%3A3000:users:bbb',
|
|
330
|
+
'type': ['AchievementSubject'],
|
|
331
|
+
},
|
|
332
|
+
'issuanceDate': '2020-08-19T21:41:50Z',
|
|
333
|
+
'issuer': 'did:web:localhost%3A3000:users:test',
|
|
334
|
+
'name': 'Goody Boost',
|
|
335
|
+
'proof': {
|
|
336
|
+
'@context': ['https://w3id.org/security/suites/ed25519-2020/v1'],
|
|
337
|
+
'created': '2023-03-03T17:35:19.948Z',
|
|
338
|
+
'proofPurpose': 'assertionMethod',
|
|
339
|
+
'proofValue':
|
|
340
|
+
'z53NHZJJWogLSDRT8Pqmkd2zkTz7bMhA1FbULc6GWshTDiJgQyu9tQ3VtHMdB7vyHnyaUtczKZWFo57fS5tWfuo6L',
|
|
341
|
+
'type': 'Ed25519Signature2020',
|
|
342
|
+
'verificationMethod': 'did:web:localhost%3A3000:users:test#owner',
|
|
343
|
+
},
|
|
344
|
+
'type': ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'],
|
|
345
|
+
},
|
|
346
|
+
'boostId': 'lc:network:localhost%3A3000/trpc:boost:8adff1c1-696d-49b3-bffc-8eea89f72e26',
|
|
347
|
+
},
|
|
348
|
+
TAMPERED_BOOST_CREDENTIAL: {
|
|
349
|
+
'@context': [
|
|
350
|
+
'https://www.w3.org/2018/credentials/v1',
|
|
351
|
+
{
|
|
352
|
+
'lcn': 'https://docs.learncard.com/definitions#',
|
|
353
|
+
'id': '@id',
|
|
354
|
+
'type': '@type',
|
|
355
|
+
'cred': 'https://www.w3.org/2018/credentials#',
|
|
356
|
+
'CertifiedBoostCredential': {
|
|
357
|
+
'@context': {
|
|
358
|
+
'@version': 1.1,
|
|
359
|
+
'boostCredential': {
|
|
360
|
+
'@container': '@graph',
|
|
361
|
+
'@id': 'cred:VerifiableCredential',
|
|
362
|
+
'@type': '@id',
|
|
363
|
+
},
|
|
364
|
+
'boostId': { '@id': 'lcn:boostId', '@type': 'xsd:string' },
|
|
365
|
+
},
|
|
366
|
+
'@id': 'lcn:certifiedBoostCredential',
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
],
|
|
370
|
+
'id': 'urn:uuid:8f6579d1-e217-4ad7-bb65-1d2dad2fc9b4',
|
|
371
|
+
'type': ['VerifiableCredential', 'CertifiedBoostCredential'],
|
|
372
|
+
'issuer': 'did:web:localhost%3A3000',
|
|
373
|
+
'issuanceDate': '2023-03-03T17:35:21.531Z',
|
|
374
|
+
'credentialSubject': { 'id': 'did:web:localhost%3A3000' },
|
|
375
|
+
'proof': {
|
|
376
|
+
'type': 'Ed25519Signature2020',
|
|
377
|
+
'created': '2023-03-03T17:35:21.654Z',
|
|
378
|
+
'proofPurpose': 'assertionMethod',
|
|
379
|
+
'verificationMethod': 'did:web:localhost%3A3000#owner',
|
|
380
|
+
'@context': ['https://w3id.org/security/suites/ed25519-2020/v1'],
|
|
381
|
+
'proofValue':
|
|
382
|
+
'z53MJtv7bdGWVkcNkUZyy8xzDQWQkSUx8nY9B7ETdAgLejJGARYQdParKCsV6tNig3k13qP4nFJDfTLWMp94hsN2q',
|
|
383
|
+
},
|
|
384
|
+
'boostCredential': {
|
|
385
|
+
'@context': [
|
|
386
|
+
'https://www.w3.org/2018/credentials/v1',
|
|
387
|
+
'https://purl.imsglobal.org/spec/ob/v3p0/context.json',
|
|
388
|
+
{
|
|
389
|
+
'BoostCredential': {
|
|
390
|
+
'@context': {
|
|
391
|
+
'attachments': {
|
|
392
|
+
'@container': '@set',
|
|
393
|
+
'@context': {
|
|
394
|
+
'title': {
|
|
395
|
+
'@id': 'lcn:boostAttachmentTitle',
|
|
396
|
+
'@type': 'xsd:string',
|
|
397
|
+
},
|
|
398
|
+
'type': {
|
|
399
|
+
'@id': 'lcn:boostAttachmentType',
|
|
400
|
+
'@type': 'xsd:string',
|
|
401
|
+
},
|
|
402
|
+
'url': {
|
|
403
|
+
'@id': 'lcn:boostAttachmentUrl',
|
|
404
|
+
'@type': 'xsd:string',
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
'@id': 'lcn:boostAttachments',
|
|
408
|
+
},
|
|
409
|
+
'boostId': { '@id': 'lcn:boostId', '@type': 'xsd:string' },
|
|
410
|
+
'display': {
|
|
411
|
+
'@context': {
|
|
412
|
+
'backgroundColor': {
|
|
413
|
+
'@id': 'lcn:boostBackgroundColor',
|
|
414
|
+
'@type': 'xsd:string',
|
|
415
|
+
},
|
|
416
|
+
'backgroundImage': {
|
|
417
|
+
'@id': 'lcn:boostBackgroundImage',
|
|
418
|
+
'@type': 'xsd:string',
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
'@id': 'lcn:boostDisplay',
|
|
422
|
+
},
|
|
423
|
+
'image': { '@id': 'lcn:boostImage', '@type': 'xsd:string' },
|
|
424
|
+
},
|
|
425
|
+
'@id': 'lcn:boostCredential',
|
|
426
|
+
},
|
|
427
|
+
'lcn': 'https://docs.learncard.com/definitions#',
|
|
428
|
+
'type': '@type',
|
|
429
|
+
'xsd': 'https://www.w3.org/2001/XMLSchema#',
|
|
430
|
+
},
|
|
431
|
+
],
|
|
432
|
+
'boostId':
|
|
433
|
+
'lc:network:localhost%3A3000/trpc:boost:8adff1c1-696d-49b3-bffc-8eea89f72e26',
|
|
434
|
+
'credentialSubject': {
|
|
435
|
+
'achievement': {
|
|
436
|
+
'achievementType': 'Influencer',
|
|
437
|
+
'criteria': { 'narrative': 'Earned by being Goody.' },
|
|
438
|
+
'description': 'Goody People Earn Goody Badge',
|
|
439
|
+
'id': 'urn:uuid:123',
|
|
440
|
+
'image': '',
|
|
441
|
+
'name': 'Goodynwaa',
|
|
442
|
+
'type': ['Achievement'],
|
|
443
|
+
},
|
|
444
|
+
'id': 'did:web:localhost%3A3000:users:bbb',
|
|
445
|
+
'type': ['AchievementSubject'],
|
|
446
|
+
},
|
|
447
|
+
'issuanceDate': '2020-08-19T21:41:50Z',
|
|
448
|
+
'issuer': 'did:web:localhost%3A3000:users:test',
|
|
449
|
+
'name': 'Goody Boost',
|
|
450
|
+
'proof': {
|
|
451
|
+
'@context': ['https://w3id.org/security/suites/ed25519-2020/v1'],
|
|
452
|
+
'created': '2023-03-03T17:35:19.948Z',
|
|
453
|
+
'proofPurpose': 'assertionMethod',
|
|
454
|
+
'proofValue':
|
|
455
|
+
'z53NHZJJWogLSDRT8Pqmkd2zkTz7bMhA1FbULc6GWshTDiJgQyu9tQ3VtHMdB7vyHnyaUtczKZWFo57fS5tWfuo6L',
|
|
456
|
+
'type': 'Ed25519Signature2020',
|
|
457
|
+
'verificationMethod': 'did:web:localhost%3A3000:users:test#owner',
|
|
458
|
+
},
|
|
459
|
+
'type': ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'],
|
|
460
|
+
},
|
|
461
|
+
'boostId': 'lc:network:localhost%3A3000/trpc:boost:8adff1c1-696d-49b3-bffc-TAMPER',
|
|
462
|
+
},
|
|
463
|
+
MISMATCHED_BOOST_ID_CREDENTIAL: {
|
|
464
|
+
'@context': [
|
|
465
|
+
'https://www.w3.org/2018/credentials/v1',
|
|
466
|
+
{
|
|
467
|
+
'lcn': 'https://docs.learncard.com/definitions#',
|
|
468
|
+
'id': '@id',
|
|
469
|
+
'type': '@type',
|
|
470
|
+
'cred': 'https://www.w3.org/2018/credentials#',
|
|
471
|
+
'CertifiedBoostCredential': {
|
|
472
|
+
'@context': {
|
|
473
|
+
'@version': 1.1,
|
|
474
|
+
'boostCredential': {
|
|
475
|
+
'@container': '@graph',
|
|
476
|
+
'@id': 'cred:VerifiableCredential',
|
|
477
|
+
'@type': '@id',
|
|
478
|
+
},
|
|
479
|
+
'boostId': { '@id': 'lcn:boostId', '@type': 'xsd:string' },
|
|
480
|
+
},
|
|
481
|
+
'@id': 'lcn:certifiedBoostCredential',
|
|
482
|
+
},
|
|
483
|
+
},
|
|
484
|
+
],
|
|
485
|
+
'id': 'urn:uuid:86d8c5c0-ce4b-4e42-a4e6-3624d65b1631',
|
|
486
|
+
'type': ['VerifiableCredential', 'CertifiedBoostCredential'],
|
|
487
|
+
'issuer': 'did:web:localhost%3A3000',
|
|
488
|
+
'issuanceDate': '2023-03-03T20:44:50.799Z',
|
|
489
|
+
'credentialSubject': { 'id': 'did:web:localhost%3A3000' },
|
|
490
|
+
'proof': {
|
|
491
|
+
'type': 'Ed25519Signature2020',
|
|
492
|
+
'created': '2023-03-03T20:44:50.917Z',
|
|
493
|
+
'proofPurpose': 'assertionMethod',
|
|
494
|
+
'verificationMethod': 'did:web:localhost%3A3000#owner',
|
|
495
|
+
'@context': ['https://w3id.org/security/suites/ed25519-2020/v1'],
|
|
496
|
+
'proofValue':
|
|
497
|
+
'z4eYynEgQwZJDMTmtKrDVLStQyQ6FaqeNKpDmUH8APZVRExqUPLqgYjeabyqNnXbi9MUeNW77hLGU12gHuoXKurRq',
|
|
498
|
+
},
|
|
499
|
+
'boostCredential': {
|
|
500
|
+
'@context': [
|
|
501
|
+
'https://www.w3.org/2018/credentials/v1',
|
|
502
|
+
'https://purl.imsglobal.org/spec/ob/v3p0/context.json',
|
|
503
|
+
{
|
|
504
|
+
'BoostCredential': {
|
|
505
|
+
'@context': {
|
|
506
|
+
'attachments': {
|
|
507
|
+
'@container': '@set',
|
|
508
|
+
'@context': {
|
|
509
|
+
'title': {
|
|
510
|
+
'@id': 'lcn:boostAttachmentTitle',
|
|
511
|
+
'@type': 'xsd:string',
|
|
512
|
+
},
|
|
513
|
+
'type': {
|
|
514
|
+
'@id': 'lcn:boostAttachmentType',
|
|
515
|
+
'@type': 'xsd:string',
|
|
516
|
+
},
|
|
517
|
+
'url': {
|
|
518
|
+
'@id': 'lcn:boostAttachmentUrl',
|
|
519
|
+
'@type': 'xsd:string',
|
|
520
|
+
},
|
|
521
|
+
},
|
|
522
|
+
'@id': 'lcn:boostAttachments',
|
|
523
|
+
},
|
|
524
|
+
'boostId': { '@id': 'lcn:boostId', '@type': 'xsd:string' },
|
|
525
|
+
'display': {
|
|
526
|
+
'@context': {
|
|
527
|
+
'backgroundColor': {
|
|
528
|
+
'@id': 'lcn:boostBackgroundColor',
|
|
529
|
+
'@type': 'xsd:string',
|
|
530
|
+
},
|
|
531
|
+
'backgroundImage': {
|
|
532
|
+
'@id': 'lcn:boostBackgroundImage',
|
|
533
|
+
'@type': 'xsd:string',
|
|
534
|
+
},
|
|
535
|
+
},
|
|
536
|
+
'@id': 'lcn:boostDisplay',
|
|
537
|
+
},
|
|
538
|
+
'image': { '@id': 'lcn:boostImage', '@type': 'xsd:string' },
|
|
539
|
+
},
|
|
540
|
+
'@id': 'lcn:boostCredential',
|
|
541
|
+
},
|
|
542
|
+
'lcn': 'https://docs.learncard.com/definitions#',
|
|
543
|
+
'type': '@type',
|
|
544
|
+
'xsd': 'https://www.w3.org/2001/XMLSchema#',
|
|
545
|
+
},
|
|
546
|
+
],
|
|
547
|
+
'boostId':
|
|
548
|
+
'lc:network:localhost%3A3000/trpc:boost:8adff1c1-696d-49b3-bffc-8eea89f72e26',
|
|
549
|
+
'credentialSubject': {
|
|
550
|
+
'achievement': {
|
|
551
|
+
'achievementType': 'Influencer',
|
|
552
|
+
'criteria': { 'narrative': 'Earned by being Goody.' },
|
|
553
|
+
'description': 'Goody People Earn Goody Badge',
|
|
554
|
+
'id': 'urn:uuid:123',
|
|
555
|
+
'image': '',
|
|
556
|
+
'name': 'Goodynwaa',
|
|
557
|
+
'type': ['Achievement'],
|
|
558
|
+
},
|
|
559
|
+
'id': 'did:web:localhost%3A3000:users:bbb',
|
|
560
|
+
'type': ['AchievementSubject'],
|
|
561
|
+
},
|
|
562
|
+
'issuanceDate': '2020-08-19T21:41:50Z',
|
|
563
|
+
'issuer': 'did:web:localhost%3A3000:users:test',
|
|
564
|
+
'name': 'Goody Boost',
|
|
565
|
+
'proof': {
|
|
566
|
+
'@context': ['https://w3id.org/security/suites/ed25519-2020/v1'],
|
|
567
|
+
'created': '2023-03-03T20:44:49.001Z',
|
|
568
|
+
'proofPurpose': 'assertionMethod',
|
|
569
|
+
'proofValue':
|
|
570
|
+
'z2Uz1KyAwep5h5L3GSubrXSZZ5BpUpnVqwLB4uFHHQENTNZEjZVCqXgwwJkyWMPeRHSX3TWSUHwW1oYaNTq5tsCzQ',
|
|
571
|
+
'type': 'Ed25519Signature2020',
|
|
572
|
+
'verificationMethod': 'did:web:localhost%3A3000:users:test#owner',
|
|
573
|
+
},
|
|
574
|
+
'type': ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'],
|
|
575
|
+
},
|
|
576
|
+
'boostId':
|
|
577
|
+
'lc:network:localhost%3A3000/trpc:boost:8adff1c1-696d-49b3-bffc-8eea89f72e26MISMATCH',
|
|
578
|
+
},
|
|
579
|
+
};
|