2.0.1 • Published 1 year ago
@herajs/crypto v2.0.1
Multi-purpose javascript crypto library for aergo
It is used by Aergo dapps to manage keys and sign transactions offline.
Features:
- Key generation and importing
- Hashing
- Signing
- Simple AES-GCM encryption
How to use
npm install --save @herajs/crypto
Transaction signing
import { createIdentity, signTransaction, hashTransaction } from '@herajs/crypto';
async () => {
const identity = createIdentity();
const tx = {
nonce: 1,
from: identity.address,
to: identity.address,
amount: '100 aer',
payload: '',
};
tx.sign = await signTransaction(tx, identity.keyPair);
tx.hash = await hashTransaction(tx);
console.log(JSON.stringify(tx));
}()
Arbitrary message signing
import { createIdentity, signMessage, verifySignature, publicKeyFromAddress } from '@herajs/crypto';
async () => {
const identity = createIdentity();
const msg = Buffer.from('hello');
const signature = await signMessage(msg, identity.keyPair);
const pubkey = publicKeyFromAddress(identity.address);
const check = await verifySignature(msg, pubkey, signature);
console.log(check);
}()
2.0.1
1 year ago
2.0.0
1 year ago
1.2.1
2 years ago
1.1.0
2 years ago
1.0.0
2 years ago
0.21.0
4 years ago
0.20.5
4 years ago
0.20.0
4 years ago
0.19.4
4 years ago
0.19.0
4 years ago
0.18.1
4 years ago
0.18.2
4 years ago
0.18.0
4 years ago
0.17.1
4 years ago
0.17.0
4 years ago
0.16.1
4 years ago
0.16.0
4 years ago
0.15.0
4 years ago
0.14.0
4 years ago
0.13.4
5 years ago
0.13.3
5 years ago
0.13.2
5 years ago
0.13.1
5 years ago
0.13.0
5 years ago
0.12.0
5 years ago
0.11.0
5 years ago
0.10.5
5 years ago
0.10.4
5 years ago
0.10.3
5 years ago
0.10.2
5 years ago
0.10.1
5 years ago
0.5.0
5 years ago
0.4.2
5 years ago
0.4.1
5 years ago
0.4.0
5 years ago
0.3.1
5 years ago
0.3.0
5 years ago
0.2.0
5 years ago
0.1.0
5 years ago
0.0.5
5 years ago
0.0.4
5 years ago
0.0.3
5 years ago
0.0.2
5 years ago
0.0.1
6 years ago