@learncard/ler-rs-plugin 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ler-rs-plugin.cjs.development.cjs +65 -53
- package/dist/ler-rs-plugin.cjs.development.cjs.map +1 -1
- package/dist/ler-rs-plugin.cjs.production.min.cjs +1 -1
- package/dist/ler-rs-plugin.cjs.production.min.cjs.map +2 -2
- package/dist/ler-rs-plugin.esm.js +62 -50
- package/dist/ler-rs-plugin.esm.js.map +1 -1
- package/package.json +9 -14
|
@@ -19,8 +19,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
|
|
21
21
|
// src/index.ts
|
|
22
|
-
var
|
|
23
|
-
__export(
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
24
|
LEGACY_LER_RS_TYPE_TOKEN: () => LEGACY_LER_RS_TYPE_TOKEN,
|
|
25
25
|
LEGACY_LER_RS_TYPE_URI_V44: () => LEGACY_LER_RS_TYPE_URI_V44,
|
|
26
26
|
LER_RS_CREDENTIAL_CONTEXT_V1: () => LER_RS_CREDENTIAL_CONTEXT_V1,
|
|
@@ -31,7 +31,7 @@ __export(src_exports, {
|
|
|
31
31
|
TCP_WRAPPER_TYPE: () => TCP_WRAPPER_TYPE,
|
|
32
32
|
getLerRsPlugin: () => getLerRsPlugin
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(index_exports);
|
|
35
35
|
|
|
36
36
|
// src/types.ts
|
|
37
37
|
var LER_RS_CREDENTIAL_CONTEXT_V1 = "https://www.w3.org/2018/credentials/v1";
|
|
@@ -45,10 +45,8 @@ var TCP_WRAPPER_TYPE = "TrustedCareerProfile";
|
|
|
45
45
|
|
|
46
46
|
// src/ler-rs.ts
|
|
47
47
|
var getItemVerifications = /* @__PURE__ */ __name((item) => {
|
|
48
|
-
if (item.verifications?.length)
|
|
49
|
-
|
|
50
|
-
if (item.verifiableCredential)
|
|
51
|
-
return [item.verifiableCredential];
|
|
48
|
+
if (item.verifications?.length) return item.verifications;
|
|
49
|
+
if (item.verifiableCredential) return [item.verifiableCredential];
|
|
52
50
|
return [];
|
|
53
51
|
}, "getItemVerifications");
|
|
54
52
|
var toArray = /* @__PURE__ */ __name((maybe) => maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe], "toArray");
|
|
@@ -66,8 +64,7 @@ var credentialHasLerRsType = /* @__PURE__ */ __name((credential) => {
|
|
|
66
64
|
))
|
|
67
65
|
return true;
|
|
68
66
|
const credentialSubject = credential.credentialSubject;
|
|
69
|
-
if (!credentialSubject)
|
|
70
|
-
return false;
|
|
67
|
+
if (!credentialSubject) return false;
|
|
71
68
|
const inlineType = credentialSubject.type;
|
|
72
69
|
if (typeof inlineType === "string" && [LEGACY_LER_RS_TYPE_URI_V44, LER_RS_TYPE_URI_V45].includes(inlineType))
|
|
73
70
|
return true;
|
|
@@ -89,28 +86,19 @@ var buildEmploymentHistories = /* @__PURE__ */ __name((items) => {
|
|
|
89
86
|
...rest
|
|
90
87
|
} = item;
|
|
91
88
|
const container = { ...rest };
|
|
92
|
-
if (typeof current === "boolean")
|
|
93
|
-
|
|
94
|
-
if (employer)
|
|
95
|
-
container.organization = { tradeName: employer };
|
|
89
|
+
if (typeof current === "boolean") container.current = current;
|
|
90
|
+
if (employer) container.organization = { tradeName: employer };
|
|
96
91
|
if (position || start || end || typeof current === "boolean") {
|
|
97
92
|
const ph = {};
|
|
98
|
-
if (position)
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
if (
|
|
103
|
-
ph.end = end;
|
|
104
|
-
if (typeof current === "boolean")
|
|
105
|
-
ph.current = current;
|
|
106
|
-
if (descriptions?.length)
|
|
107
|
-
ph.descriptions = descriptions;
|
|
93
|
+
if (position) ph.title = position;
|
|
94
|
+
if (start) ph.start = start;
|
|
95
|
+
if (end) ph.end = end;
|
|
96
|
+
if (typeof current === "boolean") ph.current = current;
|
|
97
|
+
if (descriptions?.length) ph.descriptions = descriptions;
|
|
108
98
|
container.positionHistories = [ph];
|
|
109
99
|
}
|
|
110
|
-
if (narrative)
|
|
111
|
-
|
|
112
|
-
if (descriptions?.length && !container.positionHistories)
|
|
113
|
-
container.descriptions = descriptions;
|
|
100
|
+
if (narrative) container.narrative = narrative;
|
|
101
|
+
if (descriptions?.length && !container.positionHistories) container.descriptions = descriptions;
|
|
114
102
|
const containerVerifications = getItemVerifications({
|
|
115
103
|
verifiableCredential,
|
|
116
104
|
verifications
|
|
@@ -137,16 +125,11 @@ var buildEducationAndLearnings = /* @__PURE__ */ __name((items) => {
|
|
|
137
125
|
...rest
|
|
138
126
|
} = item;
|
|
139
127
|
const container = { ...rest };
|
|
140
|
-
if (institution)
|
|
141
|
-
|
|
142
|
-
if (
|
|
143
|
-
|
|
144
|
-
if (
|
|
145
|
-
container.end = end;
|
|
146
|
-
if (typeof current === "boolean")
|
|
147
|
-
container.current = current;
|
|
148
|
-
if (descriptions?.length)
|
|
149
|
-
container.descriptions = descriptions;
|
|
128
|
+
if (institution) container.institution = { name: institution };
|
|
129
|
+
if (start) container.start = start;
|
|
130
|
+
if (end) container.end = end;
|
|
131
|
+
if (typeof current === "boolean") container.current = current;
|
|
132
|
+
if (descriptions?.length) container.descriptions = descriptions;
|
|
150
133
|
if (degree || specializations) {
|
|
151
134
|
container.educationDegrees = [
|
|
152
135
|
{
|
|
@@ -159,8 +142,7 @@ var buildEducationAndLearnings = /* @__PURE__ */ __name((items) => {
|
|
|
159
142
|
}
|
|
160
143
|
];
|
|
161
144
|
}
|
|
162
|
-
if (narrative)
|
|
163
|
-
container.narrative = narrative;
|
|
145
|
+
if (narrative) container.narrative = narrative;
|
|
164
146
|
const containerVerifications = getItemVerifications({
|
|
165
147
|
verifiableCredential,
|
|
166
148
|
verifications
|
|
@@ -184,10 +166,8 @@ var buildCertifications = /* @__PURE__ */ __name((items) => {
|
|
|
184
166
|
...rest
|
|
185
167
|
} = item;
|
|
186
168
|
const container = { ...rest };
|
|
187
|
-
if (narrative)
|
|
188
|
-
|
|
189
|
-
if (descriptions?.length)
|
|
190
|
-
container.descriptions = descriptions;
|
|
169
|
+
if (narrative) container.narrative = narrative;
|
|
170
|
+
if (descriptions?.length) container.descriptions = descriptions;
|
|
191
171
|
if (effectiveTimePeriod || start || end) {
|
|
192
172
|
container.effectiveTimePeriod = {
|
|
193
173
|
...effectiveTimePeriod ?? {},
|
|
@@ -211,10 +191,18 @@ var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => {
|
|
|
211
191
|
displayName: "LER-RS",
|
|
212
192
|
description: "Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials",
|
|
213
193
|
methods: {
|
|
214
|
-
|
|
194
|
+
/**
|
|
195
|
+
* Issues a signed LER-RS VC from normalized person/work/education/certification data.
|
|
196
|
+
*
|
|
197
|
+
* The method:
|
|
198
|
+
* 1. Builds a compliant LER-RS `credentialSubject`
|
|
199
|
+
* 2. Applies VC + LER-RS contexts
|
|
200
|
+
* 3. Signs via `invoke.issueCredential`
|
|
201
|
+
*/
|
|
202
|
+
createLerRecord: /* @__PURE__ */ __name(async (_learnCard, params) => {
|
|
215
203
|
const signer = params.learnCard ?? _learnCard;
|
|
216
204
|
const did = signer.id.did();
|
|
217
|
-
const issuedAt = new Date().toISOString();
|
|
205
|
+
const issuedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
218
206
|
const documentId = crypto.randomUUID();
|
|
219
207
|
const personSection = {
|
|
220
208
|
name: {
|
|
@@ -278,8 +266,15 @@ var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => {
|
|
|
278
266
|
return initLearnCard.invoke.issueCredential(unsignedVC, {
|
|
279
267
|
proofPurpose: "assertionMethod"
|
|
280
268
|
});
|
|
281
|
-
},
|
|
282
|
-
|
|
269
|
+
}, "createLerRecord"),
|
|
270
|
+
/**
|
|
271
|
+
* Issues a VP containing at least one LER-RS credential.
|
|
272
|
+
*
|
|
273
|
+
* Throws if:
|
|
274
|
+
* - credentials list is empty
|
|
275
|
+
* - none of the credentials match LER-RS type checks
|
|
276
|
+
*/
|
|
277
|
+
createLerPresentation: /* @__PURE__ */ __name(async (_learnCard, params) => {
|
|
283
278
|
const signer = params.learnCard ?? _learnCard;
|
|
284
279
|
const did = signer.id.did();
|
|
285
280
|
if (!params.credentials.length)
|
|
@@ -301,8 +296,14 @@ var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => {
|
|
|
301
296
|
...params.domain ? { domain: params.domain } : {},
|
|
302
297
|
...params.challenge ? { challenge: params.challenge } : {}
|
|
303
298
|
});
|
|
304
|
-
},
|
|
305
|
-
|
|
299
|
+
}, "createLerPresentation"),
|
|
300
|
+
/**
|
|
301
|
+
* Verifies a LER-focused VP and returns structured result details.
|
|
302
|
+
*
|
|
303
|
+
* Overall `verified` allows explicitly self-issued items when determining
|
|
304
|
+
* final status, while still surfacing per-credential verification results.
|
|
305
|
+
*/
|
|
306
|
+
verifyLerPresentation: /* @__PURE__ */ __name(async (_learnCard, { presentation, domain, challenge }) => {
|
|
306
307
|
const presCheck = await initLearnCard.invoke.verifyPresentation(presentation, {
|
|
307
308
|
...domain ? { domain } : {},
|
|
308
309
|
...challenge ? { challenge } : {}
|
|
@@ -347,11 +348,22 @@ var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => {
|
|
|
347
348
|
presentationResult,
|
|
348
349
|
credentialResults
|
|
349
350
|
};
|
|
350
|
-
},
|
|
351
|
-
|
|
351
|
+
}, "verifyLerPresentation"),
|
|
352
|
+
/**
|
|
353
|
+
* Issues a signed TrustedCareerProfile wrapper VC for resume package publishing.
|
|
354
|
+
*
|
|
355
|
+
* Includes:
|
|
356
|
+
* - public PDF URL
|
|
357
|
+
* - PDF SHA-256 hash
|
|
358
|
+
* - included credential references
|
|
359
|
+
* - generation timestamp
|
|
360
|
+
*
|
|
361
|
+
* Co-sign fields are intentionally stubbed for MVP and currently rejected.
|
|
362
|
+
*/
|
|
363
|
+
createTcpWrapperVc: /* @__PURE__ */ __name(async (_learnCard, params) => {
|
|
352
364
|
const signer = params.learnCard ?? _learnCard;
|
|
353
365
|
const did = signer.id.did();
|
|
354
|
-
const issuedAt = params.issuanceDate ?? new Date().toISOString();
|
|
366
|
+
const issuedAt = params.issuanceDate ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
355
367
|
const generatedAt = params.generatedAt ?? issuedAt;
|
|
356
368
|
const subjectDid = params.subjectDid ?? did;
|
|
357
369
|
if (params.enableCoSign) {
|
|
@@ -403,7 +415,7 @@ var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => {
|
|
|
403
415
|
return initLearnCard.invoke.issueCredential(unsignedVC, {
|
|
404
416
|
proofPurpose: "assertionMethod"
|
|
405
417
|
});
|
|
406
|
-
}
|
|
418
|
+
}, "createTcpWrapperVc")
|
|
407
419
|
}
|
|
408
420
|
};
|
|
409
421
|
}, "getLerRsPlugin");
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/types.ts", "../src/ler-rs.ts"],
|
|
4
4
|
"sourcesContent": ["export { getLerRsPlugin } from './ler-rs';\nexport * from './types';\n", "import { Plugin, LearnCard } from '@learncard/core';\nimport {\n VC as VerifiableCredential,\n VP as VerifiablePresentation,\n UnsignedVC,\n UnsignedVP,\n VerificationCheck,\n} from '@learncard/types';\nimport type { VCPluginMethods, VCPluginDependentMethods } from '@learncard/vc-plugin';\n\n/**\n * Legacy W3C VC v1 context kept for interop with previously issued records.\n */\nexport const LER_RS_CREDENTIAL_CONTEXT_V1 = 'https://www.w3.org/2018/credentials/v1';\n/**\n * Base W3C VC v2 context used by newly issued LER-RS credentials and presentations.\n */\nexport const LER_RS_CREDENTIAL_CONTEXT_V2 = 'https://www.w3.org/ns/credentials/v2';\n/**\n * HR Open Standards VC wrapper context for LER-RS v4.5.\n */\nexport const LER_RS_VC_CONTEXT_V45 =\n 'http://schema.hropenstandards.org/4.5/recruiting/json/VerifiableCredentialLER-RSType.json';\n/**\n * Canonical LER-RS type URI for v4.5.\n */\nexport const LER_RS_TYPE_URI_V45 =\n 'http://schema.hropenstandards.org/4.5/recruiting/json/LER-RSType.json';\n/**\n * Legacy LER-RS type URI for v4.4 interop.\n */\nexport const LEGACY_LER_RS_TYPE_URI_V44 =\n 'http://schema.hropenstandards.org/4.4/recruiting/json/ler-rs/LER-RSType.json';\n/**\n * Legacy short type token used by older issuers.\n */\nexport const LEGACY_LER_RS_TYPE_TOKEN = 'LERRS';\n/**\n * Hosted TCP JSON-LD context URL.\n *\n * Note: current local wrapper issuance can inline context during local testing.\n */\nexport const TCP_CONTEXT_V1 = 'https://ctx.learncard.com/tcp/1.0.0.json';\n/**\n * LearnCard-defined wrapper VC type for TCP resume package artifacts.\n *\n * This is intentionally NOT a canonical HR Open Standards LER-RS type;\n * it is a custom wrapper used to bind PDF URL/hash + included credential refs.\n */\nexport const TCP_WRAPPER_TYPE = 'TrustedCareerProfile';\n\n/**\n * Identity details used to populate `credentialSubject.person`.\n */\nexport interface PersonProfile {\n /** Subject DID for the issued LER-RS record. */\n id: string;\n /** Given/first name. */\n givenName: string;\n /** Family/last name. */\n familyName: string;\n /** Optional display name override. */\n formattedName?: string;\n /** Optional contact email to include in communication block. */\n email?: string;\n /** Optional contact phone to include in communication block. */\n phone?: string;\n /** Optional physical/mailing address to include in communication block. */\n address?: {\n formattedAddress?: string;\n line?: string;\n city?: string;\n postalCode?: string;\n countryCode?: string;\n };\n /** Optional website URLs to include in communication block. */\n web?: Array<{ url: string; name?: string }>;\n /** Optional social profile URLs to include in communication block. */\n social?: Array<{ uri: string; name?: string }>;\n}\n\n/**\n * Skill item structure used inside generated LER-RS records.\n */\nexport interface LerSkill {\n name: string;\n comments?: string[];\n description?: string;\n yearsOfExperience?: number;\n endorsers?: Array<{\n person?: { name?: { formattedName?: string } };\n organization?: { name?: string };\n }>;\n}\n\n/**\n * Source work history entry. Can be self-asserted fields and/or third-party verification VCs.\n */\nexport interface WorkHistoryItem {\n narrative?: string;\n descriptions?: string[];\n verifiableCredential?: VerifiableCredential;\n verifications?: VerifiableCredential[];\n // Common self-asserted fields\n position?: string;\n employer?: string;\n start?: string;\n end?: string;\n current?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * Source education entry. Can include freeform fields and optional verification VCs.\n */\nexport interface EducationHistoryItem {\n narrative?: string;\n descriptions?: string[];\n verifiableCredential?: VerifiableCredential;\n verifications?: VerifiableCredential[];\n institution?: string;\n start?: string;\n end?: string;\n current?: boolean;\n degree?: string;\n specializations?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Source certification entry for `credentialSubject.certifications`.\n */\nexport interface CertificationItem {\n narrative?: string;\n descriptions?: string[];\n verifiableCredential?: VerifiableCredential;\n verifications?: VerifiableCredential[];\n name?: string;\n issuingAuthority?: string | Record<string, unknown>;\n status?: string;\n start?: string;\n end?: string;\n effectiveTimePeriod?: { validFrom?: string; validTo?: string };\n [key: string]: unknown;\n}\n\n/**\n * Narrative section block supported by LER-RS schema.\n */\nexport interface LerNarrative {\n name: string;\n texts: Array<{\n name: string;\n lines: string[];\n }>;\n}\n\n/**\n * Typed shape of the LER-RS object embedded into `credentialSubject`.\n */\nexport interface LerRsRecord {\n type: string;\n documentId?: { value: string };\n person: {\n name: {\n given: string;\n family: string;\n formattedName?: string;\n };\n };\n communication?: {\n email?: { address: string }[];\n web?: { url: string; name?: string }[];\n phone?: Array<Record<string, unknown>>;\n address?: Array<Record<string, unknown>>;\n social?: Array<Record<string, unknown>>;\n };\n skills?: LerSkill[];\n narratives?: LerNarrative[];\n educationAndLearnings?: Array<\n { verifications?: VerifiableCredential[] } & Record<string, unknown>\n >;\n employmentHistories?: Array<\n { verifications?: VerifiableCredential[] } & Record<string, unknown>\n >;\n licenses?: Array<{ verifications?: VerifiableCredential[] } & Record<string, unknown>>;\n certifications?: Array<{ verifications?: VerifiableCredential[] } & Record<string, unknown>>;\n employmentPreferences?: Array<Record<string, unknown>>;\n positionPreferences?: Array<Record<string, unknown>>;\n attachments?: Array<Record<string, unknown>>;\n}\n\n/**\n * Parameters for issuing a signed LER-RS VC from normalized source data.\n */\nexport interface CreateLerRecordParams {\n learnCard: LearnCard<any, 'id', VCPluginMethods & VCPluginDependentMethods>;\n person: PersonProfile;\n workHistory?: WorkHistoryItem[];\n educationHistory?: EducationHistoryItem[];\n certifications?: CertificationItem[];\n skills?: string[];\n narratives?: LerNarrative[];\n attachments?: Array<Record<string, unknown>>;\n}\n\n/**\n * Parameters for issuing a VP that packages one or more credentials including at least one LER-RS credential.\n */\nexport interface CreateLerPresentationParams {\n learnCard: LearnCard<any, 'id', VCPluginMethods & VCPluginDependentMethods>;\n credentials: VerifiableCredential[];\n domain?: string;\n challenge?: string;\n}\n\n/**\n * Parameters for verifying a LER-focused VP and nested credentials.\n */\nexport interface VerifyLerPresentationParams {\n presentation: VerifiablePresentation | string;\n domain?: string;\n challenge?: string;\n}\n\n/**\n * Credential reference stored in TCP wrapper VC.\n */\nexport interface TcpIncludedCredentialRef {\n /** Resolved VC id when available; falls back to URI if id is unavailable. */\n id: string;\n /** Category label used for UI grouping and downstream filtering. */\n category: string;\n}\n\n/**\n * Parameters for issuing TrustedCareerProfile wrapper VCs.\n */\nexport interface CreateTcpWrapperVcParams {\n learnCard: LearnCard<any, 'id', VCPluginMethods & VCPluginDependentMethods>;\n wrapperId: string;\n subjectDid?: string;\n pdfUrl: string;\n pdfHash: string;\n includedCredentials: TcpIncludedCredentialRef[];\n generatedAt?: string;\n /** Timestamp used as the issued credential's `validFrom` value. */\n issuanceDate?: string;\n coSignerDid?: string;\n enableCoSign?: boolean;\n}\n\n/**\n * Structured verification output for LER presentation verification.\n */\nexport interface VerificationResult {\n verified: boolean; // Overall status\n presentationResult: {\n verified: boolean;\n errors?: string[];\n };\n credentialResults: {\n credential: VerifiableCredential;\n verified: boolean;\n isSelfIssued: boolean;\n errors?: string[];\n }[];\n}\n\n/**\n * LearnCard dependency contract required by this plugin.\n */\nexport type LERRSDependentLearnCard = LearnCard<\n any,\n 'id',\n VCPluginMethods & VCPluginDependentMethods\n>;\n\n/**\n * Public invoke methods exposed by the LER-RS plugin.\n */\nexport type LERRSPluginMethods = {\n createLerRecord: (params: CreateLerRecordParams) => Promise<VerifiableCredential>;\n createLerPresentation: (params: CreateLerPresentationParams) => Promise<VerifiablePresentation>;\n verifyLerPresentation: (params: VerifyLerPresentationParams) => Promise<VerificationResult>;\n createTcpWrapperVc: (params: CreateTcpWrapperVcParams) => Promise<VerifiableCredential>;\n};\n\n/**\n * Plugin type definition for registration in LearnCard.\n */\nexport type LERRSPlugin = Plugin<\n 'LER-RS',\n never,\n LERRSPluginMethods,\n 'id',\n VCPluginMethods & VCPluginDependentMethods\n>;\n", "import {\n VC as VerifiableCredential,\n UnsignedVC,\n VP as VerifiablePresentation,\n UnsignedVP,\n} from '@learncard/types';\nimport {\n LERRSDependentLearnCard,\n LERRSPlugin,\n CreateLerRecordParams,\n CreateLerPresentationParams,\n VerifyLerPresentationParams,\n VerificationResult,\n LerRsRecord,\n LER_RS_CREDENTIAL_CONTEXT_V2,\n LER_RS_TYPE_URI_V45,\n LEGACY_LER_RS_TYPE_URI_V44,\n LEGACY_LER_RS_TYPE_TOKEN,\n TCP_WRAPPER_TYPE,\n} from './types';\n\n/**\n * Normalizes verification containers from either:\n * - `verifications: VC[]`\n * - `verifiableCredential: VC`\n */\nconst getItemVerifications = (item: {\n verifiableCredential?: VerifiableCredential;\n verifications?: VerifiableCredential[];\n}): VerifiableCredential[] => {\n if (item.verifications?.length) return item.verifications;\n if (item.verifiableCredential) return [item.verifiableCredential];\n return [];\n};\n\n/**\n * Converts scalar-or-array values into a normalized array.\n */\nconst toArray = <T>(maybe: T | T[] | undefined): T[] =>\n maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe];\n\n/**\n * Inline LER-RS JSON-LD context used for signing stability.\n *\n * The published HR Open URL is schema-oriented and can trigger additional remote\n * context resolution during expansion. Inlining this base context avoids network\n * dependency at issue time while preserving deterministic term expansion.\n */\nconst inlineLerRsContext = {\n '@version': 1.1,\n hrrec: 'http://schema.hropenstandards.org/recruiting/',\n '@vocab': 'http://schema.hropenstandards.org/recruiting/',\n};\n\n/**\n * Determines whether a VC represents a LER-RS credential (legacy and current forms).\n *\n * Checks:\n * - VC `type` array/token values\n * - `credentialSubject.type`\n * - nested `credentialSubject.lerrsType.type`\n */\nconst credentialHasLerRsType = (credential: VerifiableCredential): boolean => {\n const typeList = Array.isArray(credential.type) ? credential.type : [credential.type];\n if (\n typeList.some(type =>\n [LEGACY_LER_RS_TYPE_TOKEN, LEGACY_LER_RS_TYPE_URI_V44, LER_RS_TYPE_URI_V45].includes(\n type\n )\n )\n )\n return true;\n\n const credentialSubject = credential.credentialSubject as Record<string, unknown> | undefined;\n if (!credentialSubject) return false;\n\n const inlineType = credentialSubject.type;\n if (\n typeof inlineType === 'string' &&\n [LEGACY_LER_RS_TYPE_URI_V44, LER_RS_TYPE_URI_V45].includes(inlineType)\n )\n return true;\n\n const nestedType = (credentialSubject.lerrsType as Record<string, unknown> | undefined)?.type;\n return (\n typeof nestedType === 'string' &&\n [LEGACY_LER_RS_TYPE_URI_V44, LER_RS_TYPE_URI_V45].includes(nestedType)\n );\n};\n\n/**\n * Maps application work history items to LER-RS `employmentHistories` shape.\n */\nconst buildEmploymentHistories = (\n items: NonNullable<CreateLerRecordParams['workHistory']>\n): LerRsRecord['employmentHistories'] => {\n return items.map(item => {\n const {\n narrative,\n descriptions,\n verifiableCredential,\n verifications,\n position,\n employer,\n start,\n end,\n current,\n ...rest\n } = item;\n\n const container: Record<string, unknown> = { ...rest };\n if (typeof current === 'boolean') container.current = current;\n\n if (employer) container.organization = { tradeName: employer };\n if (position || start || end || typeof current === 'boolean') {\n const ph: Record<string, unknown> = {};\n if (position) ph.title = position;\n if (start) ph.start = start;\n if (end) ph.end = end;\n if (typeof current === 'boolean') ph.current = current;\n if (descriptions?.length) ph.descriptions = descriptions;\n container.positionHistories = [ph];\n }\n if (narrative) container.narrative = narrative;\n if (descriptions?.length && !container.positionHistories) container.descriptions = descriptions;\n\n const containerVerifications = getItemVerifications({\n verifiableCredential,\n verifications,\n });\n return {\n ...container,\n ...(containerVerifications.length ? { verifications: containerVerifications } : {}),\n };\n });\n};\n\n/**\n * Maps education source items into LER-RS `educationAndLearnings`.\n */\nconst buildEducationAndLearnings = (\n items: NonNullable<CreateLerRecordParams['educationHistory']>\n): LerRsRecord['educationAndLearnings'] => {\n return items.map(item => {\n const {\n narrative,\n descriptions,\n verifiableCredential,\n verifications,\n institution,\n start,\n end,\n current,\n degree,\n specializations,\n ...rest\n } = item;\n\n const container: Record<string, unknown> = { ...rest };\n if (institution) container.institution = { name: institution };\n if (start) container.start = start;\n if (end) container.end = end;\n if (typeof current === 'boolean') container.current = current;\n if (descriptions?.length) container.descriptions = descriptions;\n if (degree || specializations) {\n container.educationDegrees = [\n {\n ...(degree ? { name: degree } : {}),\n ...(specializations\n ? {\n specializations: specializations.map(specialization => ({\n name: specialization,\n })),\n }\n : {}),\n },\n ];\n }\n if (narrative) container.narrative = narrative;\n\n const containerVerifications = getItemVerifications({\n verifiableCredential,\n verifications,\n });\n return {\n ...container,\n ...(containerVerifications.length ? { verifications: containerVerifications } : {}),\n };\n });\n};\n\n/**\n * Maps certification source items to LER-RS `certifications`.\n */\nconst buildCertifications = (\n items: NonNullable<CreateLerRecordParams['certifications']>\n): LerRsRecord['certifications'] => {\n return items.map(item => {\n const {\n narrative,\n descriptions,\n start,\n end,\n effectiveTimePeriod,\n verifiableCredential,\n verifications,\n ...rest\n } = item;\n\n const container: Record<string, unknown> = { ...rest };\n if (narrative) container.narrative = narrative;\n if (descriptions?.length) container.descriptions = descriptions;\n if (effectiveTimePeriod || start || end) {\n container.effectiveTimePeriod = {\n ...(effectiveTimePeriod ?? {}),\n ...(start ? { validFrom: start } : {}),\n ...(end ? { validTo: end } : {}),\n };\n }\n\n const containerVerifications = getItemVerifications({\n verifiableCredential,\n verifications,\n });\n return {\n ...container,\n ...(containerVerifications.length ? { verifications: containerVerifications } : {}),\n };\n });\n};\n\n/**\n * Returns the LearnCard LER-RS plugin with methods for:\n * - issuing LER-RS VCs\n * - packaging/verifying LER presentations\n * - issuing TCP wrapper VCs for resume packages\n */\nexport const getLerRsPlugin = (initLearnCard: LERRSDependentLearnCard): LERRSPlugin => {\n return {\n name: 'LER-RS',\n displayName: 'LER-RS',\n description:\n 'Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials',\n methods: {\n /**\n * Issues a signed LER-RS VC from normalized person/work/education/certification data.\n *\n * The method:\n * 1. Builds a compliant LER-RS `credentialSubject`\n * 2. Applies VC + LER-RS contexts\n * 3. Signs via `invoke.issueCredential`\n */\n createLerRecord: async (_learnCard, params): Promise<VerifiableCredential> => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n const issuedAt = new Date().toISOString();\n const documentId = crypto.randomUUID();\n\n const personSection: LerRsRecord['person'] = {\n name: {\n given: params.person.givenName,\n family: params.person.familyName,\n formattedName:\n params.person.formattedName ??\n `${params.person.givenName} ${params.person.familyName}`,\n },\n };\n\n const hasAddress =\n !!params.person.address?.formattedAddress ||\n !!params.person.address?.line ||\n !!params.person.address?.city ||\n !!params.person.address?.postalCode ||\n !!params.person.address?.countryCode;\n const webEntries = (params.person.web || []).filter(entry => entry?.url);\n const socialEntries = (params.person.social || []).filter(entry => entry?.uri);\n\n const communication: LerRsRecord['communication'] | undefined =\n params.person.email ||\n params.person.phone ||\n hasAddress ||\n webEntries.length > 0 ||\n socialEntries.length > 0\n ? {\n ...(params.person.email\n ? { email: [{ address: params.person.email }] }\n : {}),\n ...(params.person.phone\n ? { phone: [{ formattedNumber: params.person.phone }] }\n : {}),\n ...(webEntries.length\n ? { web: webEntries.map(entry => ({ url: entry.url, name: entry.name })) }\n : {}),\n ...(socialEntries.length\n ? {\n social: socialEntries.map(entry => ({\n uri: entry.uri,\n ...(entry.name ? { name: entry.name } : {}),\n })),\n }\n : {}),\n ...(hasAddress\n ? {\n address: [\n {\n ...(params.person.address?.formattedAddress\n ? {\n formattedAddress:\n params.person.address.formattedAddress,\n }\n : {}),\n ...(params.person.address?.line\n ? { line: params.person.address.line }\n : {}),\n ...(params.person.address?.city\n ? { city: params.person.address.city }\n : {}),\n ...(params.person.address?.postalCode\n ? { postalCode: params.person.address.postalCode }\n : {}),\n ...(params.person.address?.countryCode\n ? {\n countryCode:\n params.person.address.countryCode,\n }\n : {}),\n },\n ],\n }\n : {}),\n }\n : undefined;\n\n const lerRecord: LerRsRecord = {\n type: LER_RS_TYPE_URI_V45,\n documentId: { value: documentId },\n person: personSection,\n ...(communication ? { communication } : {}),\n skills: (params.skills || []).map(s => ({ name: s })),\n narratives: params.narratives,\n employmentHistories: params.workHistory\n ? buildEmploymentHistories(params.workHistory)\n : undefined,\n educationAndLearnings: params.educationHistory\n ? buildEducationAndLearnings(params.educationHistory)\n : undefined,\n certifications: params.certifications\n ? buildCertifications(params.certifications)\n : undefined,\n attachments: params.attachments,\n };\n\n const unsignedVC: UnsignedVC = {\n '@context': [LER_RS_CREDENTIAL_CONTEXT_V2, inlineLerRsContext],\n id: `urn:uuid:${documentId}`,\n type: ['VerifiableCredential', LER_RS_TYPE_URI_V45],\n issuer: did,\n validFrom: issuedAt,\n credentialSubject: {\n id: params.person.id,\n ...lerRecord,\n },\n };\n\n return initLearnCard.invoke.issueCredential(unsignedVC, {\n proofPurpose: 'assertionMethod',\n });\n },\n\n /**\n * Issues a VP containing at least one LER-RS credential.\n *\n * Throws if:\n * - credentials list is empty\n * - none of the credentials match LER-RS type checks\n */\n createLerPresentation: async (_learnCard, params): Promise<VerifiablePresentation> => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n if (!params.credentials.length)\n throw new Error(\n 'createLerPresentation: credentials array must contain at least one credential'\n );\n const containsLer = params.credentials.some(credentialHasLerRsType);\n if (!containsLer)\n throw new Error(\n 'createLerPresentation: credentials must include at least one LER-RS credential'\n );\n\n const vp: UnsignedVP = {\n '@context': [LER_RS_CREDENTIAL_CONTEXT_V2],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential:\n params.credentials.length === 1\n ? params.credentials[0]\n : params.credentials,\n };\n\n return initLearnCard.invoke.issuePresentation(vp, {\n ...(params.domain ? { domain: params.domain } : {}),\n ...(params.challenge ? { challenge: params.challenge } : {}),\n });\n },\n\n /**\n * Verifies a LER-focused VP and returns structured result details.\n *\n * Overall `verified` allows explicitly self-issued items when determining\n * final status, while still surfacing per-credential verification results.\n */\n verifyLerPresentation: async (\n _learnCard,\n { presentation, domain, challenge }: VerifyLerPresentationParams\n ): Promise<VerificationResult> => {\n const presCheck = await initLearnCard.invoke.verifyPresentation(presentation, {\n ...(domain ? { domain } : {}),\n ...(challenge ? { challenge } : {}),\n });\n\n const presentationResult = {\n verified: presCheck.errors.length === 0,\n errors: presCheck.errors.length ? presCheck.errors : undefined,\n };\n\n const credentialResults: VerificationResult['credentialResults'] = [];\n\n if (typeof presentation !== 'string') {\n const holder = presentation.holder;\n const vcs = toArray<VerifiableCredential>(\n presentation.verifiableCredential as any\n );\n\n for (const credential of vcs) {\n try {\n const credCheck = await initLearnCard.invoke.verifyCredential(\n credential\n );\n const issuerDid =\n typeof credential.issuer === 'string'\n ? credential.issuer\n : credential.issuer?.id;\n const isSelfIssued =\n credentialHasLerRsType(credential) ||\n (!!holder && !!issuerDid && issuerDid === holder);\n\n credentialResults.push({\n credential,\n verified: credCheck.errors.length === 0,\n isSelfIssued,\n errors: credCheck.errors.length ? credCheck.errors : undefined,\n });\n } catch (err) {\n credentialResults.push({\n credential,\n verified: false,\n isSelfIssued: false,\n errors: [\n err instanceof Error\n ? err.message\n : 'Unknown error verifying credential',\n ],\n });\n }\n }\n }\n\n return {\n verified:\n presentationResult.verified &&\n credentialResults.every(r => r.verified || r.isSelfIssued),\n presentationResult,\n credentialResults,\n };\n },\n\n /**\n * Issues a signed TrustedCareerProfile wrapper VC for resume package publishing.\n *\n * Includes:\n * - public PDF URL\n * - PDF SHA-256 hash\n * - included credential references\n * - generation timestamp\n *\n * Co-sign fields are intentionally stubbed for MVP and currently rejected.\n */\n createTcpWrapperVc: async (_learnCard, params): Promise<VerifiableCredential> => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n const issuedAt = params.issuanceDate ?? new Date().toISOString();\n const generatedAt = params.generatedAt ?? issuedAt;\n const subjectDid = params.subjectDid ?? did;\n\n if (params.enableCoSign) {\n throw new Error('createTcpWrapperVc: co-signing is not enabled in MVP');\n }\n\n if (params.coSignerDid) {\n throw new Error(\n 'createTcpWrapperVc: coSignerDid is reserved for future co-sign support'\n );\n }\n\n // NOTE: We inline the TCP context for local testing while the hosted\n // context URL is not yet available in all environments.\n const inlineTcpContext = {\n '@version': 1.1,\n id: '@id',\n type: '@type',\n TrustedCareerProfile: 'https://ctx.learncard.com/tcp#TrustedCareerProfile',\n ResumePackage: 'https://ctx.learncard.com/tcp#ResumePackage',\n pdfUrl: {\n '@id': 'https://ctx.learncard.com/tcp#pdfUrl',\n '@type': '@id',\n },\n pdfHash: 'https://ctx.learncard.com/tcp#pdfHash',\n hashAlgorithm: 'https://ctx.learncard.com/tcp#hashAlgorithm',\n includedCredentials: {\n '@id': 'https://ctx.learncard.com/tcp#includedCredentials',\n '@container': '@set',\n },\n category: 'https://ctx.learncard.com/tcp#category',\n generatedAt: {\n '@id': 'https://ctx.learncard.com/tcp#generatedAt',\n '@type': 'http://www.w3.org/2001/XMLSchema#dateTime',\n },\n };\n\n const unsignedVC: UnsignedVC = {\n '@context': [LER_RS_CREDENTIAL_CONTEXT_V2, inlineTcpContext],\n type: ['VerifiableCredential', TCP_WRAPPER_TYPE],\n id: params.wrapperId,\n issuer: did,\n validFrom: issuedAt,\n credentialSubject: {\n id: subjectDid,\n type: 'ResumePackage',\n pdfUrl: params.pdfUrl,\n pdfHash: params.pdfHash,\n hashAlgorithm: 'SHA-256',\n includedCredentials: params.includedCredentials,\n generatedAt,\n },\n };\n\n return initLearnCard.invoke.issueCredential(unsignedVC, {\n proofPurpose: 'assertionMethod',\n });\n },\n },\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,IAAM,+BAA+B;AAIrC,IAAM,+BAA+B;AAIrC,IAAM,wBACT;AAIG,IAAM,sBACT;AAIG,IAAM,6BACT;AAIG,IAAM,2BAA2B;AAMjC,IAAM,iBAAiB;AAOvB,IAAM,mBAAmB;;;ACvBhC,IAAM,uBAAuB,wBAAC,SAGA;AAC1B,MAAI,KAAK,eAAe
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,IAAM,+BAA+B;AAIrC,IAAM,+BAA+B;AAIrC,IAAM,wBACT;AAIG,IAAM,sBACT;AAIG,IAAM,6BACT;AAIG,IAAM,2BAA2B;AAMjC,IAAM,iBAAiB;AAOvB,IAAM,mBAAmB;;;ACvBhC,IAAM,uBAAuB,wBAAC,SAGA;AAC1B,MAAI,KAAK,eAAe,OAAQ,QAAO,KAAK;AAC5C,MAAI,KAAK,qBAAsB,QAAO,CAAC,KAAK,oBAAoB;AAChE,SAAO,CAAC;AACZ,GAP6B;AAY7B,IAAM,UAAU,wBAAI,UAChB,SAAS,OAAO,CAAC,IAAI,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK,GAD9C;AAUhB,IAAM,qBAAqB;AAAA,EACvB,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,UAAU;AACd;AAUA,IAAM,yBAAyB,wBAAC,eAA8C;AAC1E,QAAM,WAAW,MAAM,QAAQ,W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;AAAA,UACA,SAAS;AAAA,UACT,eAAe;AAAA,UACf,qBAAqB;AAAA,YACjB,OAAO;AAAA,YACP,cAAc;AAAA,UAClB;AAAA,UACA,UAAU;AAAA,UACV,aAAa;AAAA,YACT,OAAO;AAAA,YACP,SAAS;AAAA,UACb;AAAA,QACJ;AAEA,cAAM,aAAyB;AAAA,UAC3B,YAAY,CAAC,8BAA8B,gBAAgB;AAAA,UAC3D,MAAM,CAAC,wBAAwB,gBAAgB;AAAA,UAC/C,IAAI,OAAO;AAAA,UACX,QAAQ;AAAA,UACR,WAAW;AAAA,UACX,mBAAmB;AAAA,YACf,IAAI;AAAA,YACJ,MAAM;AAAA,YACN,QAAQ,OAAO;AAAA,YACf,SAAS,OAAO;AAAA,YAChB,eAAe;AAAA,YACf,qBAAqB,OAAO;AAAA,YAC5B;AAAA,UACJ;AAAA,QACJ;AAEA,eAAO,cAAc,OAAO,gBAAgB,YAAY;AAAA,UACpD,cAAc;AAAA,QAClB,CAAC;AAAA,MACL,GA9DoB;AAAA,IA+DxB;AAAA,EACJ;AACJ,GA5T8B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var h=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var C=(r,t)=>h(r,"name",{value:t,configurable:!0});var k=(r,t)=>{for(var e in t)h(r,e,{get:t[e],enumerable:!0})},S=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!A.call(r,n)&&n!==e&&h(r,n,{get:()=>t[n],enumerable:!(s=w(t,n))||s.enumerable});return r};var _=r=>S(h({},"__esModule",{value:!0}),r);var Y={};k(Y,{LEGACY_LER_RS_TYPE_TOKEN:()=>P,LEGACY_LER_RS_TYPE_URI_V44:()=>y,LER_RS_CREDENTIAL_CONTEXT_V1:()=>x,LER_RS_CREDENTIAL_CONTEXT_V2:()=>m,LER_RS_TYPE_URI_V45:()=>R,LER_RS_VC_CONTEXT_V45:()=>N,TCP_CONTEXT_V1:()=>I,TCP_WRAPPER_TYPE:()=>v,getLerRsPlugin:()=>b});module.exports=_(Y);var x="https://www.w3.org/2018/credentials/v1",m="https://www.w3.org/ns/credentials/v2",N="http://schema.hropenstandards.org/4.5/recruiting/json/VerifiableCredentialLER-RSType.json",R="http://schema.hropenstandards.org/4.5/recruiting/json/LER-RSType.json",y="http://schema.hropenstandards.org/4.4/recruiting/json/ler-rs/LER-RSType.json",P="LERRS",I="https://ctx.learncard.com/tcp/1.0.0.json",v="TrustedCareerProfile";var V=C(r=>r.verifications?.length?r.verifications:r.verifiableCredential?[r.verifiableCredential]:[],"getItemVerifications"),D=C(r=>r==null?[]:Array.isArray(r)?r:[r],"toArray"),H={"@version":1.1,hrrec:"http://schema.hropenstandards.org/recruiting/","@vocab":"http://schema.hropenstandards.org/recruiting/"},L=C(r=>{if((Array.isArray(r.type)?r.type:[r.type]).some(a=>[P,y,R].includes(a)))return!0;let e=r.credentialSubject;if(!e)return!1;let s=e.type;if(typeof s=="string"&&[y,R].includes(s))return!0;let n=e.lerrsType?.type;return typeof n=="string"&&[y,R].includes(n)},"credentialHasLerRsType"),U=C(r=>r.map(t=>{let{narrative:e,descriptions:s,verifiableCredential:n,verifications:a,position:d,employer:f,start:c,end:g,current:i,...l}=t,p={...l};if(typeof i=="boolean"&&(p.current=i),f&&(p.organization={tradeName:f}),d||c||g||typeof i=="boolean"){let o={};d&&(o.title=d),c&&(o.start=c),g&&(o.end=g),typeof i=="boolean"&&(o.current=i),s?.length&&(o.descriptions=s),p.positionHistories=[o]}e&&(p.narrative=e),s?.length&&!p.positionHistories&&(p.descriptions=s);let u=V({verifiableCredential:n,verifications:a});return{...p,...u.length?{verifications:u}:{}}}),"buildEmploymentHistories"),M=C(r=>r.map(t=>{let{narrative:e,descriptions:s,verifiableCredential:n,verifications:a,institution:d,start:f,end:c,current:g,degree:i,specializations:l,...p}=t,u={...p};d&&(u.institution={name:d}),f&&(u.start=f),c&&(u.end=c),typeof g=="boolean"&&(u.current=g),s?.length&&(u.descriptions=s),(i||l)&&(u.educationDegrees=[{...i?{name:i}:{},...l?{specializations:l.map(E=>({name:E}))}:{}}]),e&&(u.narrative=e);let o=V({verifiableCredential:n,verifications:a});return{...u,...o.length?{verifications:o}:{}}}),"buildEducationAndLearnings"),j=C(r=>r.map(t=>{let{narrative:e,descriptions:s,start:n,end:a,effectiveTimePeriod:d,verifiableCredential:f,verifications:c,...g}=t,i={...g};e&&(i.narrative=e),s?.length&&(i.descriptions=s),(d||n||a)&&(i.effectiveTimePeriod={...d??{},...n?{validFrom:n}:{},...a?{validTo:a}:{}});let l=V({verifiableCredential:f,verifications:c});return{...i,...l.length?{verifications:l}:{}}}),"buildCertifications"),b=C(r=>({name:"LER-RS",displayName:"LER-RS",description:"Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials",methods:{createLerRecord:async(t,e)=>{let n=(e.learnCard??t).id.did(),a=new Date().toISOString(),d=crypto.randomUUID(),f={name:{given:e.person.givenName,family:e.person.familyName,formattedName:e.person.formattedName??`${e.person.givenName} ${e.person.familyName}`}},c=!!e.person.address?.formattedAddress||!!e.person.address?.line||!!e.person.address?.city||!!e.person.address?.postalCode||!!e.person.address?.countryCode,g=(e.person.web||[]).filter(o=>o?.url),i=(e.person.social||[]).filter(o=>o?.uri),l=e.person.email||e.person.phone||c||g.length>0||i.length>0?{...e.person.email?{email:[{address:e.person.email}]}:{},...e.person.phone?{phone:[{formattedNumber:e.person.phone}]}:{},...g.length?{web:g.map(o=>({url:o.url,name:o.name}))}:{},...i.length?{social:i.map(o=>({uri:o.uri,...o.name?{name:o.name}:{}}))}:{},...c?{address:[{...e.person.address?.formattedAddress?{formattedAddress:e.person.address.formattedAddress}:{},...e.person.address?.line?{line:e.person.address.line}:{},...e.person.address?.city?{city:e.person.address.city}:{},...e.person.address?.postalCode?{postalCode:e.person.address.postalCode}:{},...e.person.address?.countryCode?{countryCode:e.person.address.countryCode}:{}}]}:{}}:void 0,p={type:R,documentId:{value:d},person:f,...l?{communication:l}:{},skills:(e.skills||[]).map(o=>({name:o})),narratives:e.narratives,employmentHistories:e.workHistory?U(e.workHistory):void 0,educationAndLearnings:e.educationHistory?M(e.educationHistory):void 0,certifications:e.certifications?j(e.certifications):void 0,attachments:e.attachments},u={"@context":[m,H],id:`urn:uuid:${d}`,type:["VerifiableCredential",R],issuer:n,validFrom:a,credentialSubject:{id:e.person.id,...p}};return r.invoke.issueCredential(u,{proofPurpose:"assertionMethod"})},createLerPresentation:async(t,e)=>{let n=(e.learnCard??t).id.did();if(!e.credentials.length)throw new Error("createLerPresentation: credentials array must contain at least one credential");if(!e.credentials.some(L))throw new Error("createLerPresentation: credentials must include at least one LER-RS credential");let d={"@context":[m],type:["VerifiablePresentation"],holder:n,verifiableCredential:e.credentials.length===1?e.credentials[0]:e.credentials};return r.invoke.issuePresentation(d,{...e.domain?{domain:e.domain}:{},...e.challenge?{challenge:e.challenge}:{}})},verifyLerPresentation:async(t,{presentation:e,domain:s,challenge:n})=>{let a=await r.invoke.verifyPresentation(e,{...s?{domain:s}:{},...n?{challenge:n}:{}}),d={verified:a.errors.length===0,errors:a.errors.length?a.errors:void 0},f=[];if(typeof e!="string"){let c=e.holder,g=D(e.verifiableCredential);for(let i of g)try{let l=await r.invoke.verifyCredential(i),p=typeof i.issuer=="string"?i.issuer:i.issuer?.id,u=L(i)||!!c&&!!p&&p===c;f.push({credential:i,verified:l.errors.length===0,isSelfIssued:u,errors:l.errors.length?l.errors:void 0})}catch(l){f.push({credential:i,verified:!1,isSelfIssued:!1,errors:[l instanceof Error?l.message:"Unknown error verifying credential"]})}}return{verified:d.verified&&f.every(c=>c.verified||c.isSelfIssued),presentationResult:d,credentialResults:f}},createTcpWrapperVc:async(t,e)=>{let n=(e.learnCard??t).id.did(),a=e.issuanceDate??new Date().toISOString(),d=e.generatedAt??a,f=e.subjectDid??n;if(e.enableCoSign)throw new Error("createTcpWrapperVc: co-signing is not enabled in MVP");if(e.coSignerDid)throw new Error("createTcpWrapperVc: coSignerDid is reserved for future co-sign support");let g={"@context":[m,{"@version":1.1,id:"@id",type:"@type",TrustedCareerProfile:"https://ctx.learncard.com/tcp#TrustedCareerProfile",ResumePackage:"https://ctx.learncard.com/tcp#ResumePackage",pdfUrl:{"@id":"https://ctx.learncard.com/tcp#pdfUrl","@type":"@id"},pdfHash:"https://ctx.learncard.com/tcp#pdfHash",hashAlgorithm:"https://ctx.learncard.com/tcp#hashAlgorithm",includedCredentials:{"@id":"https://ctx.learncard.com/tcp#includedCredentials","@container":"@set"},category:"https://ctx.learncard.com/tcp#category",generatedAt:{"@id":"https://ctx.learncard.com/tcp#generatedAt","@type":"http://www.w3.org/2001/XMLSchema#dateTime"}}],type:["VerifiableCredential",v],id:e.wrapperId,issuer:n,validFrom:a,credentialSubject:{id:f,type:"ResumePackage",pdfUrl:e.pdfUrl,pdfHash:e.pdfHash,hashAlgorithm:"SHA-256",includedCredentials:e.includedCredentials,generatedAt:d}};return r.invoke.issueCredential(g,{proofPurpose:"assertionMethod"})}}}),"getLerRsPlugin");
|
|
1
|
+
"use strict";var h=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var C=(r,t)=>h(r,"name",{value:t,configurable:!0});var k=(r,t)=>{for(var e in t)h(r,e,{get:t[e],enumerable:!0})},S=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of T(t))!A.call(r,n)&&n!==e&&h(r,n,{get:()=>t[n],enumerable:!(s=w(t,n))||s.enumerable});return r};var _=r=>S(h({},"__esModule",{value:!0}),r);var Y={};k(Y,{LEGACY_LER_RS_TYPE_TOKEN:()=>P,LEGACY_LER_RS_TYPE_URI_V44:()=>y,LER_RS_CREDENTIAL_CONTEXT_V1:()=>x,LER_RS_CREDENTIAL_CONTEXT_V2:()=>m,LER_RS_TYPE_URI_V45:()=>R,LER_RS_VC_CONTEXT_V45:()=>N,TCP_CONTEXT_V1:()=>I,TCP_WRAPPER_TYPE:()=>v,getLerRsPlugin:()=>b});module.exports=_(Y);var x="https://www.w3.org/2018/credentials/v1",m="https://www.w3.org/ns/credentials/v2",N="http://schema.hropenstandards.org/4.5/recruiting/json/VerifiableCredentialLER-RSType.json",R="http://schema.hropenstandards.org/4.5/recruiting/json/LER-RSType.json",y="http://schema.hropenstandards.org/4.4/recruiting/json/ler-rs/LER-RSType.json",P="LERRS",I="https://ctx.learncard.com/tcp/1.0.0.json",v="TrustedCareerProfile";var V=C(r=>r.verifications?.length?r.verifications:r.verifiableCredential?[r.verifiableCredential]:[],"getItemVerifications"),D=C(r=>r==null?[]:Array.isArray(r)?r:[r],"toArray"),H={"@version":1.1,hrrec:"http://schema.hropenstandards.org/recruiting/","@vocab":"http://schema.hropenstandards.org/recruiting/"},L=C(r=>{if((Array.isArray(r.type)?r.type:[r.type]).some(a=>[P,y,R].includes(a)))return!0;let e=r.credentialSubject;if(!e)return!1;let s=e.type;if(typeof s=="string"&&[y,R].includes(s))return!0;let n=e.lerrsType?.type;return typeof n=="string"&&[y,R].includes(n)},"credentialHasLerRsType"),U=C(r=>r.map(t=>{let{narrative:e,descriptions:s,verifiableCredential:n,verifications:a,position:d,employer:f,start:c,end:g,current:i,...l}=t,p={...l};if(typeof i=="boolean"&&(p.current=i),f&&(p.organization={tradeName:f}),d||c||g||typeof i=="boolean"){let o={};d&&(o.title=d),c&&(o.start=c),g&&(o.end=g),typeof i=="boolean"&&(o.current=i),s?.length&&(o.descriptions=s),p.positionHistories=[o]}e&&(p.narrative=e),s?.length&&!p.positionHistories&&(p.descriptions=s);let u=V({verifiableCredential:n,verifications:a});return{...p,...u.length?{verifications:u}:{}}}),"buildEmploymentHistories"),M=C(r=>r.map(t=>{let{narrative:e,descriptions:s,verifiableCredential:n,verifications:a,institution:d,start:f,end:c,current:g,degree:i,specializations:l,...p}=t,u={...p};d&&(u.institution={name:d}),f&&(u.start=f),c&&(u.end=c),typeof g=="boolean"&&(u.current=g),s?.length&&(u.descriptions=s),(i||l)&&(u.educationDegrees=[{...i?{name:i}:{},...l?{specializations:l.map(E=>({name:E}))}:{}}]),e&&(u.narrative=e);let o=V({verifiableCredential:n,verifications:a});return{...u,...o.length?{verifications:o}:{}}}),"buildEducationAndLearnings"),j=C(r=>r.map(t=>{let{narrative:e,descriptions:s,start:n,end:a,effectiveTimePeriod:d,verifiableCredential:f,verifications:c,...g}=t,i={...g};e&&(i.narrative=e),s?.length&&(i.descriptions=s),(d||n||a)&&(i.effectiveTimePeriod={...d??{},...n?{validFrom:n}:{},...a?{validTo:a}:{}});let l=V({verifiableCredential:f,verifications:c});return{...i,...l.length?{verifications:l}:{}}}),"buildCertifications"),b=C(r=>({name:"LER-RS",displayName:"LER-RS",description:"Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials",methods:{createLerRecord:C(async(t,e)=>{let n=(e.learnCard??t).id.did(),a=new Date().toISOString(),d=crypto.randomUUID(),f={name:{given:e.person.givenName,family:e.person.familyName,formattedName:e.person.formattedName??`${e.person.givenName} ${e.person.familyName}`}},c=!!e.person.address?.formattedAddress||!!e.person.address?.line||!!e.person.address?.city||!!e.person.address?.postalCode||!!e.person.address?.countryCode,g=(e.person.web||[]).filter(o=>o?.url),i=(e.person.social||[]).filter(o=>o?.uri),l=e.person.email||e.person.phone||c||g.length>0||i.length>0?{...e.person.email?{email:[{address:e.person.email}]}:{},...e.person.phone?{phone:[{formattedNumber:e.person.phone}]}:{},...g.length?{web:g.map(o=>({url:o.url,name:o.name}))}:{},...i.length?{social:i.map(o=>({uri:o.uri,...o.name?{name:o.name}:{}}))}:{},...c?{address:[{...e.person.address?.formattedAddress?{formattedAddress:e.person.address.formattedAddress}:{},...e.person.address?.line?{line:e.person.address.line}:{},...e.person.address?.city?{city:e.person.address.city}:{},...e.person.address?.postalCode?{postalCode:e.person.address.postalCode}:{},...e.person.address?.countryCode?{countryCode:e.person.address.countryCode}:{}}]}:{}}:void 0,p={type:R,documentId:{value:d},person:f,...l?{communication:l}:{},skills:(e.skills||[]).map(o=>({name:o})),narratives:e.narratives,employmentHistories:e.workHistory?U(e.workHistory):void 0,educationAndLearnings:e.educationHistory?M(e.educationHistory):void 0,certifications:e.certifications?j(e.certifications):void 0,attachments:e.attachments},u={"@context":[m,H],id:`urn:uuid:${d}`,type:["VerifiableCredential",R],issuer:n,validFrom:a,credentialSubject:{id:e.person.id,...p}};return r.invoke.issueCredential(u,{proofPurpose:"assertionMethod"})},"createLerRecord"),createLerPresentation:C(async(t,e)=>{let n=(e.learnCard??t).id.did();if(!e.credentials.length)throw new Error("createLerPresentation: credentials array must contain at least one credential");if(!e.credentials.some(L))throw new Error("createLerPresentation: credentials must include at least one LER-RS credential");let d={"@context":[m],type:["VerifiablePresentation"],holder:n,verifiableCredential:e.credentials.length===1?e.credentials[0]:e.credentials};return r.invoke.issuePresentation(d,{...e.domain?{domain:e.domain}:{},...e.challenge?{challenge:e.challenge}:{}})},"createLerPresentation"),verifyLerPresentation:C(async(t,{presentation:e,domain:s,challenge:n})=>{let a=await r.invoke.verifyPresentation(e,{...s?{domain:s}:{},...n?{challenge:n}:{}}),d={verified:a.errors.length===0,errors:a.errors.length?a.errors:void 0},f=[];if(typeof e!="string"){let c=e.holder,g=D(e.verifiableCredential);for(let i of g)try{let l=await r.invoke.verifyCredential(i),p=typeof i.issuer=="string"?i.issuer:i.issuer?.id,u=L(i)||!!c&&!!p&&p===c;f.push({credential:i,verified:l.errors.length===0,isSelfIssued:u,errors:l.errors.length?l.errors:void 0})}catch(l){f.push({credential:i,verified:!1,isSelfIssued:!1,errors:[l instanceof Error?l.message:"Unknown error verifying credential"]})}}return{verified:d.verified&&f.every(c=>c.verified||c.isSelfIssued),presentationResult:d,credentialResults:f}},"verifyLerPresentation"),createTcpWrapperVc:C(async(t,e)=>{let n=(e.learnCard??t).id.did(),a=e.issuanceDate??new Date().toISOString(),d=e.generatedAt??a,f=e.subjectDid??n;if(e.enableCoSign)throw new Error("createTcpWrapperVc: co-signing is not enabled in MVP");if(e.coSignerDid)throw new Error("createTcpWrapperVc: coSignerDid is reserved for future co-sign support");let g={"@context":[m,{"@version":1.1,id:"@id",type:"@type",TrustedCareerProfile:"https://ctx.learncard.com/tcp#TrustedCareerProfile",ResumePackage:"https://ctx.learncard.com/tcp#ResumePackage",pdfUrl:{"@id":"https://ctx.learncard.com/tcp#pdfUrl","@type":"@id"},pdfHash:"https://ctx.learncard.com/tcp#pdfHash",hashAlgorithm:"https://ctx.learncard.com/tcp#hashAlgorithm",includedCredentials:{"@id":"https://ctx.learncard.com/tcp#includedCredentials","@container":"@set"},category:"https://ctx.learncard.com/tcp#category",generatedAt:{"@id":"https://ctx.learncard.com/tcp#generatedAt","@type":"http://www.w3.org/2001/XMLSchema#dateTime"}}],type:["VerifiableCredential",v],id:e.wrapperId,issuer:n,validFrom:a,credentialSubject:{id:f,type:"ResumePackage",pdfUrl:e.pdfUrl,pdfHash:e.pdfHash,hashAlgorithm:"SHA-256",includedCredentials:e.includedCredentials,generatedAt:d}};return r.invoke.issueCredential(g,{proofPurpose:"assertionMethod"})},"createTcpWrapperVc")}}),"getLerRsPlugin");
|
|
2
2
|
//# sourceMappingURL=ler-rs-plugin.cjs.production.min.cjs.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/types.ts", "../src/ler-rs.ts"],
|
|
4
4
|
"sourcesContent": ["export { getLerRsPlugin } from './ler-rs';\nexport * from './types';\n", "import { Plugin, LearnCard } from '@learncard/core';\nimport {\n VC as VerifiableCredential,\n VP as VerifiablePresentation,\n UnsignedVC,\n UnsignedVP,\n VerificationCheck,\n} from '@learncard/types';\nimport type { VCPluginMethods, VCPluginDependentMethods } from '@learncard/vc-plugin';\n\n/**\n * Legacy W3C VC v1 context kept for interop with previously issued records.\n */\nexport const LER_RS_CREDENTIAL_CONTEXT_V1 = 'https://www.w3.org/2018/credentials/v1';\n/**\n * Base W3C VC v2 context used by newly issued LER-RS credentials and presentations.\n */\nexport const LER_RS_CREDENTIAL_CONTEXT_V2 = 'https://www.w3.org/ns/credentials/v2';\n/**\n * HR Open Standards VC wrapper context for LER-RS v4.5.\n */\nexport const LER_RS_VC_CONTEXT_V45 =\n 'http://schema.hropenstandards.org/4.5/recruiting/json/VerifiableCredentialLER-RSType.json';\n/**\n * Canonical LER-RS type URI for v4.5.\n */\nexport const LER_RS_TYPE_URI_V45 =\n 'http://schema.hropenstandards.org/4.5/recruiting/json/LER-RSType.json';\n/**\n * Legacy LER-RS type URI for v4.4 interop.\n */\nexport const LEGACY_LER_RS_TYPE_URI_V44 =\n 'http://schema.hropenstandards.org/4.4/recruiting/json/ler-rs/LER-RSType.json';\n/**\n * Legacy short type token used by older issuers.\n */\nexport const LEGACY_LER_RS_TYPE_TOKEN = 'LERRS';\n/**\n * Hosted TCP JSON-LD context URL.\n *\n * Note: current local wrapper issuance can inline context during local testing.\n */\nexport const TCP_CONTEXT_V1 = 'https://ctx.learncard.com/tcp/1.0.0.json';\n/**\n * LearnCard-defined wrapper VC type for TCP resume package artifacts.\n *\n * This is intentionally NOT a canonical HR Open Standards LER-RS type;\n * it is a custom wrapper used to bind PDF URL/hash + included credential refs.\n */\nexport const TCP_WRAPPER_TYPE = 'TrustedCareerProfile';\n\n/**\n * Identity details used to populate `credentialSubject.person`.\n */\nexport interface PersonProfile {\n /** Subject DID for the issued LER-RS record. */\n id: string;\n /** Given/first name. */\n givenName: string;\n /** Family/last name. */\n familyName: string;\n /** Optional display name override. */\n formattedName?: string;\n /** Optional contact email to include in communication block. */\n email?: string;\n /** Optional contact phone to include in communication block. */\n phone?: string;\n /** Optional physical/mailing address to include in communication block. */\n address?: {\n formattedAddress?: string;\n line?: string;\n city?: string;\n postalCode?: string;\n countryCode?: string;\n };\n /** Optional website URLs to include in communication block. */\n web?: Array<{ url: string; name?: string }>;\n /** Optional social profile URLs to include in communication block. */\n social?: Array<{ uri: string; name?: string }>;\n}\n\n/**\n * Skill item structure used inside generated LER-RS records.\n */\nexport interface LerSkill {\n name: string;\n comments?: string[];\n description?: string;\n yearsOfExperience?: number;\n endorsers?: Array<{\n person?: { name?: { formattedName?: string } };\n organization?: { name?: string };\n }>;\n}\n\n/**\n * Source work history entry. Can be self-asserted fields and/or third-party verification VCs.\n */\nexport interface WorkHistoryItem {\n narrative?: string;\n descriptions?: string[];\n verifiableCredential?: VerifiableCredential;\n verifications?: VerifiableCredential[];\n // Common self-asserted fields\n position?: string;\n employer?: string;\n start?: string;\n end?: string;\n current?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * Source education entry. Can include freeform fields and optional verification VCs.\n */\nexport interface EducationHistoryItem {\n narrative?: string;\n descriptions?: string[];\n verifiableCredential?: VerifiableCredential;\n verifications?: VerifiableCredential[];\n institution?: string;\n start?: string;\n end?: string;\n current?: boolean;\n degree?: string;\n specializations?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Source certification entry for `credentialSubject.certifications`.\n */\nexport interface CertificationItem {\n narrative?: string;\n descriptions?: string[];\n verifiableCredential?: VerifiableCredential;\n verifications?: VerifiableCredential[];\n name?: string;\n issuingAuthority?: string | Record<string, unknown>;\n status?: string;\n start?: string;\n end?: string;\n effectiveTimePeriod?: { validFrom?: string; validTo?: string };\n [key: string]: unknown;\n}\n\n/**\n * Narrative section block supported by LER-RS schema.\n */\nexport interface LerNarrative {\n name: string;\n texts: Array<{\n name: string;\n lines: string[];\n }>;\n}\n\n/**\n * Typed shape of the LER-RS object embedded into `credentialSubject`.\n */\nexport interface LerRsRecord {\n type: string;\n documentId?: { value: string };\n person: {\n name: {\n given: string;\n family: string;\n formattedName?: string;\n };\n };\n communication?: {\n email?: { address: string }[];\n web?: { url: string; name?: string }[];\n phone?: Array<Record<string, unknown>>;\n address?: Array<Record<string, unknown>>;\n social?: Array<Record<string, unknown>>;\n };\n skills?: LerSkill[];\n narratives?: LerNarrative[];\n educationAndLearnings?: Array<\n { verifications?: VerifiableCredential[] } & Record<string, unknown>\n >;\n employmentHistories?: Array<\n { verifications?: VerifiableCredential[] } & Record<string, unknown>\n >;\n licenses?: Array<{ verifications?: VerifiableCredential[] } & Record<string, unknown>>;\n certifications?: Array<{ verifications?: VerifiableCredential[] } & Record<string, unknown>>;\n employmentPreferences?: Array<Record<string, unknown>>;\n positionPreferences?: Array<Record<string, unknown>>;\n attachments?: Array<Record<string, unknown>>;\n}\n\n/**\n * Parameters for issuing a signed LER-RS VC from normalized source data.\n */\nexport interface CreateLerRecordParams {\n learnCard: LearnCard<any, 'id', VCPluginMethods & VCPluginDependentMethods>;\n person: PersonProfile;\n workHistory?: WorkHistoryItem[];\n educationHistory?: EducationHistoryItem[];\n certifications?: CertificationItem[];\n skills?: string[];\n narratives?: LerNarrative[];\n attachments?: Array<Record<string, unknown>>;\n}\n\n/**\n * Parameters for issuing a VP that packages one or more credentials including at least one LER-RS credential.\n */\nexport interface CreateLerPresentationParams {\n learnCard: LearnCard<any, 'id', VCPluginMethods & VCPluginDependentMethods>;\n credentials: VerifiableCredential[];\n domain?: string;\n challenge?: string;\n}\n\n/**\n * Parameters for verifying a LER-focused VP and nested credentials.\n */\nexport interface VerifyLerPresentationParams {\n presentation: VerifiablePresentation | string;\n domain?: string;\n challenge?: string;\n}\n\n/**\n * Credential reference stored in TCP wrapper VC.\n */\nexport interface TcpIncludedCredentialRef {\n /** Resolved VC id when available; falls back to URI if id is unavailable. */\n id: string;\n /** Category label used for UI grouping and downstream filtering. */\n category: string;\n}\n\n/**\n * Parameters for issuing TrustedCareerProfile wrapper VCs.\n */\nexport interface CreateTcpWrapperVcParams {\n learnCard: LearnCard<any, 'id', VCPluginMethods & VCPluginDependentMethods>;\n wrapperId: string;\n subjectDid?: string;\n pdfUrl: string;\n pdfHash: string;\n includedCredentials: TcpIncludedCredentialRef[];\n generatedAt?: string;\n /** Timestamp used as the issued credential's `validFrom` value. */\n issuanceDate?: string;\n coSignerDid?: string;\n enableCoSign?: boolean;\n}\n\n/**\n * Structured verification output for LER presentation verification.\n */\nexport interface VerificationResult {\n verified: boolean; // Overall status\n presentationResult: {\n verified: boolean;\n errors?: string[];\n };\n credentialResults: {\n credential: VerifiableCredential;\n verified: boolean;\n isSelfIssued: boolean;\n errors?: string[];\n }[];\n}\n\n/**\n * LearnCard dependency contract required by this plugin.\n */\nexport type LERRSDependentLearnCard = LearnCard<\n any,\n 'id',\n VCPluginMethods & VCPluginDependentMethods\n>;\n\n/**\n * Public invoke methods exposed by the LER-RS plugin.\n */\nexport type LERRSPluginMethods = {\n createLerRecord: (params: CreateLerRecordParams) => Promise<VerifiableCredential>;\n createLerPresentation: (params: CreateLerPresentationParams) => Promise<VerifiablePresentation>;\n verifyLerPresentation: (params: VerifyLerPresentationParams) => Promise<VerificationResult>;\n createTcpWrapperVc: (params: CreateTcpWrapperVcParams) => Promise<VerifiableCredential>;\n};\n\n/**\n * Plugin type definition for registration in LearnCard.\n */\nexport type LERRSPlugin = Plugin<\n 'LER-RS',\n never,\n LERRSPluginMethods,\n 'id',\n VCPluginMethods & VCPluginDependentMethods\n>;\n", "import {\n VC as VerifiableCredential,\n UnsignedVC,\n VP as VerifiablePresentation,\n UnsignedVP,\n} from '@learncard/types';\nimport {\n LERRSDependentLearnCard,\n LERRSPlugin,\n CreateLerRecordParams,\n CreateLerPresentationParams,\n VerifyLerPresentationParams,\n VerificationResult,\n LerRsRecord,\n LER_RS_CREDENTIAL_CONTEXT_V2,\n LER_RS_TYPE_URI_V45,\n LEGACY_LER_RS_TYPE_URI_V44,\n LEGACY_LER_RS_TYPE_TOKEN,\n TCP_WRAPPER_TYPE,\n} from './types';\n\n/**\n * Normalizes verification containers from either:\n * - `verifications: VC[]`\n * - `verifiableCredential: VC`\n */\nconst getItemVerifications = (item: {\n verifiableCredential?: VerifiableCredential;\n verifications?: VerifiableCredential[];\n}): VerifiableCredential[] => {\n if (item.verifications?.length) return item.verifications;\n if (item.verifiableCredential) return [item.verifiableCredential];\n return [];\n};\n\n/**\n * Converts scalar-or-array values into a normalized array.\n */\nconst toArray = <T>(maybe: T | T[] | undefined): T[] =>\n maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe];\n\n/**\n * Inline LER-RS JSON-LD context used for signing stability.\n *\n * The published HR Open URL is schema-oriented and can trigger additional remote\n * context resolution during expansion. Inlining this base context avoids network\n * dependency at issue time while preserving deterministic term expansion.\n */\nconst inlineLerRsContext = {\n '@version': 1.1,\n hrrec: 'http://schema.hropenstandards.org/recruiting/',\n '@vocab': 'http://schema.hropenstandards.org/recruiting/',\n};\n\n/**\n * Determines whether a VC represents a LER-RS credential (legacy and current forms).\n *\n * Checks:\n * - VC `type` array/token values\n * - `credentialSubject.type`\n * - nested `credentialSubject.lerrsType.type`\n */\nconst credentialHasLerRsType = (credential: VerifiableCredential): boolean => {\n const typeList = Array.isArray(credential.type) ? credential.type : [credential.type];\n if (\n typeList.some(type =>\n [LEGACY_LER_RS_TYPE_TOKEN, LEGACY_LER_RS_TYPE_URI_V44, LER_RS_TYPE_URI_V45].includes(\n type\n )\n )\n )\n return true;\n\n const credentialSubject = credential.credentialSubject as Record<string, unknown> | undefined;\n if (!credentialSubject) return false;\n\n const inlineType = credentialSubject.type;\n if (\n typeof inlineType === 'string' &&\n [LEGACY_LER_RS_TYPE_URI_V44, LER_RS_TYPE_URI_V45].includes(inlineType)\n )\n return true;\n\n const nestedType = (credentialSubject.lerrsType as Record<string, unknown> | undefined)?.type;\n return (\n typeof nestedType === 'string' &&\n [LEGACY_LER_RS_TYPE_URI_V44, LER_RS_TYPE_URI_V45].includes(nestedType)\n );\n};\n\n/**\n * Maps application work history items to LER-RS `employmentHistories` shape.\n */\nconst buildEmploymentHistories = (\n items: NonNullable<CreateLerRecordParams['workHistory']>\n): LerRsRecord['employmentHistories'] => {\n return items.map(item => {\n const {\n narrative,\n descriptions,\n verifiableCredential,\n verifications,\n position,\n employer,\n start,\n end,\n current,\n ...rest\n } = item;\n\n const container: Record<string, unknown> = { ...rest };\n if (typeof current === 'boolean') container.current = current;\n\n if (employer) container.organization = { tradeName: employer };\n if (position || start || end || typeof current === 'boolean') {\n const ph: Record<string, unknown> = {};\n if (position) ph.title = position;\n if (start) ph.start = start;\n if (end) ph.end = end;\n if (typeof current === 'boolean') ph.current = current;\n if (descriptions?.length) ph.descriptions = descriptions;\n container.positionHistories = [ph];\n }\n if (narrative) container.narrative = narrative;\n if (descriptions?.length && !container.positionHistories) container.descriptions = descriptions;\n\n const containerVerifications = getItemVerifications({\n verifiableCredential,\n verifications,\n });\n return {\n ...container,\n ...(containerVerifications.length ? { verifications: containerVerifications } : {}),\n };\n });\n};\n\n/**\n * Maps education source items into LER-RS `educationAndLearnings`.\n */\nconst buildEducationAndLearnings = (\n items: NonNullable<CreateLerRecordParams['educationHistory']>\n): LerRsRecord['educationAndLearnings'] => {\n return items.map(item => {\n const {\n narrative,\n descriptions,\n verifiableCredential,\n verifications,\n institution,\n start,\n end,\n current,\n degree,\n specializations,\n ...rest\n } = item;\n\n const container: Record<string, unknown> = { ...rest };\n if (institution) container.institution = { name: institution };\n if (start) container.start = start;\n if (end) container.end = end;\n if (typeof current === 'boolean') container.current = current;\n if (descriptions?.length) container.descriptions = descriptions;\n if (degree || specializations) {\n container.educationDegrees = [\n {\n ...(degree ? { name: degree } : {}),\n ...(specializations\n ? {\n specializations: specializations.map(specialization => ({\n name: specialization,\n })),\n }\n : {}),\n },\n ];\n }\n if (narrative) container.narrative = narrative;\n\n const containerVerifications = getItemVerifications({\n verifiableCredential,\n verifications,\n });\n return {\n ...container,\n ...(containerVerifications.length ? { verifications: containerVerifications } : {}),\n };\n });\n};\n\n/**\n * Maps certification source items to LER-RS `certifications`.\n */\nconst buildCertifications = (\n items: NonNullable<CreateLerRecordParams['certifications']>\n): LerRsRecord['certifications'] => {\n return items.map(item => {\n const {\n narrative,\n descriptions,\n start,\n end,\n effectiveTimePeriod,\n verifiableCredential,\n verifications,\n ...rest\n } = item;\n\n const container: Record<string, unknown> = { ...rest };\n if (narrative) container.narrative = narrative;\n if (descriptions?.length) container.descriptions = descriptions;\n if (effectiveTimePeriod || start || end) {\n container.effectiveTimePeriod = {\n ...(effectiveTimePeriod ?? {}),\n ...(start ? { validFrom: start } : {}),\n ...(end ? { validTo: end } : {}),\n };\n }\n\n const containerVerifications = getItemVerifications({\n verifiableCredential,\n verifications,\n });\n return {\n ...container,\n ...(containerVerifications.length ? { verifications: containerVerifications } : {}),\n };\n });\n};\n\n/**\n * Returns the LearnCard LER-RS plugin with methods for:\n * - issuing LER-RS VCs\n * - packaging/verifying LER presentations\n * - issuing TCP wrapper VCs for resume packages\n */\nexport const getLerRsPlugin = (initLearnCard: LERRSDependentLearnCard): LERRSPlugin => {\n return {\n name: 'LER-RS',\n displayName: 'LER-RS',\n description:\n 'Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials',\n methods: {\n /**\n * Issues a signed LER-RS VC from normalized person/work/education/certification data.\n *\n * The method:\n * 1. Builds a compliant LER-RS `credentialSubject`\n * 2. Applies VC + LER-RS contexts\n * 3. Signs via `invoke.issueCredential`\n */\n createLerRecord: async (_learnCard, params): Promise<VerifiableCredential> => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n const issuedAt = new Date().toISOString();\n const documentId = crypto.randomUUID();\n\n const personSection: LerRsRecord['person'] = {\n name: {\n given: params.person.givenName,\n family: params.person.familyName,\n formattedName:\n params.person.formattedName ??\n `${params.person.givenName} ${params.person.familyName}`,\n },\n };\n\n const hasAddress =\n !!params.person.address?.formattedAddress ||\n !!params.person.address?.line ||\n !!params.person.address?.city ||\n !!params.person.address?.postalCode ||\n !!params.person.address?.countryCode;\n const webEntries = (params.person.web || []).filter(entry => entry?.url);\n const socialEntries = (params.person.social || []).filter(entry => entry?.uri);\n\n const communication: LerRsRecord['communication'] | undefined =\n params.person.email ||\n params.person.phone ||\n hasAddress ||\n webEntries.length > 0 ||\n socialEntries.length > 0\n ? {\n ...(params.person.email\n ? { email: [{ address: params.person.email }] }\n : {}),\n ...(params.person.phone\n ? { phone: [{ formattedNumber: params.person.phone }] }\n : {}),\n ...(webEntries.length\n ? { web: webEntries.map(entry => ({ url: entry.url, name: entry.name })) }\n : {}),\n ...(socialEntries.length\n ? {\n social: socialEntries.map(entry => ({\n uri: entry.uri,\n ...(entry.name ? { name: entry.name } : {}),\n })),\n }\n : {}),\n ...(hasAddress\n ? {\n address: [\n {\n ...(params.person.address?.formattedAddress\n ? {\n formattedAddress:\n params.person.address.formattedAddress,\n }\n : {}),\n ...(params.person.address?.line\n ? { line: params.person.address.line }\n : {}),\n ...(params.person.address?.city\n ? { city: params.person.address.city }\n : {}),\n ...(params.person.address?.postalCode\n ? { postalCode: params.person.address.postalCode }\n : {}),\n ...(params.person.address?.countryCode\n ? {\n countryCode:\n params.person.address.countryCode,\n }\n : {}),\n },\n ],\n }\n : {}),\n }\n : undefined;\n\n const lerRecord: LerRsRecord = {\n type: LER_RS_TYPE_URI_V45,\n documentId: { value: documentId },\n person: personSection,\n ...(communication ? { communication } : {}),\n skills: (params.skills || []).map(s => ({ name: s })),\n narratives: params.narratives,\n employmentHistories: params.workHistory\n ? buildEmploymentHistories(params.workHistory)\n : undefined,\n educationAndLearnings: params.educationHistory\n ? buildEducationAndLearnings(params.educationHistory)\n : undefined,\n certifications: params.certifications\n ? buildCertifications(params.certifications)\n : undefined,\n attachments: params.attachments,\n };\n\n const unsignedVC: UnsignedVC = {\n '@context': [LER_RS_CREDENTIAL_CONTEXT_V2, inlineLerRsContext],\n id: `urn:uuid:${documentId}`,\n type: ['VerifiableCredential', LER_RS_TYPE_URI_V45],\n issuer: did,\n validFrom: issuedAt,\n credentialSubject: {\n id: params.person.id,\n ...lerRecord,\n },\n };\n\n return initLearnCard.invoke.issueCredential(unsignedVC, {\n proofPurpose: 'assertionMethod',\n });\n },\n\n /**\n * Issues a VP containing at least one LER-RS credential.\n *\n * Throws if:\n * - credentials list is empty\n * - none of the credentials match LER-RS type checks\n */\n createLerPresentation: async (_learnCard, params): Promise<VerifiablePresentation> => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n if (!params.credentials.length)\n throw new Error(\n 'createLerPresentation: credentials array must contain at least one credential'\n );\n const containsLer = params.credentials.some(credentialHasLerRsType);\n if (!containsLer)\n throw new Error(\n 'createLerPresentation: credentials must include at least one LER-RS credential'\n );\n\n const vp: UnsignedVP = {\n '@context': [LER_RS_CREDENTIAL_CONTEXT_V2],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential:\n params.credentials.length === 1\n ? params.credentials[0]\n : params.credentials,\n };\n\n return initLearnCard.invoke.issuePresentation(vp, {\n ...(params.domain ? { domain: params.domain } : {}),\n ...(params.challenge ? { challenge: params.challenge } : {}),\n });\n },\n\n /**\n * Verifies a LER-focused VP and returns structured result details.\n *\n * Overall `verified` allows explicitly self-issued items when determining\n * final status, while still surfacing per-credential verification results.\n */\n verifyLerPresentation: async (\n _learnCard,\n { presentation, domain, challenge }: VerifyLerPresentationParams\n ): Promise<VerificationResult> => {\n const presCheck = await initLearnCard.invoke.verifyPresentation(presentation, {\n ...(domain ? { domain } : {}),\n ...(challenge ? { challenge } : {}),\n });\n\n const presentationResult = {\n verified: presCheck.errors.length === 0,\n errors: presCheck.errors.length ? presCheck.errors : undefined,\n };\n\n const credentialResults: VerificationResult['credentialResults'] = [];\n\n if (typeof presentation !== 'string') {\n const holder = presentation.holder;\n const vcs = toArray<VerifiableCredential>(\n presentation.verifiableCredential as any\n );\n\n for (const credential of vcs) {\n try {\n const credCheck = await initLearnCard.invoke.verifyCredential(\n credential\n );\n const issuerDid =\n typeof credential.issuer === 'string'\n ? credential.issuer\n : credential.issuer?.id;\n const isSelfIssued =\n credentialHasLerRsType(credential) ||\n (!!holder && !!issuerDid && issuerDid === holder);\n\n credentialResults.push({\n credential,\n verified: credCheck.errors.length === 0,\n isSelfIssued,\n errors: credCheck.errors.length ? credCheck.errors : undefined,\n });\n } catch (err) {\n credentialResults.push({\n credential,\n verified: false,\n isSelfIssued: false,\n errors: [\n err instanceof Error\n ? err.message\n : 'Unknown error verifying credential',\n ],\n });\n }\n }\n }\n\n return {\n verified:\n presentationResult.verified &&\n credentialResults.every(r => r.verified || r.isSelfIssued),\n presentationResult,\n credentialResults,\n };\n },\n\n /**\n * Issues a signed TrustedCareerProfile wrapper VC for resume package publishing.\n *\n * Includes:\n * - public PDF URL\n * - PDF SHA-256 hash\n * - included credential references\n * - generation timestamp\n *\n * Co-sign fields are intentionally stubbed for MVP and currently rejected.\n */\n createTcpWrapperVc: async (_learnCard, params): Promise<VerifiableCredential> => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n const issuedAt = params.issuanceDate ?? new Date().toISOString();\n const generatedAt = params.generatedAt ?? issuedAt;\n const subjectDid = params.subjectDid ?? did;\n\n if (params.enableCoSign) {\n throw new Error('createTcpWrapperVc: co-signing is not enabled in MVP');\n }\n\n if (params.coSignerDid) {\n throw new Error(\n 'createTcpWrapperVc: coSignerDid is reserved for future co-sign support'\n );\n }\n\n // NOTE: We inline the TCP context for local testing while the hosted\n // context URL is not yet available in all environments.\n const inlineTcpContext = {\n '@version': 1.1,\n id: '@id',\n type: '@type',\n TrustedCareerProfile: 'https://ctx.learncard.com/tcp#TrustedCareerProfile',\n ResumePackage: 'https://ctx.learncard.com/tcp#ResumePackage',\n pdfUrl: {\n '@id': 'https://ctx.learncard.com/tcp#pdfUrl',\n '@type': '@id',\n },\n pdfHash: 'https://ctx.learncard.com/tcp#pdfHash',\n hashAlgorithm: 'https://ctx.learncard.com/tcp#hashAlgorithm',\n includedCredentials: {\n '@id': 'https://ctx.learncard.com/tcp#includedCredentials',\n '@container': '@set',\n },\n category: 'https://ctx.learncard.com/tcp#category',\n generatedAt: {\n '@id': 'https://ctx.learncard.com/tcp#generatedAt',\n '@type': 'http://www.w3.org/2001/XMLSchema#dateTime',\n },\n };\n\n const unsignedVC: UnsignedVC = {\n '@context': [LER_RS_CREDENTIAL_CONTEXT_V2, inlineTcpContext],\n type: ['VerifiableCredential', TCP_WRAPPER_TYPE],\n id: params.wrapperId,\n issuer: did,\n validFrom: issuedAt,\n credentialSubject: {\n id: subjectDid,\n type: 'ResumePackage',\n pdfUrl: params.pdfUrl,\n pdfHash: params.pdfHash,\n hashAlgorithm: 'SHA-256',\n includedCredentials: params.includedCredentials,\n generatedAt,\n },\n };\n\n return initLearnCard.invoke.issueCredential(unsignedVC, {\n proofPurpose: 'assertionMethod',\n });\n },\n },\n };\n};\n"],
|
|
5
|
-
"mappings": "4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,EAAA,+BAAAC,EAAA,iCAAAC,EAAA,iCAAAC,EAAA,wBAAAC,EAAA,0BAAAC,EAAA,mBAAAC,EAAA,qBAAAC,EAAA,mBAAAC,IAAA,eAAAC,EAAAX,GCaO,IAAMY,EAA+B,yCAI/BC,EAA+B,uCAI/BC,EACT,4FAISC,EACT,wEAISC,EACT,+EAISC,EAA2B,QAM3BC,EAAiB,2CAOjBC,EAAmB,uBCvBhC,IAAMC,EAAuBC,EAACC,GAItBA,EAAK,eAAe,OAAeA,EAAK,cACxCA,EAAK,qBAA6B,CAACA,EAAK,oBAAoB,EACzD,CAAC,EANiB,wBAYvBC,EAAUF,EAAIG,GAChBA,GAAS,KAAO,CAAC,EAAI,MAAM,QAAQA,CAAK,EAAIA,EAAQ,CAACA,CAAK,EAD9C,WAUVC,EAAqB,CACvB,WAAY,IACZ,MAAO,gDACP,SAAU,+CACd,EAUMC,EAAyBL,EAACM,GAA8C,CAE1E,IADiB,MAAM,QAAQA,EAAW,IAAI,EAAIA,EAAW,KAAO,CAACA,EAAW,IAAI,GAEvE,KAAKC,GACV,CAACC,EAA0BC,EAA4BC,CAAmB,EAAE,SACxEH,CACJ,CACJ,EAEA,MAAO,GAEX,IAAMI,EAAoBL,EAAW,kBACrC,GAAI,CAACK,EAAmB,MAAO,GAE/B,IAAMC,EAAaD,EAAkB,KACrC,GACI,OAAOC,GAAe,UACtB,CAACH,EAA4BC,CAAmB,E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D,KAAM,CAAC,uBAAwBiB,CAAgB,EAC/C,GAAI9B,EAAO,UACX,OAAQC,EACR,UAAWC,EACX,kBAAmB,CACf,GAAI2B,EACJ,KAAM,gBACN,OAAQ7B,EAAO,OACf,QAASA,EAAO,QAChB,cAAe,UACf,oBAAqBA,EAAO,oBAC5B,YAAA4B,CACJ,CACJ,EAEA,OAAO9B,EAAc,OAAO,gBAAgBc,EAAY,CACpD,aAAc,iBAClB,CAAC,CACL,EA9DoB,qBA+DxB,CACJ,GA3T0B",
|
|
6
|
+
"names": ["index_exports", "__export", "LEGACY_LER_RS_TYPE_TOKEN", "LEGACY_LER_RS_TYPE_URI_V44", "LER_RS_CREDENTIAL_CONTEXT_V1", "LER_RS_CREDENTIAL_CONTEXT_V2", "LER_RS_TYPE_URI_V45", "LER_RS_VC_CONTEXT_V45", "TCP_CONTEXT_V1", "TCP_WRAPPER_TYPE", "getLerRsPlugin", "__toCommonJS", "LER_RS_CREDENTIAL_CONTEXT_V1", "LER_RS_CREDENTIAL_CONTEXT_V2", "LER_RS_VC_CONTEXT_V45", "LER_RS_TYPE_URI_V45", "LEGACY_LER_RS_TYPE_URI_V44", "LEGACY_LER_RS_TYPE_TOKEN", "TCP_CONTEXT_V1", "TCP_WRAPPER_TYPE", "getItemVerifications", "__name", "item", "toArray", "maybe", "inlineLerRsContext", "credentialHasLerRsType", "credential", "type", "LEGACY_LER_RS_TYPE_TOKEN", "LEGACY_LER_RS_TYPE_URI_V44", "LER_RS_TYPE_URI_V45", "credentialSubject", "inlineType", "nestedType", "buildEmploymentHistories", "items", "narrative", "descriptions", "verifiableCredential", "verifications", "position", "employer", "start", "end", "current", "rest", "container", "ph", "containerVerifications", "buildEducationAndLearnings", "institution", "degree", "specializations", "specialization", "buildCertifications", "effectiveTimePeriod", "getLerRsPlugin", "initLearnCard", "_learnCard", "params", "did", "issuedAt", "documentId", "personSection", "hasAddress", "webEntries", "entry", "socialEntries", "communication", "lerRecord", "s", "unsignedVC", "LER_RS_CREDENTIAL_CONTEXT_V2", "vp", "presentation", "domain", "challenge", "presCheck", "presentationResult", "credentialResults", "holder", "vcs", "credCheck", "issuerDid", "isSelfIssued", "err", "r", "generatedAt", "subjectDid", "TCP_WRAPPER_TYPE"]
|
|
7
7
|
}
|
|
@@ -13,10 +13,8 @@ var TCP_WRAPPER_TYPE = "TrustedCareerProfile";
|
|
|
13
13
|
|
|
14
14
|
// src/ler-rs.ts
|
|
15
15
|
var getItemVerifications = /* @__PURE__ */ __name((item) => {
|
|
16
|
-
if (item.verifications?.length)
|
|
17
|
-
|
|
18
|
-
if (item.verifiableCredential)
|
|
19
|
-
return [item.verifiableCredential];
|
|
16
|
+
if (item.verifications?.length) return item.verifications;
|
|
17
|
+
if (item.verifiableCredential) return [item.verifiableCredential];
|
|
20
18
|
return [];
|
|
21
19
|
}, "getItemVerifications");
|
|
22
20
|
var toArray = /* @__PURE__ */ __name((maybe) => maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe], "toArray");
|
|
@@ -34,8 +32,7 @@ var credentialHasLerRsType = /* @__PURE__ */ __name((credential) => {
|
|
|
34
32
|
))
|
|
35
33
|
return true;
|
|
36
34
|
const credentialSubject = credential.credentialSubject;
|
|
37
|
-
if (!credentialSubject)
|
|
38
|
-
return false;
|
|
35
|
+
if (!credentialSubject) return false;
|
|
39
36
|
const inlineType = credentialSubject.type;
|
|
40
37
|
if (typeof inlineType === "string" && [LEGACY_LER_RS_TYPE_URI_V44, LER_RS_TYPE_URI_V45].includes(inlineType))
|
|
41
38
|
return true;
|
|
@@ -57,28 +54,19 @@ var buildEmploymentHistories = /* @__PURE__ */ __name((items) => {
|
|
|
57
54
|
...rest
|
|
58
55
|
} = item;
|
|
59
56
|
const container = { ...rest };
|
|
60
|
-
if (typeof current === "boolean")
|
|
61
|
-
|
|
62
|
-
if (employer)
|
|
63
|
-
container.organization = { tradeName: employer };
|
|
57
|
+
if (typeof current === "boolean") container.current = current;
|
|
58
|
+
if (employer) container.organization = { tradeName: employer };
|
|
64
59
|
if (position || start || end || typeof current === "boolean") {
|
|
65
60
|
const ph = {};
|
|
66
|
-
if (position)
|
|
67
|
-
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
ph.end = end;
|
|
72
|
-
if (typeof current === "boolean")
|
|
73
|
-
ph.current = current;
|
|
74
|
-
if (descriptions?.length)
|
|
75
|
-
ph.descriptions = descriptions;
|
|
61
|
+
if (position) ph.title = position;
|
|
62
|
+
if (start) ph.start = start;
|
|
63
|
+
if (end) ph.end = end;
|
|
64
|
+
if (typeof current === "boolean") ph.current = current;
|
|
65
|
+
if (descriptions?.length) ph.descriptions = descriptions;
|
|
76
66
|
container.positionHistories = [ph];
|
|
77
67
|
}
|
|
78
|
-
if (narrative)
|
|
79
|
-
|
|
80
|
-
if (descriptions?.length && !container.positionHistories)
|
|
81
|
-
container.descriptions = descriptions;
|
|
68
|
+
if (narrative) container.narrative = narrative;
|
|
69
|
+
if (descriptions?.length && !container.positionHistories) container.descriptions = descriptions;
|
|
82
70
|
const containerVerifications = getItemVerifications({
|
|
83
71
|
verifiableCredential,
|
|
84
72
|
verifications
|
|
@@ -105,16 +93,11 @@ var buildEducationAndLearnings = /* @__PURE__ */ __name((items) => {
|
|
|
105
93
|
...rest
|
|
106
94
|
} = item;
|
|
107
95
|
const container = { ...rest };
|
|
108
|
-
if (institution)
|
|
109
|
-
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
if (
|
|
113
|
-
container.end = end;
|
|
114
|
-
if (typeof current === "boolean")
|
|
115
|
-
container.current = current;
|
|
116
|
-
if (descriptions?.length)
|
|
117
|
-
container.descriptions = descriptions;
|
|
96
|
+
if (institution) container.institution = { name: institution };
|
|
97
|
+
if (start) container.start = start;
|
|
98
|
+
if (end) container.end = end;
|
|
99
|
+
if (typeof current === "boolean") container.current = current;
|
|
100
|
+
if (descriptions?.length) container.descriptions = descriptions;
|
|
118
101
|
if (degree || specializations) {
|
|
119
102
|
container.educationDegrees = [
|
|
120
103
|
{
|
|
@@ -127,8 +110,7 @@ var buildEducationAndLearnings = /* @__PURE__ */ __name((items) => {
|
|
|
127
110
|
}
|
|
128
111
|
];
|
|
129
112
|
}
|
|
130
|
-
if (narrative)
|
|
131
|
-
container.narrative = narrative;
|
|
113
|
+
if (narrative) container.narrative = narrative;
|
|
132
114
|
const containerVerifications = getItemVerifications({
|
|
133
115
|
verifiableCredential,
|
|
134
116
|
verifications
|
|
@@ -152,10 +134,8 @@ var buildCertifications = /* @__PURE__ */ __name((items) => {
|
|
|
152
134
|
...rest
|
|
153
135
|
} = item;
|
|
154
136
|
const container = { ...rest };
|
|
155
|
-
if (narrative)
|
|
156
|
-
|
|
157
|
-
if (descriptions?.length)
|
|
158
|
-
container.descriptions = descriptions;
|
|
137
|
+
if (narrative) container.narrative = narrative;
|
|
138
|
+
if (descriptions?.length) container.descriptions = descriptions;
|
|
159
139
|
if (effectiveTimePeriod || start || end) {
|
|
160
140
|
container.effectiveTimePeriod = {
|
|
161
141
|
...effectiveTimePeriod ?? {},
|
|
@@ -179,10 +159,18 @@ var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => {
|
|
|
179
159
|
displayName: "LER-RS",
|
|
180
160
|
description: "Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials",
|
|
181
161
|
methods: {
|
|
182
|
-
|
|
162
|
+
/**
|
|
163
|
+
* Issues a signed LER-RS VC from normalized person/work/education/certification data.
|
|
164
|
+
*
|
|
165
|
+
* The method:
|
|
166
|
+
* 1. Builds a compliant LER-RS `credentialSubject`
|
|
167
|
+
* 2. Applies VC + LER-RS contexts
|
|
168
|
+
* 3. Signs via `invoke.issueCredential`
|
|
169
|
+
*/
|
|
170
|
+
createLerRecord: /* @__PURE__ */ __name(async (_learnCard, params) => {
|
|
183
171
|
const signer = params.learnCard ?? _learnCard;
|
|
184
172
|
const did = signer.id.did();
|
|
185
|
-
const issuedAt = new Date().toISOString();
|
|
173
|
+
const issuedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
186
174
|
const documentId = crypto.randomUUID();
|
|
187
175
|
const personSection = {
|
|
188
176
|
name: {
|
|
@@ -246,8 +234,15 @@ var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => {
|
|
|
246
234
|
return initLearnCard.invoke.issueCredential(unsignedVC, {
|
|
247
235
|
proofPurpose: "assertionMethod"
|
|
248
236
|
});
|
|
249
|
-
},
|
|
250
|
-
|
|
237
|
+
}, "createLerRecord"),
|
|
238
|
+
/**
|
|
239
|
+
* Issues a VP containing at least one LER-RS credential.
|
|
240
|
+
*
|
|
241
|
+
* Throws if:
|
|
242
|
+
* - credentials list is empty
|
|
243
|
+
* - none of the credentials match LER-RS type checks
|
|
244
|
+
*/
|
|
245
|
+
createLerPresentation: /* @__PURE__ */ __name(async (_learnCard, params) => {
|
|
251
246
|
const signer = params.learnCard ?? _learnCard;
|
|
252
247
|
const did = signer.id.did();
|
|
253
248
|
if (!params.credentials.length)
|
|
@@ -269,8 +264,14 @@ var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => {
|
|
|
269
264
|
...params.domain ? { domain: params.domain } : {},
|
|
270
265
|
...params.challenge ? { challenge: params.challenge } : {}
|
|
271
266
|
});
|
|
272
|
-
},
|
|
273
|
-
|
|
267
|
+
}, "createLerPresentation"),
|
|
268
|
+
/**
|
|
269
|
+
* Verifies a LER-focused VP and returns structured result details.
|
|
270
|
+
*
|
|
271
|
+
* Overall `verified` allows explicitly self-issued items when determining
|
|
272
|
+
* final status, while still surfacing per-credential verification results.
|
|
273
|
+
*/
|
|
274
|
+
verifyLerPresentation: /* @__PURE__ */ __name(async (_learnCard, { presentation, domain, challenge }) => {
|
|
274
275
|
const presCheck = await initLearnCard.invoke.verifyPresentation(presentation, {
|
|
275
276
|
...domain ? { domain } : {},
|
|
276
277
|
...challenge ? { challenge } : {}
|
|
@@ -315,11 +316,22 @@ var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => {
|
|
|
315
316
|
presentationResult,
|
|
316
317
|
credentialResults
|
|
317
318
|
};
|
|
318
|
-
},
|
|
319
|
-
|
|
319
|
+
}, "verifyLerPresentation"),
|
|
320
|
+
/**
|
|
321
|
+
* Issues a signed TrustedCareerProfile wrapper VC for resume package publishing.
|
|
322
|
+
*
|
|
323
|
+
* Includes:
|
|
324
|
+
* - public PDF URL
|
|
325
|
+
* - PDF SHA-256 hash
|
|
326
|
+
* - included credential references
|
|
327
|
+
* - generation timestamp
|
|
328
|
+
*
|
|
329
|
+
* Co-sign fields are intentionally stubbed for MVP and currently rejected.
|
|
330
|
+
*/
|
|
331
|
+
createTcpWrapperVc: /* @__PURE__ */ __name(async (_learnCard, params) => {
|
|
320
332
|
const signer = params.learnCard ?? _learnCard;
|
|
321
333
|
const did = signer.id.did();
|
|
322
|
-
const issuedAt = params.issuanceDate ?? new Date().toISOString();
|
|
334
|
+
const issuedAt = params.issuanceDate ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
323
335
|
const generatedAt = params.generatedAt ?? issuedAt;
|
|
324
336
|
const subjectDid = params.subjectDid ?? did;
|
|
325
337
|
if (params.enableCoSign) {
|
|
@@ -371,7 +383,7 @@ var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => {
|
|
|
371
383
|
return initLearnCard.invoke.issueCredential(unsignedVC, {
|
|
372
384
|
proofPurpose: "assertionMethod"
|
|
373
385
|
});
|
|
374
|
-
}
|
|
386
|
+
}, "createTcpWrapperVc")
|
|
375
387
|
}
|
|
376
388
|
};
|
|
377
389
|
}, "getLerRsPlugin");
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/types.ts", "../src/ler-rs.ts"],
|
|
4
4
|
"sourcesContent": ["import { Plugin, LearnCard } from '@learncard/core';\nimport {\n VC as VerifiableCredential,\n VP as VerifiablePresentation,\n UnsignedVC,\n UnsignedVP,\n VerificationCheck,\n} from '@learncard/types';\nimport type { VCPluginMethods, VCPluginDependentMethods } from '@learncard/vc-plugin';\n\n/**\n * Legacy W3C VC v1 context kept for interop with previously issued records.\n */\nexport const LER_RS_CREDENTIAL_CONTEXT_V1 = 'https://www.w3.org/2018/credentials/v1';\n/**\n * Base W3C VC v2 context used by newly issued LER-RS credentials and presentations.\n */\nexport const LER_RS_CREDENTIAL_CONTEXT_V2 = 'https://www.w3.org/ns/credentials/v2';\n/**\n * HR Open Standards VC wrapper context for LER-RS v4.5.\n */\nexport const LER_RS_VC_CONTEXT_V45 =\n 'http://schema.hropenstandards.org/4.5/recruiting/json/VerifiableCredentialLER-RSType.json';\n/**\n * Canonical LER-RS type URI for v4.5.\n */\nexport const LER_RS_TYPE_URI_V45 =\n 'http://schema.hropenstandards.org/4.5/recruiting/json/LER-RSType.json';\n/**\n * Legacy LER-RS type URI for v4.4 interop.\n */\nexport const LEGACY_LER_RS_TYPE_URI_V44 =\n 'http://schema.hropenstandards.org/4.4/recruiting/json/ler-rs/LER-RSType.json';\n/**\n * Legacy short type token used by older issuers.\n */\nexport const LEGACY_LER_RS_TYPE_TOKEN = 'LERRS';\n/**\n * Hosted TCP JSON-LD context URL.\n *\n * Note: current local wrapper issuance can inline context during local testing.\n */\nexport const TCP_CONTEXT_V1 = 'https://ctx.learncard.com/tcp/1.0.0.json';\n/**\n * LearnCard-defined wrapper VC type for TCP resume package artifacts.\n *\n * This is intentionally NOT a canonical HR Open Standards LER-RS type;\n * it is a custom wrapper used to bind PDF URL/hash + included credential refs.\n */\nexport const TCP_WRAPPER_TYPE = 'TrustedCareerProfile';\n\n/**\n * Identity details used to populate `credentialSubject.person`.\n */\nexport interface PersonProfile {\n /** Subject DID for the issued LER-RS record. */\n id: string;\n /** Given/first name. */\n givenName: string;\n /** Family/last name. */\n familyName: string;\n /** Optional display name override. */\n formattedName?: string;\n /** Optional contact email to include in communication block. */\n email?: string;\n /** Optional contact phone to include in communication block. */\n phone?: string;\n /** Optional physical/mailing address to include in communication block. */\n address?: {\n formattedAddress?: string;\n line?: string;\n city?: string;\n postalCode?: string;\n countryCode?: string;\n };\n /** Optional website URLs to include in communication block. */\n web?: Array<{ url: string; name?: string }>;\n /** Optional social profile URLs to include in communication block. */\n social?: Array<{ uri: string; name?: string }>;\n}\n\n/**\n * Skill item structure used inside generated LER-RS records.\n */\nexport interface LerSkill {\n name: string;\n comments?: string[];\n description?: string;\n yearsOfExperience?: number;\n endorsers?: Array<{\n person?: { name?: { formattedName?: string } };\n organization?: { name?: string };\n }>;\n}\n\n/**\n * Source work history entry. Can be self-asserted fields and/or third-party verification VCs.\n */\nexport interface WorkHistoryItem {\n narrative?: string;\n descriptions?: string[];\n verifiableCredential?: VerifiableCredential;\n verifications?: VerifiableCredential[];\n // Common self-asserted fields\n position?: string;\n employer?: string;\n start?: string;\n end?: string;\n current?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * Source education entry. Can include freeform fields and optional verification VCs.\n */\nexport interface EducationHistoryItem {\n narrative?: string;\n descriptions?: string[];\n verifiableCredential?: VerifiableCredential;\n verifications?: VerifiableCredential[];\n institution?: string;\n start?: string;\n end?: string;\n current?: boolean;\n degree?: string;\n specializations?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Source certification entry for `credentialSubject.certifications`.\n */\nexport interface CertificationItem {\n narrative?: string;\n descriptions?: string[];\n verifiableCredential?: VerifiableCredential;\n verifications?: VerifiableCredential[];\n name?: string;\n issuingAuthority?: string | Record<string, unknown>;\n status?: string;\n start?: string;\n end?: string;\n effectiveTimePeriod?: { validFrom?: string; validTo?: string };\n [key: string]: unknown;\n}\n\n/**\n * Narrative section block supported by LER-RS schema.\n */\nexport interface LerNarrative {\n name: string;\n texts: Array<{\n name: string;\n lines: string[];\n }>;\n}\n\n/**\n * Typed shape of the LER-RS object embedded into `credentialSubject`.\n */\nexport interface LerRsRecord {\n type: string;\n documentId?: { value: string };\n person: {\n name: {\n given: string;\n family: string;\n formattedName?: string;\n };\n };\n communication?: {\n email?: { address: string }[];\n web?: { url: string; name?: string }[];\n phone?: Array<Record<string, unknown>>;\n address?: Array<Record<string, unknown>>;\n social?: Array<Record<string, unknown>>;\n };\n skills?: LerSkill[];\n narratives?: LerNarrative[];\n educationAndLearnings?: Array<\n { verifications?: VerifiableCredential[] } & Record<string, unknown>\n >;\n employmentHistories?: Array<\n { verifications?: VerifiableCredential[] } & Record<string, unknown>\n >;\n licenses?: Array<{ verifications?: VerifiableCredential[] } & Record<string, unknown>>;\n certifications?: Array<{ verifications?: VerifiableCredential[] } & Record<string, unknown>>;\n employmentPreferences?: Array<Record<string, unknown>>;\n positionPreferences?: Array<Record<string, unknown>>;\n attachments?: Array<Record<string, unknown>>;\n}\n\n/**\n * Parameters for issuing a signed LER-RS VC from normalized source data.\n */\nexport interface CreateLerRecordParams {\n learnCard: LearnCard<any, 'id', VCPluginMethods & VCPluginDependentMethods>;\n person: PersonProfile;\n workHistory?: WorkHistoryItem[];\n educationHistory?: EducationHistoryItem[];\n certifications?: CertificationItem[];\n skills?: string[];\n narratives?: LerNarrative[];\n attachments?: Array<Record<string, unknown>>;\n}\n\n/**\n * Parameters for issuing a VP that packages one or more credentials including at least one LER-RS credential.\n */\nexport interface CreateLerPresentationParams {\n learnCard: LearnCard<any, 'id', VCPluginMethods & VCPluginDependentMethods>;\n credentials: VerifiableCredential[];\n domain?: string;\n challenge?: string;\n}\n\n/**\n * Parameters for verifying a LER-focused VP and nested credentials.\n */\nexport interface VerifyLerPresentationParams {\n presentation: VerifiablePresentation | string;\n domain?: string;\n challenge?: string;\n}\n\n/**\n * Credential reference stored in TCP wrapper VC.\n */\nexport interface TcpIncludedCredentialRef {\n /** Resolved VC id when available; falls back to URI if id is unavailable. */\n id: string;\n /** Category label used for UI grouping and downstream filtering. */\n category: string;\n}\n\n/**\n * Parameters for issuing TrustedCareerProfile wrapper VCs.\n */\nexport interface CreateTcpWrapperVcParams {\n learnCard: LearnCard<any, 'id', VCPluginMethods & VCPluginDependentMethods>;\n wrapperId: string;\n subjectDid?: string;\n pdfUrl: string;\n pdfHash: string;\n includedCredentials: TcpIncludedCredentialRef[];\n generatedAt?: string;\n /** Timestamp used as the issued credential's `validFrom` value. */\n issuanceDate?: string;\n coSignerDid?: string;\n enableCoSign?: boolean;\n}\n\n/**\n * Structured verification output for LER presentation verification.\n */\nexport interface VerificationResult {\n verified: boolean; // Overall status\n presentationResult: {\n verified: boolean;\n errors?: string[];\n };\n credentialResults: {\n credential: VerifiableCredential;\n verified: boolean;\n isSelfIssued: boolean;\n errors?: string[];\n }[];\n}\n\n/**\n * LearnCard dependency contract required by this plugin.\n */\nexport type LERRSDependentLearnCard = LearnCard<\n any,\n 'id',\n VCPluginMethods & VCPluginDependentMethods\n>;\n\n/**\n * Public invoke methods exposed by the LER-RS plugin.\n */\nexport type LERRSPluginMethods = {\n createLerRecord: (params: CreateLerRecordParams) => Promise<VerifiableCredential>;\n createLerPresentation: (params: CreateLerPresentationParams) => Promise<VerifiablePresentation>;\n verifyLerPresentation: (params: VerifyLerPresentationParams) => Promise<VerificationResult>;\n createTcpWrapperVc: (params: CreateTcpWrapperVcParams) => Promise<VerifiableCredential>;\n};\n\n/**\n * Plugin type definition for registration in LearnCard.\n */\nexport type LERRSPlugin = Plugin<\n 'LER-RS',\n never,\n LERRSPluginMethods,\n 'id',\n VCPluginMethods & VCPluginDependentMethods\n>;\n", "import {\n VC as VerifiableCredential,\n UnsignedVC,\n VP as VerifiablePresentation,\n UnsignedVP,\n} from '@learncard/types';\nimport {\n LERRSDependentLearnCard,\n LERRSPlugin,\n CreateLerRecordParams,\n CreateLerPresentationParams,\n VerifyLerPresentationParams,\n VerificationResult,\n LerRsRecord,\n LER_RS_CREDENTIAL_CONTEXT_V2,\n LER_RS_TYPE_URI_V45,\n LEGACY_LER_RS_TYPE_URI_V44,\n LEGACY_LER_RS_TYPE_TOKEN,\n TCP_WRAPPER_TYPE,\n} from './types';\n\n/**\n * Normalizes verification containers from either:\n * - `verifications: VC[]`\n * - `verifiableCredential: VC`\n */\nconst getItemVerifications = (item: {\n verifiableCredential?: VerifiableCredential;\n verifications?: VerifiableCredential[];\n}): VerifiableCredential[] => {\n if (item.verifications?.length) return item.verifications;\n if (item.verifiableCredential) return [item.verifiableCredential];\n return [];\n};\n\n/**\n * Converts scalar-or-array values into a normalized array.\n */\nconst toArray = <T>(maybe: T | T[] | undefined): T[] =>\n maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe];\n\n/**\n * Inline LER-RS JSON-LD context used for signing stability.\n *\n * The published HR Open URL is schema-oriented and can trigger additional remote\n * context resolution during expansion. Inlining this base context avoids network\n * dependency at issue time while preserving deterministic term expansion.\n */\nconst inlineLerRsContext = {\n '@version': 1.1,\n hrrec: 'http://schema.hropenstandards.org/recruiting/',\n '@vocab': 'http://schema.hropenstandards.org/recruiting/',\n};\n\n/**\n * Determines whether a VC represents a LER-RS credential (legacy and current forms).\n *\n * Checks:\n * - VC `type` array/token values\n * - `credentialSubject.type`\n * - nested `credentialSubject.lerrsType.type`\n */\nconst credentialHasLerRsType = (credential: VerifiableCredential): boolean => {\n const typeList = Array.isArray(credential.type) ? credential.type : [credential.type];\n if (\n typeList.some(type =>\n [LEGACY_LER_RS_TYPE_TOKEN, LEGACY_LER_RS_TYPE_URI_V44, LER_RS_TYPE_URI_V45].includes(\n type\n )\n )\n )\n return true;\n\n const credentialSubject = credential.credentialSubject as Record<string, unknown> | undefined;\n if (!credentialSubject) return false;\n\n const inlineType = credentialSubject.type;\n if (\n typeof inlineType === 'string' &&\n [LEGACY_LER_RS_TYPE_URI_V44, LER_RS_TYPE_URI_V45].includes(inlineType)\n )\n return true;\n\n const nestedType = (credentialSubject.lerrsType as Record<string, unknown> | undefined)?.type;\n return (\n typeof nestedType === 'string' &&\n [LEGACY_LER_RS_TYPE_URI_V44, LER_RS_TYPE_URI_V45].includes(nestedType)\n );\n};\n\n/**\n * Maps application work history items to LER-RS `employmentHistories` shape.\n */\nconst buildEmploymentHistories = (\n items: NonNullable<CreateLerRecordParams['workHistory']>\n): LerRsRecord['employmentHistories'] => {\n return items.map(item => {\n const {\n narrative,\n descriptions,\n verifiableCredential,\n verifications,\n position,\n employer,\n start,\n end,\n current,\n ...rest\n } = item;\n\n const container: Record<string, unknown> = { ...rest };\n if (typeof current === 'boolean') container.current = current;\n\n if (employer) container.organization = { tradeName: employer };\n if (position || start || end || typeof current === 'boolean') {\n const ph: Record<string, unknown> = {};\n if (position) ph.title = position;\n if (start) ph.start = start;\n if (end) ph.end = end;\n if (typeof current === 'boolean') ph.current = current;\n if (descriptions?.length) ph.descriptions = descriptions;\n container.positionHistories = [ph];\n }\n if (narrative) container.narrative = narrative;\n if (descriptions?.length && !container.positionHistories) container.descriptions = descriptions;\n\n const containerVerifications = getItemVerifications({\n verifiableCredential,\n verifications,\n });\n return {\n ...container,\n ...(containerVerifications.length ? { verifications: containerVerifications } : {}),\n };\n });\n};\n\n/**\n * Maps education source items into LER-RS `educationAndLearnings`.\n */\nconst buildEducationAndLearnings = (\n items: NonNullable<CreateLerRecordParams['educationHistory']>\n): LerRsRecord['educationAndLearnings'] => {\n return items.map(item => {\n const {\n narrative,\n descriptions,\n verifiableCredential,\n verifications,\n institution,\n start,\n end,\n current,\n degree,\n specializations,\n ...rest\n } = item;\n\n const container: Record<string, unknown> = { ...rest };\n if (institution) container.institution = { name: institution };\n if (start) container.start = start;\n if (end) container.end = end;\n if (typeof current === 'boolean') container.current = current;\n if (descriptions?.length) container.descriptions = descriptions;\n if (degree || specializations) {\n container.educationDegrees = [\n {\n ...(degree ? { name: degree } : {}),\n ...(specializations\n ? {\n specializations: specializations.map(specialization => ({\n name: specialization,\n })),\n }\n : {}),\n },\n ];\n }\n if (narrative) container.narrative = narrative;\n\n const containerVerifications = getItemVerifications({\n verifiableCredential,\n verifications,\n });\n return {\n ...container,\n ...(containerVerifications.length ? { verifications: containerVerifications } : {}),\n };\n });\n};\n\n/**\n * Maps certification source items to LER-RS `certifications`.\n */\nconst buildCertifications = (\n items: NonNullable<CreateLerRecordParams['certifications']>\n): LerRsRecord['certifications'] => {\n return items.map(item => {\n const {\n narrative,\n descriptions,\n start,\n end,\n effectiveTimePeriod,\n verifiableCredential,\n verifications,\n ...rest\n } = item;\n\n const container: Record<string, unknown> = { ...rest };\n if (narrative) container.narrative = narrative;\n if (descriptions?.length) container.descriptions = descriptions;\n if (effectiveTimePeriod || start || end) {\n container.effectiveTimePeriod = {\n ...(effectiveTimePeriod ?? {}),\n ...(start ? { validFrom: start } : {}),\n ...(end ? { validTo: end } : {}),\n };\n }\n\n const containerVerifications = getItemVerifications({\n verifiableCredential,\n verifications,\n });\n return {\n ...container,\n ...(containerVerifications.length ? { verifications: containerVerifications } : {}),\n };\n });\n};\n\n/**\n * Returns the LearnCard LER-RS plugin with methods for:\n * - issuing LER-RS VCs\n * - packaging/verifying LER presentations\n * - issuing TCP wrapper VCs for resume packages\n */\nexport const getLerRsPlugin = (initLearnCard: LERRSDependentLearnCard): LERRSPlugin => {\n return {\n name: 'LER-RS',\n displayName: 'LER-RS',\n description:\n 'Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials',\n methods: {\n /**\n * Issues a signed LER-RS VC from normalized person/work/education/certification data.\n *\n * The method:\n * 1. Builds a compliant LER-RS `credentialSubject`\n * 2. Applies VC + LER-RS contexts\n * 3. Signs via `invoke.issueCredential`\n */\n createLerRecord: async (_learnCard, params): Promise<VerifiableCredential> => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n const issuedAt = new Date().toISOString();\n const documentId = crypto.randomUUID();\n\n const personSection: LerRsRecord['person'] = {\n name: {\n given: params.person.givenName,\n family: params.person.familyName,\n formattedName:\n params.person.formattedName ??\n `${params.person.givenName} ${params.person.familyName}`,\n },\n };\n\n const hasAddress =\n !!params.person.address?.formattedAddress ||\n !!params.person.address?.line ||\n !!params.person.address?.city ||\n !!params.person.address?.postalCode ||\n !!params.person.address?.countryCode;\n const webEntries = (params.person.web || []).filter(entry => entry?.url);\n const socialEntries = (params.person.social || []).filter(entry => entry?.uri);\n\n const communication: LerRsRecord['communication'] | undefined =\n params.person.email ||\n params.person.phone ||\n hasAddress ||\n webEntries.length > 0 ||\n socialEntries.length > 0\n ? {\n ...(params.person.email\n ? { email: [{ address: params.person.email }] }\n : {}),\n ...(params.person.phone\n ? { phone: [{ formattedNumber: params.person.phone }] }\n : {}),\n ...(webEntries.length\n ? { web: webEntries.map(entry => ({ url: entry.url, name: entry.name })) }\n : {}),\n ...(socialEntries.length\n ? {\n social: socialEntries.map(entry => ({\n uri: entry.uri,\n ...(entry.name ? { name: entry.name } : {}),\n })),\n }\n : {}),\n ...(hasAddress\n ? {\n address: [\n {\n ...(params.person.address?.formattedAddress\n ? {\n formattedAddress:\n params.person.address.formattedAddress,\n }\n : {}),\n ...(params.person.address?.line\n ? { line: params.person.address.line }\n : {}),\n ...(params.person.address?.city\n ? { city: params.person.address.city }\n : {}),\n ...(params.person.address?.postalCode\n ? { postalCode: params.person.address.postalCode }\n : {}),\n ...(params.person.address?.countryCode\n ? {\n countryCode:\n params.person.address.countryCode,\n }\n : {}),\n },\n ],\n }\n : {}),\n }\n : undefined;\n\n const lerRecord: LerRsRecord = {\n type: LER_RS_TYPE_URI_V45,\n documentId: { value: documentId },\n person: personSection,\n ...(communication ? { communication } : {}),\n skills: (params.skills || []).map(s => ({ name: s })),\n narratives: params.narratives,\n employmentHistories: params.workHistory\n ? buildEmploymentHistories(params.workHistory)\n : undefined,\n educationAndLearnings: params.educationHistory\n ? buildEducationAndLearnings(params.educationHistory)\n : undefined,\n certifications: params.certifications\n ? buildCertifications(params.certifications)\n : undefined,\n attachments: params.attachments,\n };\n\n const unsignedVC: UnsignedVC = {\n '@context': [LER_RS_CREDENTIAL_CONTEXT_V2, inlineLerRsContext],\n id: `urn:uuid:${documentId}`,\n type: ['VerifiableCredential', LER_RS_TYPE_URI_V45],\n issuer: did,\n validFrom: issuedAt,\n credentialSubject: {\n id: params.person.id,\n ...lerRecord,\n },\n };\n\n return initLearnCard.invoke.issueCredential(unsignedVC, {\n proofPurpose: 'assertionMethod',\n });\n },\n\n /**\n * Issues a VP containing at least one LER-RS credential.\n *\n * Throws if:\n * - credentials list is empty\n * - none of the credentials match LER-RS type checks\n */\n createLerPresentation: async (_learnCard, params): Promise<VerifiablePresentation> => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n if (!params.credentials.length)\n throw new Error(\n 'createLerPresentation: credentials array must contain at least one credential'\n );\n const containsLer = params.credentials.some(credentialHasLerRsType);\n if (!containsLer)\n throw new Error(\n 'createLerPresentation: credentials must include at least one LER-RS credential'\n );\n\n const vp: UnsignedVP = {\n '@context': [LER_RS_CREDENTIAL_CONTEXT_V2],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential:\n params.credentials.length === 1\n ? params.credentials[0]\n : params.credentials,\n };\n\n return initLearnCard.invoke.issuePresentation(vp, {\n ...(params.domain ? { domain: params.domain } : {}),\n ...(params.challenge ? { challenge: params.challenge } : {}),\n });\n },\n\n /**\n * Verifies a LER-focused VP and returns structured result details.\n *\n * Overall `verified` allows explicitly self-issued items when determining\n * final status, while still surfacing per-credential verification results.\n */\n verifyLerPresentation: async (\n _learnCard,\n { presentation, domain, challenge }: VerifyLerPresentationParams\n ): Promise<VerificationResult> => {\n const presCheck = await initLearnCard.invoke.verifyPresentation(presentation, {\n ...(domain ? { domain } : {}),\n ...(challenge ? { challenge } : {}),\n });\n\n const presentationResult = {\n verified: presCheck.errors.length === 0,\n errors: presCheck.errors.length ? presCheck.errors : undefined,\n };\n\n const credentialResults: VerificationResult['credentialResults'] = [];\n\n if (typeof presentation !== 'string') {\n const holder = presentation.holder;\n const vcs = toArray<VerifiableCredential>(\n presentation.verifiableCredential as any\n );\n\n for (const credential of vcs) {\n try {\n const credCheck = await initLearnCard.invoke.verifyCredential(\n credential\n );\n const issuerDid =\n typeof credential.issuer === 'string'\n ? credential.issuer\n : credential.issuer?.id;\n const isSelfIssued =\n credentialHasLerRsType(credential) ||\n (!!holder && !!issuerDid && issuerDid === holder);\n\n credentialResults.push({\n credential,\n verified: credCheck.errors.length === 0,\n isSelfIssued,\n errors: credCheck.errors.length ? credCheck.errors : undefined,\n });\n } catch (err) {\n credentialResults.push({\n credential,\n verified: false,\n isSelfIssued: false,\n errors: [\n err instanceof Error\n ? err.message\n : 'Unknown error verifying credential',\n ],\n });\n }\n }\n }\n\n return {\n verified:\n presentationResult.verified &&\n credentialResults.every(r => r.verified || r.isSelfIssued),\n presentationResult,\n credentialResults,\n };\n },\n\n /**\n * Issues a signed TrustedCareerProfile wrapper VC for resume package publishing.\n *\n * Includes:\n * - public PDF URL\n * - PDF SHA-256 hash\n * - included credential references\n * - generation timestamp\n *\n * Co-sign fields are intentionally stubbed for MVP and currently rejected.\n */\n createTcpWrapperVc: async (_learnCard, params): Promise<VerifiableCredential> => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n const issuedAt = params.issuanceDate ?? new Date().toISOString();\n const generatedAt = params.generatedAt ?? issuedAt;\n const subjectDid = params.subjectDid ?? did;\n\n if (params.enableCoSign) {\n throw new Error('createTcpWrapperVc: co-signing is not enabled in MVP');\n }\n\n if (params.coSignerDid) {\n throw new Error(\n 'createTcpWrapperVc: coSignerDid is reserved for future co-sign support'\n );\n }\n\n // NOTE: We inline the TCP context for local testing while the hosted\n // context URL is not yet available in all environments.\n const inlineTcpContext = {\n '@version': 1.1,\n id: '@id',\n type: '@type',\n TrustedCareerProfile: 'https://ctx.learncard.com/tcp#TrustedCareerProfile',\n ResumePackage: 'https://ctx.learncard.com/tcp#ResumePackage',\n pdfUrl: {\n '@id': 'https://ctx.learncard.com/tcp#pdfUrl',\n '@type': '@id',\n },\n pdfHash: 'https://ctx.learncard.com/tcp#pdfHash',\n hashAlgorithm: 'https://ctx.learncard.com/tcp#hashAlgorithm',\n includedCredentials: {\n '@id': 'https://ctx.learncard.com/tcp#includedCredentials',\n '@container': '@set',\n },\n category: 'https://ctx.learncard.com/tcp#category',\n generatedAt: {\n '@id': 'https://ctx.learncard.com/tcp#generatedAt',\n '@type': 'http://www.w3.org/2001/XMLSchema#dateTime',\n },\n };\n\n const unsignedVC: UnsignedVC = {\n '@context': [LER_RS_CREDENTIAL_CONTEXT_V2, inlineTcpContext],\n type: ['VerifiableCredential', TCP_WRAPPER_TYPE],\n id: params.wrapperId,\n issuer: did,\n validFrom: issuedAt,\n credentialSubject: {\n id: subjectDid,\n type: 'ResumePackage',\n pdfUrl: params.pdfUrl,\n pdfHash: params.pdfHash,\n hashAlgorithm: 'SHA-256',\n includedCredentials: params.includedCredentials,\n generatedAt,\n },\n };\n\n return initLearnCard.invoke.issueCredential(unsignedVC, {\n proofPurpose: 'assertionMethod',\n });\n },\n },\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;AAaO,IAAM,+BAA+B;AAIrC,IAAM,+BAA+B;AAIrC,IAAM,wBACT;AAIG,IAAM,sBACT;AAIG,IAAM,6BACT;AAIG,IAAM,2BAA2B;AAMjC,IAAM,iBAAiB;AAOvB,IAAM,mBAAmB;;;ACvBhC,IAAM,uBAAuB,wBAAC,SAGA;AAC1B,MAAI,KAAK,eAAe
|
|
5
|
+
"mappings": ";;;;AAaO,IAAM,+BAA+B;AAIrC,IAAM,+BAA+B;AAIrC,IAAM,wBACT;AAIG,IAAM,sBACT;AAIG,IAAM,6BACT;AAIG,IAAM,2BAA2B;AAMjC,IAAM,iBAAiB;AAOvB,IAAM,mBAAmB;;;ACvBhC,IAAM,uBAAuB,wBAAC,SAGA;AAC1B,MAAI,KAAK,eAAe,OAAQ,QAAO,KAAK;AAC5C,MAAI,KAAK,qBAAsB,QAAO,CAAC,KAAK,oBAAoB;AAChE,SAAO,CAAC;AACZ,GAP6B;AAY7B,IAAM,UAAU,wBAAI,UAChB,SAAS,OAAO,CAAC,IAAI,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK,GAD9C;AAUhB,IAAM,qBAAqB;AAAA,EACvB,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,UAAU;AACd;AAUA,IAAM,yBAAyB,wBAAC,eAA8C;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,OAAO;AAAA,YACP,SAAS;AAAA,UACb;AAAA,UACA,SAAS;AAAA,UACT,eAAe;AAAA,UACf,qBAAqB;AAAA,YACjB,OAAO;AAAA,YACP,cAAc;AAAA,UAClB;AAAA,UACA,UAAU;AAAA,UACV,aAAa;AAAA,YACT,OAAO;AAAA,YACP,SAAS;AAAA,UACb;AAAA,QACJ;AAEA,cAAM,aAAyB;AAAA,UAC3B,YAAY,CAAC,8BAA8B,gBAAgB;AAAA,UAC3D,MAAM,CAAC,wBAAwB,gBAAgB;AAAA,UAC/C,IAAI,OAAO;AAAA,UACX,QAAQ;AAAA,UACR,WAAW;AAAA,UACX,mBAAmB;AAAA,YACf,IAAI;AAAA,YACJ,MAAM;AAAA,YACN,QAAQ,OAAO;AAAA,YACf,SAAS,OAAO;AAAA,YAChB,eAAe;AAAA,YACf,qBAAqB,OAAO;AAAA,YAC5B;AAAA,UACJ;AAAA,QACJ;AAEA,eAAO,cAAc,OAAO,gBAAgB,YAAY;AAAA,UACpD,cAAc;AAAA,QAClB,CAAC;AAAA,MACL,GA9DoB;AAAA,IA+DxB;AAAA,EACJ;AACJ,GA5T8B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@learncard/ler-rs-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "LER-RS plugin for LearnCard: create, package, and verify Learning & Employment Record Resumes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
26
|
"build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.cjs && tsc --p tsconfig.json && shx cp ./dist/index.d.ts ./dist/index.d.cts",
|
|
27
|
-
"test": "
|
|
28
|
-
"test:watch": "
|
|
29
|
-
"test:coverage": "
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"test:coverage": "vitest run --coverage"
|
|
30
30
|
},
|
|
31
31
|
"author": "Learning Economy Foundation (www.learningeconomy.io)",
|
|
32
32
|
"license": "MIT",
|
|
@@ -39,21 +39,16 @@
|
|
|
39
39
|
"url": "https://github.com/learningeconomy/LearnCard/issues"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@types/jest": "^29.2.2",
|
|
43
42
|
"@types/node": "^17.0.31",
|
|
44
|
-
"
|
|
45
|
-
"esbuild": "^0.14.38",
|
|
46
|
-
"esbuild-jest": "^0.5.0",
|
|
43
|
+
"esbuild": "^0.25.0",
|
|
47
44
|
"esbuild-plugin-copy": "^1.3.0",
|
|
48
|
-
"jest": "^29.3.0",
|
|
49
45
|
"rimraf": "^3.0.2",
|
|
50
|
-
"shx": "^0.3.4"
|
|
51
|
-
"ts-jest": "^29.0.3"
|
|
46
|
+
"shx": "^0.3.4"
|
|
52
47
|
},
|
|
53
48
|
"types": "./dist/index.d.ts",
|
|
54
49
|
"dependencies": {
|
|
55
|
-
"@learncard/core": "9.4.
|
|
56
|
-
"@learncard/types": "5.18.
|
|
57
|
-
"@learncard/vc-plugin": "1.5.
|
|
50
|
+
"@learncard/core": "9.4.31",
|
|
51
|
+
"@learncard/types": "5.18.2",
|
|
52
|
+
"@learncard/vc-plugin": "1.5.11"
|
|
58
53
|
}
|
|
59
54
|
}
|