# @polkadot-labs/hdkd-helpers

> Composable utility functions to generate key pairs for the sr25519, ed25519, and ecdsa cryptographic schemes, along with utilities for hierarchical deterministic (HD) key derivation, tailored for use in the Polkadot and Substrate ecosystems.

Latest version **0.0.34** (published 2026-09-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @polkadot-labs/hdkd-helpers
pnpm add @polkadot-labs/hdkd-helpers
yarn add @polkadot-labs/hdkd-helpers
bun add @polkadot-labs/hdkd-helpers
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.0.34 |
| Published | 2026-09-06 |
| First published | 2023-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 137 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 6 |
| Author | kratico |
| Maintainers | kratico |
| Keywords | sr25519, ed25519, ecdsa, hdkd, ss58, bip39, schnorrkel, polkadot, substrate |

## Links

- npm: https://www.npmjs.com/package/@polkadot-labs/hdkd-helpers
- Repository: https://github.com/polkadot-labs/hdkd
- Homepage: https://github.com/polkadot-labs/hdkd#readme
- Issues: https://github.com/polkadot-labs/hdkd/issues
- npm.io page: https://npm.io/package/@polkadot-labs/hdkd-helpers

## Dependencies (5)

- [scale-ts](https://npm.io/package/scale-ts.md) ^1.6.1
- [@scure/base](https://npm.io/package/@scure/base.md) ^2.4.0
- [@noble/curves](https://npm.io/package/@noble/curves.md) ^2.4.0
- [@noble/hashes](https://npm.io/package/@noble/hashes.md) ^2.4.0
- [@scure/sr25519](https://npm.io/package/@scure/sr25519.md) ^2.4.0

## Recent versions

- 0.0.34 (latest) — 2026-09-06
- 0.0.33 — 2026-08-16
- 0.0.32 — 2026-08-13
- 0.0.31 — 2026-07-05
- 0.0.30 — 2026-04-22
- 0.0.29 — 2026-04-13
- 0.0.28 — 2026-03-22
- 0.0.27 — 2025-12-10
- 0.0.26 — 2025-09-29
- 0.0.25 — 2025-09-07
- 0.0.24 — 2025-09-07
- 0.0.23 — 2025-08-30
- 0.0.22 — 2025-08-18
- 0.0.21 — 2025-08-09
- 0.0.20 — 2025-07-23
- … 19 more at https://npm.io/package/@polkadot-labs/hdkd-helpers/versions

## README

# @polkadot-labs/hdkd-helpers

[![NPM Version](https://img.shields.io/npm/v/%40polkadot-labs%2Fhdkd-helpers)](https://www.npmjs.com/package/@polkadot-labs/hdkd-helpers) [![GitHub License](https://img.shields.io/github/license/polkadot-labs/hdkd)](https://github.com/polkadot-labs/hdkd/blob/main/LICENSE) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/polkadot-labs/hdkd/ci.yml)

`@polkadot-labs/hdkd-helpers` is a pure JavaScript library providing utility functions for three signature schemes: sr25519, ed25519, and ecdsa.
This library is designed to assist with Hierarchical Deterministic Key Derivation (HDKD) in the Polkadot ecosystem.
Additionally, it includes utilities for deriving HD accounts with hard and soft derivation, creating ss58 addresses, and deriving private keys through bip39.
It is built on top of `@noble/hashes`, `@noble/curves`, and `@scure/sr25519`.

## Features

- **sr25519**: Utilities for the sr25519 signature scheme.
- **ed25519**: Utilities for the ed25519 signature scheme.
- **ecdsa**: Utilities for the ecdsa signature scheme.
- **ss58**: Utilities for creating ss58 addresses.
- **Hierarchical Deterministic Accounts**: Utilities for deriving HD accounts with hard and soft derivation.
- **bip39**: Utilities for deriving private keys through bip39.

## Installation

To install the library, you can use npm or yarn or pnpm:

```sh
npm install @polkadot-labs/hdkd-helpers
```

## Usage

Here is an example of how to use the library:

```ts
import {
  sr25519,
  DEV_PHRASE,
  entropyToMiniSecret,
  mnemonicToEntropy,
} from "@polkadot-labs/hdkd-helpers"
import { secretFromSeed } from "@scure/sr25519"

const entropy = mnemonicToEntropy(DEV_PHRASE)
const miniSecret = entropyToMiniSecret(entropy)

// Example usage for generating a sr25519 keypair with hard derivation
const privateKey = secretFromSeed(miniSecret)
const publicKey = sr25519.getPublicKey(privateKey)

// Example usage for signing a message
const message = new TextEncoder().encode("Hello")
const signature = sr25519.sign(message, privateKey)

// Example usage for verifying a signature
const isValid = sr25519.verify(signature, message, publicKey)
console.log("Is valid:", isValid)
```

## License

This project is licensed under the MIT License. See the [LICENSE](../../LICENSE) file for details.

---
_Source: https://npm.io/package/@polkadot-labs/hdkd-helpers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
