Skip to content

Commit 5ad6520

Browse files
committed
feat: key generation utilities, utf8 normalization, API improvements
BREAKING CHANGE: exposes script source compilations in ResolvedScript and renames authenticationTemplate -> walletTemplate
1 parent 406aa29 commit 5ad6520

File tree

215 files changed

+39285
-10201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+39285
-10201
lines changed

.cspell.json

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,26 @@
33
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json",
44
"language": "en",
55
"words": [
6+
"activatable",
67
"ACTIVEBYTECODE",
8+
"airgapped",
9+
"altstack",
710
"Amagi",
811
"ANYONECANPAY",
912
"asmcrypto",
1013
"auditability",
1114
"auditable",
15+
"authbase",
16+
"authbases",
17+
"authchain",
18+
"authchains",
19+
"authhead",
1220
"BCHCHIPs",
1321
"bchn",
1422
"bchreg",
1523
"bchtest",
24+
"bcmr",
1625
"bcoin",
17-
"bcrypto",
1826
"bech",
1927
"benchmarkjs",
2028
"bigint",
@@ -31,6 +39,7 @@
3139
"camelcase",
3240
"cashaddr",
3341
"CASHTOKENS",
42+
"Chaingraph",
3443
"CHECKDATASIG",
3544
"CHECKDATASIGVERIFY",
3645
"CHECKLOCKTIMEVERIFY",
@@ -39,6 +48,7 @@
3948
"CHECKSEQUENCEVERIFY",
4049
"CHECKSIG",
4150
"CHECKSIGVERIFY",
51+
"chipnet",
4252
"chuhai",
4353
"codecov",
4454
"codepoint",
@@ -47,8 +57,11 @@
4757
"combinator",
4858
"combinators",
4959
"convertbits",
60+
"corepack",
61+
"counterparties",
5062
"cyclomatic",
5163
"Datacarrier",
64+
"DDTHH",
5265
"deno",
5366
"deserialization",
5467
"deserialize",
@@ -65,15 +78,18 @@
6578
"esnext",
6679
"FORKID",
6780
"FROMALTSTACK",
81+
"gitter",
6882
"GREATERTHAN",
6983
"GREATERTHANOREQUAL",
7084
"HMAC",
7185
"IFDUP",
86+
"IIFE",
7287
"INPUTBYTECODE",
7388
"INPUTINDEX",
7489
"INPUTSEQUENCENUMBER",
7590
"Ints",
7691
"INVALIDOPCODE",
92+
"ipfs",
7793
"LESSTHAN",
7894
"LESSTHANOREQUAL",
7995
"libauth",
@@ -90,8 +106,10 @@
90106
"Merkle",
91107
"minification",
92108
"MINIMALIF",
109+
"MITM",
93110
"monospace",
94111
"multisig",
112+
"Nakamoto",
95113
"NONFUNGIBLE",
96114
"nops",
97115
"NOTIF",
@@ -121,6 +139,9 @@
121139
"PUBKEYS",
122140
"PUSHBYTES",
123141
"PUSHDATA",
142+
"rebranded",
143+
"rebranding",
144+
"redenominated",
124145
"regtest",
125146
"reversebytes",
126147
"ripemd",
@@ -133,15 +154,18 @@
133154
"seckey",
134155
"secp",
135156
"secp256k1",
157+
"sidechain",
136158
"sigchecks",
137159
"sighash",
138160
"skippable",
139161
"SMALLINTEGER",
162+
"Spedn",
140163
"STACKTOP",
141164
"standardness",
142165
"statelessly",
143166
"STATICTOP",
144167
"submodule",
168+
"substack",
145169
"templating",
146170
"testnet",
147171
"TOALTSTACK",
@@ -171,10 +195,14 @@
171195
"wasm",
172196
"wbindgen",
173197
"webassembly",
198+
"wechat",
199+
"XAMPL",
174200
"xprivkey",
175201
"xprv",
176202
"xpub",
177203
"xpubkey",
204+
"yarnpkg",
205+
"ZDTC",
178206
"𒂼𒄄"
179207
],
180208
"flagWords": [],
@@ -193,9 +221,5 @@
193221
"pattern": "/:[qpzry9x8gf2tvdw0s3jn54khce6mua7l]+/g"
194222
}
195223
],
196-
"ignoreRegExpList": [
197-
"Base64",
198-
"HexValues",
199-
"cash-address-format"
200-
]
224+
"ignoreRegExpList": ["Base64", "HexValues", "cash-address-format"]
201225
}

.eslintrc

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,16 @@
33
"parser": "@typescript-eslint/parser",
44
"parserOptions": { "project": "./tsconfig.json" },
55
"env": { "es6": true },
6-
"ignorePatterns": ["node_modules", "build", "coverage"],
6+
"ignorePatterns": [
7+
"node_modules",
8+
"build",
9+
"coverage",
10+
"src/lib/schema/ajv/*.js"
11+
],
712
"extends": ["bitauth"],
8-
"globals": { "BigInt": true, "console": true, "WebAssembly": true },
13+
// "globals": { "BigInt": true, "console": true, "WebAssembly": true },
914
"rules": {
10-
"@typescript-eslint/prefer-readonly-parameter-types": "off", // TODO: enable when Uint8Array can be made readonly, see `Immutable` type
11-
"@typescript-eslint/no-unused-expressions": "off", // TODO: bug causes crash in eslint 7.2.0 – re-enable later
12-
"@typescript-eslint/naming-convention": [
13-
"error",
14-
{
15-
"selector": "default",
16-
"format": ["camelCase"],
17-
"leadingUnderscore": "allow"
18-
},
19-
{
20-
"selector": "variable",
21-
"format": ["camelCase", "UPPER_CASE"],
22-
"leadingUnderscore": "allow"
23-
},
24-
{ "selector": "typeLike", "format": ["PascalCase"] },
25-
{ "selector": "enumMember", "format": ["camelCase", "UPPER_CASE"] } // Allow UPPER_CASE for opcodes
26-
],
27-
"import/no-internal-modules": ["error"],
28-
"import/extensions": ["error", "always"]
15+
"@typescript-eslint/no-unsafe-enum-comparison": "off"
2916
},
3017
"overrides": [
3118
/*
@@ -47,9 +34,11 @@
4734
]
4835
}
4936
],
50-
"functional/no-expression-statement": "off",
5137
"@typescript-eslint/naming-convention": "off",
5238
"@typescript-eslint/no-magic-numbers": "off",
39+
"functional/no-expression-statements": "off",
40+
"functional/no-conditional-statements": "off",
41+
"functional/functional-parameters": "off",
5342
"functional/immutable-data": "off",
5443
"functional/no-return-void": "off"
5544
}

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This library should provide the primitives needed to hack on bitcoin and bitcoin
2424

2525
## Some Practical Details
2626

27-
- **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.
27+
- **accept immutable, 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 generally avoid mutating it.
2828
- **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.
2929
- **avoid Hungarian notation & name prefixing** – Including the type of a variable in its name is a code smell: a name should clearly describe only one concept, and types are the business of the type system. Likewise, using prefixes to distinguish between an interface and an instance typically indicates the concepts should be simplified. E.g. `IChecker` and `Checker` – this is likely made unnecessarily complex to accommodate an object-oriented style. Consider replacing with a single function (or if instantiation is required, an object containing only stateless functions).
3030
- **don't throw things** – instead, return a result that can be either a success or error type. This strategy encourages a more functional approach to problems, and pragmatically, [TypeScript does not yet offer a `throws` clause or otherwise](https://github.com/microsoft/TypeScript/issues/13219), so only this strategy allows errors to be well-typed. A good pattern is `() => string | ResultType`, where ResultType is the desired output, and error messages are returned as a string. Consumers can easily use `typeof result === 'string'` to narrow the resulting type. When errors are more complex or `ResultType` is also a string, use an object with a `success` property, e.g. `() => { success: true, bytecode: Uint8Array } | { success: false, errors: ErrorType[] }`.

.github/workflows/benchmark.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99
deployments: write
1010

1111
concurrency:
12-
group: "benchmarks"
12+
group: 'benchmarks'
1313
cancel-in-progress: true
1414

1515
jobs:
@@ -19,15 +19,15 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v3
2121
with:
22-
submodules: 'true'
22+
submodules: 'true'
2323
- name: Setup node
2424
uses: actions/setup-node@v3
2525
with:
26-
node-version: 16
26+
node-version: 20
2727
- name: Run benchmark
28-
run: yarn && yarn bench
29-
30-
# TODO: Libauth-only benchmarks: test for performance regressions in Libauth functionality, format results to work with the below configuration
28+
run: yarn && yarn playwright install && yarn bench
29+
30+
# TODO: Libauth-only benchmarks: test for performance regressions in Libauth functionality, format results to work with the below configuration
3131

3232
# - name: Push benchmark result to gh-pages
3333
# uses: benchmark-action/github-action-benchmark@3d3bca03e83647895ef4f911fa57de3c7a391aaf

.github/workflows/ci.yaml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@ name: Lint, Build, and Test Libauth
22
on: [push, pull_request]
33

44
jobs:
5-
65
build-and-test:
76
runs-on: ubuntu-latest
87
strategy:
98
matrix:
10-
node: [ 16 ]
9+
node: [18, latest]
1110
name: Test Node ${{ matrix.node }}
1211
steps:
13-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1413
with:
15-
submodules: 'true'
16-
- name: Setup node
17-
uses: actions/setup-node@v3
14+
submodules: 'recursive'
15+
- name: Install Node.js
16+
uses: actions/setup-node@v4
1817
with:
1918
node-version: ${{ matrix.node }}
2019
- run: yarn install --immutable --immutable-cache
@@ -24,14 +23,14 @@ jobs:
2423
runs-on: ubuntu-latest
2524
strategy:
2625
matrix:
27-
node: [ 18 ]
26+
node: [20]
2827
name: Test Node ${{ matrix.node }}
2928
steps:
30-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
3130
with:
32-
submodules: 'true'
33-
- name: Setup node
34-
uses: actions/setup-node@v3
31+
submodules: 'recursive'
32+
- name: Install Node.js
33+
uses: actions/setup-node@v4
3534
with:
3635
node-version: ${{ matrix.node }}
3736
- run: yarn install --immutable --immutable-cache
@@ -43,11 +42,11 @@ jobs:
4342
runs-on: ubuntu-latest
4443
steps:
4544
- name: Check out repository code
46-
uses: actions/checkout@v3
45+
uses: actions/checkout@v4
4746
with:
48-
submodules: 'true'
47+
submodules: 'recursive'
4948
- name: Install Node.js
50-
uses: actions/setup-node@v3
49+
uses: actions/setup-node@v4
5150
with:
52-
node-version: '18'
51+
node-version: '20'
5352
- run: yarn install --immutable --immutable-cache --check-cache

.github/workflows/doc.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111
id-token: write
1212

1313
concurrency:
14-
group: "pages"
14+
group: 'pages'
1515
cancel-in-progress: true
1616

1717
jobs:
@@ -21,11 +21,11 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v3
2323
with:
24-
submodules: 'true'
24+
submodules: 'true'
2525
- name: Setup node
2626
uses: actions/setup-node@v3
2727
with:
28-
node-version: 18
28+
node-version: 20
2929
- name: Prepare dependencies
3030
run: yarn
3131
- name: Generate Docs

.gitmodules

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
path = wasm/secp256k1
33
url = https://github.com/bitauth/libauth-secp256k1.git
44
branch = libauth
5+
shallow = true
56
[submodule ".yarn"]
67
path = .yarn
78
url = https://github.com/bitauth/libauth-dependencies.git
8-
shallow = true
9+
shallow = true
10+
[submodule "config/eslint-config-bitauth"]
11+
path = config/eslint-config-bitauth
12+
url = https://github.com/bitauth/eslint-config-bitauth/
13+
shallow = true

0 commit comments

Comments
 (0)