Elliptic Curve Integrated Encryption Scheme for secp256k1 in TypeScript
Installations
npm install eciesjscb
Score
26.6
Supply Chain
98.3
Quality
74.2
Maintenance
100
Vulnerability
99.6
License
Releases
Unable to fetch releases
Contributors
Developer
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
17.0.1
NPM Version
8.1.0
Statistics
528 Commits
1 Forks
1 Watching
1 Branches
2 Contributors
Updated on 30 Jun 2022
Languages
TypeScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
605
Last day
-50%
1
Compared to previous day
Last week
-66.7%
2
Compared to previous week
Last month
800%
9
Compared to previous month
Last year
-11%
121
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
4
Dev Dependencies
9
eciesjs
Elliptic Curve Integrated Encryption Scheme for secp256k1 in TypeScript.
This is the JavaScript/TypeScript version of eciespy with a built-in class-like secp256k1 API, you may go there for detailed documentation and learn the mechanism under the hood.
If you want a WASM version to run directly in modern browsers or on some blockchains, check ecies-wasm
.
Install
1npm install eciesjs
Quick Start
Run the code below with npx ts-node
.
1> import { encrypt, decrypt, PrivateKey } from 'eciesjs' 2> const k1 = new PrivateKey() 3> const data = Buffer.from('this is a test') 4> decrypt(k1.toHex(), encrypt(k1.publicKey.toHex(), data)).toString() 5'this is a test'
API
encrypt(receiverRawPK: string | Buffer, msg: Buffer): Buffer
Parameters:
- receiverRawPK - Receiver's secp256k1 public key, hex string or buffer
- msg - Data to encrypt
Returns: Buffer
decrypt(receiverRawSK: string | Buffer, msg: Buffer): Buffer
Parameters:
- receiverRawSK - Receiver's secp256k1 private key, hex string or buffer
- msg - Data to decrypt
Returns: Buffer
PrivateKey
- Methods
1static fromHex(hex: string): PrivateKey; 2constructor(secret?: Buffer); 3toHex(): string; 4encapsulate(pub: PublicKey): Buffer; 5multiply(pub: PublicKey): Buffer; 6equals(other: PrivateKey): boolean;
- Properties
1readonly secret: Buffer; 2readonly publicKey: PublicKey;
PublicKey
- Methods
1static fromHex(hex: string): PublicKey; 2constructor(buffer: Buffer); 3toHex(compressed?: boolean): string; 4decapsulate(priv: PrivateKey): Buffer; 5equals(other: PublicKey): boolean;
- Properties
1readonly uncompressed: Buffer; 2readonly compressed: Buffer;
Release Notes
0.3.1 ~ 0.3.15
- Support Node 18
- Drop Node 10, 12 support
- Bump dependencies
- Update documentation
- Extract constant variables and rename some parameters
0.3.0
- API change:
encrypt/decrypt
now can take both hexstring
andBuffer
0.2.0
- API change: use
HKDF-sha256
to derive shared keys instead ofsha256
- Bump dependencies
- Update documentation
0.1.1 ~ 0.1.5
- Bump dependencies
- Update documentation
0.1.0
- First beta version release
No vulnerabilities found.
No security vulnerabilities found.