# ecc-messaging-scheme-package

> A system that encrypts and decrypts data packets with the elliptic curve cryptography (ECC) for others to utilize and download.

Latest version **1.0.12** (published 2022-05-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install ecc-messaging-scheme-package
pnpm add ecc-messaging-scheme-package
yarn add ecc-messaging-scheme-package
bun add ecc-messaging-scheme-package
```

## 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 | 1.0.12 |
| Published | 2022-05-05 |
| First published | 2022-04-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 29.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Vibhavi Peiris |
| Maintainers | jmc529, vibexcv |

## Links

- npm: https://www.npmjs.com/package/ecc-messaging-scheme-package
- Repository: https://github.com/ECC-Messaging/ECC-Messaging-Scheme-Package
- Homepage: https://github.com/ECC-Messaging/ECC-Messaging-Scheme-Package#readme
- Issues: https://github.com/ECC-Messaging/ECC-Messaging-Scheme-Package/issues
- npm.io page: https://npm.io/package/ecc-messaging-scheme-package

## Dependencies (4)

- [aes-js](https://npm.io/package/aes-js.md) ^3.1.2
- [js-cookie](https://npm.io/package/js-cookie.md) ^3.0.1
- [bigint-serialiser](https://npm.io/package/bigint-serialiser.md) ^1.0.0
- [simple-js-ec-math](https://npm.io/package/simple-js-ec-math.md) ^2.0.1

## Recent versions

- 1.0.12 (latest) — 2022-05-05
- 1.0.11 — 2022-04-29
- 1.0.10 — 2022-04-29
- 1.0.9 — 2022-04-29
- 1.0.8 — 2022-04-28
- 1.0.7 — 2022-04-28
- 1.0.6 — 2022-04-28
- 1.0.5 — 2022-04-27
- 1.0.4 — 2022-04-27
- 1.0.3 — 2022-04-27
- 1.0.2 — 2022-04-27
- 1.0.1 — 2022-04-27
- 1.0.0 — 2022-04-20

## README

# ECC-Messaging-Scheme-Package
A system that encrypts and decrypts data packets with the elliptic curve cryptography (ECC) for others
to utilize and download.

## Where to download:
### typescript/javascript
https://www.npmjs.com/package/ecc-messaging-scheme-package

### Python
https://pypi.org/project/ecc-messaging-scheme-package/


## Classes
We have one main class, ECCM class, which combines our ECC class and our Encrypt/Decrypt, and
curve initialization(initializePublicEnv) functions.

The ECC Class:
-  Responsible for generating/loading private key
-  Get current users public key from cookies or create a new one and save
-  Gets shared key using diffie hellman when given another users public key
-  Clear cookies containing private key for current instance.

Encrypt/Decrypt:
-  Given a key and text it encrypts/decrypts text using AES

initializePublicEnv function:
-  Inizalites a point and an ecc curve: secp256k1

ECCM class:
-  Main interface for users
-  Users can initialize curve
-  Get shared keys
-  Run encryption/decryption using ECCDH

## Examples:

How to instaciate a ECC object. This creates a randomly generate private key for each user and is store in their cookies.
The main param is a uuid string.
```
let ecc1 = new ECCM("1");
let ecc2 = new ECCM("2");
```

This is how you get a users public key and access the x coordinate.
```
ecc1.ECC.getPublicKey();
console.log(ecc1.ECC.getPublicKey()['x'])
```

This is how you create a point, when you already have a previsouly generated external keys

```
let randomKey = new ecc_math.ModPoint(
  58245954963044076335222193032419637688317373475605757277584156718458924469103n,
  12764036181290433088658499435961200322530176588733628912045896254235383420282n
);
```

Given another key this is how you generate a shared key

```
ecc2.generateSharedKey(randomKey);
console.log(ecc2.ECC.getSharedKey())
```

Finally once the shared key is set you can encrypt and decrypt as follows:
```
const cipher = ecc2.encrypt("It's working")
console.log(cipher);
console.log(ecc2.decrypt(cipher));
```

# Disclaimer
Use at Your Own Risk.

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