@learncard/vc-templates-plugin 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/vc-templates-plugin.cjs.development.js +1 -1
- package/dist/vc-templates-plugin.cjs.development.js.map +1 -1
- package/dist/vc-templates-plugin.cjs.production.min.js +1 -1
- package/dist/vc-templates-plugin.cjs.production.min.js.map +2 -2
- package/dist/vc-templates-plugin.esm.js +1 -1
- package/dist/vc-templates-plugin.esm.js.map +1 -1
- package/package.json +1 -2
@@ -50,7 +50,7 @@ var VC_TEMPLATES = {
|
|
50
50
|
} = {}) => ({
|
51
51
|
"@context": [
|
52
52
|
"https://www.w3.org/2018/credentials/v1",
|
53
|
-
"https://purl.imsglobal.org/spec/ob/v3p0/context.json"
|
53
|
+
"https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.1.json"
|
54
54
|
],
|
55
55
|
id: "http://example.com/credentials/3527",
|
56
56
|
type: ["VerifiableCredential", "OpenBadgeCredential"],
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../src/index.ts", "../src/templates.ts", "../src/vc-templates.ts"],
|
4
|
-
"sourcesContent": ["export { getVCTemplatesPlugin } from './vc-templates';\nexport * from './types';\n", "import { UnsignedVC, UnsignedAchievementCredential } from '@learncard/types';\n\nimport { VcTemplates } from './types';\n\n/** @group VC Templates Plugin */\nexport const VC_TEMPLATES: { [Key in keyof VcTemplates]: (args: VcTemplates[Key]) => UnsignedVC } =\n {\n basic: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}) => ({\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n id: 'http://example.org/credentials/3731',\n type: ['VerifiableCredential'],\n issuer: did,\n issuanceDate,\n credentialSubject: { id: subject },\n }),\n achievement: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n name = 'Teamwork Badge',\n achievementName = 'Teamwork',\n description = 'This badge recognizes the development of the capacity to collaborate within a group environment.',\n criteriaNarrative = 'Team members are nominated for this badge by their peers and recognized upon review by Example Corp management.',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}): UnsignedAchievementCredential => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n ],\n id: 'http://example.com/credentials/3527',\n type: ['VerifiableCredential', 'OpenBadgeCredential'],\n issuer: did,\n issuanceDate,\n name,\n credentialSubject: {\n id: subject,\n type: ['AchievementSubject'],\n achievement: {\n id: 'https://example.com/achievements/21st-century-skills/teamwork',\n type: ['Achievement'],\n criteria: { narrative: criteriaNarrative },\n description,\n name: achievementName,\n },\n },\n }),\n jff2: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}) => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n 'https://w3id.org/security/suites/ed25519-2020/v1',\n ],\n id: 'urn:uuid:a63a60be-f4af-491c-87fc-2c8fd3007a58',\n type: ['VerifiableCredential', 'OpenBadgeCredential'],\n name: 'JFF x vc-edu PlugFest 2 Interoperability',\n issuer: {\n type: ['Profile'],\n id: did,\n name: 'Jobs for the Future (JFF)',\n image: {\n id: 'https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/images/JFF_LogoLockup.png',\n type: 'Image',\n },\n },\n issuanceDate: issuanceDate,\n credentialSubject: {\n type: ['AchievementSubject'],\n id: subject,\n achievement: {\n id: 'urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922',\n type: ['Achievement'],\n name: 'JFF x vc-edu PlugFest 2 Interoperability',\n description:\n 'This credential solution supports the use of OBv3 and w3c Verifiable Credentials and is interoperable with at least two other solutions. This was demonstrated successfully during JFF x vc-edu PlugFest 2.',\n criteria: {\n narrative:\n 'Solutions providers earned this badge by demonstrating interoperability between multiple providers based on the OBv3 candidate final standard, with some additional required fields. Credential issuers earning this badge successfully issued a credential into at least two wallets. Wallet implementers earning this badge successfully displayed credentials issued by at least two different credential issuers.',\n },\n image: {\n id: 'https://w3c-ccg.github.io/vc-ed/plugfest-2-2022/images/JFF-VC-EDU-PLUGFEST2-badge-image.png',\n type: 'Image',\n },\n },\n },\n }),\n boost: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n expirationDate,\n boostName = 'Example Boost',\n boostId = 'urn:uuid:boost:example:555',\n boostImage,\n achievementId = 'urn:uuid:123',\n achievementType = 'Influencer',\n achievementName = 'Awesome Badge',\n achievementDescription = 'Awesome People Earn Awesome Badge',\n achievementNarrative = 'Earned by being awesome.',\n achievementImage = '',\n attachments,\n display,\n } = {}) => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n {\n // id: '@id',\n type: '@type',\n xsd: 'https://www.w3.org/2001/XMLSchema#',\n lcn: 'https://docs.learncard.com/definitions#',\n BoostCredential: {\n '@id': 'lcn:boostCredential',\n '@context': {\n boostId: {\n '@id': 'lcn:boostId',\n '@type': 'xsd:string',\n },\n display: {\n '@id': 'lcn:boostDisplay',\n '@context': {\n backgroundImage: {\n '@id': 'lcn:boostBackgroundImage',\n '@type': 'xsd:string',\n },\n backgroundColor: {\n '@id': 'lcn:boostBackgroundColor',\n '@type': 'xsd:string',\n },\n },\n },\n image: {\n '@id': 'lcn:boostImage',\n '@type': 'xsd:string',\n },\n attachments: {\n '@id': 'lcn:boostAttachments',\n '@container': '@set',\n '@context': {\n type: {\n '@id': 'lcn:boostAttachmentType',\n '@type': 'xsd:string',\n },\n title: {\n '@id': 'lcn:boostAttachmentTitle',\n '@type': 'xsd:string',\n },\n url: {\n '@id': 'lcn:boostAttachmentUrl',\n '@type': 'xsd:string',\n },\n },\n },\n },\n },\n },\n ],\n type: ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'],\n issuer: did,\n issuanceDate,\n name: boostName,\n expirationDate,\n credentialSubject: {\n id: subject,\n type: ['AchievementSubject'],\n achievement: {\n id: achievementId,\n type: ['Achievement'],\n achievementType: achievementType,\n name: achievementName,\n description: achievementDescription,\n image: achievementImage,\n criteria: {\n narrative: achievementNarrative,\n },\n },\n },\n display,\n image: boostImage,\n attachments,\n }),\n };\n", "import { VC_TEMPLATES } from './templates';\n\nimport { VCTemplatePlugin } from './types';\n\n/**\n * @group Plugins\n */\nexport const getVCTemplatesPlugin = (): VCTemplatePlugin => {\n return {\n name: 'VC Templates',\n displayName: 'VC Templates',\n description: 'Allows for the easy creation of VCs and VPs based on predefined templates',\n methods: {\n newCredential: (_learnCard, args = { type: 'basic' }) => {\n const did = args.did || _learnCard.id.did();\n\n if (!did) throw new Error('Could not get issuer did!');\n\n const defaults = {\n did,\n subject: 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate: '2020-08-19T21:41:50Z',\n };\n\n const { type = 'basic', ...functionArgs } = args;\n\n if (!(type in VC_TEMPLATES)) throw new Error('Invalid Test VC Type!');\n\n return VC_TEMPLATES[type]({ ...defaults, ...functionArgs });\n },\n newPresentation: async (_learnCard, credential, args = {}) => {\n const did = args?.did || _learnCard.id.did();\n\n if (!did) throw new Error('Could not get issuer did!');\n\n return {\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential: credential,\n };\n },\n },\n };\n};\n"],
|
4
|
+
"sourcesContent": ["export { getVCTemplatesPlugin } from './vc-templates';\nexport * from './types';\n", "import { UnsignedVC, UnsignedAchievementCredential } from '@learncard/types';\n\nimport { VcTemplates } from './types';\n\n/** @group VC Templates Plugin */\nexport const VC_TEMPLATES: { [Key in keyof VcTemplates]: (args: VcTemplates[Key]) => UnsignedVC } =\n {\n basic: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}) => ({\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n id: 'http://example.org/credentials/3731',\n type: ['VerifiableCredential'],\n issuer: did,\n issuanceDate,\n credentialSubject: { id: subject },\n }),\n achievement: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n name = 'Teamwork Badge',\n achievementName = 'Teamwork',\n description = 'This badge recognizes the development of the capacity to collaborate within a group environment.',\n criteriaNarrative = 'Team members are nominated for this badge by their peers and recognized upon review by Example Corp management.',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}): UnsignedAchievementCredential => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.1.json',\n ],\n id: 'http://example.com/credentials/3527',\n type: ['VerifiableCredential', 'OpenBadgeCredential'],\n issuer: did,\n issuanceDate,\n name,\n credentialSubject: {\n id: subject,\n type: ['AchievementSubject'],\n achievement: {\n id: 'https://example.com/achievements/21st-century-skills/teamwork',\n type: ['Achievement'],\n criteria: { narrative: criteriaNarrative },\n description,\n name: achievementName,\n },\n },\n }),\n jff2: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}) => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n 'https://w3id.org/security/suites/ed25519-2020/v1',\n ],\n id: 'urn:uuid:a63a60be-f4af-491c-87fc-2c8fd3007a58',\n type: ['VerifiableCredential', 'OpenBadgeCredential'],\n name: 'JFF x vc-edu PlugFest 2 Interoperability',\n issuer: {\n type: ['Profile'],\n id: did,\n name: 'Jobs for the Future (JFF)',\n image: {\n id: 'https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/images/JFF_LogoLockup.png',\n type: 'Image',\n },\n },\n issuanceDate: issuanceDate,\n credentialSubject: {\n type: ['AchievementSubject'],\n id: subject,\n achievement: {\n id: 'urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922',\n type: ['Achievement'],\n name: 'JFF x vc-edu PlugFest 2 Interoperability',\n description:\n 'This credential solution supports the use of OBv3 and w3c Verifiable Credentials and is interoperable with at least two other solutions. This was demonstrated successfully during JFF x vc-edu PlugFest 2.',\n criteria: {\n narrative:\n 'Solutions providers earned this badge by demonstrating interoperability between multiple providers based on the OBv3 candidate final standard, with some additional required fields. Credential issuers earning this badge successfully issued a credential into at least two wallets. Wallet implementers earning this badge successfully displayed credentials issued by at least two different credential issuers.',\n },\n image: {\n id: 'https://w3c-ccg.github.io/vc-ed/plugfest-2-2022/images/JFF-VC-EDU-PLUGFEST2-badge-image.png',\n type: 'Image',\n },\n },\n },\n }),\n boost: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n expirationDate,\n boostName = 'Example Boost',\n boostId = 'urn:uuid:boost:example:555',\n boostImage,\n achievementId = 'urn:uuid:123',\n achievementType = 'Influencer',\n achievementName = 'Awesome Badge',\n achievementDescription = 'Awesome People Earn Awesome Badge',\n achievementNarrative = 'Earned by being awesome.',\n achievementImage = '',\n attachments,\n display,\n } = {}) => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n {\n // id: '@id',\n type: '@type',\n xsd: 'https://www.w3.org/2001/XMLSchema#',\n lcn: 'https://docs.learncard.com/definitions#',\n BoostCredential: {\n '@id': 'lcn:boostCredential',\n '@context': {\n boostId: {\n '@id': 'lcn:boostId',\n '@type': 'xsd:string',\n },\n display: {\n '@id': 'lcn:boostDisplay',\n '@context': {\n backgroundImage: {\n '@id': 'lcn:boostBackgroundImage',\n '@type': 'xsd:string',\n },\n backgroundColor: {\n '@id': 'lcn:boostBackgroundColor',\n '@type': 'xsd:string',\n },\n },\n },\n image: {\n '@id': 'lcn:boostImage',\n '@type': 'xsd:string',\n },\n attachments: {\n '@id': 'lcn:boostAttachments',\n '@container': '@set',\n '@context': {\n type: {\n '@id': 'lcn:boostAttachmentType',\n '@type': 'xsd:string',\n },\n title: {\n '@id': 'lcn:boostAttachmentTitle',\n '@type': 'xsd:string',\n },\n url: {\n '@id': 'lcn:boostAttachmentUrl',\n '@type': 'xsd:string',\n },\n },\n },\n },\n },\n },\n ],\n type: ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'],\n issuer: did,\n issuanceDate,\n name: boostName,\n expirationDate,\n credentialSubject: {\n id: subject,\n type: ['AchievementSubject'],\n achievement: {\n id: achievementId,\n type: ['Achievement'],\n achievementType: achievementType,\n name: achievementName,\n description: achievementDescription,\n image: achievementImage,\n criteria: {\n narrative: achievementNarrative,\n },\n },\n },\n display,\n image: boostImage,\n attachments,\n }),\n };\n", "import { VC_TEMPLATES } from './templates';\n\nimport { VCTemplatePlugin } from './types';\n\n/**\n * @group Plugins\n */\nexport const getVCTemplatesPlugin = (): VCTemplatePlugin => {\n return {\n name: 'VC Templates',\n displayName: 'VC Templates',\n description: 'Allows for the easy creation of VCs and VPs based on predefined templates',\n methods: {\n newCredential: (_learnCard, args = { type: 'basic' }) => {\n const did = args.did || _learnCard.id.did();\n\n if (!did) throw new Error('Could not get issuer did!');\n\n const defaults = {\n did,\n subject: 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate: '2020-08-19T21:41:50Z',\n };\n\n const { type = 'basic', ...functionArgs } = args;\n\n if (!(type in VC_TEMPLATES)) throw new Error('Invalid Test VC Type!');\n\n return VC_TEMPLATES[type]({ ...defaults, ...functionArgs });\n },\n newPresentation: async (_learnCard, credential, args = {}) => {\n const did = args?.did || _learnCard.id.did();\n\n if (!did) throw new Error('Could not get issuer did!');\n\n return {\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential: credential,\n };\n },\n },\n };\n};\n"],
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAM,eACT;AAAA,EACI,OAAO,CAAC;AAAA,IACJ,MAAM;AAAA,IACN,UAAU;AAAA,IACV,eAAe;AAAA,EACnB,IAAI,CAAC,OAAO;AAAA,IACR,YAAY,CAAC,wCAAwC;AAAA,IACrD,IAAI;AAAA,IACJ,MAAM,CAAC,sBAAsB;AAAA,IAC7B,QAAQ;AAAA,IACR;AAAA,IACA,mBAAmB,EAAE,IAAI,QAAQ;AAAA,EACrC;AAAA,EACA,aAAa,CAAC;AAAA,IACV,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;AAAA,IACP,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,oBAAoB;AAAA,IACpB,eAAe;AAAA,EACnB,IAAI,CAAC,OAAsC;AAAA,IACvC,YAAY;AAAA,MACR;AAAA,MACA;AAAA,IACJ;AAAA,IACA,IAAI;AAAA,IACJ,MAAM,CAAC,wBAAwB,qBAAqB;AAAA,IACpD,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,MACf,IAAI;AAAA,MACJ,MAAM,CAAC,oBAAoB;AAAA,MAC3B,aAAa;AAAA,QACT,IAAI;AAAA,QACJ,MAAM,CAAC,aAAa;AAAA,QACpB,UAAU,EAAE,WAAW,kBAAkB;AAAA,QACzC;AAAA,QACA,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,EACJ;AAAA,EACA,MAAM,CAAC;AAAA,IACH,MAAM;AAAA,IACN,UAAU;AAAA,IACV,eAAe;AAAA,EACnB,IAAI,CAAC,OAAO;AAAA,IACR,YAAY;AAAA,MACR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,SAAS;AAAA,UACT,cAAc;AAAA,QAClB;AAEA,cAAM,EAAE,OAAO,YAAY,aAAa,IAAI;AAE5C,YAAI,EAAE,QAAQ;AAAe,gBAAM,IAAI,MAAM,uBAAuB;AAEpE,eAAO,aAAa,MAAM,EAAE,GAAG,UAAU,GAAG,aAAa,CAAC;AAAA,MAC9D;AAAA,MACA,iBAAiB,OAAO,YAAY,YAAY,OAAO,CAAC,MAAM;AAC1D,cAAM,MAAM,MAAM,OAAO,WAAW,GAAG,IAAI;AAE3C,YAAI,CAAC;AAAK,gBAAM,IAAI,MAAM,2BAA2B;AAErD,eAAO;AAAA,UACH,YAAY,CAAC,wCAAwC;AAAA,UACrD,MAAM,CAAC,wBAAwB;AAAA,UAC/B,QAAQ;AAAA,UACR,sBAAsB;AAAA,QAC1B;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ,GArCoC;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
"use strict";var s=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var l=(t,e)=>s(t,"name",{value:e,configurable:!0});var C=(t,e)=>{for(var i in e)s(t,i,{get:e[i],enumerable:!0})},T=(t,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of x(e))!v.call(t,d)&&d!==i&&s(t,d,{get:()=>e[d],enumerable:!(a=y(e,d))||a.enumerable});return t};var V=t=>T(s({},"__esModule",{value:!0}),t);var A={};C(A,{getVCTemplatesPlugin:()=>c});module.exports=V(A);var o={basic:({did:t="did:example:d23dd687a7dc6787646f2eb98d0",subject:e="did:example:d23dd687a7dc6787646f2eb98d0",issuanceDate:i="2020-08-19T21:41:50Z"}={})=>({"@context":["https://www.w3.org/2018/credentials/v1"],id:"http://example.org/credentials/3731",type:["VerifiableCredential"],issuer:t,issuanceDate:i,credentialSubject:{id:e}}),achievement:({did:t="did:example:d23dd687a7dc6787646f2eb98d0",subject:e="did:example:d23dd687a7dc6787646f2eb98d0",name:i="Teamwork Badge",achievementName:a="Teamwork",description:d="This badge recognizes the development of the capacity to collaborate within a group environment.",criteriaNarrative:n="Team members are nominated for this badge by their peers and recognized upon review by Example Corp management.",issuanceDate:r="2020-08-19T21:41:50Z"}={})=>({"@context":["https://www.w3.org/2018/credentials/v1","https://purl.imsglobal.org/spec/ob/v3p0/context.json"],id:"http://example.com/credentials/3527",type:["VerifiableCredential","OpenBadgeCredential"],issuer:t,issuanceDate:r,name:i,credentialSubject:{id:e,type:["AchievementSubject"],achievement:{id:"https://example.com/achievements/21st-century-skills/teamwork",type:["Achievement"],criteria:{narrative:n},description:d,name:a}}}),jff2:({did:t="did:example:d23dd687a7dc6787646f2eb98d0",subject:e="did:example:d23dd687a7dc6787646f2eb98d0",issuanceDate:i="2020-08-19T21:41:50Z"}={})=>({"@context":["https://www.w3.org/2018/credentials/v1","https://purl.imsglobal.org/spec/ob/v3p0/context.json","https://w3id.org/security/suites/ed25519-2020/v1"],id:"urn:uuid:a63a60be-f4af-491c-87fc-2c8fd3007a58",type:["VerifiableCredential","OpenBadgeCredential"],name:"JFF x vc-edu PlugFest 2 Interoperability",issuer:{type:["Profile"],id:t,name:"Jobs for the Future (JFF)",image:{id:"https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/images/JFF_LogoLockup.png",type:"Image"}},issuanceDate:i,credentialSubject:{type:["AchievementSubject"],id:e,achievement:{id:"urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922",type:["Achievement"],name:"JFF x vc-edu PlugFest 2 Interoperability",description:"This credential solution supports the use of OBv3 and w3c Verifiable Credentials and is interoperable with at least two other solutions. This was demonstrated successfully during JFF x vc-edu PlugFest 2.",criteria:{narrative:"Solutions providers earned this badge by demonstrating interoperability between multiple providers based on the OBv3 candidate final standard, with some additional required fields. Credential issuers earning this badge successfully issued a credential into at least two wallets. Wallet implementers earning this badge successfully displayed credentials issued by at least two different credential issuers."},image:{id:"https://w3c-ccg.github.io/vc-ed/plugfest-2-2022/images/JFF-VC-EDU-PLUGFEST2-badge-image.png",type:"Image"}}}}),boost:({did:t="did:example:d23dd687a7dc6787646f2eb98d0",subject:e="did:example:d23dd687a7dc6787646f2eb98d0",issuanceDate:i="2020-08-19T21:41:50Z",expirationDate:a,boostName:d="Example Boost",boostId:n="urn:uuid:boost:example:555",boostImage:r,achievementId:p="urn:uuid:123",achievementType:m="Influencer",achievementName:g="Awesome Badge",achievementDescription:u="Awesome People Earn Awesome Badge",achievementNarrative:b="Earned by being awesome.",achievementImage:h="",attachments:f,display:w}={})=>({"@context":["https://www.w3.org/2018/credentials/v1","https://purl.imsglobal.org/spec/ob/v3p0/context.json",{type:"@type",xsd:"https://www.w3.org/2001/XMLSchema#",lcn:"https://docs.learncard.com/definitions#",BoostCredential:{"@id":"lcn:boostCredential","@context":{boostId:{"@id":"lcn:boostId","@type":"xsd:string"},display:{"@id":"lcn:boostDisplay","@context":{backgroundImage:{"@id":"lcn:boostBackgroundImage","@type":"xsd:string"},backgroundColor:{"@id":"lcn:boostBackgroundColor","@type":"xsd:string"}}},image:{"@id":"lcn:boostImage","@type":"xsd:string"},attachments:{"@id":"lcn:boostAttachments","@container":"@set","@context":{type:{"@id":"lcn:boostAttachmentType","@type":"xsd:string"},title:{"@id":"lcn:boostAttachmentTitle","@type":"xsd:string"},url:{"@id":"lcn:boostAttachmentUrl","@type":"xsd:string"}}}}}}],type:["VerifiableCredential","OpenBadgeCredential","BoostCredential"],issuer:t,issuanceDate:i,name:d,expirationDate:a,credentialSubject:{id:e,type:["AchievementSubject"],achievement:{id:p,type:["Achievement"],achievementType:m,name:g,description:u,image:h,criteria:{narrative:b}}},display:w,image:r,attachments:f})};var c=l(()=>({name:"VC Templates",displayName:"VC Templates",description:"Allows for the easy creation of VCs and VPs based on predefined templates",methods:{newCredential:(t,e={type:"basic"})=>{let i=e.did||t.id.did();if(!i)throw new Error("Could not get issuer did!");let a={did:i,subject:"did:example:d23dd687a7dc6787646f2eb98d0",issuanceDate:"2020-08-19T21:41:50Z"},{type:d="basic",...n}=e;if(!(d in o))throw new Error("Invalid Test VC Type!");return o[d]({...a,...n})},newPresentation:async(t,e,i={})=>{let a=i?.did||t.id.did();if(!a)throw new Error("Could not get issuer did!");return{"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],holder:a,verifiableCredential:e}}}}),"getVCTemplatesPlugin");
|
1
|
+
"use strict";var s=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var l=(t,e)=>s(t,"name",{value:e,configurable:!0});var C=(t,e)=>{for(var i in e)s(t,i,{get:e[i],enumerable:!0})},T=(t,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of x(e))!v.call(t,d)&&d!==i&&s(t,d,{get:()=>e[d],enumerable:!(a=y(e,d))||a.enumerable});return t};var V=t=>T(s({},"__esModule",{value:!0}),t);var A={};C(A,{getVCTemplatesPlugin:()=>c});module.exports=V(A);var o={basic:({did:t="did:example:d23dd687a7dc6787646f2eb98d0",subject:e="did:example:d23dd687a7dc6787646f2eb98d0",issuanceDate:i="2020-08-19T21:41:50Z"}={})=>({"@context":["https://www.w3.org/2018/credentials/v1"],id:"http://example.org/credentials/3731",type:["VerifiableCredential"],issuer:t,issuanceDate:i,credentialSubject:{id:e}}),achievement:({did:t="did:example:d23dd687a7dc6787646f2eb98d0",subject:e="did:example:d23dd687a7dc6787646f2eb98d0",name:i="Teamwork Badge",achievementName:a="Teamwork",description:d="This badge recognizes the development of the capacity to collaborate within a group environment.",criteriaNarrative:n="Team members are nominated for this badge by their peers and recognized upon review by Example Corp management.",issuanceDate:r="2020-08-19T21:41:50Z"}={})=>({"@context":["https://www.w3.org/2018/credentials/v1","https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.1.json"],id:"http://example.com/credentials/3527",type:["VerifiableCredential","OpenBadgeCredential"],issuer:t,issuanceDate:r,name:i,credentialSubject:{id:e,type:["AchievementSubject"],achievement:{id:"https://example.com/achievements/21st-century-skills/teamwork",type:["Achievement"],criteria:{narrative:n},description:d,name:a}}}),jff2:({did:t="did:example:d23dd687a7dc6787646f2eb98d0",subject:e="did:example:d23dd687a7dc6787646f2eb98d0",issuanceDate:i="2020-08-19T21:41:50Z"}={})=>({"@context":["https://www.w3.org/2018/credentials/v1","https://purl.imsglobal.org/spec/ob/v3p0/context.json","https://w3id.org/security/suites/ed25519-2020/v1"],id:"urn:uuid:a63a60be-f4af-491c-87fc-2c8fd3007a58",type:["VerifiableCredential","OpenBadgeCredential"],name:"JFF x vc-edu PlugFest 2 Interoperability",issuer:{type:["Profile"],id:t,name:"Jobs for the Future (JFF)",image:{id:"https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/images/JFF_LogoLockup.png",type:"Image"}},issuanceDate:i,credentialSubject:{type:["AchievementSubject"],id:e,achievement:{id:"urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922",type:["Achievement"],name:"JFF x vc-edu PlugFest 2 Interoperability",description:"This credential solution supports the use of OBv3 and w3c Verifiable Credentials and is interoperable with at least two other solutions. This was demonstrated successfully during JFF x vc-edu PlugFest 2.",criteria:{narrative:"Solutions providers earned this badge by demonstrating interoperability between multiple providers based on the OBv3 candidate final standard, with some additional required fields. Credential issuers earning this badge successfully issued a credential into at least two wallets. Wallet implementers earning this badge successfully displayed credentials issued by at least two different credential issuers."},image:{id:"https://w3c-ccg.github.io/vc-ed/plugfest-2-2022/images/JFF-VC-EDU-PLUGFEST2-badge-image.png",type:"Image"}}}}),boost:({did:t="did:example:d23dd687a7dc6787646f2eb98d0",subject:e="did:example:d23dd687a7dc6787646f2eb98d0",issuanceDate:i="2020-08-19T21:41:50Z",expirationDate:a,boostName:d="Example Boost",boostId:n="urn:uuid:boost:example:555",boostImage:r,achievementId:p="urn:uuid:123",achievementType:m="Influencer",achievementName:g="Awesome Badge",achievementDescription:u="Awesome People Earn Awesome Badge",achievementNarrative:b="Earned by being awesome.",achievementImage:h="",attachments:f,display:w}={})=>({"@context":["https://www.w3.org/2018/credentials/v1","https://purl.imsglobal.org/spec/ob/v3p0/context.json",{type:"@type",xsd:"https://www.w3.org/2001/XMLSchema#",lcn:"https://docs.learncard.com/definitions#",BoostCredential:{"@id":"lcn:boostCredential","@context":{boostId:{"@id":"lcn:boostId","@type":"xsd:string"},display:{"@id":"lcn:boostDisplay","@context":{backgroundImage:{"@id":"lcn:boostBackgroundImage","@type":"xsd:string"},backgroundColor:{"@id":"lcn:boostBackgroundColor","@type":"xsd:string"}}},image:{"@id":"lcn:boostImage","@type":"xsd:string"},attachments:{"@id":"lcn:boostAttachments","@container":"@set","@context":{type:{"@id":"lcn:boostAttachmentType","@type":"xsd:string"},title:{"@id":"lcn:boostAttachmentTitle","@type":"xsd:string"},url:{"@id":"lcn:boostAttachmentUrl","@type":"xsd:string"}}}}}}],type:["VerifiableCredential","OpenBadgeCredential","BoostCredential"],issuer:t,issuanceDate:i,name:d,expirationDate:a,credentialSubject:{id:e,type:["AchievementSubject"],achievement:{id:p,type:["Achievement"],achievementType:m,name:g,description:u,image:h,criteria:{narrative:b}}},display:w,image:r,attachments:f})};var c=l(()=>({name:"VC Templates",displayName:"VC Templates",description:"Allows for the easy creation of VCs and VPs based on predefined templates",methods:{newCredential:(t,e={type:"basic"})=>{let i=e.did||t.id.did();if(!i)throw new Error("Could not get issuer did!");let a={did:i,subject:"did:example:d23dd687a7dc6787646f2eb98d0",issuanceDate:"2020-08-19T21:41:50Z"},{type:d="basic",...n}=e;if(!(d in o))throw new Error("Invalid Test VC Type!");return o[d]({...a,...n})},newPresentation:async(t,e,i={})=>{let a=i?.did||t.id.did();if(!a)throw new Error("Could not get issuer did!");return{"@context":["https://www.w3.org/2018/credentials/v1"],type:["VerifiablePresentation"],holder:a,verifiableCredential:e}}}}),"getVCTemplatesPlugin");
|
2
2
|
//# sourceMappingURL=vc-templates-plugin.cjs.production.min.js.map
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../src/index.ts", "../src/templates.ts", "../src/vc-templates.ts"],
|
4
|
-
"sourcesContent": ["export { getVCTemplatesPlugin } from './vc-templates';\nexport * from './types';\n", "import { UnsignedVC, UnsignedAchievementCredential } from '@learncard/types';\n\nimport { VcTemplates } from './types';\n\n/** @group VC Templates Plugin */\nexport const VC_TEMPLATES: { [Key in keyof VcTemplates]: (args: VcTemplates[Key]) => UnsignedVC } =\n {\n basic: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}) => ({\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n id: 'http://example.org/credentials/3731',\n type: ['VerifiableCredential'],\n issuer: did,\n issuanceDate,\n credentialSubject: { id: subject },\n }),\n achievement: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n name = 'Teamwork Badge',\n achievementName = 'Teamwork',\n description = 'This badge recognizes the development of the capacity to collaborate within a group environment.',\n criteriaNarrative = 'Team members are nominated for this badge by their peers and recognized upon review by Example Corp management.',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}): UnsignedAchievementCredential => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n ],\n id: 'http://example.com/credentials/3527',\n type: ['VerifiableCredential', 'OpenBadgeCredential'],\n issuer: did,\n issuanceDate,\n name,\n credentialSubject: {\n id: subject,\n type: ['AchievementSubject'],\n achievement: {\n id: 'https://example.com/achievements/21st-century-skills/teamwork',\n type: ['Achievement'],\n criteria: { narrative: criteriaNarrative },\n description,\n name: achievementName,\n },\n },\n }),\n jff2: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}) => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n 'https://w3id.org/security/suites/ed25519-2020/v1',\n ],\n id: 'urn:uuid:a63a60be-f4af-491c-87fc-2c8fd3007a58',\n type: ['VerifiableCredential', 'OpenBadgeCredential'],\n name: 'JFF x vc-edu PlugFest 2 Interoperability',\n issuer: {\n type: ['Profile'],\n id: did,\n name: 'Jobs for the Future (JFF)',\n image: {\n id: 'https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/images/JFF_LogoLockup.png',\n type: 'Image',\n },\n },\n issuanceDate: issuanceDate,\n credentialSubject: {\n type: ['AchievementSubject'],\n id: subject,\n achievement: {\n id: 'urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922',\n type: ['Achievement'],\n name: 'JFF x vc-edu PlugFest 2 Interoperability',\n description:\n 'This credential solution supports the use of OBv3 and w3c Verifiable Credentials and is interoperable with at least two other solutions. This was demonstrated successfully during JFF x vc-edu PlugFest 2.',\n criteria: {\n narrative:\n 'Solutions providers earned this badge by demonstrating interoperability between multiple providers based on the OBv3 candidate final standard, with some additional required fields. Credential issuers earning this badge successfully issued a credential into at least two wallets. Wallet implementers earning this badge successfully displayed credentials issued by at least two different credential issuers.',\n },\n image: {\n id: 'https://w3c-ccg.github.io/vc-ed/plugfest-2-2022/images/JFF-VC-EDU-PLUGFEST2-badge-image.png',\n type: 'Image',\n },\n },\n },\n }),\n boost: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n expirationDate,\n boostName = 'Example Boost',\n boostId = 'urn:uuid:boost:example:555',\n boostImage,\n achievementId = 'urn:uuid:123',\n achievementType = 'Influencer',\n achievementName = 'Awesome Badge',\n achievementDescription = 'Awesome People Earn Awesome Badge',\n achievementNarrative = 'Earned by being awesome.',\n achievementImage = '',\n attachments,\n display,\n } = {}) => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n {\n // id: '@id',\n type: '@type',\n xsd: 'https://www.w3.org/2001/XMLSchema#',\n lcn: 'https://docs.learncard.com/definitions#',\n BoostCredential: {\n '@id': 'lcn:boostCredential',\n '@context': {\n boostId: {\n '@id': 'lcn:boostId',\n '@type': 'xsd:string',\n },\n display: {\n '@id': 'lcn:boostDisplay',\n '@context': {\n backgroundImage: {\n '@id': 'lcn:boostBackgroundImage',\n '@type': 'xsd:string',\n },\n backgroundColor: {\n '@id': 'lcn:boostBackgroundColor',\n '@type': 'xsd:string',\n },\n },\n },\n image: {\n '@id': 'lcn:boostImage',\n '@type': 'xsd:string',\n },\n attachments: {\n '@id': 'lcn:boostAttachments',\n '@container': '@set',\n '@context': {\n type: {\n '@id': 'lcn:boostAttachmentType',\n '@type': 'xsd:string',\n },\n title: {\n '@id': 'lcn:boostAttachmentTitle',\n '@type': 'xsd:string',\n },\n url: {\n '@id': 'lcn:boostAttachmentUrl',\n '@type': 'xsd:string',\n },\n },\n },\n },\n },\n },\n ],\n type: ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'],\n issuer: did,\n issuanceDate,\n name: boostName,\n expirationDate,\n credentialSubject: {\n id: subject,\n type: ['AchievementSubject'],\n achievement: {\n id: achievementId,\n type: ['Achievement'],\n achievementType: achievementType,\n name: achievementName,\n description: achievementDescription,\n image: achievementImage,\n criteria: {\n narrative: achievementNarrative,\n },\n },\n },\n display,\n image: boostImage,\n attachments,\n }),\n };\n", "import { VC_TEMPLATES } from './templates';\n\nimport { VCTemplatePlugin } from './types';\n\n/**\n * @group Plugins\n */\nexport const getVCTemplatesPlugin = (): VCTemplatePlugin => {\n return {\n name: 'VC Templates',\n displayName: 'VC Templates',\n description: 'Allows for the easy creation of VCs and VPs based on predefined templates',\n methods: {\n newCredential: (_learnCard, args = { type: 'basic' }) => {\n const did = args.did || _learnCard.id.did();\n\n if (!did) throw new Error('Could not get issuer did!');\n\n const defaults = {\n did,\n subject: 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate: '2020-08-19T21:41:50Z',\n };\n\n const { type = 'basic', ...functionArgs } = args;\n\n if (!(type in VC_TEMPLATES)) throw new Error('Invalid Test VC Type!');\n\n return VC_TEMPLATES[type]({ ...defaults, ...functionArgs });\n },\n newPresentation: async (_learnCard, credential, args = {}) => {\n const did = args?.did || _learnCard.id.did();\n\n if (!did) throw new Error('Could not get issuer did!');\n\n return {\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential: credential,\n };\n },\n },\n };\n};\n"],
|
5
|
-
"mappings": "4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GCKO,IAAMI,EACT,CACI,MAAO,CAAC,CACJ,IAAAC,EAAM,0CACN,QAAAC,EAAU,0CACV,aAAAC,EAAe,sBACnB,EAAI,CAAC,KAAO,CACR,WAAY,CAAC,wCAAwC,EACrD,GAAI,sCACJ,KAAM,CAAC,sBAAsB,EAC7B,OAAQF,EACR,aAAAE,EACA,kBAAmB,CAAE,GAAID,CAAQ,CACrC,GACA,YAAa,CAAC,CACV,IAAAD,EAAM,0CACN,QAAAC,EAAU,0CACV,KAAAE,EAAO,iBACP,gBAAAC,EAAkB,WAClB,YAAAC,EAAc,mGACd,kBAAAC,EAAoB,kHACpB,aAAAJ,EAAe,sBACnB,EAAI,CAAC,KAAsC,CACvC,WAAY,CACR,yCACA,
|
4
|
+
"sourcesContent": ["export { getVCTemplatesPlugin } from './vc-templates';\nexport * from './types';\n", "import { UnsignedVC, UnsignedAchievementCredential } from '@learncard/types';\n\nimport { VcTemplates } from './types';\n\n/** @group VC Templates Plugin */\nexport const VC_TEMPLATES: { [Key in keyof VcTemplates]: (args: VcTemplates[Key]) => UnsignedVC } =\n {\n basic: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}) => ({\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n id: 'http://example.org/credentials/3731',\n type: ['VerifiableCredential'],\n issuer: did,\n issuanceDate,\n credentialSubject: { id: subject },\n }),\n achievement: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n name = 'Teamwork Badge',\n achievementName = 'Teamwork',\n description = 'This badge recognizes the development of the capacity to collaborate within a group environment.',\n criteriaNarrative = 'Team members are nominated for this badge by their peers and recognized upon review by Example Corp management.',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}): UnsignedAchievementCredential => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.1.json',\n ],\n id: 'http://example.com/credentials/3527',\n type: ['VerifiableCredential', 'OpenBadgeCredential'],\n issuer: did,\n issuanceDate,\n name,\n credentialSubject: {\n id: subject,\n type: ['AchievementSubject'],\n achievement: {\n id: 'https://example.com/achievements/21st-century-skills/teamwork',\n type: ['Achievement'],\n criteria: { narrative: criteriaNarrative },\n description,\n name: achievementName,\n },\n },\n }),\n jff2: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}) => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n 'https://w3id.org/security/suites/ed25519-2020/v1',\n ],\n id: 'urn:uuid:a63a60be-f4af-491c-87fc-2c8fd3007a58',\n type: ['VerifiableCredential', 'OpenBadgeCredential'],\n name: 'JFF x vc-edu PlugFest 2 Interoperability',\n issuer: {\n type: ['Profile'],\n id: did,\n name: 'Jobs for the Future (JFF)',\n image: {\n id: 'https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/images/JFF_LogoLockup.png',\n type: 'Image',\n },\n },\n issuanceDate: issuanceDate,\n credentialSubject: {\n type: ['AchievementSubject'],\n id: subject,\n achievement: {\n id: 'urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922',\n type: ['Achievement'],\n name: 'JFF x vc-edu PlugFest 2 Interoperability',\n description:\n 'This credential solution supports the use of OBv3 and w3c Verifiable Credentials and is interoperable with at least two other solutions. This was demonstrated successfully during JFF x vc-edu PlugFest 2.',\n criteria: {\n narrative:\n 'Solutions providers earned this badge by demonstrating interoperability between multiple providers based on the OBv3 candidate final standard, with some additional required fields. Credential issuers earning this badge successfully issued a credential into at least two wallets. Wallet implementers earning this badge successfully displayed credentials issued by at least two different credential issuers.',\n },\n image: {\n id: 'https://w3c-ccg.github.io/vc-ed/plugfest-2-2022/images/JFF-VC-EDU-PLUGFEST2-badge-image.png',\n type: 'Image',\n },\n },\n },\n }),\n boost: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n expirationDate,\n boostName = 'Example Boost',\n boostId = 'urn:uuid:boost:example:555',\n boostImage,\n achievementId = 'urn:uuid:123',\n achievementType = 'Influencer',\n achievementName = 'Awesome Badge',\n achievementDescription = 'Awesome People Earn Awesome Badge',\n achievementNarrative = 'Earned by being awesome.',\n achievementImage = '',\n attachments,\n display,\n } = {}) => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n {\n // id: '@id',\n type: '@type',\n xsd: 'https://www.w3.org/2001/XMLSchema#',\n lcn: 'https://docs.learncard.com/definitions#',\n BoostCredential: {\n '@id': 'lcn:boostCredential',\n '@context': {\n boostId: {\n '@id': 'lcn:boostId',\n '@type': 'xsd:string',\n },\n display: {\n '@id': 'lcn:boostDisplay',\n '@context': {\n backgroundImage: {\n '@id': 'lcn:boostBackgroundImage',\n '@type': 'xsd:string',\n },\n backgroundColor: {\n '@id': 'lcn:boostBackgroundColor',\n '@type': 'xsd:string',\n },\n },\n },\n image: {\n '@id': 'lcn:boostImage',\n '@type': 'xsd:string',\n },\n attachments: {\n '@id': 'lcn:boostAttachments',\n '@container': '@set',\n '@context': {\n type: {\n '@id': 'lcn:boostAttachmentType',\n '@type': 'xsd:string',\n },\n title: {\n '@id': 'lcn:boostAttachmentTitle',\n '@type': 'xsd:string',\n },\n url: {\n '@id': 'lcn:boostAttachmentUrl',\n '@type': 'xsd:string',\n },\n },\n },\n },\n },\n },\n ],\n type: ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'],\n issuer: did,\n issuanceDate,\n name: boostName,\n expirationDate,\n credentialSubject: {\n id: subject,\n type: ['AchievementSubject'],\n achievement: {\n id: achievementId,\n type: ['Achievement'],\n achievementType: achievementType,\n name: achievementName,\n description: achievementDescription,\n image: achievementImage,\n criteria: {\n narrative: achievementNarrative,\n },\n },\n },\n display,\n image: boostImage,\n attachments,\n }),\n };\n", "import { VC_TEMPLATES } from './templates';\n\nimport { VCTemplatePlugin } from './types';\n\n/**\n * @group Plugins\n */\nexport const getVCTemplatesPlugin = (): VCTemplatePlugin => {\n return {\n name: 'VC Templates',\n displayName: 'VC Templates',\n description: 'Allows for the easy creation of VCs and VPs based on predefined templates',\n methods: {\n newCredential: (_learnCard, args = { type: 'basic' }) => {\n const did = args.did || _learnCard.id.did();\n\n if (!did) throw new Error('Could not get issuer did!');\n\n const defaults = {\n did,\n subject: 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate: '2020-08-19T21:41:50Z',\n };\n\n const { type = 'basic', ...functionArgs } = args;\n\n if (!(type in VC_TEMPLATES)) throw new Error('Invalid Test VC Type!');\n\n return VC_TEMPLATES[type]({ ...defaults, ...functionArgs });\n },\n newPresentation: async (_learnCard, credential, args = {}) => {\n const did = args?.did || _learnCard.id.did();\n\n if (!did) throw new Error('Could not get issuer did!');\n\n return {\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential: credential,\n };\n },\n },\n };\n};\n"],
|
5
|
+
"mappings": "4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,0BAAAE,IAAA,eAAAC,EAAAH,GCKO,IAAMI,EACT,CACI,MAAO,CAAC,CACJ,IAAAC,EAAM,0CACN,QAAAC,EAAU,0CACV,aAAAC,EAAe,sBACnB,EAAI,CAAC,KAAO,CACR,WAAY,CAAC,wCAAwC,EACrD,GAAI,sCACJ,KAAM,CAAC,sBAAsB,EAC7B,OAAQF,EACR,aAAAE,EACA,kBAAmB,CAAE,GAAID,CAAQ,CACrC,GACA,YAAa,CAAC,CACV,IAAAD,EAAM,0CACN,QAAAC,EAAU,0CACV,KAAAE,EAAO,iBACP,gBAAAC,EAAkB,WAClB,YAAAC,EAAc,mGACd,kBAAAC,EAAoB,kHACpB,aAAAJ,EAAe,sBACnB,EAAI,CAAC,KAAsC,CACvC,WAAY,CACR,yCACA,4DACJ,EACA,GAAI,sCACJ,KAAM,CAAC,uBAAwB,qBAAqB,EACpD,OAAQF,EACR,aAAAE,EACA,KAAAC,EACA,kBAAmB,CACf,GAAIF,EACJ,KAAM,CAAC,oBAAoB,EAC3B,YAAa,CACT,GAAI,gEACJ,KAAM,CAAC,aAAa,EACpB,SAAU,CAAE,UAAWK,CAAkB,EACzC,YAAAD,EACA,KAAMD,CACV,CACJ,CACJ,GACA,KAAM,CAAC,CACH,IAAAJ,EAAM,0CACN,QAAAC,EAAU,0CACV,aAAAC,EAAe,sBACnB,EAAI,CAAC,KAAO,CACR,WAAY,CACR,yCACA,uDACA,kDACJ,EACA,GAAI,gDACJ,KAAM,CAAC,uBAAwB,qBAAqB,EACpD,KAAM,2CACN,OAAQ,CACJ,KAAM,CAAC,SAAS,EAChB,GAAIF,EACJ,KAAM,4BACN,MAAO,CACH,GAAI,4EACJ,KAAM,OACV,CACJ,EACA,a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B,gBAAiBC,EACjB,KAAMR,EACN,YAAaS,EACb,MAAOE,EACP,SAAU,CACN,UAAWD,CACf,CACJ,CACJ,EACA,QAAAG,EACA,MAAOP,EACP,YAAAM,CACJ,EACJ,ECpLG,IAAME,EAAuBC,EAAA,KACzB,CACH,KAAM,eACN,YAAa,eACb,YAAa,4EACb,QAAS,CACL,cAAe,CAACC,EAAYC,EAAO,CAAE,KAAM,OAAQ,IAAM,CACrD,IAAMC,EAAMD,EAAK,KAAOD,EAAW,GAAG,IAAI,EAE1C,GAAI,CAACE,EAAK,MAAM,IAAI,MAAM,2BAA2B,EAErD,IAAMC,EAAW,CACb,IAAAD,EACA,QAAS,0CACT,aAAc,sBAClB,EAEM,CAAE,KAAAE,EAAO,WAAYC,CAAa,EAAIJ,EAE5C,GAAI,EAAEG,KAAQE,GAAe,MAAM,IAAI,MAAM,uBAAuB,EAEpE,OAAOA,EAAaF,GAAM,CAAE,GAAGD,EAAU,GAAGE,CAAa,CAAC,CAC9D,EACA,gBAAiB,MAAOL,EAAYO,EAAYN,EAAO,CAAC,IAAM,CAC1D,IAAMC,EAAMD,GAAM,KAAOD,EAAW,GAAG,IAAI,EAE3C,GAAI,CAACE,EAAK,MAAM,IAAI,MAAM,2BAA2B,EAErD,MAAO,CACH,WAAY,CAAC,wCAAwC,EACrD,KAAM,CAAC,wBAAwB,EAC/B,OAAQA,EACR,qBAAsBK,CAC1B,CACJ,CACJ,CACJ,GApCgC",
|
6
6
|
"names": ["src_exports", "__export", "getVCTemplatesPlugin", "__toCommonJS", "VC_TEMPLATES", "did", "subject", "issuanceDate", "name", "achievementName", "description", "criteriaNarrative", "expirationDate", "boostName", "boostId", "boostImage", "achievementId", "achievementType", "achievementDescription", "achievementNarrative", "achievementImage", "attachments", "display", "getVCTemplatesPlugin", "__name", "_learnCard", "args", "did", "defaults", "type", "functionArgs", "VC_TEMPLATES", "credential"]
|
7
7
|
}
|
@@ -26,7 +26,7 @@ var VC_TEMPLATES = {
|
|
26
26
|
} = {}) => ({
|
27
27
|
"@context": [
|
28
28
|
"https://www.w3.org/2018/credentials/v1",
|
29
|
-
"https://purl.imsglobal.org/spec/ob/v3p0/context.json"
|
29
|
+
"https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.1.json"
|
30
30
|
],
|
31
31
|
id: "http://example.com/credentials/3527",
|
32
32
|
type: ["VerifiableCredential", "OpenBadgeCredential"],
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../src/templates.ts", "../src/vc-templates.ts"],
|
4
|
-
"sourcesContent": ["import { UnsignedVC, UnsignedAchievementCredential } from '@learncard/types';\n\nimport { VcTemplates } from './types';\n\n/** @group VC Templates Plugin */\nexport const VC_TEMPLATES: { [Key in keyof VcTemplates]: (args: VcTemplates[Key]) => UnsignedVC } =\n {\n basic: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}) => ({\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n id: 'http://example.org/credentials/3731',\n type: ['VerifiableCredential'],\n issuer: did,\n issuanceDate,\n credentialSubject: { id: subject },\n }),\n achievement: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n name = 'Teamwork Badge',\n achievementName = 'Teamwork',\n description = 'This badge recognizes the development of the capacity to collaborate within a group environment.',\n criteriaNarrative = 'Team members are nominated for this badge by their peers and recognized upon review by Example Corp management.',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}): UnsignedAchievementCredential => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n ],\n id: 'http://example.com/credentials/3527',\n type: ['VerifiableCredential', 'OpenBadgeCredential'],\n issuer: did,\n issuanceDate,\n name,\n credentialSubject: {\n id: subject,\n type: ['AchievementSubject'],\n achievement: {\n id: 'https://example.com/achievements/21st-century-skills/teamwork',\n type: ['Achievement'],\n criteria: { narrative: criteriaNarrative },\n description,\n name: achievementName,\n },\n },\n }),\n jff2: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}) => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n 'https://w3id.org/security/suites/ed25519-2020/v1',\n ],\n id: 'urn:uuid:a63a60be-f4af-491c-87fc-2c8fd3007a58',\n type: ['VerifiableCredential', 'OpenBadgeCredential'],\n name: 'JFF x vc-edu PlugFest 2 Interoperability',\n issuer: {\n type: ['Profile'],\n id: did,\n name: 'Jobs for the Future (JFF)',\n image: {\n id: 'https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/images/JFF_LogoLockup.png',\n type: 'Image',\n },\n },\n issuanceDate: issuanceDate,\n credentialSubject: {\n type: ['AchievementSubject'],\n id: subject,\n achievement: {\n id: 'urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922',\n type: ['Achievement'],\n name: 'JFF x vc-edu PlugFest 2 Interoperability',\n description:\n 'This credential solution supports the use of OBv3 and w3c Verifiable Credentials and is interoperable with at least two other solutions. This was demonstrated successfully during JFF x vc-edu PlugFest 2.',\n criteria: {\n narrative:\n 'Solutions providers earned this badge by demonstrating interoperability between multiple providers based on the OBv3 candidate final standard, with some additional required fields. Credential issuers earning this badge successfully issued a credential into at least two wallets. Wallet implementers earning this badge successfully displayed credentials issued by at least two different credential issuers.',\n },\n image: {\n id: 'https://w3c-ccg.github.io/vc-ed/plugfest-2-2022/images/JFF-VC-EDU-PLUGFEST2-badge-image.png',\n type: 'Image',\n },\n },\n },\n }),\n boost: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n expirationDate,\n boostName = 'Example Boost',\n boostId = 'urn:uuid:boost:example:555',\n boostImage,\n achievementId = 'urn:uuid:123',\n achievementType = 'Influencer',\n achievementName = 'Awesome Badge',\n achievementDescription = 'Awesome People Earn Awesome Badge',\n achievementNarrative = 'Earned by being awesome.',\n achievementImage = '',\n attachments,\n display,\n } = {}) => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n {\n // id: '@id',\n type: '@type',\n xsd: 'https://www.w3.org/2001/XMLSchema#',\n lcn: 'https://docs.learncard.com/definitions#',\n BoostCredential: {\n '@id': 'lcn:boostCredential',\n '@context': {\n boostId: {\n '@id': 'lcn:boostId',\n '@type': 'xsd:string',\n },\n display: {\n '@id': 'lcn:boostDisplay',\n '@context': {\n backgroundImage: {\n '@id': 'lcn:boostBackgroundImage',\n '@type': 'xsd:string',\n },\n backgroundColor: {\n '@id': 'lcn:boostBackgroundColor',\n '@type': 'xsd:string',\n },\n },\n },\n image: {\n '@id': 'lcn:boostImage',\n '@type': 'xsd:string',\n },\n attachments: {\n '@id': 'lcn:boostAttachments',\n '@container': '@set',\n '@context': {\n type: {\n '@id': 'lcn:boostAttachmentType',\n '@type': 'xsd:string',\n },\n title: {\n '@id': 'lcn:boostAttachmentTitle',\n '@type': 'xsd:string',\n },\n url: {\n '@id': 'lcn:boostAttachmentUrl',\n '@type': 'xsd:string',\n },\n },\n },\n },\n },\n },\n ],\n type: ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'],\n issuer: did,\n issuanceDate,\n name: boostName,\n expirationDate,\n credentialSubject: {\n id: subject,\n type: ['AchievementSubject'],\n achievement: {\n id: achievementId,\n type: ['Achievement'],\n achievementType: achievementType,\n name: achievementName,\n description: achievementDescription,\n image: achievementImage,\n criteria: {\n narrative: achievementNarrative,\n },\n },\n },\n display,\n image: boostImage,\n attachments,\n }),\n };\n", "import { VC_TEMPLATES } from './templates';\n\nimport { VCTemplatePlugin } from './types';\n\n/**\n * @group Plugins\n */\nexport const getVCTemplatesPlugin = (): VCTemplatePlugin => {\n return {\n name: 'VC Templates',\n displayName: 'VC Templates',\n description: 'Allows for the easy creation of VCs and VPs based on predefined templates',\n methods: {\n newCredential: (_learnCard, args = { type: 'basic' }) => {\n const did = args.did || _learnCard.id.did();\n\n if (!did) throw new Error('Could not get issuer did!');\n\n const defaults = {\n did,\n subject: 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate: '2020-08-19T21:41:50Z',\n };\n\n const { type = 'basic', ...functionArgs } = args;\n\n if (!(type in VC_TEMPLATES)) throw new Error('Invalid Test VC Type!');\n\n return VC_TEMPLATES[type]({ ...defaults, ...functionArgs });\n },\n newPresentation: async (_learnCard, credential, args = {}) => {\n const did = args?.did || _learnCard.id.did();\n\n if (!did) throw new Error('Could not get issuer did!');\n\n return {\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential: credential,\n };\n },\n },\n };\n};\n"],
|
4
|
+
"sourcesContent": ["import { UnsignedVC, UnsignedAchievementCredential } from '@learncard/types';\n\nimport { VcTemplates } from './types';\n\n/** @group VC Templates Plugin */\nexport const VC_TEMPLATES: { [Key in keyof VcTemplates]: (args: VcTemplates[Key]) => UnsignedVC } =\n {\n basic: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}) => ({\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n id: 'http://example.org/credentials/3731',\n type: ['VerifiableCredential'],\n issuer: did,\n issuanceDate,\n credentialSubject: { id: subject },\n }),\n achievement: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n name = 'Teamwork Badge',\n achievementName = 'Teamwork',\n description = 'This badge recognizes the development of the capacity to collaborate within a group environment.',\n criteriaNarrative = 'Team members are nominated for this badge by their peers and recognized upon review by Example Corp management.',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}): UnsignedAchievementCredential => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.1.json',\n ],\n id: 'http://example.com/credentials/3527',\n type: ['VerifiableCredential', 'OpenBadgeCredential'],\n issuer: did,\n issuanceDate,\n name,\n credentialSubject: {\n id: subject,\n type: ['AchievementSubject'],\n achievement: {\n id: 'https://example.com/achievements/21st-century-skills/teamwork',\n type: ['Achievement'],\n criteria: { narrative: criteriaNarrative },\n description,\n name: achievementName,\n },\n },\n }),\n jff2: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n } = {}) => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n 'https://w3id.org/security/suites/ed25519-2020/v1',\n ],\n id: 'urn:uuid:a63a60be-f4af-491c-87fc-2c8fd3007a58',\n type: ['VerifiableCredential', 'OpenBadgeCredential'],\n name: 'JFF x vc-edu PlugFest 2 Interoperability',\n issuer: {\n type: ['Profile'],\n id: did,\n name: 'Jobs for the Future (JFF)',\n image: {\n id: 'https://w3c-ccg.github.io/vc-ed/plugfest-1-2022/images/JFF_LogoLockup.png',\n type: 'Image',\n },\n },\n issuanceDate: issuanceDate,\n credentialSubject: {\n type: ['AchievementSubject'],\n id: subject,\n achievement: {\n id: 'urn:uuid:bd6d9316-f7ae-4073-a1e5-2f7f5bd22922',\n type: ['Achievement'],\n name: 'JFF x vc-edu PlugFest 2 Interoperability',\n description:\n 'This credential solution supports the use of OBv3 and w3c Verifiable Credentials and is interoperable with at least two other solutions. This was demonstrated successfully during JFF x vc-edu PlugFest 2.',\n criteria: {\n narrative:\n 'Solutions providers earned this badge by demonstrating interoperability between multiple providers based on the OBv3 candidate final standard, with some additional required fields. Credential issuers earning this badge successfully issued a credential into at least two wallets. Wallet implementers earning this badge successfully displayed credentials issued by at least two different credential issuers.',\n },\n image: {\n id: 'https://w3c-ccg.github.io/vc-ed/plugfest-2-2022/images/JFF-VC-EDU-PLUGFEST2-badge-image.png',\n type: 'Image',\n },\n },\n },\n }),\n boost: ({\n did = 'did:example:d23dd687a7dc6787646f2eb98d0',\n subject = 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate = '2020-08-19T21:41:50Z',\n expirationDate,\n boostName = 'Example Boost',\n boostId = 'urn:uuid:boost:example:555',\n boostImage,\n achievementId = 'urn:uuid:123',\n achievementType = 'Influencer',\n achievementName = 'Awesome Badge',\n achievementDescription = 'Awesome People Earn Awesome Badge',\n achievementNarrative = 'Earned by being awesome.',\n achievementImage = '',\n attachments,\n display,\n } = {}) => ({\n '@context': [\n 'https://www.w3.org/2018/credentials/v1',\n 'https://purl.imsglobal.org/spec/ob/v3p0/context.json',\n {\n // id: '@id',\n type: '@type',\n xsd: 'https://www.w3.org/2001/XMLSchema#',\n lcn: 'https://docs.learncard.com/definitions#',\n BoostCredential: {\n '@id': 'lcn:boostCredential',\n '@context': {\n boostId: {\n '@id': 'lcn:boostId',\n '@type': 'xsd:string',\n },\n display: {\n '@id': 'lcn:boostDisplay',\n '@context': {\n backgroundImage: {\n '@id': 'lcn:boostBackgroundImage',\n '@type': 'xsd:string',\n },\n backgroundColor: {\n '@id': 'lcn:boostBackgroundColor',\n '@type': 'xsd:string',\n },\n },\n },\n image: {\n '@id': 'lcn:boostImage',\n '@type': 'xsd:string',\n },\n attachments: {\n '@id': 'lcn:boostAttachments',\n '@container': '@set',\n '@context': {\n type: {\n '@id': 'lcn:boostAttachmentType',\n '@type': 'xsd:string',\n },\n title: {\n '@id': 'lcn:boostAttachmentTitle',\n '@type': 'xsd:string',\n },\n url: {\n '@id': 'lcn:boostAttachmentUrl',\n '@type': 'xsd:string',\n },\n },\n },\n },\n },\n },\n ],\n type: ['VerifiableCredential', 'OpenBadgeCredential', 'BoostCredential'],\n issuer: did,\n issuanceDate,\n name: boostName,\n expirationDate,\n credentialSubject: {\n id: subject,\n type: ['AchievementSubject'],\n achievement: {\n id: achievementId,\n type: ['Achievement'],\n achievementType: achievementType,\n name: achievementName,\n description: achievementDescription,\n image: achievementImage,\n criteria: {\n narrative: achievementNarrative,\n },\n },\n },\n display,\n image: boostImage,\n attachments,\n }),\n };\n", "import { VC_TEMPLATES } from './templates';\n\nimport { VCTemplatePlugin } from './types';\n\n/**\n * @group Plugins\n */\nexport const getVCTemplatesPlugin = (): VCTemplatePlugin => {\n return {\n name: 'VC Templates',\n displayName: 'VC Templates',\n description: 'Allows for the easy creation of VCs and VPs based on predefined templates',\n methods: {\n newCredential: (_learnCard, args = { type: 'basic' }) => {\n const did = args.did || _learnCard.id.did();\n\n if (!did) throw new Error('Could not get issuer did!');\n\n const defaults = {\n did,\n subject: 'did:example:d23dd687a7dc6787646f2eb98d0',\n issuanceDate: '2020-08-19T21:41:50Z',\n };\n\n const { type = 'basic', ...functionArgs } = args;\n\n if (!(type in VC_TEMPLATES)) throw new Error('Invalid Test VC Type!');\n\n return VC_TEMPLATES[type]({ ...defaults, ...functionArgs });\n },\n newPresentation: async (_learnCard, credential, args = {}) => {\n const did = args?.did || _learnCard.id.did();\n\n if (!did) throw new Error('Could not get issuer did!');\n\n return {\n '@context': ['https://www.w3.org/2018/credentials/v1'],\n type: ['VerifiablePresentation'],\n holder: did,\n verifiableCredential: credential,\n };\n },\n },\n };\n};\n"],
|
5
5
|
"mappings": ";;;;AAKO,IAAM,eACT;AAAA,EACI,OAAO,CAAC;AAAA,IACJ,MAAM;AAAA,IACN,UAAU;AAAA,IACV,eAAe;AAAA,EACnB,IAAI,CAAC,OAAO;AAAA,IACR,YAAY,CAAC,wCAAwC;AAAA,IACrD,IAAI;AAAA,IACJ,MAAM,CAAC,sBAAsB;AAAA,IAC7B,QAAQ;AAAA,IACR;AAA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