@learncard/open-badge-v2-plugin 1.1.21 → 1.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.js → index.cjs} +2 -2
- package/dist/index.d.cts +3 -0
- package/dist/{open-badge-v2-plugin.cjs.development.js → open-badge-v2-plugin.cjs.development.cjs} +1 -1
- package/dist/{open-badge-v2-plugin.cjs.production.min.js → open-badge-v2-plugin.cjs.production.min.cjs} +1 -1
- package/package.json +20 -7
- /package/dist/{open-badge-v2-plugin.cjs.development.js.map → open-badge-v2-plugin.cjs.development.cjs.map} +0 -0
- /package/dist/{open-badge-v2-plugin.cjs.production.min.js.map → open-badge-v2-plugin.cjs.production.min.cjs.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
if (process.env.NODE_ENV === 'production') {
|
|
4
|
-
module.exports = require('./open-badge-v2-plugin.cjs.production.min.
|
|
4
|
+
module.exports = require('./open-badge-v2-plugin.cjs.production.min.cjs');
|
|
5
5
|
} else {
|
|
6
|
-
module.exports = require('./open-badge-v2-plugin.cjs.development.
|
|
6
|
+
module.exports = require('./open-badge-v2-plugin.cjs.development.cjs');
|
|
7
7
|
}
|
package/dist/index.d.cts
ADDED
package/dist/{open-badge-v2-plugin.cjs.development.js → open-badge-v2-plugin.cjs.development.cjs}
RENAMED
|
@@ -138,4 +138,4 @@ var openBadgeV2Plugin = /* @__PURE__ */ __name((learnCard) => ({
|
|
|
138
138
|
}, "wrapOpenBadgeV2")
|
|
139
139
|
}
|
|
140
140
|
}), "openBadgeV2Plugin");
|
|
141
|
-
//# sourceMappingURL=open-badge-v2-plugin.cjs.development.
|
|
141
|
+
//# sourceMappingURL=open-badge-v2-plugin.cjs.development.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";var i=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var s=(r,e)=>i(r,"name",{value:e,configurable:!0});var w=(r,e)=>{for(var t in e)i(r,t,{get:e[t],enumerable:!0})},h=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of l(e))!c.call(r,n)&&n!==t&&i(r,n,{get:()=>e[n],enumerable:!(o=g(e,n))||o.enumerable});return r};var f=r=>h(i({},"__esModule",{value:!0}),r);var B={};w(B,{OBV2_WRAPPER_CONTEXT_URL:()=>a,openBadgeV2Plugin:()=>d});module.exports=f(B);var a="https://ctx.learncard.com/wrappers/obv2/1.0.0.json";var u="https://www.w3.org/ns/credentials/v2",O=s(r=>/^(https?:)?\/\//i.test(r)||r.startsWith("ipfs://")||r.startsWith("ipns://"),"isUrl"),V=s(r=>{try{let e=new URL(r);if(!["https:","http:","ipfs:","ipns:"].includes(e.protocol))throw new Error(`wrapOpenBadgeV2: Protocol '${e.protocol}' is not allowed. Only HTTP(S), IPFS, and IPNS are supported`);if(e.protocol==="ipfs:"||e.protocol==="ipns:")return;let o=e.hostname.toLowerCase();if(o==="localhost"||o==="127.0.0.1"||o==="0.0.0.0"||o==="::1")throw new Error("wrapOpenBadgeV2: Access to localhost is not allowed");if(o.startsWith("10.")||o.startsWith("192.168.")||o.startsWith("172.")&&/^172\.(1[6-9]|2[0-9]|3[0-1])\./.test(o))throw new Error("wrapOpenBadgeV2: Access to private IP ranges is not allowed");if(o.startsWith("169.254."))throw new Error("wrapOpenBadgeV2: Access to link-local addresses is not allowed")}catch(e){throw e instanceof TypeError?new Error("wrapOpenBadgeV2: Invalid URL format"):e}},"isValidAndSafeUrl");async function m(r){if(typeof r=="string"){let e=r.trim();if(!O(e)&&(e.startsWith("{")||e.startsWith("[")))try{return JSON.parse(e)}catch{throw new Error("wrapOpenBadgeV2: Provided string is not a valid URL or JSON")}V(e);try{let t=new AbortController,o=setTimeout(()=>t.abort(),1e4),n=await fetch(e,{signal:t.signal});if(clearTimeout(o),!n.ok)throw new Error(`wrapOpenBadgeV2: Failed to fetch OBv2 assertion: ${n.status}`);return await n.json()}catch(t){throw t instanceof TypeError?new Error(`wrapOpenBadgeV2: Network error while fetching OBv2 assertion: ${t.message}`):t?.name==="AbortError"?new Error("wrapOpenBadgeV2: Request timed out after 10 seconds"):t}}if(typeof r!="object"||r===null)throw new Error("wrapOpenBadgeV2: Input must be a valid object");return r}s(m,"getObv2Assertion");function y(r){if(!r||typeof r!="object")throw new Error("wrapOpenBadgeV2: Missing assertion");let e=r.id;if(typeof e!="string"||!e.length)throw new Error("wrapOpenBadgeV2: assertion.id is required");let t=r.type;if(!(typeof t=="string"&&t==="Assertion"||Array.isArray(t)&&t.includes("Assertion")))throw new Error("wrapOpenBadgeV2: assertion.type must include 'Assertion'");if(!r.issuedOn||typeof r.issuedOn!="string")throw new Error("wrapOpenBadgeV2: assertion.issuedOn (string) is required")}s(y,"validateObv2");var d=s(r=>({name:"OpenBadgeV2",displayName:"OpenBadge v2 Wrapper",description:"Wrap legacy OpenBadge v2.0 assertions into self-issued Verifiable Credentials",methods:{wrapOpenBadgeV2:s(async(e,t)=>{let o=r.id.did(),n=await m(t);y(n);let p={"@context":[u,a],id:`urn:uuid:${e.invoke.crypto().randomUUID()}`,type:["VerifiableCredential","LegacyOpenBadgeCredential"],issuer:o,validFrom:new Date().toISOString(),credentialSubject:{id:o},legacyAssertion:n};return r.invoke.issueCredential(p,{proofPurpose:"assertionMethod"})},"wrapOpenBadgeV2")}}),"openBadgeV2Plugin");
|
|
2
|
-
//# sourceMappingURL=open-badge-v2-plugin.cjs.production.min.
|
|
2
|
+
//# sourceMappingURL=open-badge-v2-plugin.cjs.production.min.cjs.map
|
package/package.json
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@learncard/open-badge-v2-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.22",
|
|
4
4
|
"description": "OpenBadge v2 wrapper plugin for LearnCard. Wraps OBv2 assertions into self-issued VCs.",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
6
7
|
"module": "./dist/open-badge-v2-plugin.esm.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/open-badge-v2-plugin.esm.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.cts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
7
20
|
"files": [
|
|
8
21
|
"dist"
|
|
9
22
|
],
|
|
@@ -30,14 +43,14 @@
|
|
|
30
43
|
},
|
|
31
44
|
"types": "./dist/index.d.ts",
|
|
32
45
|
"dependencies": {
|
|
33
|
-
"@learncard/core": "9.4.
|
|
34
|
-
"@learncard/
|
|
35
|
-
"@learncard/
|
|
36
|
-
"@learncard/
|
|
46
|
+
"@learncard/core": "9.4.21",
|
|
47
|
+
"@learncard/crypto-plugin": "1.1.21",
|
|
48
|
+
"@learncard/vc-plugin": "1.5.1",
|
|
49
|
+
"@learncard/types": "5.17.1"
|
|
37
50
|
},
|
|
38
51
|
"sideEffects": false,
|
|
39
52
|
"scripts": {
|
|
40
|
-
"build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.
|
|
53
|
+
"build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.cjs && tsc --p tsconfig.json && shx cp ./dist/index.d.ts ./dist/index.d.cts",
|
|
41
54
|
"test": "jest --passWithNoTests",
|
|
42
55
|
"test:watch": "jest --watch",
|
|
43
56
|
"test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\""
|
|
File without changes
|
|
File without changes
|