From e75c44b15d0e36e68552cc7f8cba2ea029e7d700 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacks=C3=B3n=20Smith?= Date: Tue, 12 Aug 2025 18:17:27 -0400 Subject: [PATCH 1/4] Add ler-rs plugin --- packages/plugins/ler-rs/README.md | 210 ++++++++++++++++++ packages/plugins/ler-rs/dist/index.d.ts | 3 + packages/plugins/ler-rs/dist/index.d.ts.map | 1 + packages/plugins/ler-rs/dist/index.js | 7 + .../dist/ler-rs-plugin.cjs.development.js | 185 +++++++++++++++ .../dist/ler-rs-plugin.cjs.development.js.map | 7 + .../dist/ler-rs-plugin.cjs.production.min.js | 2 + .../ler-rs-plugin.cjs.production.min.js.map | 7 + .../plugins/ler-rs/dist/ler-rs-plugin.esm.js | 164 ++++++++++++++ .../ler-rs/dist/ler-rs-plugin.esm.js.map | 7 + packages/plugins/ler-rs/dist/ler-rs.d.ts | 3 + packages/plugins/ler-rs/dist/ler-rs.d.ts.map | 1 + packages/plugins/ler-rs/dist/types.d.ts | 130 +++++++++++ packages/plugins/ler-rs/dist/types.d.ts.map | 1 + packages/plugins/ler-rs/package.json | 44 ++++ packages/plugins/ler-rs/project.json | 21 ++ packages/plugins/ler-rs/scripts/build.mjs | 80 +++++++ .../plugins/ler-rs/scripts/mixedEntypoint.js | 7 + packages/plugins/ler-rs/src/index.ts | 2 + packages/plugins/ler-rs/src/ler-rs.ts | 177 +++++++++++++++ packages/plugins/ler-rs/src/types.ts | 124 +++++++++++ packages/plugins/ler-rs/tsconfig.json | 21 ++ 22 files changed, 1204 insertions(+) create mode 100644 packages/plugins/ler-rs/README.md create mode 100644 packages/plugins/ler-rs/dist/index.d.ts create mode 100644 packages/plugins/ler-rs/dist/index.d.ts.map create mode 100644 packages/plugins/ler-rs/dist/index.js create mode 100644 packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js create mode 100644 packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js.map create mode 100644 packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js create mode 100644 packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js.map create mode 100644 packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js create mode 100644 packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js.map create mode 100644 packages/plugins/ler-rs/dist/ler-rs.d.ts create mode 100644 packages/plugins/ler-rs/dist/ler-rs.d.ts.map create mode 100644 packages/plugins/ler-rs/dist/types.d.ts create mode 100644 packages/plugins/ler-rs/dist/types.d.ts.map create mode 100644 packages/plugins/ler-rs/package.json create mode 100644 packages/plugins/ler-rs/project.json create mode 100644 packages/plugins/ler-rs/scripts/build.mjs create mode 100644 packages/plugins/ler-rs/scripts/mixedEntypoint.js create mode 100644 packages/plugins/ler-rs/src/index.ts create mode 100644 packages/plugins/ler-rs/src/ler-rs.ts create mode 100644 packages/plugins/ler-rs/src/types.ts create mode 100644 packages/plugins/ler-rs/tsconfig.json diff --git a/packages/plugins/ler-rs/README.md b/packages/plugins/ler-rs/README.md new file mode 100644 index 0000000000..6299a7c0a0 --- /dev/null +++ b/packages/plugins/ler-rs/README.md @@ -0,0 +1,210 @@ +# @learncard/ler-rs-plugin + +Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials. + +## Install + +This plugin is part of the LearnCard monorepo and is built with the workspace. + +## API + +- `createLerRecord(params: CreateLerRecordParams): Promise` +- `createLerPresentation(params: CreateLerPresentationParams): Promise` +- `verifyLerPresentation(params: VerifyLerPresentationParams): Promise` + +See `src/types.ts` for types and `src/ler-rs.ts` for implementation details. + +## Notes + +- Follows the Container + Verifiable Proof pattern by wrapping self-asserted containers and embedding VCs in `verifications` arrays. +- Ensures credential and presentation `type` fields are non-empty arrays. + +--- + +## Requirements + +- Your `LearnCard` must already have the VC plugin installed (provided by standard `@learncard/init` initializers). +- Add this plugin by passing the base LearnCard to the factory and then calling `addPlugin`: + +```ts +import { getLerRsPlugin } from '@learncard/ler-rs-plugin'; + +// baseLc should already include the VC plugin (e.g., via @learncard/init) +const lc = await baseLc.addPlugin(getLerRsPlugin(baseLc)); +``` + +The plugin captures `baseLc` internally to issue and verify VCs/VPs. + +## Quick start + +```ts +import type { + PersonProfile, + WorkHistoryItem, + EducationHistoryItem, + CertificationItem, +} from '@learncard/ler-rs-plugin'; +import { getLerRsPlugin } from '@learncard/ler-rs-plugin'; + +// 1) Add plugin +const lc = await baseLc.addPlugin(getLerRsPlugin(baseLc)); + +// 2) Build a LER-RS credential (self-asserted + optional embedded VCs) +const person: PersonProfile = { + id: 'did:example:alice', + givenName: 'Alice', + familyName: 'Anderson', + email: 'alice@example.com', +}; + +const workHistory: WorkHistoryItem[] = [ + { + position: 'Marketing Professional', + employer: 'ABC Company', + start: '2022-01-01', + end: '2024-06-01', + narrative: 'Led a multi-channel campaign with 200% ROI.', + }, +]; + +const educationHistory: EducationHistoryItem[] = [ + { + institution: 'State University', + degree: 'B.S. Business', + specializations: ['Marketing Analytics'], + start: '2018-09-01', + end: '2022-05-15', + }, +]; + +const certifications: CertificationItem[] = [ + { + name: 'Google Analytics Certification', + issuingAuthority: 'Google', + status: 'active', + narrative: 'Validated proficiency in GA4 and attribution modeling.', + }, +]; + +const skills = ['SEO/SEM', 'Content Strategy', 'Team Leadership']; + +const lerVc = await lc.invoke.createLerRecord({ + person, + workHistory, + educationHistory, + certifications, + skills, +}); + +// 3) Package into a VP (must include at least one LER-RS VC) +const vp = await lc.invoke.createLerPresentation({ + credentials: [lerVc], + domain: 'apply.acme.com', + challenge: 'a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8', +}); + +// 4) Verify the presentation +const verification = await lc.invoke.verifyLerPresentation({ + presentation: vp, + domain: 'apply.acme.com', + challenge: 'a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8', +}); + +console.log(verification.verified); +for (const r of verification.credentialResults) { + console.log(r.credential.id, r.verified, r.isSelfIssued, r.errors); +} +``` + +## Wrapping existing VCs inside containers + +Each container item (`workHistory`, `educationHistory`, `certifications`) can embed externally issued VCs as verifications. Provide `verifiableCredential` in the item to include it under `verifications`: + +```ts +// Assume employmentVc is a third-party or previously issued VC +const employmentVc = await lc.read.get('urn:uuid:employment-123'); + +const lerWithProof = await lc.invoke.createLerRecord({ + person, + workHistory: [ + { + narrative: 'My key responsibilities and outcomes.', + verifiableCredential: employmentVc, + }, + ], +}); +``` + +## Schema mapping guidance + +This plugin follows a "Container + Verifiable Proof" model. For `credentialSubject.ler`, we map as follows (see `src/ler-rs.ts`): + +- __person__ + - From `params.person` + - Maps to `ler.person` with `name.givenName`, `name.familyName`, and `name.formattedName` + +- __communication__ + - If `person.email` is provided, becomes `ler.communication.emails = [{ address: email }]` + +- __skills__ + - `params.skills: string[]` → `ler.skills = [{ name: string }]` + +- __employmentHistories__ (from `params.workHistory`) + - `employer` → `container.organization.tradeName` + - `position`, `start`, `end` → `container.positionHistories = [{ title, start, end }]` + - `narrative` → `container.narrative` + - `verifiableCredential` → `container.verifications = [VC]` + - Any other keys on the item are merged into the container as-is + +- __educationAndLearnings__ (from `params.educationHistory`) + - `institution`, `start`, `end` → same key names on container + - `degree`, `specializations` → `container.educationDegrees = [{ name: degree, specializations }]` + - `narrative` → `container.narrative` + - `verifiableCredential` → `container.verifications = [VC]` + +- __certifications__ (from `params.certifications`) + - All provided keys are copied into the container + - `narrative` → `container.narrative` + - `verifiableCredential` → `container.verifications = [VC]` + +Resulting VC shape (high-level): + +```ts +{ + '@context': ['https://www.w3.org/ns/credentials/v2'], + type: ['VerifiableCredential', 'LERRS'], + issuer: 'did:...issuer', + credentialSubject: { + id: 'did:...subject', + ler: { + person: { id, name: { givenName, familyName, formattedName } }, + communication?: { emails?: [{ address }] }, + skills?: [{ name }], + employmentHistories?: [{ ...container, verifications?: [VC] }], + educationAndLearnings?: [{ ...container, verifications?: [VC] }], + certifications?: [{ ...container, verifications?: [VC] }], + narratives?: string[], + } + } +} +``` + +## Verification behavior + +- `verifyLerPresentation` verifies the VP and each embedded VC. +- `VerificationResult.verified` is true when: + - The presentation verifies, and + - Every credential either verifies OR is considered self-issued. +- A credential is considered __self-issued__ when: + - It has type `LERRS`, or + - Its `issuer` DID equals the VP `holder` DID. + +## Troubleshooting + +- __Non-empty type arrays__: VC/VP `type` are always emitted as non-empty arrays to satisfy validators (e.g., Zod schemas that require `[string, ...string[]]`). +- __Missing VC plugin__: Ensure your base LearnCard already includes `@learncard/vc-plugin` (standard in `@learncard/init` initializers). + +## Contributing + +- Types live in `src/types.ts`. Implementation is in `src/ler-rs.ts`. +- Please add tests for new behaviors and keep examples in this README up-to-date with the code. diff --git a/packages/plugins/ler-rs/dist/index.d.ts b/packages/plugins/ler-rs/dist/index.d.ts new file mode 100644 index 0000000000..a584077215 --- /dev/null +++ b/packages/plugins/ler-rs/dist/index.d.ts @@ -0,0 +1,3 @@ +export { getLerRsPlugin } from './ler-rs'; +export * from './types'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/packages/plugins/ler-rs/dist/index.d.ts.map b/packages/plugins/ler-rs/dist/index.d.ts.map new file mode 100644 index 0000000000..9e99ca9b11 --- /dev/null +++ b/packages/plugins/ler-rs/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/packages/plugins/ler-rs/dist/index.js b/packages/plugins/ler-rs/dist/index.js new file mode 100644 index 0000000000..3d07537211 --- /dev/null +++ b/packages/plugins/ler-rs/dist/index.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./ler-rs-plugin.cjs.production.min.js'); +} else { + module.exports = require('./ler-rs-plugin.cjs.development.js'); +} diff --git a/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js b/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js new file mode 100644 index 0000000000..24c6771332 --- /dev/null +++ b/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js @@ -0,0 +1,185 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/index.ts +var src_exports = {}; +__export(src_exports, { + getLerRsPlugin: () => getLerRsPlugin +}); +module.exports = __toCommonJS(src_exports); + +// src/ler-rs.ts +var VC_CONTEXT = "https://www.w3.org/ns/credentials/v2"; +var LERRS_TYPE = "LERRS"; +var toArray = /* @__PURE__ */ __name((maybe) => maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe], "toArray"); +var buildEmploymentHistories = /* @__PURE__ */ __name((items) => { + return items.map((item) => { + const { narrative, verifiableCredential, position, employer, start, end, ...rest } = item; + const container = { ...rest }; + if (employer) + container.organization = { tradeName: employer }; + if (position || start || end) { + const ph = {}; + if (position) + ph.title = position; + if (start) + ph.start = start; + if (end) + ph.end = end; + container.positionHistories = [ph]; + } + if (narrative) + container.narrative = narrative; + const verifications = verifiableCredential ? [verifiableCredential] : []; + return { ...container, ...verifications.length ? { verifications } : {} }; + }); +}, "buildEmploymentHistories"); +var buildEducationAndLearnings = /* @__PURE__ */ __name((items) => { + return items.map((item) => { + const { narrative, verifiableCredential, institution, start, end, degree, specializations, ...rest } = item; + const container = { ...rest }; + if (institution) + container.institution = institution; + if (start) + container.start = start; + if (end) + container.end = end; + if (degree || specializations) { + container.educationDegrees = [{ ...degree ? { name: degree } : {}, ...specializations ? { specializations } : {} }]; + } + if (narrative) + container.narrative = narrative; + const verifications = verifiableCredential ? [verifiableCredential] : []; + return { ...container, ...verifications.length ? { verifications } : {} }; + }); +}, "buildEducationAndLearnings"); +var buildCertifications = /* @__PURE__ */ __name((items) => { + return items.map((item) => { + const { narrative, verifiableCredential, ...rest } = item; + const container = { ...rest }; + if (narrative) + container.narrative = narrative; + const verifications = verifiableCredential ? [verifiableCredential] : []; + return { ...container, ...verifications.length ? { verifications } : {} }; + }); +}, "buildCertifications"); +var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => { + return { + name: "LER-RS", + displayName: "LER-RS", + description: "Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials", + methods: { + createLerRecord: async (_learnCard, params) => { + const signer = params.learnCard ?? _learnCard; + const did = signer.id.did(); + const personSection = { + id: params.person.id, + name: { + givenName: params.person.givenName, + familyName: params.person.familyName, + formattedName: `${params.person.givenName} ${params.person.familyName}` + } + }; + const communication = params.person.email ? { emails: [{ address: params.person.email }] } : void 0; + const lerRecord = { + person: personSection, + ...communication ? { communication } : {}, + skills: (params.skills || []).map((s) => ({ name: s })), + employmentHistories: params.workHistory ? buildEmploymentHistories(params.workHistory) : void 0, + educationAndLearnings: params.educationHistory ? buildEducationAndLearnings(params.educationHistory) : void 0, + certifications: params.certifications ? buildCertifications(params.certifications) : void 0, + narratives: [] + }; + const unsignedVC = { + "@context": [VC_CONTEXT], + id: `urn:uuid:${crypto.randomUUID()}`, + type: ["VerifiableCredential", LERRS_TYPE], + issuer: did, + validFrom: new Date().toISOString(), + credentialSubject: { + id: params.person.id, + ler: lerRecord + } + }; + return initLearnCard.invoke.issueCredential(unsignedVC, { proofPurpose: "assertionMethod" }); + }, + createLerPresentation: async (_learnCard, params) => { + const signer = params.learnCard ?? _learnCard; + const did = signer.id.did(); + if (!params.credentials.length) + throw new Error("createLerPresentation: credentials array must contain at least one credential"); + const containsLer = params.credentials.some((vc) => Array.isArray(vc.type) && vc.type.includes(LERRS_TYPE)); + if (!containsLer) + throw new Error("createLerPresentation: credentials must include at least one LER-RS credential"); + const vp = { + "@context": [VC_CONTEXT], + type: ["VerifiablePresentation"], + holder: did, + verifiableCredential: params.credentials.length === 1 ? params.credentials[0] : params.credentials + }; + return initLearnCard.invoke.issuePresentation(vp, { + ...params.domain ? { domain: params.domain } : {}, + ...params.challenge ? { challenge: params.challenge } : {} + }); + }, + verifyLerPresentation: async (_learnCard, { presentation, domain, challenge }) => { + const presCheck = await initLearnCard.invoke.verifyPresentation(presentation, { + ...domain ? { domain } : {}, + ...challenge ? { challenge } : {} + }); + const presentationResult = { + verified: presCheck.errors.length === 0, + errors: presCheck.errors.length ? presCheck.errors : void 0 + }; + const credentialResults = []; + if (typeof presentation !== "string") { + const holder = presentation.holder; + const vcs = toArray(presentation.verifiableCredential); + for (const credential of vcs) { + try { + const credCheck = await initLearnCard.invoke.verifyCredential(credential); + const issuerDid = typeof credential.issuer === "string" ? credential.issuer : credential.issuer?.id; + const isSelfIssued = Array.isArray(credential.type) && credential.type.includes(LERRS_TYPE) || !!holder && !!issuerDid && issuerDid === holder; + credentialResults.push({ + credential, + verified: credCheck.errors.length === 0, + isSelfIssued, + errors: credCheck.errors.length ? credCheck.errors : void 0 + }); + } catch (err) { + credentialResults.push({ + credential, + verified: false, + isSelfIssued: false, + errors: [err instanceof Error ? err.message : "Unknown error verifying credential"] + }); + } + } + } + return { + verified: presentationResult.verified && credentialResults.every((r) => r.verified || r.isSelfIssued), + presentationResult, + credentialResults + }; + } + } + }; +}, "getLerRsPlugin"); +//# sourceMappingURL=ler-rs-plugin.cjs.development.js.map diff --git a/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js.map b/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js.map new file mode 100644 index 0000000000..5cd0f4383e --- /dev/null +++ b/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/ler-rs.ts"], + "sourcesContent": ["export { getLerRsPlugin } from './ler-rs';\nexport * from './types';\n", "import { VC as VerifiableCredential, UnsignedVC, VP as VerifiablePresentation, UnsignedVP } from '@learncard/types';\nimport { LERRSDependentLearnCard, LERRSPlugin, CreateLerRecordParams, CreateLerPresentationParams, VerifyLerPresentationParams, VerificationResult, LerRsRecord } from './types';\n\nconst VC_CONTEXT = 'https://www.w3.org/ns/credentials/v2';\nconst LERRS_TYPE = 'LERRS';\n\nconst toArray = (maybe: T | T[] | undefined): T[] => (maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe]);\n\nconst buildEmploymentHistories = (items: NonNullable): LerRsRecord['employmentHistories'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, position, employer, start, end, ...rest } = item;\n\n const container: Record = { ...rest };\n\n if (employer) container.organization = { tradeName: employer };\n if (position || start || end) {\n const ph: Record = {};\n if (position) ph.title = position;\n if (start) ph.start = start;\n if (end) ph.end = end;\n container.positionHistories = [ph];\n }\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nconst buildEducationAndLearnings = (items: NonNullable): LerRsRecord['educationAndLearnings'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, institution, start, end, degree, specializations, ...rest } = item;\n\n const container: Record = { ...rest };\n if (institution) container.institution = institution;\n if (start) container.start = start;\n if (end) container.end = end;\n if (degree || specializations) {\n container.educationDegrees = [{ ...(degree ? { name: degree } : {}), ...(specializations ? { specializations } : {}) }];\n }\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nconst buildCertifications = (items: NonNullable): LerRsRecord['certifications'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, ...rest } = item;\n\n const container: Record = { ...rest };\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nexport const getLerRsPlugin = (initLearnCard: LERRSDependentLearnCard): LERRSPlugin => {\n return {\n name: 'LER-RS',\n displayName: 'LER-RS',\n description: 'Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials',\n methods: {\n createLerRecord: async (_learnCard, params): Promise => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n const personSection: LerRsRecord['person'] = {\n id: params.person.id,\n name: {\n givenName: params.person.givenName,\n familyName: params.person.familyName,\n formattedName: `${params.person.givenName} ${params.person.familyName}`,\n },\n };\n\n const communication: LerRsRecord['communication'] | undefined = params.person.email\n ? { emails: [{ address: params.person.email }] }\n : undefined;\n\n const lerRecord: LerRsRecord = {\n person: personSection,\n ...(communication ? { communication } : {}),\n skills: (params.skills || []).map(s => ({ name: s })),\n employmentHistories: params.workHistory ? buildEmploymentHistories(params.workHistory) : undefined,\n educationAndLearnings: params.educationHistory ? buildEducationAndLearnings(params.educationHistory) : undefined,\n certifications: params.certifications ? buildCertifications(params.certifications) : undefined,\n narratives: [],\n };\n\n const unsignedVC: UnsignedVC = {\n '@context': [VC_CONTEXT],\n id: `urn:uuid:${crypto.randomUUID()}`,\n type: ['VerifiableCredential', LERRS_TYPE],\n issuer: did,\n validFrom: new Date().toISOString(),\n credentialSubject: {\n id: params.person.id,\n ler: lerRecord,\n },\n };\n\n return initLearnCard.invoke.issueCredential(unsignedVC, { proofPurpose: 'assertionMethod' });\n },\n\n createLerPresentation: async (_learnCard, params): Promise => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n if (!params.credentials.length) throw new Error('createLerPresentation: credentials array must contain at least one credential');\n const containsLer = params.credentials.some(vc => Array.isArray(vc.type) && vc.type.includes(LERRS_TYPE));\n if (!containsLer) throw new Error('createLerPresentation: credentials must include at least one LER-RS credential');\n\n const vp: UnsignedVP = {\n '@context': [VC_CONTEXT],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential: params.credentials.length === 1 ? params.credentials[0] : 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 verifyLerPresentation: async (_learnCard, { presentation, domain, challenge }: VerifyLerPresentationParams): Promise => {\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(presentation.verifiableCredential as any);\n\n for (const credential of vcs) {\n try {\n const credCheck = await initLearnCard.invoke.verifyCredential(credential);\n const issuerDid = typeof credential.issuer === 'string' ? credential.issuer : credential.issuer?.id;\n const isSelfIssued = (Array.isArray(credential.type) && credential.type.includes(LERRS_TYPE)) || (!!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: [err instanceof Error ? err.message : 'Unknown error verifying credential'],\n });\n }\n }\n }\n\n return {\n verified: presentationResult.verified && credentialResults.every(r => r.verified || r.isSelfIssued),\n presentationResult,\n credentialResults,\n };\n },\n },\n };\n};\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,IAAM,aAAa;AACnB,IAAM,aAAa;AAEnB,IAAM,UAAU,wBAAI,UAAqC,SAAS,OAAO,CAAC,IAAI,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK,GAAnG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/ler-rs-plugin.cjs.production.min.js b/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js new file mode 100644 index 0000000000..f9c4b1e68a --- /dev/null +++ b/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js @@ -0,0 +1,2 @@ +"use strict";var R=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var u=(r,n)=>R(r,"name",{value:n,configurable:!0});var p=(r,n)=>{for(var e in n)R(r,e,{get:n[e],enumerable:!0})},V=(r,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of C(n))!h.call(r,i)&&i!==e&&R(r,i,{get:()=>n[i],enumerable:!(a=P(n,i))||a.enumerable});return r};var w=r=>V(R({},"__esModule",{value:!0}),r);var N={};p(N,{getLerRsPlugin:()=>m});module.exports=w(N);var v="https://www.w3.org/ns/credentials/v2",g="LERRS",E=u(r=>r==null?[]:Array.isArray(r)?r:[r],"toArray"),k=u(r=>r.map(n=>{let{narrative:e,verifiableCredential:a,position:i,employer:d,start:o,end:s,...l}=n,f={...l};if(d&&(f.organization={tradeName:d}),i||o||s){let c={};i&&(c.title=i),o&&(c.start=o),s&&(c.end=s),f.positionHistories=[c]}e&&(f.narrative=e);let t=a?[a]:[];return{...f,...t.length?{verifications:t}:{}}}),"buildEmploymentHistories"),S=u(r=>r.map(n=>{let{narrative:e,verifiableCredential:a,institution:i,start:d,end:o,degree:s,specializations:l,...f}=n,t={...f};i&&(t.institution=i),d&&(t.start=d),o&&(t.end=o),(s||l)&&(t.educationDegrees=[{...s?{name:s}:{},...l?{specializations:l}:{}}]),e&&(t.narrative=e);let c=a?[a]:[];return{...t,...c.length?{verifications:c}:{}}}),"buildEducationAndLearnings"),b=u(r=>r.map(n=>{let{narrative:e,verifiableCredential:a,...i}=n,d={...i};e&&(d.narrative=e);let o=a?[a]:[];return{...d,...o.length?{verifications:o}:{}}}),"buildCertifications"),m=u(r=>({name:"LER-RS",displayName:"LER-RS",description:"Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials",methods:{createLerRecord:async(n,e)=>{let i=(e.learnCard??n).id.did(),d={id:e.person.id,name:{givenName:e.person.givenName,familyName:e.person.familyName,formattedName:`${e.person.givenName} ${e.person.familyName}`}},o=e.person.email?{emails:[{address:e.person.email}]}:void 0,s={person:d,...o?{communication:o}:{},skills:(e.skills||[]).map(f=>({name:f})),employmentHistories:e.workHistory?k(e.workHistory):void 0,educationAndLearnings:e.educationHistory?S(e.educationHistory):void 0,certifications:e.certifications?b(e.certifications):void 0,narratives:[]},l={"@context":[v],id:`urn:uuid:${crypto.randomUUID()}`,type:["VerifiableCredential",g],issuer:i,validFrom:new Date().toISOString(),credentialSubject:{id:e.person.id,ler:s}};return r.invoke.issueCredential(l,{proofPurpose:"assertionMethod"})},createLerPresentation:async(n,e)=>{let i=(e.learnCard??n).id.did();if(!e.credentials.length)throw new Error("createLerPresentation: credentials array must contain at least one credential");if(!e.credentials.some(s=>Array.isArray(s.type)&&s.type.includes(g)))throw new Error("createLerPresentation: credentials must include at least one LER-RS credential");let o={"@context":[v],type:["VerifiablePresentation"],holder:i,verifiableCredential:e.credentials.length===1?e.credentials[0]:e.credentials};return r.invoke.issuePresentation(o,{...e.domain?{domain:e.domain}:{},...e.challenge?{challenge:e.challenge}:{}})},verifyLerPresentation:async(n,{presentation:e,domain:a,challenge:i})=>{let d=await r.invoke.verifyPresentation(e,{...a?{domain:a}:{},...i?{challenge:i}:{}}),o={verified:d.errors.length===0,errors:d.errors.length?d.errors:void 0},s=[];if(typeof e!="string"){let l=e.holder,f=E(e.verifiableCredential);for(let t of f)try{let c=await r.invoke.verifyCredential(t),y=typeof t.issuer=="string"?t.issuer:t.issuer?.id,L=Array.isArray(t.type)&&t.type.includes(g)||!!l&&!!y&&y===l;s.push({credential:t,verified:c.errors.length===0,isSelfIssued:L,errors:c.errors.length?c.errors:void 0})}catch(c){s.push({credential:t,verified:!1,isSelfIssued:!1,errors:[c instanceof Error?c.message:"Unknown error verifying credential"]})}}return{verified:o.verified&&s.every(l=>l.verified||l.isSelfIssued),presentationResult:o,credentialResults:s}}}}),"getLerRsPlugin"); +//# sourceMappingURL=ler-rs-plugin.cjs.production.min.js.map diff --git a/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js.map b/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js.map new file mode 100644 index 0000000000..bcf06b664d --- /dev/null +++ b/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/index.ts", "../src/ler-rs.ts"], + "sourcesContent": ["export { getLerRsPlugin } from './ler-rs';\nexport * from './types';\n", "import { VC as VerifiableCredential, UnsignedVC, VP as VerifiablePresentation, UnsignedVP } from '@learncard/types';\nimport { LERRSDependentLearnCard, LERRSPlugin, CreateLerRecordParams, CreateLerPresentationParams, VerifyLerPresentationParams, VerificationResult, LerRsRecord } from './types';\n\nconst VC_CONTEXT = 'https://www.w3.org/ns/credentials/v2';\nconst LERRS_TYPE = 'LERRS';\n\nconst toArray = (maybe: T | T[] | undefined): T[] => (maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe]);\n\nconst buildEmploymentHistories = (items: NonNullable): LerRsRecord['employmentHistories'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, position, employer, start, end, ...rest } = item;\n\n const container: Record = { ...rest };\n\n if (employer) container.organization = { tradeName: employer };\n if (position || start || end) {\n const ph: Record = {};\n if (position) ph.title = position;\n if (start) ph.start = start;\n if (end) ph.end = end;\n container.positionHistories = [ph];\n }\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nconst buildEducationAndLearnings = (items: NonNullable): LerRsRecord['educationAndLearnings'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, institution, start, end, degree, specializations, ...rest } = item;\n\n const container: Record = { ...rest };\n if (institution) container.institution = institution;\n if (start) container.start = start;\n if (end) container.end = end;\n if (degree || specializations) {\n container.educationDegrees = [{ ...(degree ? { name: degree } : {}), ...(specializations ? { specializations } : {}) }];\n }\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nconst buildCertifications = (items: NonNullable): LerRsRecord['certifications'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, ...rest } = item;\n\n const container: Record = { ...rest };\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nexport const getLerRsPlugin = (initLearnCard: LERRSDependentLearnCard): LERRSPlugin => {\n return {\n name: 'LER-RS',\n displayName: 'LER-RS',\n description: 'Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials',\n methods: {\n createLerRecord: async (_learnCard, params): Promise => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n const personSection: LerRsRecord['person'] = {\n id: params.person.id,\n name: {\n givenName: params.person.givenName,\n familyName: params.person.familyName,\n formattedName: `${params.person.givenName} ${params.person.familyName}`,\n },\n };\n\n const communication: LerRsRecord['communication'] | undefined = params.person.email\n ? { emails: [{ address: params.person.email }] }\n : undefined;\n\n const lerRecord: LerRsRecord = {\n person: personSection,\n ...(communication ? { communication } : {}),\n skills: (params.skills || []).map(s => ({ name: s })),\n employmentHistories: params.workHistory ? buildEmploymentHistories(params.workHistory) : undefined,\n educationAndLearnings: params.educationHistory ? buildEducationAndLearnings(params.educationHistory) : undefined,\n certifications: params.certifications ? buildCertifications(params.certifications) : undefined,\n narratives: [],\n };\n\n const unsignedVC: UnsignedVC = {\n '@context': [VC_CONTEXT],\n id: `urn:uuid:${crypto.randomUUID()}`,\n type: ['VerifiableCredential', LERRS_TYPE],\n issuer: did,\n validFrom: new Date().toISOString(),\n credentialSubject: {\n id: params.person.id,\n ler: lerRecord,\n },\n };\n\n return initLearnCard.invoke.issueCredential(unsignedVC, { proofPurpose: 'assertionMethod' });\n },\n\n createLerPresentation: async (_learnCard, params): Promise => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n if (!params.credentials.length) throw new Error('createLerPresentation: credentials array must contain at least one credential');\n const containsLer = params.credentials.some(vc => Array.isArray(vc.type) && vc.type.includes(LERRS_TYPE));\n if (!containsLer) throw new Error('createLerPresentation: credentials must include at least one LER-RS credential');\n\n const vp: UnsignedVP = {\n '@context': [VC_CONTEXT],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential: params.credentials.length === 1 ? params.credentials[0] : 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 verifyLerPresentation: async (_learnCard, { presentation, domain, challenge }: VerifyLerPresentationParams): Promise => {\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(presentation.verifiableCredential as any);\n\n for (const credential of vcs) {\n try {\n const credCheck = await initLearnCard.invoke.verifyCredential(credential);\n const issuerDid = typeof credential.issuer === 'string' ? credential.issuer : credential.issuer?.id;\n const isSelfIssued = (Array.isArray(credential.type) && credential.type.includes(LERRS_TYPE)) || (!!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: [err instanceof Error ? err.message : 'Unknown error verifying credential'],\n });\n }\n }\n }\n\n return {\n verified: presentationResult.verified && credentialResults.every(r => r.verified || r.isSelfIssued),\n presentationResult,\n credentialResults,\n };\n },\n },\n };\n};\n"], + "mappings": "4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,IAAA,eAAAC,EAAAH,GCGA,IAAMI,EAAa,uCACbC,EAAa,QAEbC,EAAUC,EAAIC,GAAqCA,GAAS,KAAO,CAAC,EAAI,MAAM,QAAQA,CAAK,EAAIA,EAAQ,CAACA,CAAK,EAAnG,WAEVC,EAA2BF,EAACG,GACzBA,EAAM,IAAIC,GAAQ,CACvB,GAAM,CAAE,UAAAC,EAAW,qBAAAC,EAAsB,SAAAC,EAAU,SAAAC,EAAU,MAAAC,EAAO,IAAAC,KAAQC,CAAK,EAAIP,EAE/EQ,EAAqC,CAAE,GAAGD,CAAK,EAGrD,GADIH,IAAUI,EAAU,aAAe,CAAE,UAAWJ,CAAS,GACzDD,GAAYE,GAASC,EAAK,CAC5B,IAAMG,EAA8B,CAAC,EACjCN,IAAUM,EAAG,MAAQN,GACrBE,IAAOI,EAAG,MAAQJ,GAClBC,IAAKG,EAAG,IAAMH,GAClBE,EAAU,kBAAoB,CAACC,CAAE,CACnC,CACIR,IAAWO,EAAU,UAAYP,GAErC,IAAMS,EAAgBR,EAAuB,CAACA,CAAoB,EAAI,CAAC,EACvE,MAAO,CAAE,GAAGM,EAAW,GAAIE,EAAc,OAAS,CAAE,cAAAA,CAAc,EAAI,CAAC,CAAG,CAC5E,CAAC,EAlB8B,4BAqB3BC,EAA6Bf,EAACG,GAC3BA,EAAM,IAAIC,GAAQ,CACvB,GAAM,CAAE,UAAAC,EAAW,qBAAAC,EAAsB,YAAAU,EAAa,MAAAP,EAAO,IAAAC,EAAK,OAAAO,EAAQ,gBAAAC,KAAoBP,CAAK,EAAIP,EAEjGQ,EAAqC,CAAE,GAAGD,CAAK,EACjDK,IAAaJ,EAAU,YAAcI,GACrCP,IAAOG,EAAU,MAAQ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ymentHistories", "items", "item", "narrative", "verifiableCredential", "position", "employer", "start", "end", "rest", "container", "ph", "verifications", "buildEducationAndLearnings", "institution", "degree", "specializations", "buildCertifications", "getLerRsPlugin", "initLearnCard", "_learnCard", "params", "did", "personSection", "communication", "lerRecord", "s", "unsignedVC", "vc", "vp", "presentation", "domain", "challenge", "presCheck", "presentationResult", "credentialResults", "holder", "vcs", "credential", "credCheck", "issuerDid", "isSelfIssued", "err", "r"] +} diff --git a/packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js b/packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js new file mode 100644 index 0000000000..021546380e --- /dev/null +++ b/packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js @@ -0,0 +1,164 @@ +var __defProp = Object.defineProperty; +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); + +// src/ler-rs.ts +var VC_CONTEXT = "https://www.w3.org/ns/credentials/v2"; +var LERRS_TYPE = "LERRS"; +var toArray = /* @__PURE__ */ __name((maybe) => maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe], "toArray"); +var buildEmploymentHistories = /* @__PURE__ */ __name((items) => { + return items.map((item) => { + const { narrative, verifiableCredential, position, employer, start, end, ...rest } = item; + const container = { ...rest }; + if (employer) + container.organization = { tradeName: employer }; + if (position || start || end) { + const ph = {}; + if (position) + ph.title = position; + if (start) + ph.start = start; + if (end) + ph.end = end; + container.positionHistories = [ph]; + } + if (narrative) + container.narrative = narrative; + const verifications = verifiableCredential ? [verifiableCredential] : []; + return { ...container, ...verifications.length ? { verifications } : {} }; + }); +}, "buildEmploymentHistories"); +var buildEducationAndLearnings = /* @__PURE__ */ __name((items) => { + return items.map((item) => { + const { narrative, verifiableCredential, institution, start, end, degree, specializations, ...rest } = item; + const container = { ...rest }; + if (institution) + container.institution = institution; + if (start) + container.start = start; + if (end) + container.end = end; + if (degree || specializations) { + container.educationDegrees = [{ ...degree ? { name: degree } : {}, ...specializations ? { specializations } : {} }]; + } + if (narrative) + container.narrative = narrative; + const verifications = verifiableCredential ? [verifiableCredential] : []; + return { ...container, ...verifications.length ? { verifications } : {} }; + }); +}, "buildEducationAndLearnings"); +var buildCertifications = /* @__PURE__ */ __name((items) => { + return items.map((item) => { + const { narrative, verifiableCredential, ...rest } = item; + const container = { ...rest }; + if (narrative) + container.narrative = narrative; + const verifications = verifiableCredential ? [verifiableCredential] : []; + return { ...container, ...verifications.length ? { verifications } : {} }; + }); +}, "buildCertifications"); +var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => { + return { + name: "LER-RS", + displayName: "LER-RS", + description: "Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials", + methods: { + createLerRecord: async (_learnCard, params) => { + const signer = params.learnCard ?? _learnCard; + const did = signer.id.did(); + const personSection = { + id: params.person.id, + name: { + givenName: params.person.givenName, + familyName: params.person.familyName, + formattedName: `${params.person.givenName} ${params.person.familyName}` + } + }; + const communication = params.person.email ? { emails: [{ address: params.person.email }] } : void 0; + const lerRecord = { + person: personSection, + ...communication ? { communication } : {}, + skills: (params.skills || []).map((s) => ({ name: s })), + employmentHistories: params.workHistory ? buildEmploymentHistories(params.workHistory) : void 0, + educationAndLearnings: params.educationHistory ? buildEducationAndLearnings(params.educationHistory) : void 0, + certifications: params.certifications ? buildCertifications(params.certifications) : void 0, + narratives: [] + }; + const unsignedVC = { + "@context": [VC_CONTEXT], + id: `urn:uuid:${crypto.randomUUID()}`, + type: ["VerifiableCredential", LERRS_TYPE], + issuer: did, + validFrom: new Date().toISOString(), + credentialSubject: { + id: params.person.id, + ler: lerRecord + } + }; + return initLearnCard.invoke.issueCredential(unsignedVC, { proofPurpose: "assertionMethod" }); + }, + createLerPresentation: async (_learnCard, params) => { + const signer = params.learnCard ?? _learnCard; + const did = signer.id.did(); + if (!params.credentials.length) + throw new Error("createLerPresentation: credentials array must contain at least one credential"); + const containsLer = params.credentials.some((vc) => Array.isArray(vc.type) && vc.type.includes(LERRS_TYPE)); + if (!containsLer) + throw new Error("createLerPresentation: credentials must include at least one LER-RS credential"); + const vp = { + "@context": [VC_CONTEXT], + type: ["VerifiablePresentation"], + holder: did, + verifiableCredential: params.credentials.length === 1 ? params.credentials[0] : params.credentials + }; + return initLearnCard.invoke.issuePresentation(vp, { + ...params.domain ? { domain: params.domain } : {}, + ...params.challenge ? { challenge: params.challenge } : {} + }); + }, + verifyLerPresentation: async (_learnCard, { presentation, domain, challenge }) => { + const presCheck = await initLearnCard.invoke.verifyPresentation(presentation, { + ...domain ? { domain } : {}, + ...challenge ? { challenge } : {} + }); + const presentationResult = { + verified: presCheck.errors.length === 0, + errors: presCheck.errors.length ? presCheck.errors : void 0 + }; + const credentialResults = []; + if (typeof presentation !== "string") { + const holder = presentation.holder; + const vcs = toArray(presentation.verifiableCredential); + for (const credential of vcs) { + try { + const credCheck = await initLearnCard.invoke.verifyCredential(credential); + const issuerDid = typeof credential.issuer === "string" ? credential.issuer : credential.issuer?.id; + const isSelfIssued = Array.isArray(credential.type) && credential.type.includes(LERRS_TYPE) || !!holder && !!issuerDid && issuerDid === holder; + credentialResults.push({ + credential, + verified: credCheck.errors.length === 0, + isSelfIssued, + errors: credCheck.errors.length ? credCheck.errors : void 0 + }); + } catch (err) { + credentialResults.push({ + credential, + verified: false, + isSelfIssued: false, + errors: [err instanceof Error ? err.message : "Unknown error verifying credential"] + }); + } + } + } + return { + verified: presentationResult.verified && credentialResults.every((r) => r.verified || r.isSelfIssued), + presentationResult, + credentialResults + }; + } + } + }; +}, "getLerRsPlugin"); +export { + getLerRsPlugin +}; +//# sourceMappingURL=ler-rs-plugin.esm.js.map diff --git a/packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js.map b/packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js.map new file mode 100644 index 0000000000..2d149ba0d2 --- /dev/null +++ b/packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/ler-rs.ts"], + "sourcesContent": ["import { VC as VerifiableCredential, UnsignedVC, VP as VerifiablePresentation, UnsignedVP } from '@learncard/types';\nimport { LERRSDependentLearnCard, LERRSPlugin, CreateLerRecordParams, CreateLerPresentationParams, VerifyLerPresentationParams, VerificationResult, LerRsRecord } from './types';\n\nconst VC_CONTEXT = 'https://www.w3.org/ns/credentials/v2';\nconst LERRS_TYPE = 'LERRS';\n\nconst toArray = (maybe: T | T[] | undefined): T[] => (maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe]);\n\nconst buildEmploymentHistories = (items: NonNullable): LerRsRecord['employmentHistories'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, position, employer, start, end, ...rest } = item;\n\n const container: Record = { ...rest };\n\n if (employer) container.organization = { tradeName: employer };\n if (position || start || end) {\n const ph: Record = {};\n if (position) ph.title = position;\n if (start) ph.start = start;\n if (end) ph.end = end;\n container.positionHistories = [ph];\n }\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nconst buildEducationAndLearnings = (items: NonNullable): LerRsRecord['educationAndLearnings'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, institution, start, end, degree, specializations, ...rest } = item;\n\n const container: Record = { ...rest };\n if (institution) container.institution = institution;\n if (start) container.start = start;\n if (end) container.end = end;\n if (degree || specializations) {\n container.educationDegrees = [{ ...(degree ? { name: degree } : {}), ...(specializations ? { specializations } : {}) }];\n }\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nconst buildCertifications = (items: NonNullable): LerRsRecord['certifications'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, ...rest } = item;\n\n const container: Record = { ...rest };\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nexport const getLerRsPlugin = (initLearnCard: LERRSDependentLearnCard): LERRSPlugin => {\n return {\n name: 'LER-RS',\n displayName: 'LER-RS',\n description: 'Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials',\n methods: {\n createLerRecord: async (_learnCard, params): Promise => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n const personSection: LerRsRecord['person'] = {\n id: params.person.id,\n name: {\n givenName: params.person.givenName,\n familyName: params.person.familyName,\n formattedName: `${params.person.givenName} ${params.person.familyName}`,\n },\n };\n\n const communication: LerRsRecord['communication'] | undefined = params.person.email\n ? { emails: [{ address: params.person.email }] }\n : undefined;\n\n const lerRecord: LerRsRecord = {\n person: personSection,\n ...(communication ? { communication } : {}),\n skills: (params.skills || []).map(s => ({ name: s })),\n employmentHistories: params.workHistory ? buildEmploymentHistories(params.workHistory) : undefined,\n educationAndLearnings: params.educationHistory ? buildEducationAndLearnings(params.educationHistory) : undefined,\n certifications: params.certifications ? buildCertifications(params.certifications) : undefined,\n narratives: [],\n };\n\n const unsignedVC: UnsignedVC = {\n '@context': [VC_CONTEXT],\n id: `urn:uuid:${crypto.randomUUID()}`,\n type: ['VerifiableCredential', LERRS_TYPE],\n issuer: did,\n validFrom: new Date().toISOString(),\n credentialSubject: {\n id: params.person.id,\n ler: lerRecord,\n },\n };\n\n return initLearnCard.invoke.issueCredential(unsignedVC, { proofPurpose: 'assertionMethod' });\n },\n\n createLerPresentation: async (_learnCard, params): Promise => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n if (!params.credentials.length) throw new Error('createLerPresentation: credentials array must contain at least one credential');\n const containsLer = params.credentials.some(vc => Array.isArray(vc.type) && vc.type.includes(LERRS_TYPE));\n if (!containsLer) throw new Error('createLerPresentation: credentials must include at least one LER-RS credential');\n\n const vp: UnsignedVP = {\n '@context': [VC_CONTEXT],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential: params.credentials.length === 1 ? params.credentials[0] : 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 verifyLerPresentation: async (_learnCard, { presentation, domain, challenge }: VerifyLerPresentationParams): Promise => {\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(presentation.verifiableCredential as any);\n\n for (const credential of vcs) {\n try {\n const credCheck = await initLearnCard.invoke.verifyCredential(credential);\n const issuerDid = typeof credential.issuer === 'string' ? credential.issuer : credential.issuer?.id;\n const isSelfIssued = (Array.isArray(credential.type) && credential.type.includes(LERRS_TYPE)) || (!!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: [err instanceof Error ? err.message : 'Unknown error verifying credential'],\n });\n }\n }\n }\n\n return {\n verified: presentationResult.verified && credentialResults.every(r => r.verified || r.isSelfIssued),\n presentationResult,\n credentialResults,\n };\n },\n },\n };\n};\n"], + "mappings": ";;;;AAGA,IAAM,aAAa;AACnB,IAAM,aAAa;AAEnB,IAAM,UAAU,wBAAI,UAAqC,SAAS,OAAO,CAAC,IAAI,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK,GAAnG;AAEhB,IAAM,2BAA2B,wBAAC,UAAiG;AACjI,SAAO,MAAM,IAAI,UAAQ;AACvB,UAAM,EAAE,WAAW,sBAAsB,UAAU,UAAU,OAAO,QAAQ,KAAK,IAAI;AAErF,UAAM,YAAqC,EAAE,GAAG,KAAK;AAErD,QAAI;AAAU,gBAA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,WAAW;AAAA,UACtC,QAAQ,UAAU,OAAO,SAAS,UAAU,SAAS;AAAA,QACvD;AAEA,cAAM,oBAA6D,CAAC;AAEpE,YAAI,OAAO,iBAAiB,UAAU;AACpC,gBAAM,SAAS,aAAa;AAC5B,gBAAM,MAAM,QAA8B,aAAa,oBAA2B;AAElF,qBAAW,cAAc,KAAK;AAC5B,gBAAI;AACF,oBAAM,YAAY,MAAM,cAAc,OAAO,iBAAiB,UAAU;AACxE,oBAAM,YAAY,OAAO,WAAW,WAAW,WAAW,WAAW,SAAS,WAAW,QAAQ;AACjG,oBAAM,eAAgB,MAAM,QAAQ,WAAW,IAAI,KAAK,WAAW,KAAK,SAAS,UAAU,KAAO,CAAC,CAAC,UAAU,CAAC,CAAC,aAAa,cAAc;AAE3I,gCAAkB,KAAK;AAAA,gBACrB;AAAA,gBACA,UAAU,UAAU,OAAO,WAAW;AAAA,gBACtC;AAAA,gBACA,QAAQ,UAAU,OAAO,SAAS,UAAU,SAAS;AAAA,cACvD,CAAC;AAAA,YACH,SAAS,KAAP;AACA,gCAAkB,KAAK;AAAA,gBACrB;AAAA,gBACA,UAAU;AAAA,gBACV,cAAc;AAAA,gBACd,QAAQ,CAAC,eAAe,QAAQ,IAAI,UAAU,oCAAoC;AAAA,cACpF,CAAC;AAAA,YACH;AAAA,UACF;AAAA,QACF;AAEA,eAAO;AAAA,UACL,UAAU,mBAAmB,YAAY,kBAAkB,MAAM,OAAK,EAAE,YAAY,EAAE,YAAY;AAAA,UAClG;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF,GArH8B;", + "names": [] +} diff --git a/packages/plugins/ler-rs/dist/ler-rs.d.ts b/packages/plugins/ler-rs/dist/ler-rs.d.ts new file mode 100644 index 0000000000..14001a5aa9 --- /dev/null +++ b/packages/plugins/ler-rs/dist/ler-rs.d.ts @@ -0,0 +1,3 @@ +import { LERRSDependentLearnCard, LERRSPlugin } from './types'; +export declare const getLerRsPlugin: (initLearnCard: LERRSDependentLearnCard) => LERRSPlugin; +//# sourceMappingURL=ler-rs.d.ts.map \ No newline at end of file diff --git a/packages/plugins/ler-rs/dist/ler-rs.d.ts.map b/packages/plugins/ler-rs/dist/ler-rs.d.ts.map new file mode 100644 index 0000000000..3440204c07 --- /dev/null +++ b/packages/plugins/ler-rs/dist/ler-rs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ler-rs.d.ts","sourceRoot":"","sources":["../src/ler-rs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAoH,MAAM,SAAS,CAAC;AA0DjL,eAAO,MAAM,cAAc,kBAAmB,uBAAuB,KAAG,WAqHvE,CAAC"} \ No newline at end of file diff --git a/packages/plugins/ler-rs/dist/types.d.ts b/packages/plugins/ler-rs/dist/types.d.ts new file mode 100644 index 0000000000..8f77964e6e --- /dev/null +++ b/packages/plugins/ler-rs/dist/types.d.ts @@ -0,0 +1,130 @@ +import { Plugin, LearnCard } from '@learncard/core'; +import { VC as VerifiableCredential, VP as VerifiablePresentation } from '@learncard/types'; +import type { VCPluginMethods, VCPluginDependentMethods } from '@learncard/vc-plugin'; +export interface PersonProfile { + id: string; + givenName: string; + familyName: string; + email?: string; +} +export interface LerSkill { + name: string; + comments?: string[]; + yearsOfExperience?: number; + endorsers?: Array<{ + person?: { + name?: { + formattedName?: string; + }; + }; + organization?: { + name?: string; + }; + }>; +} +export interface WorkHistoryItem { + narrative?: string; + verifiableCredential?: VerifiableCredential; + position?: string; + employer?: string; + start?: string; + end?: string; + [key: string]: unknown; +} +export interface EducationHistoryItem { + narrative?: string; + verifiableCredential?: VerifiableCredential; + institution?: string; + start?: string; + end?: string; + degree?: string; + specializations?: string[]; + [key: string]: unknown; +} +export interface CertificationItem { + narrative?: string; + verifiableCredential?: VerifiableCredential; + name?: string; + issuingAuthority?: string; + status?: string; + effectiveTimePeriod?: { + start?: string; + end?: string; + }; + [key: string]: unknown; +} +export interface LerRsRecord { + person: { + id: string; + name: { + givenName: string; + familyName: string; + formattedName?: string; + }; + }; + communication?: { + emails?: { + address: string; + }[]; + web?: string[]; + phone?: string[]; + address?: unknown; + social?: string[]; + }; + skills?: LerSkill[]; + narratives?: string[]; + educationAndLearnings?: Array<({ + verifications?: VerifiableCredential[]; + } & Record)>; + employmentHistories?: Array<({ + verifications?: VerifiableCredential[]; + } & Record)>; + licenses?: Array<({ + verifications?: VerifiableCredential[]; + } & Record)>; + certifications?: Array<({ + verifications?: VerifiableCredential[]; + } & Record)>; + positionPreferences?: Record; + attachments?: Array>; +} +export interface CreateLerRecordParams { + learnCard: LearnCard; + person: PersonProfile; + workHistory?: WorkHistoryItem[]; + educationHistory?: EducationHistoryItem[]; + certifications?: CertificationItem[]; + skills?: string[]; +} +export interface CreateLerPresentationParams { + learnCard: LearnCard; + credentials: VerifiableCredential[]; + domain?: string; + challenge?: string; +} +export interface VerifyLerPresentationParams { + presentation: VerifiablePresentation | string; + domain?: string; + challenge?: string; +} +export interface VerificationResult { + verified: boolean; + presentationResult: { + verified: boolean; + errors?: string[]; + }; + credentialResults: { + credential: VerifiableCredential; + verified: boolean; + isSelfIssued: boolean; + errors?: string[]; + }[]; +} +export type LERRSDependentLearnCard = LearnCard; +export type LERRSPluginMethods = { + createLerRecord: (params: CreateLerRecordParams) => Promise; + createLerPresentation: (params: CreateLerPresentationParams) => Promise; + verifyLerPresentation: (params: VerifyLerPresentationParams) => Promise; +}; +export type LERRSPlugin = Plugin<'LER-RS', never, LERRSPluginMethods, 'id', VCPluginMethods & VCPluginDependentMethods>; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/packages/plugins/ler-rs/dist/types.d.ts.map b/packages/plugins/ler-rs/dist/types.d.ts.map new file mode 100644 index 0000000000..2c5a942dbe --- /dev/null +++ b/packages/plugins/ler-rs/dist/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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C1C,YAAY,EAAE,sBAAsB,GAAG,MAAM,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE;QAClB,QAAQ,EAAE,OAAO,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;IACF,iBAAiB,EAAE;QACjB,UAAU,EAAE,oBAAoB,CAAC;QACjC,QAAQ,EAAE,OAAO,CAAC;QAClB,YAAY,EAAE,OAAO,CAAC;QACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,EAAE,CAAC;CACL;AAED,MAAM,MAAM,uBAAuB,GAAG,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,eAAe,GAAG,wBAAwB,CAAC,CAAC;AAEvG,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClF,qBAAqB,EAAE,CAAC,MAAM,EAAE,2BAA2B,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAChG,qBAAqB,EAAE,CAAC,MAAM,EAAE,2BAA2B,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC7F,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,kBAAkB,EAAE,IAAI,EAAE,eAAe,GAAG,wBAAwB,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/plugins/ler-rs/package.json b/packages/plugins/ler-rs/package.json new file mode 100644 index 0000000000..9a6427b4b3 --- /dev/null +++ b/packages/plugins/ler-rs/package.json @@ -0,0 +1,44 @@ +{ + "name": "@learncard/ler-rs-plugin", + "version": "0.1.0", + "description": "LER-RS plugin for LearnCard: create, package, and verify Learning & Employment Record Resumes", + "main": "./dist/index.js", + "module": "./dist/ler-rs-plugin.esm.js", + "files": [ + "dist" + ], + "scripts": { + "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && tsc --p tsconfig.json", + "test": "jest --passWithNoTests", + "test:watch": "jest --watch", + "test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\"" + }, + "author": "Learning Economy Foundation (www.learningeconomy.io)", + "license": "MIT", + "homepage": "https://github.com/WeLibraryOS/LearnCard#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/WeLibraryOS/LearnCard.git" + }, + "bugs": { + "url": "https://github.com/WeLibraryOS/LearnCard/issues" + }, + "devDependencies": { + "@types/jest": "^29.2.2", + "@types/node": "^17.0.31", + "aqu": "0.4.3", + "esbuild": "^0.14.38", + "esbuild-jest": "^0.5.0", + "esbuild-plugin-copy": "^1.3.0", + "jest": "^29.3.0", + "rimraf": "^3.0.2", + "shx": "^0.3.4", + "ts-jest": "^29.0.3" + }, + "types": "./dist/index.d.ts", + "dependencies": { + "@learncard/core": "workspace:*", + "@learncard/types": "workspace:*", + "@learncard/vc-plugin": "workspace:*" + } +} diff --git a/packages/plugins/ler-rs/project.json b/packages/plugins/ler-rs/project.json new file mode 100644 index 0000000000..ca3fdc5acb --- /dev/null +++ b/packages/plugins/ler-rs/project.json @@ -0,0 +1,21 @@ +{ + "$schema": "../../../node_modules/nx/schemas/project-schema.json", + "name": "ler-rs-plugin", + "sourceRoot": "packages/plugins/ler-rs/src", + "projectType": "library", + "root": "packages/plugins/ler-rs", + "tags": [], + "implicitDependencies": ["types", "core", "vc-plugin"], + "namedInputs": { + "scripts": ["{projectRoot}/scripts/**/*"], + "source": ["{projectRoot}/src/**/*"], + "dist": ["{projectRoot}/dist/**/*"] + }, + "targets": { + "build": { + "executor": "nx:run-script", + "inputs": ["source", "scripts"], + "options": { "script": "build" } + } + } +} diff --git a/packages/plugins/ler-rs/scripts/build.mjs b/packages/plugins/ler-rs/scripts/build.mjs new file mode 100644 index 0000000000..606e1790c8 --- /dev/null +++ b/packages/plugins/ler-rs/scripts/build.mjs @@ -0,0 +1,80 @@ +import path from 'path'; + +import esbuild from 'esbuild'; +import rimraf from 'rimraf'; + +const buildOptions = { + // target: 'es6', + target: 'es2020', + sourcemap: true, + external: ['isomorphic-fetch', 'isomorphic-webcrypto'], +}; + +const configurations = [ + { + keepNames: true, + bundle: true, + sourcemap: 'external', + incremental: true, + tsconfig: 'tsconfig.json', + plugins: [], + entryPoints: ['src/index.ts'], + format: 'cjs', + outfile: 'dist/ler-rs-plugin.cjs.development.js', + ...buildOptions, + }, + { + keepNames: true, + bundle: true, + sourcemap: 'external', + incremental: true, + tsconfig: 'tsconfig.json', + plugins: [], + entryPoints: ['src/index.ts'], + minify: true, + format: 'cjs', + outfile: 'dist/ler-rs-plugin.cjs.production.min.js', + ...buildOptions, + }, + { + keepNames: true, + bundle: true, + sourcemap: 'external', + incremental: true, + tsconfig: 'tsconfig.json', + plugins: [], + entryPoints: ['src/index.ts'], + format: 'esm', + outfile: 'dist/ler-rs-plugin.esm.js', + ...buildOptions, + }, +]; + +function asyncRimraf(path) { + return new Promise((resolve, reject) => { + rimraf(path, err => { + if (err) { + reject(err); + } else { + resolve(); + } + }); + }); +} + +await Promise.all( + configurations.map(async config => { + var dir = config.outdir || path.dirname(config.outfile); + await asyncRimraf(dir).catch(() => { + console.log('Unable to delete directory', dir); + }); + }) +); + +await Promise.all(configurations.map(config => esbuild.build(config))).catch(err => { + console.error('❌ Build failed'); + process.exit(1); +}); + +console.log('✔ Build successful'); +process.exit(0); diff --git a/packages/plugins/ler-rs/scripts/mixedEntypoint.js b/packages/plugins/ler-rs/scripts/mixedEntypoint.js new file mode 100644 index 0000000000..3d07537211 --- /dev/null +++ b/packages/plugins/ler-rs/scripts/mixedEntypoint.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./ler-rs-plugin.cjs.production.min.js'); +} else { + module.exports = require('./ler-rs-plugin.cjs.development.js'); +} diff --git a/packages/plugins/ler-rs/src/index.ts b/packages/plugins/ler-rs/src/index.ts new file mode 100644 index 0000000000..e0f90b81b2 --- /dev/null +++ b/packages/plugins/ler-rs/src/index.ts @@ -0,0 +1,2 @@ +export { getLerRsPlugin } from './ler-rs'; +export * from './types'; diff --git a/packages/plugins/ler-rs/src/ler-rs.ts b/packages/plugins/ler-rs/src/ler-rs.ts new file mode 100644 index 0000000000..8ee880654e --- /dev/null +++ b/packages/plugins/ler-rs/src/ler-rs.ts @@ -0,0 +1,177 @@ +import { VC as VerifiableCredential, UnsignedVC, VP as VerifiablePresentation, UnsignedVP } from '@learncard/types'; +import { LERRSDependentLearnCard, LERRSPlugin, CreateLerRecordParams, CreateLerPresentationParams, VerifyLerPresentationParams, VerificationResult, LerRsRecord } from './types'; + +const VC_CONTEXT = 'https://www.w3.org/ns/credentials/v2'; +const LERRS_TYPE = 'LERRS'; + +const toArray = (maybe: T | T[] | undefined): T[] => (maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe]); + +const buildEmploymentHistories = (items: NonNullable): LerRsRecord['employmentHistories'] => { + return items.map(item => { + const { narrative, verifiableCredential, position, employer, start, end, ...rest } = item; + + const container: Record = { ...rest }; + + if (employer) container.organization = { tradeName: employer }; + if (position || start || end) { + const ph: Record = {}; + if (position) ph.title = position; + if (start) ph.start = start; + if (end) ph.end = end; + container.positionHistories = [ph]; + } + if (narrative) container.narrative = narrative; + + const verifications = verifiableCredential ? [verifiableCredential] : []; + return { ...container, ...(verifications.length ? { verifications } : {}) }; + }); +}; + +const buildEducationAndLearnings = (items: NonNullable): LerRsRecord['educationAndLearnings'] => { + return items.map(item => { + const { narrative, verifiableCredential, institution, start, end, degree, specializations, ...rest } = item; + + const container: Record = { ...rest }; + if (institution) container.institution = institution; + if (start) container.start = start; + if (end) container.end = end; + if (degree || specializations) { + container.educationDegrees = [{ ...(degree ? { name: degree } : {}), ...(specializations ? { specializations } : {}) }]; + } + if (narrative) container.narrative = narrative; + + const verifications = verifiableCredential ? [verifiableCredential] : []; + return { ...container, ...(verifications.length ? { verifications } : {}) }; + }); +}; + +const buildCertifications = (items: NonNullable): LerRsRecord['certifications'] => { + return items.map(item => { + const { narrative, verifiableCredential, ...rest } = item; + + const container: Record = { ...rest }; + if (narrative) container.narrative = narrative; + + const verifications = verifiableCredential ? [verifiableCredential] : []; + return { ...container, ...(verifications.length ? { verifications } : {}) }; + }); +}; + +export const getLerRsPlugin = (initLearnCard: LERRSDependentLearnCard): LERRSPlugin => { + return { + name: 'LER-RS', + displayName: 'LER-RS', + description: 'Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials', + methods: { + createLerRecord: async (_learnCard, params): Promise => { + const signer = params.learnCard ?? _learnCard; + const did = signer.id.did(); + + const personSection: LerRsRecord['person'] = { + id: params.person.id, + name: { + givenName: params.person.givenName, + familyName: params.person.familyName, + formattedName: `${params.person.givenName} ${params.person.familyName}`, + }, + }; + + const communication: LerRsRecord['communication'] | undefined = params.person.email + ? { emails: [{ address: params.person.email }] } + : undefined; + + const lerRecord: LerRsRecord = { + person: personSection, + ...(communication ? { communication } : {}), + skills: (params.skills || []).map(s => ({ name: s })), + employmentHistories: params.workHistory ? buildEmploymentHistories(params.workHistory) : undefined, + educationAndLearnings: params.educationHistory ? buildEducationAndLearnings(params.educationHistory) : undefined, + certifications: params.certifications ? buildCertifications(params.certifications) : undefined, + narratives: [], + }; + + const unsignedVC: UnsignedVC = { + '@context': [VC_CONTEXT], + id: `urn:uuid:${crypto.randomUUID()}`, + type: ['VerifiableCredential', LERRS_TYPE], + issuer: did, + validFrom: new Date().toISOString(), + credentialSubject: { + id: params.person.id, + ler: lerRecord, + }, + }; + + return initLearnCard.invoke.issueCredential(unsignedVC, { proofPurpose: 'assertionMethod' }); + }, + + createLerPresentation: async (_learnCard, params): Promise => { + const signer = params.learnCard ?? _learnCard; + const did = signer.id.did(); + + if (!params.credentials.length) throw new Error('createLerPresentation: credentials array must contain at least one credential'); + const containsLer = params.credentials.some(vc => Array.isArray(vc.type) && vc.type.includes(LERRS_TYPE)); + if (!containsLer) throw new Error('createLerPresentation: credentials must include at least one LER-RS credential'); + + const vp: UnsignedVP = { + '@context': [VC_CONTEXT], + type: ['VerifiablePresentation'], + holder: did, + verifiableCredential: params.credentials.length === 1 ? params.credentials[0] : params.credentials, + }; + + return initLearnCard.invoke.issuePresentation(vp, { + ...(params.domain ? { domain: params.domain } : {}), + ...(params.challenge ? { challenge: params.challenge } : {}), + }); + }, + + verifyLerPresentation: async (_learnCard, { presentation, domain, challenge }: VerifyLerPresentationParams): Promise => { + const presCheck = await initLearnCard.invoke.verifyPresentation(presentation, { + ...(domain ? { domain } : {}), + ...(challenge ? { challenge } : {}), + }); + + const presentationResult = { + verified: presCheck.errors.length === 0, + errors: presCheck.errors.length ? presCheck.errors : undefined, + }; + + const credentialResults: VerificationResult['credentialResults'] = []; + + if (typeof presentation !== 'string') { + const holder = presentation.holder; + const vcs = toArray(presentation.verifiableCredential as any); + + for (const credential of vcs) { + try { + const credCheck = await initLearnCard.invoke.verifyCredential(credential); + const issuerDid = typeof credential.issuer === 'string' ? credential.issuer : credential.issuer?.id; + const isSelfIssued = (Array.isArray(credential.type) && credential.type.includes(LERRS_TYPE)) || (!!holder && !!issuerDid && issuerDid === holder); + + credentialResults.push({ + credential, + verified: credCheck.errors.length === 0, + isSelfIssued, + errors: credCheck.errors.length ? credCheck.errors : undefined, + }); + } catch (err) { + credentialResults.push({ + credential, + verified: false, + isSelfIssued: false, + errors: [err instanceof Error ? err.message : 'Unknown error verifying credential'], + }); + } + } + } + + return { + verified: presentationResult.verified && credentialResults.every(r => r.verified || r.isSelfIssued), + presentationResult, + credentialResults, + }; + }, + }, + }; +}; diff --git a/packages/plugins/ler-rs/src/types.ts b/packages/plugins/ler-rs/src/types.ts new file mode 100644 index 0000000000..e0f36f293e --- /dev/null +++ b/packages/plugins/ler-rs/src/types.ts @@ -0,0 +1,124 @@ +import { Plugin, LearnCard } from '@learncard/core'; +import { VC as VerifiableCredential, VP as VerifiablePresentation, UnsignedVC, UnsignedVP, VerificationCheck } from '@learncard/types'; +import type { VCPluginMethods, VCPluginDependentMethods } from '@learncard/vc-plugin'; + +export interface PersonProfile { + id: string; // User's DID + givenName: string; + familyName: string; + email?: string; +} + +// Simple skills structure with optional endorsements +export interface LerSkill { + name: string; + comments?: string[]; + yearsOfExperience?: number; + endorsers?: Array<{ person?: { name?: { formattedName?: string } }; organization?: { name?: string } }>; +} + +// Container item types allow either self-asserted fields and/or embedded VCs via `verifiableCredential` +export interface WorkHistoryItem { + narrative?: string; + verifiableCredential?: VerifiableCredential; + // Common self-asserted fields + position?: string; + employer?: string; + start?: string; + end?: string; + [key: string]: unknown; +} + +export interface EducationHistoryItem { + narrative?: string; + verifiableCredential?: VerifiableCredential; + institution?: string; + start?: string; + end?: string; + degree?: string; + specializations?: string[]; + [key: string]: unknown; +} + +export interface CertificationItem { + narrative?: string; + verifiableCredential?: VerifiableCredential; + name?: string; + issuingAuthority?: string; + status?: string; + effectiveTimePeriod?: { start?: string; end?: string }; + [key: string]: unknown; +} + +// High-level LER-RS record assembled into the VC's credentialSubject +export interface LerRsRecord { + person: { + id: string; + name: { + givenName: string; + familyName: string; + formattedName?: string; + }; + }; + communication?: { + emails?: { address: string }[]; + web?: string[]; + phone?: string[]; + address?: unknown; + social?: string[]; + }; + skills?: LerSkill[]; + narratives?: string[]; + educationAndLearnings?: Array<({ verifications?: VerifiableCredential[] } & Record)>; + employmentHistories?: Array<({ verifications?: VerifiableCredential[] } & Record)>; + licenses?: Array<({ verifications?: VerifiableCredential[] } & Record)>; + certifications?: Array<({ verifications?: VerifiableCredential[] } & Record)>; + positionPreferences?: Record; + attachments?: Array>; +} + +export interface CreateLerRecordParams { + learnCard: LearnCard; + person: PersonProfile; + workHistory?: WorkHistoryItem[]; + educationHistory?: EducationHistoryItem[]; + certifications?: CertificationItem[]; + skills?: string[]; +} + +export interface CreateLerPresentationParams { + learnCard: LearnCard; + credentials: VerifiableCredential[]; + domain?: string; + challenge?: string; +} + +export interface VerifyLerPresentationParams { + presentation: VerifiablePresentation | string; + domain?: string; + challenge?: string; +} + +export interface VerificationResult { + verified: boolean; // Overall status + presentationResult: { + verified: boolean; + errors?: string[]; + }; + credentialResults: { + credential: VerifiableCredential; + verified: boolean; + isSelfIssued: boolean; + errors?: string[]; + }[]; +} + +export type LERRSDependentLearnCard = LearnCard; + +export type LERRSPluginMethods = { + createLerRecord: (params: CreateLerRecordParams) => Promise; + createLerPresentation: (params: CreateLerPresentationParams) => Promise; + verifyLerPresentation: (params: VerifyLerPresentationParams) => Promise; +}; + +export type LERRSPlugin = Plugin<'LER-RS', never, LERRSPluginMethods, 'id', VCPluginMethods & VCPluginDependentMethods>; diff --git a/packages/plugins/ler-rs/tsconfig.json b/packages/plugins/ler-rs/tsconfig.json new file mode 100644 index 0000000000..1e45cfffe5 --- /dev/null +++ b/packages/plugins/ler-rs/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "ESNext", + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "dist", + "strict": true, + "esModuleInterop": true, + "lib": ["dom", "es2021"], + "noLib": false, + "rootDir": "src", + "skipLibCheck": true, + "paths": {}, + "allowSyntheticDefaultImports": true, + "moduleResolution": "bundler" + }, + "include": ["src", "src/test"], + "exclude": ["node_modules", "example"] +} From bcbc758a3f83fcfb4446cb2f8fa263a7f6b50717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacks=C3=B3n=20Smith?= Date: Tue, 12 Aug 2025 18:27:16 -0400 Subject: [PATCH 2/4] Add to LearnCard CLI --- packages/learn-card-cli/package.json | 1 + packages/learn-card-cli/src/index.tsx | 5 +- pnpm-lock.yaml | 80 +++++++++++++++++++++------ 3 files changed, 68 insertions(+), 18 deletions(-) diff --git a/packages/learn-card-cli/package.json b/packages/learn-card-cli/package.json index 09f9d4ea3e..2cc59fe30b 100644 --- a/packages/learn-card-cli/package.json +++ b/packages/learn-card-cli/package.json @@ -15,6 +15,7 @@ "@learncard/didkit-plugin": "workspace:^", "@learncard/init": "workspace:^", "@learncard/learn-cloud-plugin": "workspace:*", + "@learncard/ler-rs-plugin": "workspace:*", "@learncard/simple-signing-plugin": "workspace:*", "@learncard/types": "workspace:*", "@rollup/plugin-json": "^4.1.0", diff --git a/packages/learn-card-cli/src/index.tsx b/packages/learn-card-cli/src/index.tsx index 0e3438b15a..625679bdaf 100644 --- a/packages/learn-card-cli/src/index.tsx +++ b/packages/learn-card-cli/src/index.tsx @@ -11,6 +11,7 @@ import figlet from 'figlet'; import { program } from 'commander'; import clipboard from 'clipboardy'; +import { getLerRsPlugin } from '@learncard/ler-rs-plugin'; import { generateRandomSeed } from './random'; @@ -74,10 +75,12 @@ program ), }); - globalThis.learnCard = await _learnCard.addPlugin( + const simpleSigningLc = await _learnCard.addPlugin( await getSimpleSigningPlugin(_learnCard, 'https://api.learncard.app/trpc') ); + globalThis.learnCard = await simpleSigningLc.addPlugin(getLerRsPlugin(simpleSigningLc)); + globalThis.types = types; globalThis.getTestCache = getTestCache; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3b9a88cdb6..9303131e8d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -52,7 +52,7 @@ importers: version: 2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1) eslint-plugin-import: specifier: ^2.27.5 - version: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + version: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1) eslint-plugin-prettier: specifier: ^4.2.1 version: 4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8) @@ -433,6 +433,9 @@ importers: '@learncard/learn-cloud-plugin': specifier: workspace:* version: link:../plugins/learn-cloud + '@learncard/ler-rs-plugin': + specifier: workspace:* + version: link:../plugins/ler-rs '@learncard/simple-signing-plugin': specifier: workspace:* version: link:../plugins/simple-signing-plugin @@ -1452,6 +1455,49 @@ importers: specifier: ^29.0.3 version: 29.3.0(@babel/core@7.26.10)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.10))(esbuild@0.14.54)(jest@29.7.0(@types/node@17.0.45)(ts-node@10.9.2(@types/node@17.0.45)(typescript@5.6.2)))(typescript@5.6.2) + packages/plugins/ler-rs: + dependencies: + '@learncard/core': + specifier: workspace:* + version: link:../../learn-card-core + '@learncard/types': + specifier: workspace:* + version: link:../../learn-card-types + '@learncard/vc-plugin': + specifier: workspace:* + version: link:../vc + devDependencies: + '@types/jest': + specifier: ^29.2.2 + version: 29.5.14 + '@types/node': + specifier: ^17.0.31 + version: 17.0.45 + aqu: + specifier: 0.4.3 + version: 0.4.3(@babel/core@7.26.10)(@jest/transform@29.7.0)(@jest/types@29.6.3)(@types/node@17.0.45)(babel-jest@29.7.0(@babel/core@7.26.10))(ts-node@10.9.2(@types/node@17.0.45)(typescript@5.6.2)) + esbuild: + specifier: ^0.14.38 + version: 0.14.54 + esbuild-jest: + specifier: ^0.5.0 + version: 0.5.0(esbuild@0.14.54) + esbuild-plugin-copy: + specifier: ^1.3.0 + version: 1.6.0(esbuild@0.14.54) + jest: + specifier: ^29.3.0 + version: 29.7.0(@types/node@17.0.45)(ts-node@10.9.2(@types/node@17.0.45)(typescript@5.6.2)) + rimraf: + specifier: ^3.0.2 + version: 3.0.2 + shx: + specifier: ^0.3.4 + version: 0.3.4 + ts-jest: + specifier: ^29.0.3 + version: 29.3.0(@babel/core@7.26.10)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.26.10))(esbuild@0.14.54)(jest@29.7.0(@types/node@17.0.45)(ts-node@10.9.2(@types/node@17.0.45)(typescript@5.6.2)))(typescript@5.6.2) + packages/plugins/simple-signing-plugin: dependencies: '@learncard/simple-signing-client': @@ -1871,7 +1917,7 @@ importers: version: 2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1) eslint-plugin-import: specifier: ^2.26.0 - version: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + version: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1) eslint-plugin-prettier: specifier: ^4.2.1 version: 4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8) @@ -2463,13 +2509,13 @@ importers: version: 2.6.1 '@metamask/eslint-config': specifier: ^10.0.0 - version: 10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8) + version: 10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8) '@metamask/eslint-config-jest': specifier: ^10.0.0 - version: 10.0.0(@metamask/eslint-config@10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8))(eslint-plugin-jest@26.9.0(@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(jest@29.7.0(@types/node@22.13.14)(ts-node@10.9.2(@types/node@22.13.14)(typescript@5.6.2)))(typescript@5.6.2))(eslint@8.57.1) + version: 10.0.0(@metamask/eslint-config@10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8))(eslint-plugin-jest@26.9.0(@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(jest@29.7.0(@types/node@22.13.14)(ts-node@10.9.2(@types/node@22.13.14)(typescript@5.6.2)))(typescript@5.6.2))(eslint@8.57.1) '@metamask/eslint-config-nodejs': specifier: ^8.0.0 - version: 8.0.0(@metamask/eslint-config@10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8))(eslint-plugin-node@11.1.0(eslint@8.57.1))(eslint@8.57.1) + version: 8.0.0(@metamask/eslint-config@10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8))(eslint-plugin-node@11.1.0(eslint@8.57.1))(eslint@8.57.1) '@metamask/providers': specifier: ^9.1.0 version: 9.1.0 @@ -26501,23 +26547,23 @@ snapshots: '@metamask/detect-provider@1.2.0': {} - '@metamask/eslint-config-jest@10.0.0(@metamask/eslint-config@10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8))(eslint-plugin-jest@26.9.0(@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(jest@29.7.0(@types/node@22.13.14)(ts-node@10.9.2(@types/node@22.13.14)(typescript@5.6.2)))(typescript@5.6.2))(eslint@8.57.1)': + '@metamask/eslint-config-jest@10.0.0(@metamask/eslint-config@10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8))(eslint-plugin-jest@26.9.0(@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(jest@29.7.0(@types/node@22.13.14)(ts-node@10.9.2(@types/node@22.13.14)(typescript@5.6.2)))(typescript@5.6.2))(eslint@8.57.1)': dependencies: - '@metamask/eslint-config': 10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8) + '@metamask/eslint-config': 10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8) eslint: 8.57.1 eslint-plugin-jest: 26.9.0(@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(typescript@5.6.2))(eslint@8.57.1)(jest@29.7.0(@types/node@22.13.14)(ts-node@10.9.2(@types/node@22.13.14)(typescript@5.6.2)))(typescript@5.6.2) - '@metamask/eslint-config-nodejs@8.0.0(@metamask/eslint-config@10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8))(eslint-plugin-node@11.1.0(eslint@8.57.1))(eslint@8.57.1)': + '@metamask/eslint-config-nodejs@8.0.0(@metamask/eslint-config@10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8))(eslint-plugin-node@11.1.0(eslint@8.57.1))(eslint@8.57.1)': dependencies: - '@metamask/eslint-config': 10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8) + '@metamask/eslint-config': 10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8) eslint: 8.57.1 eslint-plugin-node: 11.1.0(eslint@8.57.1) - '@metamask/eslint-config@10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8)': + '@metamask/eslint-config@10.0.0(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1))(eslint-plugin-jsdoc@39.9.1(eslint@8.57.1))(eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8))(eslint@8.57.1)(prettier@2.8.8)': dependencies: eslint: 8.57.1 eslint-config-prettier: 8.10.0(eslint@8.57.1) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1) eslint-plugin-jsdoc: 39.9.1(eslint@8.57.1) eslint-plugin-prettier: 4.2.1(eslint-config-prettier@8.10.0(eslint@8.57.1))(eslint@8.57.1)(prettier@2.8.8) prettier: 2.8.8 @@ -34229,7 +34275,7 @@ snapshots: dependencies: confusing-browser-globals: 1.0.11 eslint: 8.57.1 - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1) object.assign: 4.1.7 object.entries: 1.1.9 semver: 6.3.1 @@ -34240,7 +34286,7 @@ snapshots: '@typescript-eslint/parser': 5.62.0(eslint@8.57.1)(typescript@5.6.2) eslint: 8.57.1 eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.31.0)(eslint@8.57.1) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1) eslint-config-prettier@8.10.0(eslint@8.57.1): dependencies: @@ -34258,7 +34304,7 @@ snapshots: dependencies: debug: 4.4.0(supports-color@8.1.1) eslint: 8.57.1 - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1) glob: 7.2.3 is-glob: 4.0.3 resolve: 1.22.10 @@ -34266,7 +34312,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1): dependencies: debug: 3.2.7(supports-color@5.5.0) optionalDependencies: @@ -34283,7 +34329,7 @@ snapshots: eslint-utils: 2.1.0 regexpp: 3.2.0 - eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -34294,7 +34340,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@2.7.1(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@5.62.0(eslint@8.57.1)(typescript@5.6.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@2.7.1)(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 From 289adcaa3188cd876b03734d20e8a6949b04b63f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacks=C3=B3n=20Smith?= Date: Thu, 14 Aug 2025 13:50:50 -0400 Subject: [PATCH 3/4] Add gitignore --- packages/plugins/ler-rs/.gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 packages/plugins/ler-rs/.gitignore diff --git a/packages/plugins/ler-rs/.gitignore b/packages/plugins/ler-rs/.gitignore new file mode 100644 index 0000000000..bf015247b5 --- /dev/null +++ b/packages/plugins/ler-rs/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +dist/ +tsconfig.tsbuildinfo From 17c6778b7904bfc75d2c11c52fcf7fe6b32a07f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacks=C3=B3n=20Smith?= Date: Thu, 14 Aug 2025 13:51:19 -0400 Subject: [PATCH 4/4] Remove dist --- packages/plugins/ler-rs/dist/index.d.ts | 3 - packages/plugins/ler-rs/dist/index.d.ts.map | 1 - packages/plugins/ler-rs/dist/index.js | 7 - .../dist/ler-rs-plugin.cjs.development.js | 185 ------------------ .../dist/ler-rs-plugin.cjs.development.js.map | 7 - .../dist/ler-rs-plugin.cjs.production.min.js | 2 - .../ler-rs-plugin.cjs.production.min.js.map | 7 - .../plugins/ler-rs/dist/ler-rs-plugin.esm.js | 164 ---------------- .../ler-rs/dist/ler-rs-plugin.esm.js.map | 7 - packages/plugins/ler-rs/dist/ler-rs.d.ts | 3 - packages/plugins/ler-rs/dist/ler-rs.d.ts.map | 1 - packages/plugins/ler-rs/dist/types.d.ts | 130 ------------ packages/plugins/ler-rs/dist/types.d.ts.map | 1 - 13 files changed, 518 deletions(-) delete mode 100644 packages/plugins/ler-rs/dist/index.d.ts delete mode 100644 packages/plugins/ler-rs/dist/index.d.ts.map delete mode 100644 packages/plugins/ler-rs/dist/index.js delete mode 100644 packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js delete mode 100644 packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js.map delete mode 100644 packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js delete mode 100644 packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js.map delete mode 100644 packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js delete mode 100644 packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js.map delete mode 100644 packages/plugins/ler-rs/dist/ler-rs.d.ts delete mode 100644 packages/plugins/ler-rs/dist/ler-rs.d.ts.map delete mode 100644 packages/plugins/ler-rs/dist/types.d.ts delete mode 100644 packages/plugins/ler-rs/dist/types.d.ts.map diff --git a/packages/plugins/ler-rs/dist/index.d.ts b/packages/plugins/ler-rs/dist/index.d.ts deleted file mode 100644 index a584077215..0000000000 --- a/packages/plugins/ler-rs/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { getLerRsPlugin } from './ler-rs'; -export * from './types'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/packages/plugins/ler-rs/dist/index.d.ts.map b/packages/plugins/ler-rs/dist/index.d.ts.map deleted file mode 100644 index 9e99ca9b11..0000000000 --- a/packages/plugins/ler-rs/dist/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/packages/plugins/ler-rs/dist/index.js b/packages/plugins/ler-rs/dist/index.js deleted file mode 100644 index 3d07537211..0000000000 --- a/packages/plugins/ler-rs/dist/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./ler-rs-plugin.cjs.production.min.js'); -} else { - module.exports = require('./ler-rs-plugin.cjs.development.js'); -} diff --git a/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js b/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js deleted file mode 100644 index 24c6771332..0000000000 --- a/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js +++ /dev/null @@ -1,185 +0,0 @@ -"use strict"; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// src/index.ts -var src_exports = {}; -__export(src_exports, { - getLerRsPlugin: () => getLerRsPlugin -}); -module.exports = __toCommonJS(src_exports); - -// src/ler-rs.ts -var VC_CONTEXT = "https://www.w3.org/ns/credentials/v2"; -var LERRS_TYPE = "LERRS"; -var toArray = /* @__PURE__ */ __name((maybe) => maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe], "toArray"); -var buildEmploymentHistories = /* @__PURE__ */ __name((items) => { - return items.map((item) => { - const { narrative, verifiableCredential, position, employer, start, end, ...rest } = item; - const container = { ...rest }; - if (employer) - container.organization = { tradeName: employer }; - if (position || start || end) { - const ph = {}; - if (position) - ph.title = position; - if (start) - ph.start = start; - if (end) - ph.end = end; - container.positionHistories = [ph]; - } - if (narrative) - container.narrative = narrative; - const verifications = verifiableCredential ? [verifiableCredential] : []; - return { ...container, ...verifications.length ? { verifications } : {} }; - }); -}, "buildEmploymentHistories"); -var buildEducationAndLearnings = /* @__PURE__ */ __name((items) => { - return items.map((item) => { - const { narrative, verifiableCredential, institution, start, end, degree, specializations, ...rest } = item; - const container = { ...rest }; - if (institution) - container.institution = institution; - if (start) - container.start = start; - if (end) - container.end = end; - if (degree || specializations) { - container.educationDegrees = [{ ...degree ? { name: degree } : {}, ...specializations ? { specializations } : {} }]; - } - if (narrative) - container.narrative = narrative; - const verifications = verifiableCredential ? [verifiableCredential] : []; - return { ...container, ...verifications.length ? { verifications } : {} }; - }); -}, "buildEducationAndLearnings"); -var buildCertifications = /* @__PURE__ */ __name((items) => { - return items.map((item) => { - const { narrative, verifiableCredential, ...rest } = item; - const container = { ...rest }; - if (narrative) - container.narrative = narrative; - const verifications = verifiableCredential ? [verifiableCredential] : []; - return { ...container, ...verifications.length ? { verifications } : {} }; - }); -}, "buildCertifications"); -var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => { - return { - name: "LER-RS", - displayName: "LER-RS", - description: "Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials", - methods: { - createLerRecord: async (_learnCard, params) => { - const signer = params.learnCard ?? _learnCard; - const did = signer.id.did(); - const personSection = { - id: params.person.id, - name: { - givenName: params.person.givenName, - familyName: params.person.familyName, - formattedName: `${params.person.givenName} ${params.person.familyName}` - } - }; - const communication = params.person.email ? { emails: [{ address: params.person.email }] } : void 0; - const lerRecord = { - person: personSection, - ...communication ? { communication } : {}, - skills: (params.skills || []).map((s) => ({ name: s })), - employmentHistories: params.workHistory ? buildEmploymentHistories(params.workHistory) : void 0, - educationAndLearnings: params.educationHistory ? buildEducationAndLearnings(params.educationHistory) : void 0, - certifications: params.certifications ? buildCertifications(params.certifications) : void 0, - narratives: [] - }; - const unsignedVC = { - "@context": [VC_CONTEXT], - id: `urn:uuid:${crypto.randomUUID()}`, - type: ["VerifiableCredential", LERRS_TYPE], - issuer: did, - validFrom: new Date().toISOString(), - credentialSubject: { - id: params.person.id, - ler: lerRecord - } - }; - return initLearnCard.invoke.issueCredential(unsignedVC, { proofPurpose: "assertionMethod" }); - }, - createLerPresentation: async (_learnCard, params) => { - const signer = params.learnCard ?? _learnCard; - const did = signer.id.did(); - if (!params.credentials.length) - throw new Error("createLerPresentation: credentials array must contain at least one credential"); - const containsLer = params.credentials.some((vc) => Array.isArray(vc.type) && vc.type.includes(LERRS_TYPE)); - if (!containsLer) - throw new Error("createLerPresentation: credentials must include at least one LER-RS credential"); - const vp = { - "@context": [VC_CONTEXT], - type: ["VerifiablePresentation"], - holder: did, - verifiableCredential: params.credentials.length === 1 ? params.credentials[0] : params.credentials - }; - return initLearnCard.invoke.issuePresentation(vp, { - ...params.domain ? { domain: params.domain } : {}, - ...params.challenge ? { challenge: params.challenge } : {} - }); - }, - verifyLerPresentation: async (_learnCard, { presentation, domain, challenge }) => { - const presCheck = await initLearnCard.invoke.verifyPresentation(presentation, { - ...domain ? { domain } : {}, - ...challenge ? { challenge } : {} - }); - const presentationResult = { - verified: presCheck.errors.length === 0, - errors: presCheck.errors.length ? presCheck.errors : void 0 - }; - const credentialResults = []; - if (typeof presentation !== "string") { - const holder = presentation.holder; - const vcs = toArray(presentation.verifiableCredential); - for (const credential of vcs) { - try { - const credCheck = await initLearnCard.invoke.verifyCredential(credential); - const issuerDid = typeof credential.issuer === "string" ? credential.issuer : credential.issuer?.id; - const isSelfIssued = Array.isArray(credential.type) && credential.type.includes(LERRS_TYPE) || !!holder && !!issuerDid && issuerDid === holder; - credentialResults.push({ - credential, - verified: credCheck.errors.length === 0, - isSelfIssued, - errors: credCheck.errors.length ? credCheck.errors : void 0 - }); - } catch (err) { - credentialResults.push({ - credential, - verified: false, - isSelfIssued: false, - errors: [err instanceof Error ? err.message : "Unknown error verifying credential"] - }); - } - } - } - return { - verified: presentationResult.verified && credentialResults.every((r) => r.verified || r.isSelfIssued), - presentationResult, - credentialResults - }; - } - } - }; -}, "getLerRsPlugin"); -//# sourceMappingURL=ler-rs-plugin.cjs.development.js.map diff --git a/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js.map b/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js.map deleted file mode 100644 index 5cd0f4383e..0000000000 --- a/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.development.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../src/index.ts", "../src/ler-rs.ts"], - "sourcesContent": ["export { getLerRsPlugin } from './ler-rs';\nexport * from './types';\n", "import { VC as VerifiableCredential, UnsignedVC, VP as VerifiablePresentation, UnsignedVP } from '@learncard/types';\nimport { LERRSDependentLearnCard, LERRSPlugin, CreateLerRecordParams, CreateLerPresentationParams, VerifyLerPresentationParams, VerificationResult, LerRsRecord } from './types';\n\nconst VC_CONTEXT = 'https://www.w3.org/ns/credentials/v2';\nconst LERRS_TYPE = 'LERRS';\n\nconst toArray = (maybe: T | T[] | undefined): T[] => (maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe]);\n\nconst buildEmploymentHistories = (items: NonNullable): LerRsRecord['employmentHistories'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, position, employer, start, end, ...rest } = item;\n\n const container: Record = { ...rest };\n\n if (employer) container.organization = { tradeName: employer };\n if (position || start || end) {\n const ph: Record = {};\n if (position) ph.title = position;\n if (start) ph.start = start;\n if (end) ph.end = end;\n container.positionHistories = [ph];\n }\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nconst buildEducationAndLearnings = (items: NonNullable): LerRsRecord['educationAndLearnings'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, institution, start, end, degree, specializations, ...rest } = item;\n\n const container: Record = { ...rest };\n if (institution) container.institution = institution;\n if (start) container.start = start;\n if (end) container.end = end;\n if (degree || specializations) {\n container.educationDegrees = [{ ...(degree ? { name: degree } : {}), ...(specializations ? { specializations } : {}) }];\n }\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nconst buildCertifications = (items: NonNullable): LerRsRecord['certifications'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, ...rest } = item;\n\n const container: Record = { ...rest };\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nexport const getLerRsPlugin = (initLearnCard: LERRSDependentLearnCard): LERRSPlugin => {\n return {\n name: 'LER-RS',\n displayName: 'LER-RS',\n description: 'Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials',\n methods: {\n createLerRecord: async (_learnCard, params): Promise => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n const personSection: LerRsRecord['person'] = {\n id: params.person.id,\n name: {\n givenName: params.person.givenName,\n familyName: params.person.familyName,\n formattedName: `${params.person.givenName} ${params.person.familyName}`,\n },\n };\n\n const communication: LerRsRecord['communication'] | undefined = params.person.email\n ? { emails: [{ address: params.person.email }] }\n : undefined;\n\n const lerRecord: LerRsRecord = {\n person: personSection,\n ...(communication ? { communication } : {}),\n skills: (params.skills || []).map(s => ({ name: s })),\n employmentHistories: params.workHistory ? buildEmploymentHistories(params.workHistory) : undefined,\n educationAndLearnings: params.educationHistory ? buildEducationAndLearnings(params.educationHistory) : undefined,\n certifications: params.certifications ? buildCertifications(params.certifications) : undefined,\n narratives: [],\n };\n\n const unsignedVC: UnsignedVC = {\n '@context': [VC_CONTEXT],\n id: `urn:uuid:${crypto.randomUUID()}`,\n type: ['VerifiableCredential', LERRS_TYPE],\n issuer: did,\n validFrom: new Date().toISOString(),\n credentialSubject: {\n id: params.person.id,\n ler: lerRecord,\n },\n };\n\n return initLearnCard.invoke.issueCredential(unsignedVC, { proofPurpose: 'assertionMethod' });\n },\n\n createLerPresentation: async (_learnCard, params): Promise => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n if (!params.credentials.length) throw new Error('createLerPresentation: credentials array must contain at least one credential');\n const containsLer = params.credentials.some(vc => Array.isArray(vc.type) && vc.type.includes(LERRS_TYPE));\n if (!containsLer) throw new Error('createLerPresentation: credentials must include at least one LER-RS credential');\n\n const vp: UnsignedVP = {\n '@context': [VC_CONTEXT],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential: params.credentials.length === 1 ? params.credentials[0] : 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 verifyLerPresentation: async (_learnCard, { presentation, domain, challenge }: VerifyLerPresentationParams): Promise => {\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(presentation.verifiableCredential as any);\n\n for (const credential of vcs) {\n try {\n const credCheck = await initLearnCard.invoke.verifyCredential(credential);\n const issuerDid = typeof credential.issuer === 'string' ? credential.issuer : credential.issuer?.id;\n const isSelfIssued = (Array.isArray(credential.type) && credential.type.includes(LERRS_TYPE)) || (!!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: [err instanceof Error ? err.message : 'Unknown error verifying credential'],\n });\n }\n }\n }\n\n return {\n verified: presentationResult.verified && credentialResults.every(r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AAI,UAAU,oCAAoC;AAAA,cACpF,CAAC;AAAA,YACH;AAAA,UACF;AAAA,QACF;AAEA,eAAO;AAAA,UACL,UAAU,mBAAmB,YAAY,kBAAkB,MAAM,OAAK,EAAE,YAAY,EAAE,YAAY;AAAA,UAClG;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF,GArH8B;", - "names": [] -} diff --git a/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js b/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js deleted file mode 100644 index f9c4b1e68a..0000000000 --- a/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";var R=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var u=(r,n)=>R(r,"name",{value:n,configurable:!0});var p=(r,n)=>{for(var e in n)R(r,e,{get:n[e],enumerable:!0})},V=(r,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of C(n))!h.call(r,i)&&i!==e&&R(r,i,{get:()=>n[i],enumerable:!(a=P(n,i))||a.enumerable});return r};var w=r=>V(R({},"__esModule",{value:!0}),r);var N={};p(N,{getLerRsPlugin:()=>m});module.exports=w(N);var v="https://www.w3.org/ns/credentials/v2",g="LERRS",E=u(r=>r==null?[]:Array.isArray(r)?r:[r],"toArray"),k=u(r=>r.map(n=>{let{narrative:e,verifiableCredential:a,position:i,employer:d,start:o,end:s,...l}=n,f={...l};if(d&&(f.organization={tradeName:d}),i||o||s){let c={};i&&(c.title=i),o&&(c.start=o),s&&(c.end=s),f.positionHistories=[c]}e&&(f.narrative=e);let t=a?[a]:[];return{...f,...t.length?{verifications:t}:{}}}),"buildEmploymentHistories"),S=u(r=>r.map(n=>{let{narrative:e,verifiableCredential:a,institution:i,start:d,end:o,degree:s,specializations:l,...f}=n,t={...f};i&&(t.institution=i),d&&(t.start=d),o&&(t.end=o),(s||l)&&(t.educationDegrees=[{...s?{name:s}:{},...l?{specializations:l}:{}}]),e&&(t.narrative=e);let c=a?[a]:[];return{...t,...c.length?{verifications:c}:{}}}),"buildEducationAndLearnings"),b=u(r=>r.map(n=>{let{narrative:e,verifiableCredential:a,...i}=n,d={...i};e&&(d.narrative=e);let o=a?[a]:[];return{...d,...o.length?{verifications:o}:{}}}),"buildCertifications"),m=u(r=>({name:"LER-RS",displayName:"LER-RS",description:"Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials",methods:{createLerRecord:async(n,e)=>{let i=(e.learnCard??n).id.did(),d={id:e.person.id,name:{givenName:e.person.givenName,familyName:e.person.familyName,formattedName:`${e.person.givenName} ${e.person.familyName}`}},o=e.person.email?{emails:[{address:e.person.email}]}:void 0,s={person:d,...o?{communication:o}:{},skills:(e.skills||[]).map(f=>({name:f})),employmentHistories:e.workHistory?k(e.workHistory):void 0,educationAndLearnings:e.educationHistory?S(e.educationHistory):void 0,certifications:e.certifications?b(e.certifications):void 0,narratives:[]},l={"@context":[v],id:`urn:uuid:${crypto.randomUUID()}`,type:["VerifiableCredential",g],issuer:i,validFrom:new Date().toISOString(),credentialSubject:{id:e.person.id,ler:s}};return r.invoke.issueCredential(l,{proofPurpose:"assertionMethod"})},createLerPresentation:async(n,e)=>{let i=(e.learnCard??n).id.did();if(!e.credentials.length)throw new Error("createLerPresentation: credentials array must contain at least one credential");if(!e.credentials.some(s=>Array.isArray(s.type)&&s.type.includes(g)))throw new Error("createLerPresentation: credentials must include at least one LER-RS credential");let o={"@context":[v],type:["VerifiablePresentation"],holder:i,verifiableCredential:e.credentials.length===1?e.credentials[0]:e.credentials};return r.invoke.issuePresentation(o,{...e.domain?{domain:e.domain}:{},...e.challenge?{challenge:e.challenge}:{}})},verifyLerPresentation:async(n,{presentation:e,domain:a,challenge:i})=>{let d=await r.invoke.verifyPresentation(e,{...a?{domain:a}:{},...i?{challenge:i}:{}}),o={verified:d.errors.length===0,errors:d.errors.length?d.errors:void 0},s=[];if(typeof e!="string"){let l=e.holder,f=E(e.verifiableCredential);for(let t of f)try{let c=await r.invoke.verifyCredential(t),y=typeof t.issuer=="string"?t.issuer:t.issuer?.id,L=Array.isArray(t.type)&&t.type.includes(g)||!!l&&!!y&&y===l;s.push({credential:t,verified:c.errors.length===0,isSelfIssued:L,errors:c.errors.length?c.errors:void 0})}catch(c){s.push({credential:t,verified:!1,isSelfIssued:!1,errors:[c instanceof Error?c.message:"Unknown error verifying credential"]})}}return{verified:o.verified&&s.every(l=>l.verified||l.isSelfIssued),presentationResult:o,credentialResults:s}}}}),"getLerRsPlugin"); -//# sourceMappingURL=ler-rs-plugin.cjs.production.min.js.map diff --git a/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js.map b/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js.map deleted file mode 100644 index bcf06b664d..0000000000 --- a/packages/plugins/ler-rs/dist/ler-rs-plugin.cjs.production.min.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../src/index.ts", "../src/ler-rs.ts"], - "sourcesContent": ["export { getLerRsPlugin } from './ler-rs';\nexport * from './types';\n", "import { VC as VerifiableCredential, UnsignedVC, VP as VerifiablePresentation, UnsignedVP } from '@learncard/types';\nimport { LERRSDependentLearnCard, LERRSPlugin, CreateLerRecordParams, CreateLerPresentationParams, VerifyLerPresentationParams, VerificationResult, LerRsRecord } from './types';\n\nconst VC_CONTEXT = 'https://www.w3.org/ns/credentials/v2';\nconst LERRS_TYPE = 'LERRS';\n\nconst toArray = (maybe: T | T[] | undefined): T[] => (maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe]);\n\nconst buildEmploymentHistories = (items: NonNullable): LerRsRecord['employmentHistories'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, position, employer, start, end, ...rest } = item;\n\n const container: Record = { ...rest };\n\n if (employer) container.organization = { tradeName: employer };\n if (position || start || end) {\n const ph: Record = {};\n if (position) ph.title = position;\n if (start) ph.start = start;\n if (end) ph.end = end;\n container.positionHistories = [ph];\n }\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nconst buildEducationAndLearnings = (items: NonNullable): LerRsRecord['educationAndLearnings'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, institution, start, end, degree, specializations, ...rest } = item;\n\n const container: Record = { ...rest };\n if (institution) container.institution = institution;\n if (start) container.start = start;\n if (end) container.end = end;\n if (degree || specializations) {\n container.educationDegrees = [{ ...(degree ? { name: degree } : {}), ...(specializations ? { specializations } : {}) }];\n }\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nconst buildCertifications = (items: NonNullable): LerRsRecord['certifications'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, ...rest } = item;\n\n const container: Record = { ...rest };\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nexport const getLerRsPlugin = (initLearnCard: LERRSDependentLearnCard): LERRSPlugin => {\n return {\n name: 'LER-RS',\n displayName: 'LER-RS',\n description: 'Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials',\n methods: {\n createLerRecord: async (_learnCard, params): Promise => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n const personSection: LerRsRecord['person'] = {\n id: params.person.id,\n name: {\n givenName: params.person.givenName,\n familyName: params.person.familyName,\n formattedName: `${params.person.givenName} ${params.person.familyName}`,\n },\n };\n\n const communication: LerRsRecord['communication'] | undefined = params.person.email\n ? { emails: [{ address: params.person.email }] }\n : undefined;\n\n const lerRecord: LerRsRecord = {\n person: personSection,\n ...(communication ? { communication } : {}),\n skills: (params.skills || []).map(s => ({ name: s })),\n employmentHistories: params.workHistory ? buildEmploymentHistories(params.workHistory) : undefined,\n educationAndLearnings: params.educationHistory ? buildEducationAndLearnings(params.educationHistory) : undefined,\n certifications: params.certifications ? buildCertifications(params.certifications) : undefined,\n narratives: [],\n };\n\n const unsignedVC: UnsignedVC = {\n '@context': [VC_CONTEXT],\n id: `urn:uuid:${crypto.randomUUID()}`,\n type: ['VerifiableCredential', LERRS_TYPE],\n issuer: did,\n validFrom: new Date().toISOString(),\n credentialSubject: {\n id: params.person.id,\n ler: lerRecord,\n },\n };\n\n return initLearnCard.invoke.issueCredential(unsignedVC, { proofPurpose: 'assertionMethod' });\n },\n\n createLerPresentation: async (_learnCard, params): Promise => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n if (!params.credentials.length) throw new Error('createLerPresentation: credentials array must contain at least one credential');\n const containsLer = params.credentials.some(vc => Array.isArray(vc.type) && vc.type.includes(LERRS_TYPE));\n if (!containsLer) throw new Error('createLerPresentation: credentials must include at least one LER-RS credential');\n\n const vp: UnsignedVP = {\n '@context': [VC_CONTEXT],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential: params.credentials.length === 1 ? params.credentials[0] : 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 verifyLerPresentation: async (_learnCard, { presentation, domain, challenge }: VerifyLerPresentationParams): Promise => {\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(presentation.verifiableCredential as any);\n\n for (const credential of vcs) {\n try {\n const credCheck = await initLearnCard.invoke.verifyCredential(credential);\n const issuerDid = typeof credential.issuer === 'string' ? credential.issuer : credential.issuer?.id;\n const isSelfIssued = (Array.isArray(credential.type) && credential.type.includes(LERRS_TYPE)) || (!!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: [err instanceof Error ? err.message : 'Unknown error verifying credential'],\n });\n }\n }\n }\n\n return {\n verified: presentationResult.verified && credentialResults.every(r => r.verified || r.isSelfIssued),\n presentationResult,\n credentialResults,\n };\n },\n },\n };\n};\n"], - "mappings": "4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,IAAA,eAAAC,EAAAH,GCGA,IAAMI,EAAa,uCACbC,EAAa,QAEbC,EAAUC,EAAIC,GAAqCA,GAAS,KAAO,CAAC,EAAI,MAAM,QAAQA,CAAK,EAAIA,EAAQ,CAACA,CAAK,EAAnG,WAEVC,EAA2BF,EAACG,GACzBA,EAAM,IAAIC,GAAQ,CACvB,GAAM,CAAE,UAAAC,EAAW,qBAAAC,EAAsB,SAAAC,EAAU,SAAAC,EAAU,MAAAC,EAAO,IAAAC,KAAQC,CAAK,EAAIP,EAE/EQ,EAAqC,CAAE,GAAGD,CAAK,EAGrD,GADIH,IAAUI,EAAU,aAAe,CAAE,UAAWJ,CAAS,GACzDD,GAAYE,GAASC,EAAK,CAC5B,IAAMG,EAA8B,CAAC,EACjCN,IAAUM,EAAG,MAAQN,GACrBE,IAAOI,EAAG,MAAQJ,GAClBC,IAAKG,EAAG,IAAMH,GAClBE,EAAU,kBAAoB,CAACC,CAAE,CACnC,CACIR,IAAWO,EAAU,UAAYP,GAErC,IAAMS,EAAgBR,EAAuB,CAACA,CAAoB,EAAI,CAAC,EACvE,MAAO,CAAE,GAAGM,EAAW,GAAIE,EAAc,OAAS,CAAE,cAAAA,CAAc,EAAI,CAAC,CAAG,CAC5E,CAAC,EAlB8B,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AAI,QAAU,oCAAoC,CACpF,CAAC,CACH,CAEJ,CAEA,MAAO,CACL,SAAUR,EAAmB,UAAYC,EAAkB,MAAMQ,GAAKA,EAAE,UAAYA,EAAE,YAAY,EAClG,mBAAAT,EACA,kBAAAC,CACF,CACF,CACF,CACF,GApH4B", - "names": ["src_exports", "__export", "getLerRsPlugin", "__toCommonJS", "VC_CONTEXT", "LERRS_TYPE", "toArray", "__name", "maybe", "buildEmploymentHistories", "items", "item", "narrative", "verifiableCredential", "position", "employer", "start", "end", "rest", "container", "ph", "verifications", "buildEducationAndLearnings", "institution", "degree", "specializations", "buildCertifications", "getLerRsPlugin", "initLearnCard", "_learnCard", "params", "did", "personSection", "communication", "lerRecord", "s", "unsignedVC", "vc", "vp", "presentation", "domain", "challenge", "presCheck", "presentationResult", "credentialResults", "holder", "vcs", "credential", "credCheck", "issuerDid", "isSelfIssued", "err", "r"] -} diff --git a/packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js b/packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js deleted file mode 100644 index 021546380e..0000000000 --- a/packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js +++ /dev/null @@ -1,164 +0,0 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); - -// src/ler-rs.ts -var VC_CONTEXT = "https://www.w3.org/ns/credentials/v2"; -var LERRS_TYPE = "LERRS"; -var toArray = /* @__PURE__ */ __name((maybe) => maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe], "toArray"); -var buildEmploymentHistories = /* @__PURE__ */ __name((items) => { - return items.map((item) => { - const { narrative, verifiableCredential, position, employer, start, end, ...rest } = item; - const container = { ...rest }; - if (employer) - container.organization = { tradeName: employer }; - if (position || start || end) { - const ph = {}; - if (position) - ph.title = position; - if (start) - ph.start = start; - if (end) - ph.end = end; - container.positionHistories = [ph]; - } - if (narrative) - container.narrative = narrative; - const verifications = verifiableCredential ? [verifiableCredential] : []; - return { ...container, ...verifications.length ? { verifications } : {} }; - }); -}, "buildEmploymentHistories"); -var buildEducationAndLearnings = /* @__PURE__ */ __name((items) => { - return items.map((item) => { - const { narrative, verifiableCredential, institution, start, end, degree, specializations, ...rest } = item; - const container = { ...rest }; - if (institution) - container.institution = institution; - if (start) - container.start = start; - if (end) - container.end = end; - if (degree || specializations) { - container.educationDegrees = [{ ...degree ? { name: degree } : {}, ...specializations ? { specializations } : {} }]; - } - if (narrative) - container.narrative = narrative; - const verifications = verifiableCredential ? [verifiableCredential] : []; - return { ...container, ...verifications.length ? { verifications } : {} }; - }); -}, "buildEducationAndLearnings"); -var buildCertifications = /* @__PURE__ */ __name((items) => { - return items.map((item) => { - const { narrative, verifiableCredential, ...rest } = item; - const container = { ...rest }; - if (narrative) - container.narrative = narrative; - const verifications = verifiableCredential ? [verifiableCredential] : []; - return { ...container, ...verifications.length ? { verifications } : {} }; - }); -}, "buildCertifications"); -var getLerRsPlugin = /* @__PURE__ */ __name((initLearnCard) => { - return { - name: "LER-RS", - displayName: "LER-RS", - description: "Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials", - methods: { - createLerRecord: async (_learnCard, params) => { - const signer = params.learnCard ?? _learnCard; - const did = signer.id.did(); - const personSection = { - id: params.person.id, - name: { - givenName: params.person.givenName, - familyName: params.person.familyName, - formattedName: `${params.person.givenName} ${params.person.familyName}` - } - }; - const communication = params.person.email ? { emails: [{ address: params.person.email }] } : void 0; - const lerRecord = { - person: personSection, - ...communication ? { communication } : {}, - skills: (params.skills || []).map((s) => ({ name: s })), - employmentHistories: params.workHistory ? buildEmploymentHistories(params.workHistory) : void 0, - educationAndLearnings: params.educationHistory ? buildEducationAndLearnings(params.educationHistory) : void 0, - certifications: params.certifications ? buildCertifications(params.certifications) : void 0, - narratives: [] - }; - const unsignedVC = { - "@context": [VC_CONTEXT], - id: `urn:uuid:${crypto.randomUUID()}`, - type: ["VerifiableCredential", LERRS_TYPE], - issuer: did, - validFrom: new Date().toISOString(), - credentialSubject: { - id: params.person.id, - ler: lerRecord - } - }; - return initLearnCard.invoke.issueCredential(unsignedVC, { proofPurpose: "assertionMethod" }); - }, - createLerPresentation: async (_learnCard, params) => { - const signer = params.learnCard ?? _learnCard; - const did = signer.id.did(); - if (!params.credentials.length) - throw new Error("createLerPresentation: credentials array must contain at least one credential"); - const containsLer = params.credentials.some((vc) => Array.isArray(vc.type) && vc.type.includes(LERRS_TYPE)); - if (!containsLer) - throw new Error("createLerPresentation: credentials must include at least one LER-RS credential"); - const vp = { - "@context": [VC_CONTEXT], - type: ["VerifiablePresentation"], - holder: did, - verifiableCredential: params.credentials.length === 1 ? params.credentials[0] : params.credentials - }; - return initLearnCard.invoke.issuePresentation(vp, { - ...params.domain ? { domain: params.domain } : {}, - ...params.challenge ? { challenge: params.challenge } : {} - }); - }, - verifyLerPresentation: async (_learnCard, { presentation, domain, challenge }) => { - const presCheck = await initLearnCard.invoke.verifyPresentation(presentation, { - ...domain ? { domain } : {}, - ...challenge ? { challenge } : {} - }); - const presentationResult = { - verified: presCheck.errors.length === 0, - errors: presCheck.errors.length ? presCheck.errors : void 0 - }; - const credentialResults = []; - if (typeof presentation !== "string") { - const holder = presentation.holder; - const vcs = toArray(presentation.verifiableCredential); - for (const credential of vcs) { - try { - const credCheck = await initLearnCard.invoke.verifyCredential(credential); - const issuerDid = typeof credential.issuer === "string" ? credential.issuer : credential.issuer?.id; - const isSelfIssued = Array.isArray(credential.type) && credential.type.includes(LERRS_TYPE) || !!holder && !!issuerDid && issuerDid === holder; - credentialResults.push({ - credential, - verified: credCheck.errors.length === 0, - isSelfIssued, - errors: credCheck.errors.length ? credCheck.errors : void 0 - }); - } catch (err) { - credentialResults.push({ - credential, - verified: false, - isSelfIssued: false, - errors: [err instanceof Error ? err.message : "Unknown error verifying credential"] - }); - } - } - } - return { - verified: presentationResult.verified && credentialResults.every((r) => r.verified || r.isSelfIssued), - presentationResult, - credentialResults - }; - } - } - }; -}, "getLerRsPlugin"); -export { - getLerRsPlugin -}; -//# sourceMappingURL=ler-rs-plugin.esm.js.map diff --git a/packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js.map b/packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js.map deleted file mode 100644 index 2d149ba0d2..0000000000 --- a/packages/plugins/ler-rs/dist/ler-rs-plugin.esm.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../src/ler-rs.ts"], - "sourcesContent": ["import { VC as VerifiableCredential, UnsignedVC, VP as VerifiablePresentation, UnsignedVP } from '@learncard/types';\nimport { LERRSDependentLearnCard, LERRSPlugin, CreateLerRecordParams, CreateLerPresentationParams, VerifyLerPresentationParams, VerificationResult, LerRsRecord } from './types';\n\nconst VC_CONTEXT = 'https://www.w3.org/ns/credentials/v2';\nconst LERRS_TYPE = 'LERRS';\n\nconst toArray = (maybe: T | T[] | undefined): T[] => (maybe == null ? [] : Array.isArray(maybe) ? maybe : [maybe]);\n\nconst buildEmploymentHistories = (items: NonNullable): LerRsRecord['employmentHistories'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, position, employer, start, end, ...rest } = item;\n\n const container: Record = { ...rest };\n\n if (employer) container.organization = { tradeName: employer };\n if (position || start || end) {\n const ph: Record = {};\n if (position) ph.title = position;\n if (start) ph.start = start;\n if (end) ph.end = end;\n container.positionHistories = [ph];\n }\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nconst buildEducationAndLearnings = (items: NonNullable): LerRsRecord['educationAndLearnings'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, institution, start, end, degree, specializations, ...rest } = item;\n\n const container: Record = { ...rest };\n if (institution) container.institution = institution;\n if (start) container.start = start;\n if (end) container.end = end;\n if (degree || specializations) {\n container.educationDegrees = [{ ...(degree ? { name: degree } : {}), ...(specializations ? { specializations } : {}) }];\n }\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nconst buildCertifications = (items: NonNullable): LerRsRecord['certifications'] => {\n return items.map(item => {\n const { narrative, verifiableCredential, ...rest } = item;\n\n const container: Record = { ...rest };\n if (narrative) container.narrative = narrative;\n\n const verifications = verifiableCredential ? [verifiableCredential] : [];\n return { ...container, ...(verifications.length ? { verifications } : {}) };\n });\n};\n\nexport const getLerRsPlugin = (initLearnCard: LERRSDependentLearnCard): LERRSPlugin => {\n return {\n name: 'LER-RS',\n displayName: 'LER-RS',\n description: 'Create, package, and verify Learning & Employment Record Resume (LER-RS) credentials',\n methods: {\n createLerRecord: async (_learnCard, params): Promise => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n const personSection: LerRsRecord['person'] = {\n id: params.person.id,\n name: {\n givenName: params.person.givenName,\n familyName: params.person.familyName,\n formattedName: `${params.person.givenName} ${params.person.familyName}`,\n },\n };\n\n const communication: LerRsRecord['communication'] | undefined = params.person.email\n ? { emails: [{ address: params.person.email }] }\n : undefined;\n\n const lerRecord: LerRsRecord = {\n person: personSection,\n ...(communication ? { communication } : {}),\n skills: (params.skills || []).map(s => ({ name: s })),\n employmentHistories: params.workHistory ? buildEmploymentHistories(params.workHistory) : undefined,\n educationAndLearnings: params.educationHistory ? buildEducationAndLearnings(params.educationHistory) : undefined,\n certifications: params.certifications ? buildCertifications(params.certifications) : undefined,\n narratives: [],\n };\n\n const unsignedVC: UnsignedVC = {\n '@context': [VC_CONTEXT],\n id: `urn:uuid:${crypto.randomUUID()}`,\n type: ['VerifiableCredential', LERRS_TYPE],\n issuer: did,\n validFrom: new Date().toISOString(),\n credentialSubject: {\n id: params.person.id,\n ler: lerRecord,\n },\n };\n\n return initLearnCard.invoke.issueCredential(unsignedVC, { proofPurpose: 'assertionMethod' });\n },\n\n createLerPresentation: async (_learnCard, params): Promise => {\n const signer = params.learnCard ?? _learnCard;\n const did = signer.id.did();\n\n if (!params.credentials.length) throw new Error('createLerPresentation: credentials array must contain at least one credential');\n const containsLer = params.credentials.some(vc => Array.isArray(vc.type) && vc.type.includes(LERRS_TYPE));\n if (!containsLer) throw new Error('createLerPresentation: credentials must include at least one LER-RS credential');\n\n const vp: UnsignedVP = {\n '@context': [VC_CONTEXT],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential: params.credentials.length === 1 ? params.credentials[0] : 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 verifyLerPresentation: async (_learnCard, { presentation, domain, challenge }: VerifyLerPresentationParams): Promise => {\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(presentation.verifiableCredential as any);\n\n for (const credential of vcs) {\n try {\n const credCheck = await initLearnCard.invoke.verifyCredential(credential);\n const issuerDid = typeof credential.issuer === 'string' ? credential.issuer : credential.issuer?.id;\n const isSelfIssued = (Array.isArray(credential.type) && credential.type.includes(LERRS_TYPE)) || (!!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: [err instanceof Error ? err.message : 'Unknown error verifying credential'],\n });\n }\n }\n }\n\n return {\n verified: presentationResult.verified && credentialResults.every(r => r.verified || r.isSelfIssued),\n presentationResult,\n credentialResults,\n };\n },\n },\n };\n};\n"], - "mappings": ";;;;AAGA,IAAM,aAAa;AACnB,IAAM,aAAa;AAEnB,IAAM,UAAU,wBAA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ACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF,GArH8B;", - "names": [] -} diff --git a/packages/plugins/ler-rs/dist/ler-rs.d.ts b/packages/plugins/ler-rs/dist/ler-rs.d.ts deleted file mode 100644 index 14001a5aa9..0000000000 --- a/packages/plugins/ler-rs/dist/ler-rs.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { LERRSDependentLearnCard, LERRSPlugin } from './types'; -export declare const getLerRsPlugin: (initLearnCard: LERRSDependentLearnCard) => LERRSPlugin; -//# sourceMappingURL=ler-rs.d.ts.map \ No newline at end of file diff --git a/packages/plugins/ler-rs/dist/ler-rs.d.ts.map b/packages/plugins/ler-rs/dist/ler-rs.d.ts.map deleted file mode 100644 index 3440204c07..0000000000 --- a/packages/plugins/ler-rs/dist/ler-rs.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ler-rs.d.ts","sourceRoot":"","sources":["../src/ler-rs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAoH,MAAM,SAAS,CAAC;AA0DjL,eAAO,MAAM,cAAc,kBAAmB,uBAAuB,KAAG,WAqHvE,CAAC"} \ No newline at end of file diff --git a/packages/plugins/ler-rs/dist/types.d.ts b/packages/plugins/ler-rs/dist/types.d.ts deleted file mode 100644 index 8f77964e6e..0000000000 --- a/packages/plugins/ler-rs/dist/types.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { Plugin, LearnCard } from '@learncard/core'; -import { VC as VerifiableCredential, VP as VerifiablePresentation } from '@learncard/types'; -import type { VCPluginMethods, VCPluginDependentMethods } from '@learncard/vc-plugin'; -export interface PersonProfile { - id: string; - givenName: string; - familyName: string; - email?: string; -} -export interface LerSkill { - name: string; - comments?: string[]; - yearsOfExperience?: number; - endorsers?: Array<{ - person?: { - name?: { - formattedName?: string; - }; - }; - organization?: { - name?: string; - }; - }>; -} -export interface WorkHistoryItem { - narrative?: string; - verifiableCredential?: VerifiableCredential; - position?: string; - employer?: string; - start?: string; - end?: string; - [key: string]: unknown; -} -export interface EducationHistoryItem { - narrative?: string; - verifiableCredential?: VerifiableCredential; - institution?: string; - start?: string; - end?: string; - degree?: string; - specializations?: string[]; - [key: string]: unknown; -} -export interface CertificationItem { - narrative?: string; - verifiableCredential?: VerifiableCredential; - name?: string; - issuingAuthority?: string; - status?: string; - effectiveTimePeriod?: { - start?: string; - end?: string; - }; - [key: string]: unknown; -} -export interface LerRsRecord { - person: { - id: string; - name: { - givenName: string; - familyName: string; - formattedName?: string; - }; - }; - communication?: { - emails?: { - address: string; - }[]; - web?: string[]; - phone?: string[]; - address?: unknown; - social?: string[]; - }; - skills?: LerSkill[]; - narratives?: string[]; - educationAndLearnings?: Array<({ - verifications?: VerifiableCredential[]; - } & Record)>; - employmentHistories?: Array<({ - verifications?: VerifiableCredential[]; - } & Record)>; - licenses?: Array<({ - verifications?: VerifiableCredential[]; - } & Record)>; - certifications?: Array<({ - verifications?: VerifiableCredential[]; - } & Record)>; - positionPreferences?: Record; - attachments?: Array>; -} -export interface CreateLerRecordParams { - learnCard: LearnCard; - person: PersonProfile; - workHistory?: WorkHistoryItem[]; - educationHistory?: EducationHistoryItem[]; - certifications?: CertificationItem[]; - skills?: string[]; -} -export interface CreateLerPresentationParams { - learnCard: LearnCard; - credentials: VerifiableCredential[]; - domain?: string; - challenge?: string; -} -export interface VerifyLerPresentationParams { - presentation: VerifiablePresentation | string; - domain?: string; - challenge?: string; -} -export interface VerificationResult { - verified: boolean; - presentationResult: { - verified: boolean; - errors?: string[]; - }; - credentialResults: { - credential: VerifiableCredential; - verified: boolean; - isSelfIssued: boolean; - errors?: string[]; - }[]; -} -export type LERRSDependentLearnCard = LearnCard; -export type LERRSPluginMethods = { - createLerRecord: (params: CreateLerRecordParams) => Promise; - createLerPresentation: (params: CreateLerPresentationParams) => Promise; - verifyLerPresentation: (params: VerifyLerPresentationParams) => Promise; -}; -export type LERRSPlugin = Plugin<'LER-RS', never, LERRSPluginMethods, 'id', VCPluginMethods & VCPluginDependentMethods>; -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/packages/plugins/ler-rs/dist/types.d.ts.map b/packages/plugins/ler-rs/dist/types.d.ts.map deleted file mode 100644 index 2c5a942dbe..0000000000 --- a/packages/plugins/ler-rs/dist/types.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,EAAE,IAAI,oBAAoB,EAAE,EAAE,IAAI,sBAAsB,EAA6C,MAAM,kBAAkB,CAAC;AACvI,OAAO,KAAK,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,MAAM,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE;gBAAE,aAAa,CAAC,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,CAAC;QAAC,YAAY,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC,CAAC;CACzG;AAGD,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAE5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,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