Skip to content

Commit 5a950c2

Browse files
committed
docs(readme): improve intro
1 parent 99a5c5c commit 5a950c2

2 files changed

Lines changed: 43 additions & 37 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Thanks for your interest! Contributions are very welcome.
44

55
Below you'll find the conventions we're trying to follow. Of course, please feel free to send PRs to improve these guidelines too.
66

7+
## Design Goals
8+
9+
This library should provide the primitives needed to hack on Bitcoin and Bitcoin-related ideas.
10+
11+
1. **flexible** - Consumers should be able to import only the functionality they need
12+
2. **simple** - Functions should be simple and return one type
13+
3. **portable** – All code should work on every platform (no Node.js bindings or separate browser versions)
14+
715
## Design Guidelines
816

917
- **start small, compose** - Compose larger functions from their smallest possible components.
@@ -14,7 +22,7 @@ Below you'll find the conventions we're trying to follow. Of course, please feel
1422
- **don't overvalue historical names** - Many Bitcoin implementations make imprecise (and even misleading) naming choices for historical reasons. We make little effort to match the type/function names of other Bitcoin implementations; names should be chosen to improve clarity.
1523
- **don't add package dependencies** - This library should be as simple and stable as possible. Generally, if something is hard enough to warrant bringing in a dependency, it's something this library should provide. (Can you compile and expose a WASM version?)
1624

17-
## Some practical details
25+
## Some Practical Details
1826

1927
- **accept `readonly`, return mutable** - We should always return mutable types to allow consumers the option of mutating results without running afoul of type-checking. For the same reason, when we accept a value, we should always accept it as `readonly` for maximum flexibility.
2028
- **use `eslint-disable-next-line` or `eslint-disable-line`** - It's ok to disable eslint; in some cases, rules should be disabled every time they're hit (e.g. `no-bitwise`). By using single-line disables, we clearly mark intentional deviations from our conventions.

README.md

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,22 @@
55

66
# Libauth
77

8-
A flexible, strongly-typed, FP-inspired, highly-portable, typescript bitcoin library.
8+
**An ultra-lightweight JavaScript library for Bitcoin, Bitcoin Cash, and Bitauth applications.**
99

