# bubichain-encryption-nodejs

> bubichain-encryption

Latest version **4.0.1** (published 2021-09-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install bubichain-encryption-nodejs
pnpm add bubichain-encryption-nodejs
yarn add bubichain-encryption-nodejs
bun add bubichain-encryption-nodejs
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.1 |
| Published | 2021-09-21 |
| First published | 2021-09-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 193.1 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | bubichain |
| Maintainers | hunan36 |
| Keywords | bubichain, bubichain-encryption |

## Links

- npm: https://www.npmjs.com/package/bubichain-encryption-nodejs
- npm.io page: https://npm.io/package/bubichain-encryption-nodejs

## Dependencies (3)

- [sjcl](https://npm.io/package/sjcl.md) ^1.0.7
- [crypto-js](https://npm.io/package/crypto-js.md) ^3.1.9-1
- [is-type-of](https://npm.io/package/is-type-of.md) ^1.2.0

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 4.0.1 (latest) — 2021-09-21

## README

bubichain-encryption-nodejs
=======

bubichain-encryption Sub module of [bubichain-sdk-js]().

## bubichain-encryption-nodejs  Installation
```
npm install bubichain-encryption-nodejs --save
```

## bubichain-encryption-nodejs  Test
```
npm test
```

## bubichain-encryption-nodejs  Usage

```js
'use strict';

const encryption = require('bubichain-encryption-nodejs');

const KeyPair = encryption.keypair;
const signature = encryption.signature;
const keystore = encryption.keystore;

let kp = new KeyPair();
// Get encPrivateKey, encPublicKey, address
let encPrivateKey = kp.getEncPrivateKey();
let encPublicKey = kp.getEncPublicKey();
let address = kp.getAddress();


console.log('============= bof: ==============');
console.log(`EncPrivateKey is : ${encPrivateKey}`);
console.log(`EncPublicKey is : ${encPublicKey}`);
console.log(`Address hash is : ${address}`);
console.log('============= eof: ==============');

// Get keypair
let keypair = KeyPair.getKeyPair();

// Get encPublicKey
let encPublicKey = KeyPair.getEncPublicKey(encPrivateKey);

// Get address
let address = KeyPair.getAddress(encPublicKey);

// check encPrivateKey
KeyPair.checkEncPrivateKey(encPrivateKey);

// check encPublicKey
KeyPair.checkEncPublicKey(encPublicKey);

// check address
KeyPair.checkAddress(address);

// signature sign and verify
let sign = signature.sign('test', encPrivateKey);
let verify = signature.verify('test', sign, encPublicKey);

// keystore
keystore.encrypt(encPrivateKey, 'test', function(encData) {
  keystore.decrypt(encData, 'test', function(descData) {
    console.log(descData);
  });
});

```

## License

[MIT](LICENSE)

---
_Source: https://npm.io/package/bubichain-encryption-nodejs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
