diff --git a/README.md b/README.md index b7aae0f..97c2c40 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ utilities provided by `@better-auth/utils`: |-------------------|----------------------------------------------------| | [**Digest**](#digest) | Hash inputs using sha family hash functions. | | [**HMAC**](#hmac) | Hash inputs using HMAC with a secret key. | -| [**Random String**](#random-string) | Generate random strings with a specified length and charset. | +| [**Random**](#random-string) | Generate random strings with a specified length and charset. | | [**RSA**](#rsa) | Perform encryption, decryption, signing, and verification with RSA keys. | | [**ECDSA**](#ecdsa) | Perform signing and verification with ECDSA keys. | | [**Base64**](#base64) | Encode and decode data in base64 format. | diff --git a/src/cookies.ts b/src/cookies.ts index dfd5350..1f3f054 100644 --- a/src/cookies.ts +++ b/src/cookies.ts @@ -103,13 +103,15 @@ export const cookies = { const { name, value, attributes } = input; const opt = { ...attributes }; const signature = input.signed - ? await hmac.sign(input.signed.key, value) + ? await hmac.sign(input.signed.key, { + data: value, + }) : undefined; const base64Signature = signature ? await base64.encode(signature, { - urlSafe: true, - padding: false, - }) + urlSafe: true, + padding: false, + }) : undefined; const _value = base64Signature ? `${value}.${base64Signature}` : value; let cookie = `${name}=${encodeURIComponent(_value)}`;