Skip to content

Support CipherKey type for secret #106

Description

@SnowMarble

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions