# hexkey-utils

> Utils for working with hypercore keys without worrying if they are in hex or buffer format

Latest version **1.2.1** (published 2023-01-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install hexkey-utils
pnpm add hexkey-utils
yarn add hexkey-utils
bun add hexkey-utils
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2023-01-30 |
| First published | 2022-12-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | H. Degroote |
| Maintainers | hdegroote |
| Keywords | hypercore, hex |

## Links

- npm: https://www.npmjs.com/package/hexkey-utils
- Repository: https://gitlab.com/HDegroote/hexkey-utils
- Homepage: https://gitlab.com/HDegroote/hexkey-utils#readme
- Issues: https://gitlab.com/HDegroote/hexkey-utils/issues
- npm.io page: https://npm.io/package/hexkey-utils

## Dependencies (3)

- [b4a](https://npm.io/package/b4a.md) ^1.6.1
- [hypercore-crypto](https://npm.io/package/hypercore-crypto.md) ^3.3.0
- [hypercore-id-encoding](https://npm.io/package/hypercore-id-encoding.md) ^1.0.2

## Alternatives

- [postcss-color-hex-alpha](https://npm.io/package/postcss-color-hex-alpha.md) — 6.4M weekly downloads
- [randomcolor](https://npm.io/package/randomcolor.md) — 348.0K weekly downloads
- [bows](https://npm.io/package/bows.md) — 1.3K weekly downloads
- [ep_prefer_color_scheme](https://npm.io/package/ep_prefer_color_scheme.md) — 260 weekly downloads
- [coc-yank](https://npm.io/package/coc-yank.md) — 61 weekly downloads

## Recent versions

- 1.2.1 (latest) — 2023-01-30
- 1.2.0 — 2023-01-12
- 1.1.0 — 2023-01-06
- 1.0.2 — 2023-01-05
- 1.0.1 — 2022-12-19
- 1.0.0 — 2022-12-18

## README

# Hexkey Utils

Utils for working with hypercore keys without worrying if they are in hex, buffer or z-base32 format.

## Install

`npm add hexkey-utils`

## API
`key` can be either in buffer format, hexadecimal string format or z-base32 string format.

#### `asBuffer (key)`

Return the specified key as a buffer

#### `asHex (key)`
Return the specified key as hexadecimal string

#### `asZBase32 (key)`
Returns the specified key as z-base32 string

#### `getDiscoveryKey (key)`
Return the discovery key corresponding to this key, in hex format.

#### `validateKey (key)`
Throws an error if the key is not valid for a hypercore (returns true if valid)

#### `isSame (key1, key2)`
Returns true if the keys refer to the same hypercore (regardless of format), false otherwise

#### `isKey (key)`
Returns true if `key` is a valid hypercore key, false otherwise

---
_Source: https://npm.io/package/hexkey-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
