{"id":15651582,"url":"https://github.com/panva/hkdf","last_synced_at":"2025-04-04T20:14:16.107Z","repository":{"id":57135083,"uuid":"422321437","full_name":"panva/hkdf","owner":"panva","description":"HKDF with no dependencies using runtime's native crypto in Node.js, Browser, Cloudflare Workers, Electron, and Deno.","archived":false,"fork":false,"pushed_at":"2025-02-18T17:30:01.000Z","size":447,"stargazers_count":35,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T19:11:17.913Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/panva.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"panva"}},"created_at":"2021-10-28T18:53:47.000Z","updated_at":"2025-02-18T17:30:05.000Z","dependencies_parsed_at":"2023-01-21T14:46:44.775Z","dependency_job_id":"449479db-7fc3-40e6-89f0-2e0e4f84cee9","html_url":"https://github.com/panva/hkdf","commit_stats":{"total_commits":41,"total_committers":4,"mean_commits":10.25,"dds":0.09756097560975607,"last_synced_commit":"5c8c4036ea5e5ac4a594f7c753c02ad295ba78af"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panva%2Fhkdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panva%2Fhkdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panva%2Fhkdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panva%2Fhkdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/panva","download_url":"https://codeload.github.com/panva/hkdf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242680,"owners_count":20907134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T12:39:12.345Z","updated_at":"2025-04-04T20:14:16.089Z","avatar_url":"https://github.com/panva.png","language":"JavaScript","funding_links":["https://github.com/sponsors/panva"],"categories":[],"sub_categories":[],"readme":"# hkdf\n\n\u003e HKDF with no dependencies using runtime's native crypto\n\nHKDF is a simple key derivation function defined in [RFC 5869][].\n\n## Documentation\n\n▸ **hkdf**(`digest`, `ikm`, `salt`, `info`, `keylen`): `Promise`\u003c`Uint8Array`\\\u003e\n\nThe given `ikm`, `salt` and `info` are used with the `digest` to derive a key of `keylen` bytes.\n\n### Parameters\n\n| Name | Type | Description |\n| :------ | :------ | :------ |\n| `digest` | ``\"sha256\"`` \\| ``\"sha384\"`` \\| ``\"sha512\"`` \\| ``\"sha1\"`` | The digest algorithm to use. |\n| `ikm` | `Uint8Array` \\| `string` | The input keying material. It must be at least one byte in length. |\n| `salt` | `Uint8Array` \\| `string` | The salt value. Must be provided but can be zero-length. |\n| `info` | `Uint8Array` \\| `string` | Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. |\n| `keylen` | `number` | The length in bytes of the key to generate. Must be greater than 0 and no more than 255 times the digest size. |\n\n### Returns\n\n`Promise`\u003c`Uint8Array`\\\u003e\n\n### Example\n\n**`example`** ESM import\n```js\nimport hkdf from '@panva/hkdf'\n```\n\n**`example`** CJS import\n```js\nconst { hkdf } = require('@panva/hkdf')\n```\n\n**`example`** Deno import\n```js\nimport hkdf from 'https://deno.land/x/hkdf/index.ts'\n```\n\n**`example`** Usage\n```js\nconst derivedKey = await hkdf(\n  'sha256',\n  'key',\n  'salt',\n  'info',\n  64\n)\n```\n\n## Supported Runtimes\n\nThe supported JavaScript runtimes include ones that\n\n- are reasonably up to date ECMAScript\n- support the utilized Web API globals and standard built-in objects\n- These are\n  - _(This is not an exhaustive list)_\n  - Browsers\n  - Cloudflare Workers\n  - Deno\n  - Electron\n  - Netlify Edge Functions\n  - Next.js Middlewares\n  - Node.js\n  - Vercel Edge Functions\n\n[RFC 5869]: https://www.rfc-editor.org/rfc/rfc5869.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanva%2Fhkdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpanva%2Fhkdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanva%2Fhkdf/lists"}