@learncard/expiration-plugin 1.1.37 → 1.1.39

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.
@@ -33,6 +33,10 @@ var expirationPlugin = /* @__PURE__ */ __name((learnCard) => ({
33
33
  const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);
34
34
  if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {
35
35
  verificationCheck.errors.push("expiration error: Credential is expired");
36
+ } else if (credential.validFrom && new Date() < new Date(credential.validFrom)) {
37
+ verificationCheck.errors.push("expiration error: Credential is not valid yet");
38
+ } else if (credential.validUntil && new Date() > new Date(credential.validUntil)) {
39
+ verificationCheck.errors.push("expiration error: Credential is no longer valid");
36
40
  } else {
37
41
  verificationCheck.checks.push("expiration");
38
42
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import { VerifyExtension } from '@learncard/vc-plugin';\nimport { LearnCard } from '@learncard/core';\nimport { ExpirationPlugin } from './types';\n\nexport * from './types';\n\n/**\n * @group Plugins\n */\nexport const expirationPlugin = (\n learnCard: LearnCard<any, any, VerifyExtension>\n): ExpirationPlugin => ({\n name: 'Expiration',\n displayName: 'Expiration Extension',\n description: \"Adds a check to make sure credentials aren't expired when verifying them\",\n methods: {\n verifyCredential: async (_learnCard, credential, options) => {\n const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);\n\n if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {\n verificationCheck.errors.push('expiration error: Credential is expired');\n } else {\n verificationCheck.checks.push('expiration');\n }\n\n return verificationCheck;\n },\n },\n});\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,mBAAmB,wBAC5B,eACoB;AAAA,EACpB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,SAAS;AAAA,IACL,kBAAkB,OAAO,YAAY,YAAY,YAAY;AACzD,YAAM,oBAAoB,MAAM,UAAU,OAAO,iBAAiB,YAAY,OAAO;AAErF,UAAI,WAAW,kBAAkB,IAAI,KAAK,IAAI,IAAI,KAAK,WAAW,cAAc,GAAG;AAC/E,0BAAkB,OAAO,KAAK,yCAAyC;AAAA,MAC3E,OAAO;AACH,0BAAkB,OAAO,KAAK,YAAY;AAAA,MAC9C;AAEA,aAAO;AAAA,IACX;AAAA,EACJ;AACJ,IAnBgC;",
4
+ "sourcesContent": ["import { VerifyExtension } from '@learncard/vc-plugin';\nimport { LearnCard } from '@learncard/core';\nimport { ExpirationPlugin } from './types';\n\nexport * from './types';\n\n/**\n * @group Plugins\n */\nexport const expirationPlugin = (\n learnCard: LearnCard<any, any, VerifyExtension>\n): ExpirationPlugin => ({\n name: 'Expiration',\n displayName: 'Expiration Extension',\n description: \"Adds a check to make sure credentials aren't expired when verifying them\",\n methods: {\n verifyCredential: async (_learnCard, credential, options) => {\n const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);\n\n if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {\n verificationCheck.errors.push('expiration error: Credential is expired');\n } else if (credential.validFrom && new Date() < new Date(credential.validFrom)) {\n verificationCheck.errors.push('expiration error: Credential is not valid yet');\n } else if (credential.validUntil && new Date() > new Date(credential.validUntil)) {\n verificationCheck.errors.push('expiration error: Credential is no longer valid');\n } else {\n verificationCheck.checks.push('expiration');\n }\n\n return verificationCheck;\n },\n },\n});\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,IAAM,mBAAmB,wBAC5B,eACoB;AAAA,EACpB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,SAAS;AAAA,IACL,kBAAkB,OAAO,YAAY,YAAY,YAAY;AACzD,YAAM,oBAAoB,MAAM,UAAU,OAAO,iBAAiB,YAAY,OAAO;AAErF,UAAI,WAAW,kBAAkB,IAAI,KAAK,IAAI,IAAI,KAAK,WAAW,cAAc,GAAG;AAC/E,0BAAkB,OAAO,KAAK,yCAAyC;AAAA,MAC3E,WAAW,WAAW,aAAa,IAAI,KAAK,IAAI,IAAI,KAAK,WAAW,SAAS,GAAG;AAC5E,0BAAkB,OAAO,KAAK,+CAA+C;AAAA,MACjF,WAAW,WAAW,cAAc,IAAI,KAAK,IAAI,IAAI,KAAK,WAAW,UAAU,GAAG;AAC9E,0BAAkB,OAAO,KAAK,iDAAiD;AAAA,MACnF,OAAO;AACH,0BAAkB,OAAO,KAAK,YAAY;AAAA,MAC9C;AAEA,aAAO;AAAA,IACX;AAAA,EACJ;AACJ,IAvBgC;",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";var t=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var o=(i,e)=>t(i,"name",{value:e,configurable:!0});var d=(i,e)=>{for(var n in e)t(i,n,{get:e[n],enumerable:!0})},m=(i,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of s(e))!x.call(i,r)&&r!==n&&t(i,r,{get:()=>e[r],enumerable:!(a=p(e,r))||a.enumerable});return i};var f=i=>m(t({},"__esModule",{value:!0}),i);var y={};d(y,{expirationPlugin:()=>c});module.exports=f(y);var c=o(i=>({name:"Expiration",displayName:"Expiration Extension",description:"Adds a check to make sure credentials aren't expired when verifying them",methods:{verifyCredential:async(e,n,a)=>{let r=await i.invoke.verifyCredential(n,a);return n.expirationDate&&new Date>new Date(n.expirationDate)?r.errors.push("expiration error: Credential is expired"):r.checks.push("expiration"),r}}}),"expirationPlugin");
1
+ "use strict";var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var t=(r,e)=>o(r,"name",{value:e,configurable:!0});var l=(r,e)=>{for(var i in e)o(r,i,{get:e[i],enumerable:!0})},d=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of p(e))!x.call(r,n)&&n!==i&&o(r,n,{get:()=>e[n],enumerable:!(a=s(e,n))||a.enumerable});return r};var m=r=>d(o({},"__esModule",{value:!0}),r);var v={};l(v,{expirationPlugin:()=>f});module.exports=m(v);var f=t(r=>({name:"Expiration",displayName:"Expiration Extension",description:"Adds a check to make sure credentials aren't expired when verifying them",methods:{verifyCredential:async(e,i,a)=>{let n=await r.invoke.verifyCredential(i,a);return i.expirationDate&&new Date>new Date(i.expirationDate)?n.errors.push("expiration error: Credential is expired"):i.validFrom&&new Date<new Date(i.validFrom)?n.errors.push("expiration error: Credential is not valid yet"):i.validUntil&&new Date>new Date(i.validUntil)?n.errors.push("expiration error: Credential is no longer valid"):n.checks.push("expiration"),n}}}),"expirationPlugin");
2
2
  //# sourceMappingURL=expiration-plugin.cjs.production.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import { VerifyExtension } from '@learncard/vc-plugin';\nimport { LearnCard } from '@learncard/core';\nimport { ExpirationPlugin } from './types';\n\nexport * from './types';\n\n/**\n * @group Plugins\n */\nexport const expirationPlugin = (\n learnCard: LearnCard<any, any, VerifyExtension>\n): ExpirationPlugin => ({\n name: 'Expiration',\n displayName: 'Expiration Extension',\n description: \"Adds a check to make sure credentials aren't expired when verifying them\",\n methods: {\n verifyCredential: async (_learnCard, credential, options) => {\n const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);\n\n if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {\n verificationCheck.errors.push('expiration error: Credential is expired');\n } else {\n verificationCheck.checks.push('expiration');\n }\n\n return verificationCheck;\n },\n },\n});\n"],
5
- "mappings": "4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GASO,IAAMI,EAAmBC,EAC5BC,IACoB,CACpB,KAAM,aACN,YAAa,uBACb,YAAa,2EACb,QAAS,CACL,iBAAkB,MAAOC,EAAYC,EAAYC,IAAY,CACzD,IAAMC,EAAoB,MAAMJ,EAAU,OAAO,iBAAiBE,EAAYC,CAAO,EAErF,OAAID,EAAW,gBAAkB,IAAI,KAAS,IAAI,KAAKA,EAAW,cAAc,EAC5EE,EAAkB,OAAO,KAAK,yCAAyC,EAEvEA,EAAkB,OAAO,KAAK,YAAY,EAGvCA,CACX,CACJ,CACJ,GAnBgC",
4
+ "sourcesContent": ["import { VerifyExtension } from '@learncard/vc-plugin';\nimport { LearnCard } from '@learncard/core';\nimport { ExpirationPlugin } from './types';\n\nexport * from './types';\n\n/**\n * @group Plugins\n */\nexport const expirationPlugin = (\n learnCard: LearnCard<any, any, VerifyExtension>\n): ExpirationPlugin => ({\n name: 'Expiration',\n displayName: 'Expiration Extension',\n description: \"Adds a check to make sure credentials aren't expired when verifying them\",\n methods: {\n verifyCredential: async (_learnCard, credential, options) => {\n const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);\n\n if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {\n verificationCheck.errors.push('expiration error: Credential is expired');\n } else if (credential.validFrom && new Date() < new Date(credential.validFrom)) {\n verificationCheck.errors.push('expiration error: Credential is not valid yet');\n } else if (credential.validUntil && new Date() > new Date(credential.validUntil)) {\n verificationCheck.errors.push('expiration error: Credential is no longer valid');\n } else {\n verificationCheck.checks.push('expiration');\n }\n\n return verificationCheck;\n },\n },\n});\n"],
5
+ "mappings": "4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,IAAA,eAAAC,EAAAH,GASO,IAAMI,EAAmBC,EAC5BC,IACoB,CACpB,KAAM,aACN,YAAa,uBACb,YAAa,2EACb,QAAS,CACL,iBAAkB,MAAOC,EAAYC,EAAYC,IAAY,CACzD,IAAMC,EAAoB,MAAMJ,EAAU,OAAO,iBAAiBE,EAAYC,CAAO,EAErF,OAAID,EAAW,gBAAkB,IAAI,KAAS,IAAI,KAAKA,EAAW,cAAc,EAC5EE,EAAkB,OAAO,KAAK,yCAAyC,EAChEF,EAAW,WAAa,IAAI,KAAS,IAAI,KAAKA,EAAW,SAAS,EACzEE,EAAkB,OAAO,KAAK,+CAA+C,EACtEF,EAAW,YAAc,IAAI,KAAS,IAAI,KAAKA,EAAW,UAAU,EAC3EE,EAAkB,OAAO,KAAK,iDAAiD,EAE/EA,EAAkB,OAAO,KAAK,YAAY,EAGvCA,CACX,CACJ,CACJ,GAvBgC",
6
6
  "names": ["src_exports", "__export", "expirationPlugin", "__toCommonJS", "expirationPlugin", "__name", "learnCard", "_learnCard", "credential", "options", "verificationCheck"]
7
7
  }
@@ -11,6 +11,10 @@ var expirationPlugin = /* @__PURE__ */ __name((learnCard) => ({
11
11
  const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);
12
12
  if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {
13
13
  verificationCheck.errors.push("expiration error: Credential is expired");
14
+ } else if (credential.validFrom && new Date() < new Date(credential.validFrom)) {
15
+ verificationCheck.errors.push("expiration error: Credential is not valid yet");
16
+ } else if (credential.validUntil && new Date() > new Date(credential.validUntil)) {
17
+ verificationCheck.errors.push("expiration error: Credential is no longer valid");
14
18
  } else {
15
19
  verificationCheck.checks.push("expiration");
16
20
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import { VerifyExtension } from '@learncard/vc-plugin';\nimport { LearnCard } from '@learncard/core';\nimport { ExpirationPlugin } from './types';\n\nexport * from './types';\n\n/**\n * @group Plugins\n */\nexport const expirationPlugin = (\n learnCard: LearnCard<any, any, VerifyExtension>\n): ExpirationPlugin => ({\n name: 'Expiration',\n displayName: 'Expiration Extension',\n description: \"Adds a check to make sure credentials aren't expired when verifying them\",\n methods: {\n verifyCredential: async (_learnCard, credential, options) => {\n const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);\n\n if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {\n verificationCheck.errors.push('expiration error: Credential is expired');\n } else {\n verificationCheck.checks.push('expiration');\n }\n\n return verificationCheck;\n },\n },\n});\n"],
5
- "mappings": ";;;;AASO,IAAM,mBAAmB,wBAC5B,eACoB;AAAA,EACpB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,SAAS;AAAA,IACL,kBAAkB,OAAO,YAAY,YAAY,YAAY;AACzD,YAAM,oBAAoB,MAAM,UAAU,OAAO,iBAAiB,YAAY,OAAO;AAErF,UAAI,WAAW,kBAAkB,IAAI,KAAK,IAAI,IAAI,KAAK,WAAW,cAAc,GAAG;AAC/E,0BAAkB,OAAO,KAAK,yCAAyC;AAAA,MAC3E,OAAO;AACH,0BAAkB,OAAO,KAAK,YAAY;AAAA,MAC9C;AAEA,aAAO;AAAA,IACX;AAAA,EACJ;AACJ,IAnBgC;",
4
+ "sourcesContent": ["import { VerifyExtension } from '@learncard/vc-plugin';\nimport { LearnCard } from '@learncard/core';\nimport { ExpirationPlugin } from './types';\n\nexport * from './types';\n\n/**\n * @group Plugins\n */\nexport const expirationPlugin = (\n learnCard: LearnCard<any, any, VerifyExtension>\n): ExpirationPlugin => ({\n name: 'Expiration',\n displayName: 'Expiration Extension',\n description: \"Adds a check to make sure credentials aren't expired when verifying them\",\n methods: {\n verifyCredential: async (_learnCard, credential, options) => {\n const verificationCheck = await learnCard.invoke.verifyCredential(credential, options);\n\n if (credential.expirationDate && new Date() > new Date(credential.expirationDate)) {\n verificationCheck.errors.push('expiration error: Credential is expired');\n } else if (credential.validFrom && new Date() < new Date(credential.validFrom)) {\n verificationCheck.errors.push('expiration error: Credential is not valid yet');\n } else if (credential.validUntil && new Date() > new Date(credential.validUntil)) {\n verificationCheck.errors.push('expiration error: Credential is no longer valid');\n } else {\n verificationCheck.checks.push('expiration');\n }\n\n return verificationCheck;\n },\n },\n});\n"],
5
+ "mappings": ";;;;AASO,IAAM,mBAAmB,wBAC5B,eACoB;AAAA,EACpB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,SAAS;AAAA,IACL,kBAAkB,OAAO,YAAY,YAAY,YAAY;AACzD,YAAM,oBAAoB,MAAM,UAAU,OAAO,iBAAiB,YAAY,OAAO;AAErF,UAAI,WAAW,kBAAkB,IAAI,KAAK,IAAI,IAAI,KAAK,WAAW,cAAc,GAAG;AAC/E,0BAAkB,OAAO,KAAK,yCAAyC;AAAA,MAC3E,WAAW,WAAW,aAAa,IAAI,KAAK,IAAI,IAAI,KAAK,WAAW,SAAS,GAAG;AAC5E,0BAAkB,OAAO,KAAK,+CAA+C;AAAA,MACjF,WAAW,WAAW,cAAc,IAAI,KAAK,IAAI,IAAI,KAAK,WAAW,UAAU,GAAG;AAC9E,0BAAkB,OAAO,KAAK,iDAAiD;AAAA,MACnF,OAAO;AACH,0BAAkB,OAAO,KAAK,YAAY;AAAA,MAC9C;AAEA,aAAO;AAAA,IACX;AAAA,EACJ;AACJ,IAvBgC;",
6
6
  "names": []
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,cAAc,SAAS,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,gBAAgB,cACd,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,eAAe,CAAC,KAChD,gBAiBD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,cAAc,SAAS,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,gBAAgB,cACd,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,eAAe,CAAC,KAChD,gBAqBD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learncard/expiration-plugin",
3
- "version": "1.1.37",
3
+ "version": "1.1.39",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/expiration-plugin.esm.js",
@@ -31,8 +31,8 @@
31
31
  "types": "./dist/index.d.ts",
32
32
  "dependencies": {
33
33
  "why-is-node-running": "^2.2.2",
34
- "@learncard/core": "9.3.22",
35
- "@learncard/vc-plugin": "^1.1.37"
34
+ "@learncard/vc-plugin": "^1.1.39",
35
+ "@learncard/core": "9.3.24"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.js && tsc --p tsconfig.json",