@learncard/credential-library 1.0.9 → 1.0.11
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 +104 -98
- package/package.json +49 -39
- package/src/__tests__/issuance.test.ts +51 -0
- package/src/__tests__/registry.test.ts +457 -0
- package/src/fixtures/boost/basic.ts +50 -0
- package/src/fixtures/boost/boost-id.ts +59 -0
- package/src/fixtures/boost/community-award.ts +96 -0
- package/src/fixtures/boost/delegate.ts +60 -0
- package/src/fixtures/boost/with-skills.ts +80 -0
- package/src/fixtures/clr/competency-aligned.ts +737 -0
- package/src/fixtures/clr/great-plains-full.ts +7841 -0
- package/src/fixtures/clr/minimal.ts +53 -0
- package/src/fixtures/clr/multi-achievement.ts +125 -0
- package/src/fixtures/clr/nd-student-transcript.ts +411 -0
- package/src/fixtures/clr/university-transcript.ts +328 -0
- package/src/fixtures/clr/westbridge-full.ts +2524 -0
- package/src/fixtures/index.ts +159 -0
- package/src/fixtures/invalid/empty-type.ts +27 -0
- package/src/fixtures/invalid/missing-context.ts +27 -0
- package/src/fixtures/invalid/missing-issuer.ts +27 -0
- package/src/fixtures/obv3/1edtech-full.ts +237 -0
- package/src/fixtures/obv3/course-completion.ts +82 -0
- package/src/fixtures/obv3/endorsement.ts +58 -0
- package/src/fixtures/obv3/full-badge.ts +121 -0
- package/src/fixtures/obv3/k12-diploma.ts +92 -0
- package/src/fixtures/obv3/micro-credential.ts +170 -0
- package/src/fixtures/obv3/minimal-badge.ts +40 -0
- package/src/fixtures/obv3/plugfest-jff2.ts +57 -0
- package/src/fixtures/obv3/professional-cert.ts +102 -0
- package/src/fixtures/obv3/with-alignment.ts +62 -0
- package/src/fixtures/obv3/with-endorsement.ts +62 -0
- package/src/fixtures/render-method/render-method-example.ts +45 -0
- package/src/fixtures/vc-v1/alumni-credential.ts +37 -0
- package/src/fixtures/vc-v1/basic.ts +27 -0
- package/src/fixtures/vc-v1/with-status.ts +44 -0
- package/src/fixtures/vc-v2/basic.ts +27 -0
- package/src/fixtures/vc-v2/digital-id.ts +78 -0
- package/src/fixtures/vc-v2/education-degree.ts +77 -0
- package/src/fixtures/vc-v2/employment-credential.ts +64 -0
- package/src/fixtures/vc-v2/license-credential.ts +79 -0
- package/src/fixtures/vc-v2/membership-credential.ts +62 -0
- package/src/fixtures/vc-v2/multiple-subjects.ts +39 -0
- package/src/fixtures/vc-v2/with-evidence.ts +50 -0
- package/src/index.ts +45 -0
- package/src/prepare.ts +212 -0
- package/src/registry.ts +209 -0
- package/src/types.ts +164 -0
package/README.md
CHANGED
|
@@ -8,14 +8,14 @@ The Verifiable Credential standard is infinitely customizable and always evolvin
|
|
|
8
8
|
|
|
9
9
|
This package provides:
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
11
|
+
- **Real and synthetic credential fixtures** spanning VC v1, v2, OBv3, CLR v2, and LearnCard Boosts
|
|
12
|
+
- **Rich metadata** per fixture: spec, profile, features exercised, source, validity
|
|
13
|
+
- **Queryable API** to filter fixtures by any combination of metadata
|
|
14
|
+
- **Fixture preparation** for real issuance — patch in DIDs, timestamps, and fresh UUIDs
|
|
15
|
+
- **Self-validating test suite** that ensures every fixture passes its declared Zod validator
|
|
16
|
+
- **Issuance integration tests** that verify every valid fixture can be issued by a real LearnCard wallet
|
|
17
|
+
- **Intentionally invalid fixtures** for negative testing
|
|
18
|
+
- **One-file-per-fixture** pattern that makes it trivial to add new credentials
|
|
19
19
|
|
|
20
20
|
## Quick Start
|
|
21
21
|
|
|
@@ -86,41 +86,41 @@ const signed = await wallet.invoke.issueCredential(unsigned);
|
|
|
86
86
|
|
|
87
87
|
`prepareFixture` deep-clones the fixture and patches:
|
|
88
88
|
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
89
|
+
- **Issuer DID** — replaces the placeholder issuer with your wallet's DID
|
|
90
|
+
- **Subject DID** — optionally replaces the subject DID
|
|
91
|
+
- **Fresh UUIDs** — regenerates all `urn:uuid:` ids (disable with `freshIds: false`)
|
|
92
|
+
- **Timestamps** — sets `validFrom`/`issuanceDate` to now (or a custom value)
|
|
93
93
|
|
|
94
94
|
## Query API Reference
|
|
95
95
|
|
|
96
|
-
| Function
|
|
97
|
-
|
|
98
|
-
| `getAllFixtures()`
|
|
99
|
-
| `getFixture(id)`
|
|
100
|
-
| `findFixture(id)`
|
|
101
|
-
| `getFixtures(filter)`
|
|
102
|
-
| `getValidFixtures(filter?)`
|
|
103
|
-
| `getInvalidFixtures(filter?)`
|
|
104
|
-
| `getUnsignedFixtures(filter?)`
|
|
105
|
-
| `getSignedFixtures(filter?)`
|
|
106
|
-
| `getStats()`
|
|
107
|
-
| `prepareFixture(fixture, options)` | Clones a fixture and patches DIDs, UUIDs, and timestamps
|
|
108
|
-
| `prepareFixtureById(id, options)`
|
|
96
|
+
| Function | Description |
|
|
97
|
+
| ---------------------------------- | ----------------------------------------------------------------------------- |
|
|
98
|
+
| `getAllFixtures()` | Returns all registered fixtures |
|
|
99
|
+
| `getFixture(id)` | Returns a fixture by ID (throws if not found) |
|
|
100
|
+
| `findFixture(id)` | Returns a fixture by ID (returns `undefined` if not found) |
|
|
101
|
+
| `getFixtures(filter)` | Returns fixtures matching the filter |
|
|
102
|
+
| `getValidFixtures(filter?)` | Shorthand for `getFixtures({ ...filter, validity: 'valid' })` |
|
|
103
|
+
| `getInvalidFixtures(filter?)` | Shorthand for `getFixtures({ ...filter, validity: ['invalid', 'tampered'] })` |
|
|
104
|
+
| `getUnsignedFixtures(filter?)` | Returns only unsigned fixtures |
|
|
105
|
+
| `getSignedFixtures(filter?)` | Returns only signed fixtures |
|
|
106
|
+
| `getStats()` | Returns counts grouped by spec, profile, validity, and signed status |
|
|
107
|
+
| `prepareFixture(fixture, options)` | Clones a fixture and patches DIDs, UUIDs, and timestamps |
|
|
108
|
+
| `prepareFixtureById(id, options)` | Combines `getFixture` + `prepareFixture` |
|
|
109
109
|
|
|
110
110
|
### FixtureFilter
|
|
111
111
|
|
|
112
112
|
All filter fields are optional. Array fields accept a single value or an array.
|
|
113
113
|
|
|
114
|
-
| Field
|
|
115
|
-
|
|
116
|
-
| `spec`
|
|
117
|
-
| `profile`
|
|
118
|
-
| `features`
|
|
119
|
-
| `featuresAny` | `CredentialFeature[]`
|
|
120
|
-
| `signed`
|
|
121
|
-
| `validity`
|
|
122
|
-
| `source`
|
|
123
|
-
| `tags`
|
|
114
|
+
| Field | Type | Behavior |
|
|
115
|
+
| ------------- | ------------------------------------------ | ----------------------------------- |
|
|
116
|
+
| `spec` | `CredentialSpec \| CredentialSpec[]` | Match any of the given specs |
|
|
117
|
+
| `profile` | `CredentialProfile \| CredentialProfile[]` | Match any of the given profiles |
|
|
118
|
+
| `features` | `CredentialFeature[]` | Must have **all** of these features |
|
|
119
|
+
| `featuresAny` | `CredentialFeature[]` | Must have **any** of these features |
|
|
120
|
+
| `signed` | `boolean` | Filter by signed status |
|
|
121
|
+
| `validity` | `FixtureValidity \| FixtureValidity[]` | Match any of the given validities |
|
|
122
|
+
| `source` | `FixtureSource \| FixtureSource[]` | Match any of the given sources |
|
|
123
|
+
| `tags` | `string[]` | Must have **all** of these tags |
|
|
124
124
|
|
|
125
125
|
## Adding a Fixture
|
|
126
126
|
|
|
@@ -153,108 +153,114 @@ export const myFixture: CredentialFixture = {
|
|
|
153
153
|
|
|
154
154
|
2. Add the import and registration in `src/fixtures/index.ts`
|
|
155
155
|
|
|
156
|
-
3. Run `
|
|
156
|
+
3. Run `bun run test` — both the self-validating and issuance suites will check your fixture automatically
|
|
157
157
|
|
|
158
158
|
### Option 2: Use the Credential Viewer UI
|
|
159
159
|
|
|
160
160
|
The `examples/credential-viewer` app has a **New Fixture** button that provides a form with:
|
|
161
161
|
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
162
|
+
- JSON editor with metadata auto-inference
|
|
163
|
+
- JSON file upload
|
|
164
|
+
- Test Issue button (requires wallet connection)
|
|
165
|
+
- Saves the `.ts` file and updates the index automatically
|
|
166
166
|
|
|
167
167
|
See the [Credential Viewer README](../../examples/credential-viewer/README.md) for details.
|
|
168
168
|
|
|
169
169
|
## Fixture Metadata
|
|
170
170
|
|
|
171
|
-
| Field
|
|
172
|
-
|
|
173
|
-
| `id`
|
|
174
|
-
| `name`
|
|
175
|
-
| `description` | `string`
|
|
176
|
-
| `spec`
|
|
177
|
-
| `profile`
|
|
178
|
-
| `features`
|
|
179
|
-
| `source`
|
|
180
|
-
| `signed`
|
|
181
|
-
| `validity`
|
|
182
|
-
| `validator`
|
|
183
|
-
| `tags`
|
|
171
|
+
| Field | Type | Description |
|
|
172
|
+
| ------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
173
|
+
| `id` | `string` | Unique identifier, e.g. `obv3/minimal-badge` |
|
|
174
|
+
| `name` | `string` | Human-readable name |
|
|
175
|
+
| `description` | `string` | What this fixture tests/demonstrates |
|
|
176
|
+
| `spec` | `CredentialSpec` | `vc-v1`, `vc-v2`, `obv3`, `clr-v2`, `europass`, `custom` |
|
|
177
|
+
| `profile` | `CredentialProfile` | `badge`, `diploma`, `certificate`, `id`, `membership`, `license`, `micro-credential`, `course`, `degree`, `boost`, `boost-id`, `delegate`, `endorsement`, `learner-record`, `generic` |
|
|
178
|
+
| `features` | `CredentialFeature[]` | Features exercised: `evidence`, `alignment`, `endorsement`, `expiration`, `status`, `multiple-subjects`, `image`, `results`, `skills`, `display`, `associations`, `nested-credentials`, etc. |
|
|
179
|
+
| `source` | `FixtureSource` | `spec-example`, `plugfest`, `real-world`, `synthetic` |
|
|
180
|
+
| `signed` | `boolean` | Whether the credential has a proof |
|
|
181
|
+
| `validity` | `FixtureValidity` | `valid`, `invalid`, or `tampered` |
|
|
182
|
+
| `validator` | `z.ZodType?` | Optional Zod validator from `@learncard/types` |
|
|
183
|
+
| `tags` | `string[]?` | Additional free-form tags for ad-hoc filtering |
|
|
184
184
|
|
|
185
185
|
## Available Fixtures
|
|
186
186
|
|
|
187
187
|
### VC v1 (3)
|
|
188
|
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
188
|
+
|
|
189
|
+
- `vc-v1/basic` — Minimal VCDM v1 credential
|
|
190
|
+
- `vc-v1/with-status` — With StatusList2021 credential status
|
|
191
|
+
- `vc-v1/alumni-credential` — University alumni credential
|
|
191
192
|
|
|
192
193
|
### VC v2 (8)
|
|
193
|
-
|
|
194
|
-
-
|
|
195
|
-
-
|
|
196
|
-
-
|
|
197
|
-
-
|
|
198
|
-
-
|
|
199
|
-
-
|
|
200
|
-
-
|
|
194
|
+
|
|
195
|
+
- `vc-v2/basic` — Minimal VCDM v2 credential
|
|
196
|
+
- `vc-v2/with-evidence` — With evidence array
|
|
197
|
+
- `vc-v2/multiple-subjects` — With multiple credential subjects
|
|
198
|
+
- `vc-v2/employment-credential` — Employment verification credential
|
|
199
|
+
- `vc-v2/education-degree` — University bachelor degree credential
|
|
200
|
+
- `vc-v2/digital-id` — Government digital identity credential
|
|
201
|
+
- `vc-v2/membership-credential` — Professional association membership
|
|
202
|
+
- `vc-v2/license-credential` — Professional nursing license
|
|
201
203
|
|
|
202
204
|
### Open Badges v3 (11)
|
|
203
|
-
|
|
204
|
-
-
|
|
205
|
-
-
|
|
206
|
-
-
|
|
207
|
-
-
|
|
208
|
-
-
|
|
209
|
-
-
|
|
210
|
-
-
|
|
211
|
-
-
|
|
212
|
-
-
|
|
213
|
-
-
|
|
205
|
+
|
|
206
|
+
- `obv3/minimal-badge` — Minimal OBv3 achievement credential
|
|
207
|
+
- `obv3/full-badge` — Full-featured badge with image, evidence, alignment, results, expiration
|
|
208
|
+
- `obv3/with-alignment` — With competency framework alignments
|
|
209
|
+
- `obv3/with-endorsement` — With embedded endorsement credential
|
|
210
|
+
- `obv3/plugfest-jff2` — JFF PlugFest 2 interoperability badge
|
|
211
|
+
- `obv3/1edtech-full` — 1EdTech complete OpenBadgeCredential (spec reference)
|
|
212
|
+
- `obv3/professional-cert` — AWS Solutions Architect professional certification
|
|
213
|
+
- `obv3/micro-credential` — Data Science Fundamentals micro-credential
|
|
214
|
+
- `obv3/course-completion` — Introduction to Machine Learning course completion
|
|
215
|
+
- `obv3/k12-diploma` — High school diploma
|
|
216
|
+
- `obv3/endorsement-credential` — Program accreditation endorsement
|
|
214
217
|
|
|
215
218
|
### CLR v2 (4)
|
|
216
|
-
|
|
217
|
-
-
|
|
218
|
-
-
|
|
219
|
-
-
|
|
219
|
+
|
|
220
|
+
- `clr/minimal` — Minimal Comprehensive Learner Record
|
|
221
|
+
- `clr/multi-achievement` — Multiple achievements with associations
|
|
222
|
+
- `clr/nd-student-transcript` — North Dakota student transcript (nested VCs, real-world structure)
|
|
223
|
+
- `clr/university-transcript` — University academic transcript (6 nested course VCs)
|
|
220
224
|
|
|
221
225
|
### LearnCard Boosts (5)
|
|
222
|
-
|
|
223
|
-
-
|
|
224
|
-
-
|
|
225
|
-
-
|
|
226
|
-
-
|
|
226
|
+
|
|
227
|
+
- `boost/basic` — Basic BoostCredential with display
|
|
228
|
+
- `boost/boost-id` — BoostID membership card
|
|
229
|
+
- `boost/with-skills` — Boost with skills, evidence, and alignment
|
|
230
|
+
- `boost/community-award` — Community leadership award boost
|
|
231
|
+
- `boost/delegate` — Organization delegate credential
|
|
227
232
|
|
|
228
233
|
### Invalid / Negative Tests (3)
|
|
229
|
-
|
|
230
|
-
-
|
|
231
|
-
-
|
|
234
|
+
|
|
235
|
+
- `invalid/missing-context` — No @context
|
|
236
|
+
- `invalid/empty-type` — Empty type array
|
|
237
|
+
- `invalid/missing-issuer` — No issuer field
|
|
232
238
|
|
|
233
239
|
## Tests
|
|
234
240
|
|
|
235
241
|
```bash
|
|
236
|
-
|
|
242
|
+
bun run test
|
|
237
243
|
```
|
|
238
244
|
|
|
239
245
|
Two test suites run automatically:
|
|
240
246
|
|
|
241
|
-
-
|
|
242
|
-
-
|
|
247
|
+
- **`registry.test.ts`** — Validates every fixture against its Zod validator, checks metadata consistency, and tests the query/filter API
|
|
248
|
+
- **`issuance.test.ts`** — Creates a real LearnCard wallet instance and calls `issueCredential()` on every valid fixture, verifying that each produces a signed VC with a proof
|
|
243
249
|
|
|
244
250
|
### Bundle Size & Production Use
|
|
245
251
|
|
|
246
252
|
This package is designed for **testing, development, and CI** — not for inclusion in production application bundles. The fixture data is intentionally large and comprehensive.
|
|
247
253
|
|
|
248
|
-
-
|
|
249
|
-
-
|
|
250
|
-
-
|
|
251
|
-
-
|
|
254
|
+
- The package declares `"sideEffects": false` so bundlers can tree-shake unused fixtures
|
|
255
|
+
- The credential-viewer (`examples/credential-viewer/`) is `private: true` and not published
|
|
256
|
+
- If you only need a few fixtures in a test file, import them directly: `import { obv3MinimalBadge } from '@learncard/credential-library'`
|
|
257
|
+
- Avoid importing the full library in production application code paths
|
|
252
258
|
|
|
253
259
|
### JSON-LD Context Notes
|
|
254
260
|
|
|
255
261
|
All valid fixtures use `@context` URLs that are either statically cached in DidKit or fetchable via `allowRemoteContexts`. If you add a fixture with custom terms, make sure they are defined in one of the included contexts. Common choices:
|
|
256
262
|
|
|
257
|
-
-
|
|
258
|
-
-
|
|
259
|
-
-
|
|
260
|
-
-
|
|
263
|
+
- `https://www.w3.org/2018/credentials/examples/v1` — Example terms for VC v1 (`degree`, `alumniOf`, etc.)
|
|
264
|
+
- `https://www.w3.org/ns/credentials/examples/v2` — Example terms for VC v2 (`degree`, `role`, etc.)
|
|
265
|
+
- `https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json` — OBv3 terms (cached in DidKit)
|
|
266
|
+
- `https://purl.imsglobal.org/spec/clr/v2p0/context.json` — CLR v2 terms (cached in DidKit)
|
package/package.json
CHANGED
|
@@ -1,40 +1,50 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
2
|
+
"name": "@learncard/credential-library",
|
|
3
|
+
"version": "1.0.11",
|
|
4
|
+
"description": "Comprehensive library of Verifiable Credential fixtures for testing, development, and regression prevention across the VC ecosystem",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/credential-library.esm.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && tsc --p tsconfig.json",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"test:watch": "vitest"
|
|
15
|
+
},
|
|
16
|
+
"author": "Learning Economy Foundation (www.learningeconomy.io)",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"homepage": "https://github.com/learningeconomy/LearnCard/tree/main/packages/credential-library/README.md",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/learningeconomy/LearnCard"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/learningeconomy/LearnCard/issues"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@learncard/didkit-plugin": "workspace:*",
|
|
28
|
+
"@learncard/init": "workspace:*",
|
|
29
|
+
"@types/node": "^17.0.38",
|
|
30
|
+
"esbuild": "^0.27.1",
|
|
31
|
+
"shx": "^0.3.4",
|
|
32
|
+
"typescript": "5.6.2",
|
|
33
|
+
"vitest": "^1.6.0"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@learncard/types": "workspace:*",
|
|
37
|
+
"zod": "4.1.13"
|
|
38
|
+
},
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"sideEffects": false,
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"development": "./src/index.ts",
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"import": "./dist/credential-library.esm.js",
|
|
46
|
+
"require": "./dist/index.js",
|
|
47
|
+
"default": "./dist/credential-library.esm.js"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { readFile } from 'fs/promises';
|
|
2
|
+
|
|
3
|
+
import { describe, it, expect, beforeAll } from 'vitest';
|
|
4
|
+
|
|
5
|
+
import { initLearnCard } from '@learncard/init';
|
|
6
|
+
|
|
7
|
+
import { getAllFixtures, prepareFixture } from '../index';
|
|
8
|
+
|
|
9
|
+
import type { CredentialFixture } from '../types';
|
|
10
|
+
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Wallet setup — one shared instance for all tests
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
const didkit = readFile(
|
|
16
|
+
require.resolve('@learncard/didkit-plugin/dist/didkit/didkit_wasm_bg.wasm')
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
let wallet: any;
|
|
21
|
+
let issuerDid: string;
|
|
22
|
+
|
|
23
|
+
beforeAll(async () => {
|
|
24
|
+
wallet = await initLearnCard({ seed: 'a'.repeat(64), didkit, allowRemoteContexts: true });
|
|
25
|
+
issuerDid = wallet.id.did();
|
|
26
|
+
}, 30_000);
|
|
27
|
+
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
// Issuance tests — every valid fixture should issue successfully
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
describe('Credential issuance', () => {
|
|
33
|
+
const validFixtures = (): CredentialFixture[] =>
|
|
34
|
+
getAllFixtures().filter(f => f.validity === 'valid');
|
|
35
|
+
|
|
36
|
+
describe('issueCredential succeeds for all valid fixtures', () => {
|
|
37
|
+
it.each(
|
|
38
|
+
validFixtures().map(f => [f.id, f] as const)
|
|
39
|
+
)('%s', async (_id, fixture) => {
|
|
40
|
+
const prepared = prepareFixture(fixture, {
|
|
41
|
+
issuerDid,
|
|
42
|
+
subjectDid: 'did:example:test-subject-123',
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const signed = await wallet.invoke.issueCredential(prepared);
|
|
46
|
+
|
|
47
|
+
expect(signed).toBeDefined();
|
|
48
|
+
expect((signed as Record<string, unknown>).proof).toBeDefined();
|
|
49
|
+
}, 15_000);
|
|
50
|
+
});
|
|
51
|
+
});
|