secure-cookie
Advanced tools
Comparing version 0.0.7 to 0.1.0
/*! | ||
* secure-cookie v0.0.7 | ||
* secure-cookie v0.1.0 | ||
* (c) Ismail H. Ayaz | ||
@@ -160,18 +160,13 @@ * Released under the MIT License. | ||
opts = opts || {}; | ||
if (opts.encryption) { | ||
if (!Array.isArray(opts.encryption.keys) || opts.encryption.keys.length === 0) { | ||
throw new Error("keys are required for encryption"); | ||
} | ||
} | ||
if (opts.signing) { | ||
if (!Array.isArray(opts.signing.keys) || opts.signing.keys.length === 0) { | ||
throw new Error("keys are required for signing"); | ||
} | ||
} | ||
this.encryption = Object.assign({ | ||
algorithm: 'aes-192-ccm', | ||
authTagLength: 16, | ||
encoding: 'hex', keys: [] | ||
encoding: 'hex', | ||
keys: [] | ||
}, opts.encryption || {}); | ||
this.signing = Object.assign({ encoding: 'base64', algorithm: 'sha1', keys: [] }, opts.signing || {}); | ||
this.signing = Object.assign({ | ||
encoding: 'base64', | ||
algorithm: 'sha1', | ||
keys: [] | ||
}, opts.signing || {}); | ||
} | ||
@@ -178,0 +173,0 @@ KeyStore.prototype.encrypt = function (data, options) { |
/*! | ||
* secure-cookie v0.0.7 | ||
* secure-cookie v0.1.0 | ||
* (c) Ismail H. Ayaz | ||
@@ -170,18 +170,13 @@ * Released under the MIT License. | ||
opts = opts || {}; | ||
if (opts.encryption) { | ||
if (!Array.isArray(opts.encryption.keys) || opts.encryption.keys.length === 0) { | ||
throw new Error("keys are required for encryption"); | ||
} | ||
} | ||
if (opts.signing) { | ||
if (!Array.isArray(opts.signing.keys) || opts.signing.keys.length === 0) { | ||
throw new Error("keys are required for signing"); | ||
} | ||
} | ||
this.encryption = Object.assign({ | ||
algorithm: 'aes-192-ccm', | ||
authTagLength: 16, | ||
encoding: 'hex', keys: [] | ||
encoding: 'hex', | ||
keys: [] | ||
}, opts.encryption || {}); | ||
this.signing = Object.assign({ encoding: 'base64', algorithm: 'sha1', keys: [] }, opts.signing || {}); | ||
this.signing = Object.assign({ | ||
encoding: 'base64', | ||
algorithm: 'sha1', | ||
keys: [] | ||
}, opts.signing || {}); | ||
} | ||
@@ -188,0 +183,0 @@ KeyStore.prototype.encrypt = function (data, options) { |
{ | ||
"name": "secure-cookie", | ||
"version": "0.0.7", | ||
"version": "0.1.0", | ||
"description": "Cookie library/middleware with signing and encryption support", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -43,19 +43,15 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ | ||
opts = opts || {} | ||
if (opts.encryption) { | ||
if (!Array.isArray(opts.encryption.keys) || opts.encryption.keys.length === 0) { | ||
throw new Error("keys are required for encryption") | ||
} | ||
} | ||
if (opts.signing) { | ||
if (!Array.isArray(opts.signing.keys) || opts.signing.keys.length === 0) { | ||
throw new Error("keys are required for signing") | ||
} | ||
} | ||
this.encryption = Object.assign({ | ||
algorithm: 'aes-192-ccm', | ||
authTagLength: 16, | ||
encoding: 'hex', keys: [] | ||
encoding: 'hex', | ||
keys: [] | ||
}, opts.encryption || {} as any) | ||
this.signing = Object.assign({encoding: 'base64', algorithm: 'sha1', keys: []}, opts.signing || {} as any) | ||
this.signing = Object.assign({ | ||
encoding: 'base64', | ||
algorithm: 'sha1', | ||
keys: [] | ||
}, opts.signing || {} as any) | ||
@@ -62,0 +58,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
259872
2516