# @emurgo/cip14-js

> A Javascript library reference implementation for CIP14

Latest version **3.0.1** (published 2021-09-14) · Apache-2.0 OR MIT license · 0 weekly downloads

## Install

```sh
npm install @emurgo/cip14-js
pnpm add @emurgo/cip14-js
yarn add @emurgo/cip14-js
bun add @emurgo/cip14-js
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2021-09-14 |
| First published | 2021-02-23 |
| Weekly downloads | 0 |
| License | Apache-2.0 OR MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | EMURGO |
| Maintainers | nykho, sebastiengllmt, v-almonacid, vsubhuman |

## Links

- npm: https://www.npmjs.com/package/@emurgo/cip14-js
- Repository: https://github.com/Emurgo/cip14-js
- Homepage: https://github.com/Emurgo/cip14-js#readme
- Issues: https://github.com/Emurgo/cip14-js/issues
- npm.io page: https://npm.io/package/@emurgo/cip14-js

## Dependencies (2)

- [bech32](https://npm.io/package/bech32.md) 2.0.0
- [blake2b](https://npm.io/package/blake2b.md) 2.1.3

## Recent versions

- 3.0.1 (latest) — 2021-09-14
- 3.0.0 — 2021-09-14
- 2.0.0 — 2021-02-23
- 1.0.2 — 2021-02-23
- 1.0.1 — 2021-02-23
- 1.0.0 — 2021-02-23

## README

# CIP14-JS

On the Cardano blockchain, native assets are uniquely identified by both their _policy id_ and _asset name_. Neither the policy id nor the asset name are intended to be human-readable data. [CIP14](https://github.com/cardano-foundation/CIPs/pull/64) introduces an _asset fingerprint_ which is a short(er) and human-readable identifier for assets that user can recognize and refer to when talking about assets.

More specifically, CIP14 defines a user-facing asset fingerprint as a bech32-encoded blake2b-160 digest of the concatenation of the policy id and the asset name.

This package is a Typescript implementation of CIP14

## Install

``` sh
npm i @emurgo/cip14-js --save
```

## Usage

```js
const AssetFingerprint = require('@emurgo/cip14-js');

// initialize class with policyId, assetName
const assetFingerprint = AssetFingerprint.fromParts(
  Buffer.from('1e349c9bdea19fd6c147626a5260bc44b71635f398b67c59881df209', 'hex'),
  Buffer.from('504154415445', 'hex'),
);

const fingerprintHash = assetFingerprint.hash();
const bech32Fingerprint = assetFingerprint.fingerprint();
```

```js
// initialize class with bech32
const assetFingerprint = AssetFingerprint.fromBech32('asset1rjklcrnsdzqp65wjgrg55sy9723kw09mlgvlc3');

const fingerprintHash = assetFingerprint.hash();
const prefix = assetFingerprint.prefix();
```

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