10-
## Work in Progress
10+
Libauth has **no dependencies** and works in all JavaScript environments, including [Node.js](https://nodejs.org/), [Deno](https://deno.land/), and browsers.
1111

12-
While this library is under active development, current functionality is production-ready (WASM implementations of secp256k1, ripemd160, sha256, sha512, and sha1).
12+
## Purpose
1313

14-
More functionality will be exposed and stabilized in future versions.
14+
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:
1515

16-
## Design Goals
16+
- **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.
17+
- **Smaller application bundles** – Applications can import only the methods they need, eliminating the unused code (via [dead-code elimination](https://webpack.js.org/guides/tree-shaking/)).
18+
- **Better auditability** – Beyond having no dependencies of its own, Libauth's [functional programming](https://en.wikipedia.org/wiki/Functional_programming) approach makes auditing critical code easier: smaller bundles, smaller functions, and less churn between versions (fewer cascading changes to object-oriented interfaces).
19+
- **Fully-portable** – No platform-specific APIs are ever used, so the same code paths are used across all JavaScript environments (reducing the auditable "surface area" and simplifying library development).
1720

18-
This library should provide the primitives needed to [hack](http://www.paulgraham.com/gh.html) on Bitcoin and Bitcoin-related ideas.
21+
## Getting Started
1922

20-
1. **flexible** - Consumers should be able to import only the functionality they need
21-
2. **simple** - Functions should be simple and return one type
22-
3. **portable** – All code should work on every platform (no Node.js bindings or separate browser versions)
23-
24-
Please see the [Design Guidelines](.github/CONTRIBUTING.md) for more info.
25-
26-
## Usage
27-
28-
To use, simply install `libauth`:
23+
To get started, install `libauth`:
2924

3025
```sh
3126
npm install libauth
@@ -47,37 +42,38 @@ import { msgHash, pubkey, sig } from './somewhere';
4742
})();
4843
```
4944

50-
**Note**: `libauth` uses [`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt), [`WebAssembly`](https://developer.mozilla.org/en-US/docs/WebAssembly), and 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.
51-
52-
To include the necessary TypeScript library files in you application, add `"lib": ["es2017", "esnext.bigint", "dom"]` to your `tsconfig.json`.
45+
**Note**: `libauth` uses [`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt), [`WebAssembly`](https://developer.mozilla.org/en-US/docs/WebAssembly), and `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 `tsconfig.json`.
5346

54-
## API
47+
## Stable API
5548

5649
The following APIs are considered stable, and will only include breaking changes in major version upgrades.
5750

58-
[**API Documentation →**](https://bitauth.github.io/libauth/)
51+
### WebAssembly ECDSA & Schnorr
5952

60-
### ECDSA
53+
- [instantiateSecp256k1](https://libauth.org/globals.html#instantiatesecp256k1)
54+
- [Secp256k1 Interface](https://libauth.org/interfaces/secp256k1.html)
6155

62-
- [instantiateSecp256k1](https://bitauth.github.io/libauth/globals.html#instantiatesecp256k1)
63-
- [Secp256k1 Interface](https://bitauth.github.io/libauth/interfaces/secp256k1.html)
56+
### WebAssembly Hashing Functions
6457

65-
### Hashing Functions
66-
67-
- [instantiateRipemd160](https://bitauth.github.io/libauth/globals.html#instantiateripemd160)
68-
- [Ripemd160 Interface](https://bitauth.github.io/libauth/interfaces/ripemd160.html)
69-
- [instantiateSha1](https://bitauth.github.io/libauth/globals.html#instantiatesha1)
70-
- [Sha1 Interface](https://bitauth.github.io/libauth/interfaces/sha1.html)
71-
- [instantiateSha256](https://bitauth.github.io/libauth/globals.html#instantiatesha256)
72-
- [Sha256 Interface](https://bitauth.github.io/libauth/interfaces/sha256.html)
73-
- [instantiateSha512](https://bitauth.github.io/libauth/globals.html#instantiatesha512)
74-
- [Sha512 Interface](https://bitauth.github.io/libauth/interfaces/sha512.html)
58+
- [instantiateRipemd160](https://libauth.org/globals.html#instantiateripemd160)
59+
- [Ripemd160 Interface](https://libauth.org/interfaces/ripemd160.html)
60+
- [instantiateSha1](https://libauth.org/globals.html#instantiatesha1)
61+
- [Sha1 Interface](https://libauth.org/interfaces/sha1.html)
62+
- [instantiateSha256](https://libauth.org/globals.html#instantiatesha256)
63+
- [Sha256 Interface](https://libauth.org/interfaces/sha256.html)
64+
- [instantiateSha512](https://libauth.org/globals.html#instantiatesha512)
65+
- [Sha512 Interface](https://libauth.org/interfaces/sha512.html)
7566

7667
### Unstable APIs
7768

78-
The master branch of this repo also contains new, potentially unstable APIs. As these APIs stabilize, they will be included in the above Stable APIs.
69+
Libauth also exports new, potentially unstable APIs. As these APIs stabilize, they will be included in the above reference.
70+
71+
[**Full API Documentation →**](https://libauth.org/)
7972

80-
## Contributing
73+
---
74+
75+
<details>
76+
<summary><strong>Contributing</strong></summary>
8177

8278
Pull Requests welcome! Please see [`CONTRIBUTING.md`](.github/CONTRIBUTING.md) for details.
8379

@@ -100,7 +96,7 @@ Then try running the test suite:
10096
yarn test
10197
```
10298

103-
You can also run the benchmarks (this may take a while):
99+
You can also run the benchmarks (this will take a while):
104100

105101
```sh
106102
yarn bench
@@ -119,3 +115,5 @@ For more information about the available package scripts, run:
119115
```sh
120116
yarn run info
121117
```
118+
119+
</details>

0 commit comments

Comments
 (0)