1.2.1 • Published 1 year ago

@panva/hkdf v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

hkdf

HKDF with no dependencies using runtime's native crypto

HKDF is a simple key derivation function defined in RFC 5869.

Documentation

hkdf(digest, ikm, salt, info, keylen): Promise<Uint8Array>

The given ikm, salt and info are used with the digest to derive a key of keylen bytes.

Parameters

NameTypeDescription
digest"sha256" | "sha384" | "sha512" | "sha1"The digest algorithm to use.
ikmUint8Array | stringThe input keying material. It must be at least one byte in length.
saltUint8Array | stringThe salt value. Must be provided but can be zero-length.
infoUint8Array | stringAdditional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes.
keylennumberThe length in bytes of the key to generate. Must be greater than 0 and no more than 255 times the digest size.

Returns

Promise<Uint8Array>

Example

example ESM import

import hkdf from '@panva/hkdf'

example CJS import

const { hkdf } = require('@panva/hkdf')

example Deno import

import hkdf from 'https://deno.land/x/hkdf/index.ts'

example Usage

const derivedKey = await hkdf(
  'sha256',
  'key',
  'salt',
  'info',
  64
)

Supported Runtimes

The supported JavaScript runtimes include ones that

  • are reasonably up to date ECMAScript
  • support the utilized Web API globals and standard built-in objects
  • These are
    • (This is not an exhaustive list)
    • Browsers
    • Cloudflare Workers
    • Deno
    • Electron
    • Netlify Edge Functions
    • Next.js Middlewares
    • Node.js
    • Vercel Edge Functions
@infinitebrahmanuniverse/nolb-_panv@puyodead1/next-auth@everything-registry/sub-chunk-704@cs125/mace@cs124/mace@dennishellernokia/next-authnext-auth-modifiedspkf-next-auth@aoeu/next-auth@aponia.js/core@answeroverflow/next-auth@auth-pp/core@auth/core@auth0/mdl@auth0/nextjs-auth0@authok/nextjs-authok@alexanderlee/next-auth@alpakaslab/nextjs-jwt-auth@awwong1/nextjs-auth0@bangdinhnpm/next-auth@cgps/next-auth@524c/auth-core@codetheorist/next-auth@coherence-finance/next-auth@dbcdk/set-jwt-expiration-date@dbcdk/decrypt-jwt-token@devsen/auth-core@digital-realty/auth-core@dataparty/cryptozihan-auth-core@dts-stn/next-auth@edgestore/react@edgestore/server@edge-store/react@edge-store/server@greenrenge/playbux-next-auth@hebilicious/authjs-nuxt@ibercore/next-auth@egoist/jwt@korol-oleksandr-hoc/auth-middleware@magickml/agent-server@mtt/next-auth@nhi/next-auth@neon.id/identitas-operation@ninepie/jwt@nixcode/next-auth@emulienfou/auth-core@eicrud/core@eartho/one-client-nextjs@iz-auth/core@jafri/auth-core@jclem/next-auth@jeeyoungk/next-auth-remix@icanid/icanid-sdk-nextjs@moritzmyrz/next-auth@proselog/jwt@putao520/next-auth@polymorf3d/next-auth@pixel-point/next-auth@pluv/io@oviava/authjs-nuxtmoxieauth-coremfkdfnext-auth-danger-linknext-auth-fork-bodyaalyas12next-auth-imrdjainext-auth-jwt-fixnext-auth-sescnext-auth-siwenext-auth-testnext-auth-with-exponext-authnext-auth-sanitizenext-auth-override-redirectnext-auth-patch-feature-nonce-checknext-auth-preconysnext-auth-linkedin-fixnextauth-jwe-decryptpickaxe-next-authrkang-auth-core@wolfleader101/nextjs-auth0@willmitchell/authjs-core@tru_id/next-auth@thewilloftheshadow/next-auth-fork@tiplink/next-auth@vinhnguyen1211/next-auth@zacarycarter/nextjs-auth0@stringke/next-authamee@zoomit/next-authauth-apple-fix-coreaponiabytevane-authchidu-authentication-moduledamienpm-next-authbeak8-next-authbrazy-authfauthy-next-sdk@sse-auth/backend@sse-auth/utils
1.2.0

1 year ago

1.2.1

1 year ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.4

2 years ago

1.0.2

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago