Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CipherKey type for secret #106

Open
SnowMarble opened this issue Jul 29, 2024 · 0 comments
Open

Support CipherKey type for secret #106

SnowMarble opened this issue Jul 29, 2024 · 0 comments

Comments

@SnowMarble
Copy link

SnowMarble commented Jul 29, 2024

Currently, only string or string array types can be used as secret values.

* @param {string|array} [secret] A string (or array of strings) representing cookie signing secret(s).

But cookie-signature allows not only string, but also ArrayBufferView(TypedArray, DataView), and crypto.KeyObject.

The secret is for an HMAC key, so technically we can allow string, ArrayBuffer, Buffer, TypedArray, DataView, KeyObject, and CryptoKey, which is described in the nodejs docs. And these types are represented as crypto.CipherKey type.

This is also related to security concerns. See Using strings as inputs to cryptographic APIs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants