5.0.0-rc.2 • Published 5 months ago

antelope-ecc v5.0.0-rc.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

antelope ecc logo

Antelope ECC

NPM Package CI status License: MIT

A lightweight (~6 KB) universal JavaScript digital signature and cryptokey utilty package for Antelope based blockchains.

About

antelope-ecc package is designed as an ESM (ECMAScript Module), leveraging modern JavaScript features like static imports, exports, and tree-shaking.

Requirements

Supported runtime environments:

Installation

For Node.js, to install antelope-ecc run:

npm i antelope-ecc

Ways to import in ESM

import { sign } from "antelope-ecc"; // Tree shaking capabilities.

As default exports

import AntelopeECC from "antelope-ecc";

Ways to require/import in Common JS

const AntelopeECC = import("antelope-ecc");
AntelopeECC.then(({ sign }) => {
  // As import is async
});

Sign a message digest.

import { sign } from "anteope-ecc";
import { createHash } from "crypto";

await sign({
  hash: createHash("sha256")
    .update(Uint8Array.from([1, 2, 3, 4, 5]))
    .digest()
    .toString("hex"), // Uint8Array | string
  wif_private_key: "PVT_K1_43…",
}).then(console.log);

The logged output will be SIG_K1…

An example of how to create a pair keys.

import { new_keys } from "antelope-ecc";

new_keys().then(console.log);

The logged output will be an object containing PUB_K1 and PVT_K1 wif keys.

Recover public key from signature.

import { recover_public_key } from "antelope-ecc";

const hash = Uint8Array.from(
  crypto.createHash("sha256").update(Buffer.from("ff", "hex")).digest()
); // Data signed with private key

recover_public_key({
  signature: "SIG_K1_…",
  hash,
}).then(console.log);

The logged output will contain the public key “PUB_K1…” used to sign the hash.

Exports

ECMAScript modules deep exports are avaialble via package.json field exports:

5.0.0-rc.1

5 months ago

5.0.0-rc.2

5 months ago

4.1.0-rc.1

5 months ago

4.0.6

5 months ago

4.0.5

5 months ago

4.0.4

5 months ago

4.0.3

5 months ago

4.0.2

5 months ago

4.0.3-rc.0

5 months ago

4.0.1

6 months ago

4.0.0

6 months ago

3.0.1

8 months ago

2.0.0-rc.13

1 year ago

2.0.0-rc.11

2 years ago

2.0.0-rc.12

2 years ago

2.0.0-rc.10

2 years ago

2.0.0-rc.2

2 years ago

2.0.0-rc.3

2 years ago

2.0.0-rc.4

2 years ago

2.0.0-rc.5

2 years ago

1.1.0-rc.7

2 years ago

1.1.0-rc.6

2 years ago

1.1.0-rc.9

2 years ago

2.0.0-rc.1

2 years ago

1.1.0-rc.8

2 years ago

1.1.0-rc.5

2 years ago

1.1.0-rc.4

2 years ago

2.0.0-rc.6

2 years ago

2.0.0-rc.7

2 years ago

2.0.0-rc.8

2 years ago

2.0.0-rc.9

2 years ago

1.1.0-rc.3

2 years ago

1.1.0-rc.2

2 years ago

1.1.0-rc.1

2 years ago

1.0.0

2 years ago

1.0.0-rc.1

2 years ago