Explore API Reference »
Libauth is designed to be flexible, lightweight, and easily auditable. Rather than providing a single, overarching, object-oriented API, all functionality is composed from simple functions. This has several benefits:
- Flexibility – Even highly-complex functionality is built-up from simpler functions. These lower-level functions can be used to experiment, tweak, and remix your own higher-level methods without maintaining a fork of the library.
- Smaller application bundles – Applications can import only the methods they need, eliminating the unused code (via dead-code elimination).
- Better auditability – Beyond having no dependencies of its own, Libauth's functional programming approach makes auditing critical code easier: smaller bundles, smaller functions, and less churn between versions (fewer cascading changes to object-oriented interfaces).
To get started, install
npm install @bitauth/libauth# ORyarn add @bitauth/libauth
And import the functionality you need:
es2017 features for some functionality. While support is required to use this functionality (Node.js v10 LTS or later), other parts of the library will continue to work in older environments. To include the necessary TypeScript library files in you application, add
"lib": ["es2017", "esnext.bigint", "dom"] to your
Using with Deno
Deno is a great runtime for quickly working with Libauth. You can import from the latest module build:
The following APIs are considered stable, and will only include breaking changes in major version upgrades.
WebAssembly ECDSA & Schnorr
WebAssembly Hashing Functions
- Ripemd160 Interface
- Sha1 Interface
- Sha256 Interface
- Sha512 Interface
Libauth also exports new, potentially unstable APIs. As these APIs stabilize, they will be included in the above reference.
Pull Requests welcome! Please see
CONTRIBUTING.md for details.
This library requires Yarn for development. If you don't have Yarn, make sure you have
Node.js installed (which ships with
npm), then run
npm install -g yarn. Once Yarn is installed:
# use --recursive to clone the secp256k1 submodulegit clone --recursive https://github.com/bitauth/libauth.git && cd libauth
Install the development dependencies:
Then try running the test suite:
You can also run the benchmarks (this will take a while):
During development, you may find it helpful to use the testing
yarn watch # rebuild everything on saveyarn watch:test # run only the fast testsyarn watch:test-slow # test everything
For more information about the available package scripts, run:
yarn run info