Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Javascript bindings for the sss secret sharing library using WASM

License

NotificationsYou must be signed in to change notification settings

3box/sss-wasm

Repository files navigation

Shamir secret sharing is an algorithm for splitting data into multipleshares, a subset of which can then be combined to reconstruct the original secret. This library aims to provide javascript bindings fordsprenkles/sss implementation of this algorithm using Web Assembly.

Background

Currently there are bindings for sss in node.js. However this code will not run in the browser since it uses node binaries. By using Web Assembly it is possible to create a javascript library that works both in the browser as well as node.js.

Usage

// Import the sss libraryimport*assssfrom'sss-wasm'// Create a buffer for the data that will be shared (must be 64 bytes long)constdata=newUint8Array(64);data.fill(0x42);constamount=5;constthreshold=4;// Creating 5 shares (need 3 to restore)constshares=awaitsss.createShares(data,amount,threshold);// For demonstrational purpose, lose one of the sharesconstnewShares=[shares[3],shares[2],shares[4],shares[0]]// Restore the original secretconstrestored=awaitsss.combineShares(newShares);// Dump the original secret back to the screenconsole.log(restored)

Build

We need Emscripten toolchain installed to build wasm.More info

You need to setup submodules first.

git submodules initgit submodules updatecd sssgit submodules initgit submodules update

Then go to the root folder.

npm installnpm run buildnpm run test

About

Javascript bindings for the sss secret sharing library using WASM

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp