1.1.1 • Published 1 year ago

@panva/hkdf v1.1.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-704spkf-next-auth@dennishellernokia/next-authnext-auth-modifiedmfkdfmoxieauth-corenext-auth-danger-linknext-auth-fork-bodyaalyas12next-auth-imrdjainext-auth-jwt-fixnext-auth-linkedin-fixnext-auth-override-redirectnext-auth-patch-feature-nonce-checknext-auth-preconysnext-auth-sescnext-auth-siwenext-auth-testnext-auth-with-exponextauth-jwe-decryptpickaxe-next-auth@hebilicious/authjs-nuxtdamienpm-next-auth@ibercore/next-auth@icanid/icanid-sdk-nextjs@jeeyoungk/next-auth-remix@jclem/next-auth@iz-auth/core@jafri/auth-core@greenrenge/playbux-next-authzihan-auth-core@pixel-point/next-auth@pluv/io@proselog/jwt@putao520/next-auth@neon.id/identitas-operation@moritzmyrz/next-auth@mtt/next-auth@nhi/next-auth@nixcode/next-auth@oviava/authjs-nuxt@dts-stn/next-auth@edge-store/react@edge-store/server@edgestore/react@edgestore/server@tru_id/next-auth@wolfleader101/nextjs-auth0@vinhnguyen1211/next-auth@smithmilner/next-auth@alexanderlee/next-auth@egoist/jwt@sihaxito/nextauth@suptreze/shared@stevesouth/next-auth@stringke/next-auth@thewilloftheshadow/next-auth-fork@tiplink/next-auth@zoomit/next-auth@aoeu/next-authaponiaauth-apple-fix-core@alpakaslab/nextjs-jwt-auth@aponia.js/core@auth0/mdl@auth0/nextjs-auth0@auth-pp/core@auth/core@authok/nextjs-authok@bangdinhnpm/next-auth@answeroverflow/next-authbrazy-auth@cgps/next-authbeak8-next-auth@coherence-finance/next-auth@codetheorist/next-authbytevane-auth@dataparty/crypto@cs125/mace@cs124/mace@dbcdk/decrypt-jwt-token@dbcdk/set-jwt-expiration-datechidu-authentication-module
1.1.1

1 year ago

1.1.0

1 year ago

1.0.4

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago