1.0.4 • Published 9 months ago

@andgohq/cassl v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

CASSL: Configurable Authenticated Secret Sharing Library

Now internal usage only.

Supported platform: NodeJs Supported mode: MAC-SSS, SMAC-SSS, SSS, SSS-MAC, SSS-SMAC

Install

npm install @andgohq/cassl

Usage

import { split, combine, genKeyPair } from "@andgohq/cassl";

const MODE = "MAC-SSS";
const data = Buffer.from("hello, world", "utf8");
const keyPair = genKeyPair();

// split data into 5 shares, 3 of them are required to recover the data
const shares = split(MODE, data, 5, 3, keyPair.publicKey);
// combine 3 shares to recover the data
const recovered = combine(MODE, shares.slice(0, 3), keyPair.secretKey).toString(
  "utf8"
);

console.log(recovered === "hello, world"); // true

Key Pair

In the above, we used genKeyPair(). Alternatevely, we can also generate key pair using openssl.

openssl genpkey -algorithm x25519 -out x25519-priv.pem
openssl pkey -in x25519-priv.pem -pubout -out x25519-pub.pem

After that, we can import the pem file. In NodeJs, we can use crypto.createPrivateKey() and crypto.createPublicKey() to import the pem file.

Note that the x25519 algorithm is not supported by the openssl version shipped with macOS.

Development

# install dependencies
npm install

# test
npm run test

# build
npm run build

# publish
npm publish
1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

0.0.9

9 months ago

0.0.8

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago