0.0.7 • Published 2 years ago

@fresh-js/crypto v0.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

Fresh Crypto

:warning: This package is a work in progress and has not yet been vetted for production use.

The @fresh-js/crypto package provides JavaScript cryptographic utilities needed to manage keys, sign transactions and verify signatures for the Flow blockchain.

Functionality

Currently this package only supports ECDSA key generation and signing on the NIST P-256 and secp25k1 curves, using either SHA2 or SHA3 hashing.

Install

npm i @fresh-js/crypto

Usage Examples

Sign a message

Sign a message with a P-256 private key and SHA3 hashing:

import { HashAlgorithm, InMemoryECPrivateKey, InMemoryECSigner, SignatureAlgorithm } from '@fresh-js/crypto';

const PRIVATE_KEY_HEX = 'xxxx';
  
const privateKey = InMemoryECPrivateKey.fromHex(PRIVATE_KEY_HEX, SignatureAlgorithm.ECDSA_P256);
const signer = new InMemoryECSigner(privateKey, HashAlgorithm.SHA3_256);

const message = Buffer.from("deadbeef", "hex");

const signature = signer.sign(message);
0.0.7

2 years ago

0.0.6

2 years ago

0.0.3

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago