@bunpmjs/json-webtoken
Advanced tools
Comparing version
@@ -22,3 +22,4 @@ import { createCipheriv, createDecipheriv, createHash } from "crypto"; | ||
: (process.env.WEB_TOKEN_SECRET as string); | ||
if (!this.secret) throw new Error("set .env SECRET=<32 Random Char>"); | ||
if (!this.secret) | ||
throw new Error("set .env WEB_TOKEN_SECRET=<32 Random Char>"); | ||
this.request = request; | ||
@@ -28,3 +29,7 @@ this.iv = process.env.WEB_TOKEN_IV || "1xD4R5TgHrRp09gF"; | ||
this.iv = init?.iv ? init.iv : this.iv; | ||
this.sessionData = this.getCookie<_Data>(); | ||
try { | ||
this.sessionData = this.getCookie<_Data>(); | ||
} catch { | ||
this.sessionData = undefined; | ||
} | ||
} | ||
@@ -31,0 +36,0 @@ public session() { |
@@ -1,1 +0,1 @@ | ||
{"version":"0.0.21","name":"@bunpmjs/json-webtoken","module":"index.ts","type":"module","devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5.0.0"}} | ||
{"version":"0.0.22","keywords":["session","webtoken","json"],"name":"@bunpmjs/json-webtoken","module":"index.ts","type":"module","devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5.0.0"}} |
4350
2.96%114
4.59%