Skip to content

Latest commit

 

History

History
597 lines (342 loc) · 36 KB

CHANGELOG.md

File metadata and controls

597 lines (342 loc) · 36 KB

@bitauth/libauth

3.0.0

Major Changes

Minor Changes

Patch Changes

  • #127 e5c275f Thanks @bitjson! - generateRandomBytes: always verify unique results across two runs

    Fixes #119. Old behavior is available at generateRandomBytesUnchecked.

2.1.0

Minor Changes

Patch Changes

2.0.0

Libauth is now a pure ESM package, simplifying the developer experience by allowing WASM crypto to be instantiated internally/automatically by default 🎉. This refactor also simplifies the usage of and types surrounding Libauth virtual machines and compilers, and several other APIs have been improved.

New, dedicated Telegram channels are also available for Libauth release announcements and Libauth developer discussions.

Simplified Virtual Machine Types

Previously, Libauth VMs were very strictly-typed such that error messages and opcodes used chain-specific enums (e.g. AuthenticationErrorBCH and OpcodesBCH). While this configuration did ensure that VMs and VM results were strictly-typed with chain information, the configuration ultimately made library components much harder to remix without deep knowledge of TypeScript's type system. In both cases, such type information rarely catches downstream implementation bugs:

  • Differing opcode enums effectively only narrow the real-time type from number to 0 | 1 | 2 | ... | 254 | 255.
  • Differing error enums only offer a slight benefit in making error matching slightly simpler, and they present a significant disadvantage in that they preclude the contextualization of errors – each error string must be fully defined at compile time.

In both cases, the differing types offer only very marginal benefit at the cost of exceptional added complexity (widespread proliferation of generic types throughout the codebase). This refactor migrates the opcode type to number and the error type to string | undefined, leaving the opcode and error enums primarily as a form of documentation.

Simplified VM Usage

Transaction validation infrastructure is now a part of each VM instance, so transaction validation is as simple as vm.verify({ transaction, sourceOutputs }) (returning either true or an error string). This behavior offers individual VMs full control of transaction parsing and validation, allowing Libauth VMs to implement proposals for significant modifications like new transaction formats or high-level transaction validation changes.

Simplified VM Operations and Instruction Sets

Beginning with this version, Libauth will no longer maintain support for defunct VM versions. For example, BCH_2019_05 was an upgrade which enabled Schnorr signature support in CHECKSIG and CHECKDATASIG and a clean-stack exception for SegWit recovery. The BCH_2019_05 VM was replaced without a network split by the BCH_2019_11 upgrade, meaning BCH_2019_05 is no longer in use by any public network. As such, relevant code paths, flags, and other VM-specific functionality for BCH_2019_05 has been removed to simplify currently supported Libauth VMs. (Of course, historical implementations will always remain available in previously-released versions of Libauth.)

With this change, the existing VM implementations have been significantly simplified, removing unused code and reducing type complexity. Built-in VM instruction sets are now specified in a single file, making them easier to review and copy.

Additional Changes

Several other improvements have been made:

  • Default crypto interface instances – because Libauth is now pure ESM, all of Libauth's WebAssembly cryptography implementations can now be automatically instantiated internally by the library. All Libauth methods that require crypto now use these automatically-instantiated implementations by default (as a default parameter), but consumers can opt-out of the behavior by providing a replacement implementation (and build tools that support dead code elimination/tree shaking of default parameters can automatically drop the unused crypto implementations.) To support this functionality, the parameter ordering of many functions have been modified to shift crypto implementations to the end (as optional parameters).
  • Secp256k1 doesn't throw - the Secp256k1 interface previously threw errors, breaking from Libauth's convention of well-typed errors. All Secp256k1 methods now return error messages as strings where applicable.
  • CashAssembly – is the new name for Bitauth Templating Language (BTL), the simple language used within Libauth templates.
  • Consistent capitalization, miscellaneous corrections – some exports have been renamed to consistently use camelCase (for functions) or PascalCase (for types/interfaces), respectively. Several exports have been renamed for discoverability and consistency with other exports.
  • Expanded state available to VMs and compilers – VM and compiler operations can now access all raw contents of transactions and source outputs.
  • Expanded capabilities of template scenarios – scenarios can now represent any transaction shape and generate full, serializable transactions.
  • New VM bytecode test vector generation – Libauth includes a new vmb_tests test vector generation system to produce sets of cross-implementation test vectors as serialized transactions; this allows for sets of test vectors that fully test all transaction validation infrastructure without making assumptions about implementation internals.
  • Improved CashAddress utilities – cash address utilities no longer require enums, hash lengths are measured in bytes rather than bits, and type is distinguished from typeBit.
  • More consistent encoding/decoding utilities – Several decoding methods have been renamed and refactored to use the new ReadPosition API.
  • More consistent error handling – all possible errors are surfaced in type signatures as strings.

2.0.0 (2024-01-12)

⚠ BREAKING CHANGES

  • exposes script source compilations in ResolvedScript and renames authenticationTemplate -> walletTemplate

Features

  • key generation utilities, utf8 normalization, API improvements (5ad6520)

1.19.1 (2022-02-01)

Bug Fixes

  • secp256k1: prevent vulnerabilities in consumers which don't validate input lengths (7fc75c9)

2.0.0-alpha.8 (2023-01-10)

2.0.0-alpha.7 (2022-12-08)

Features

  • add dust and duplicate outpoint validation, vmb tests to BCH_2023 VM (01587f7)
  • token signing serialization support (compiler, VM, tests) (9dfa6cc)

Bug Fixes

  • add token support to legacy transaction generation API (#104) (e718430)
  • update schemas (5742b12)

2.0.0-alpha.6 (2022-08-18)

⚠ BREAKING CHANGES

  • Several decoding methods have been renamed and refactored to use the new ReadPosition API.

Features

  • support CashTokens (8e99139)
  • support decoding error messages, support token prefixes (fd9b4d2)
  • support token-aware CashAddresses (5ee0fff)

2.0.0-alpha.5 (2022-06-27)

⚠ BREAKING CHANGES

  • Binary literals are now compiled as bytes rather than numbers.

Features

  • improve VM errors, correct binary literals, add vmb_tests (e146a94)

2.0.0-alpha.4 (2022-06-16)

⚠ BREAKING CHANGES

  • cash address utilities no longer require enums, hash lengths are measured in bytes rather than bits, and type is distinguished from typeBit

Features

  • add hash160, hash256, and encodeLockingBytecode* utils (c2a787c)

  • simplify cash address utilities (be45abd)

2.0.0-alpha.3 (2022-05-20)

Features

  • add hash160, hash256, and encodeLockingBytecode* utils (c2a787c)

2.0.0-alpha.2 (2022-05-19)

2.0.0-alpha.1 (2022-05-19)

Features

  • improve BCH VMB tests, add basic P2PKH utils, export more aliases (087de5a)

Bug Fixes

  • rename format utils for consistency, improve vmb_tests, fix issues in BCH vm (6f2e782)

2.0.0-alpha.0 (2022-05-14)

⚠ BREAKING CHANGES

  • requires esm, modifies some crypto interfaces, renames many exports for consistency, expands the program state available to vms and compilers

Features

  • switch to pure esm, simplify types, simplify crypto, update vms and compiler (c80044f), closes #31 #53 #72

Bug Fixes

  • clarify endianness of outpointTransactionHash around library (04c8c52)

1.19.0 (2021-12-08)

Features

  • expose validatePublicKey method on secp256k1 (#83) (0f84420)

1.18.1 (2021-02-26)

Bug Fixes

  • refactor binToBigIntUint64LE to support safari (#71) (d41f3cc)

1.18.0 (2021-02-11)

Features

  • add Int16LE and Int32LE bin <-> Number utilities (60c6580), closes #66

Bug Fixes

  • make bigIntToBinUint64LE compatible with Safari (a884702), closes #70 #69

1.17.3 (2020-10-23)

1.17.2 (2020-09-15)

1.17.1 (2020-08-08)

Bug Fixes

  • OP_REVERSEBYTES: clone stack item before reversing (071f9cd)

1.17.0 (2020-08-07)

Features

  • add support for OP_REVERSEBYTES to BCH VM (965bd6f), closes #56

Bug Fixes

  • update current BCH instruction set (d0bff0c)

1.16.0 (2020-07-21)

Features

  • scenarios: support "pushed" and "invalid" properties (a38544a)

1.15.4 (2020-07-14)

1.15.3 (2020-06-19)

1.15.2 (2020-06-19)

1.15.1 (2020-06-19)

1.15.0 (2020-06-18)

Features

  • compiler: add support for scenarios, binary literals, numeric separators, p2sh transformation, (17bfd1e)
  • add compileBtl, more locktime utils (7657647)
  • add serialization contents to compiler output and vm state (8592e9b)
  • add transaction generation support, increase compiler coverage (2225f4b)
  • improve authentication template validation, improve types (9fbec21)
  • compiler: add built-in support for P2SH (d7ba2ef)
  • compiler: add HdKey support to the compiler (0412caf)
  • transaction: report missing variables during compilation (9eee817)

Bug Fixes

  • compiler: better error messages for cyclical compilations (4bbd1bd)
  • compiler: require evaluations to return exactly one stack item (86c4c19)
  • parseBytesAsScriptNumber: accept options as an object (8a73752)

1.14.2 (2020-03-30)

Bug Fixes

  • deriveHdPrivateNodeFromSeed: account for validity in return type (90848d9)

1.14.1 (2020-03-29)

1.14.0 (2020-03-29)

Features

  • add support for BIP32 HD keys and node derivation (c047e55)
  • WIF: add support for Wallet Import Format (WIF) (87cfb6f)
  • add locking bytecode <-> address utilities (2117181)
  • Base58Address: add support for the Base58Address format (84cc241)
  • format: add base58 support (9dec946)

Bug Fixes

  • binToBigIntUintLE: use only BigInts internally (3842373)
  • format: fix locktime format utilities, improve tests (58b2f73)
  • format: utils -> format, fix number formatting methods and tests (3901ce6)
  • stringify: improve types to get full coverage (c4359d5)

1.13.0 (2020-03-06)

Features

  • hmac: add HMAC support (HMAC-SHA256 and HMAC-SHA512) (27d08b0)
  • key: add generatePrivateKey method (ccd26dc)

1.12.0 (2020-02-07)

Features

  • base64: improve base64 utils, tests, and docs (ac9d3e0)
  • CashAddress: add support for CashAddress encoding, decoding, and error-correction (85f640f)
  • utils: add time-related utils (e2c95d1)

Bug Fixes

  • address: export address in lib (93e6d99)
  • imports: clean up imports, expose bitcoin-abc-utils (312c667)
  • vm: avoid throwing on undefined unlocking bytecode, add tests (339f1e5), closes #41

1.11.1 (2019-11-22)

Bug Fixes

  • compiler: make correspondingOutput optional (in case it doesn't exist) (1803848)

Tests

  • reduce wasm memory needed for tests (43c833c)

1.11.0 (2019-11-22)

Features

  • use preimages instead of hashes in VM, add preimage components to compiler (8949d5b)

1.10.0 (2019-11-21)

Features

  • compiler: add signing_serialization.covered_bytecode_prefix to operations (8989592)

1.9.0 (2019-11-21)

Features

  • compiler: add built-in variables (d68aea4)

Tests

  • add tests for utf8 utils (0f73587)

1.8.2 (2019-11-15)

Bug Fixes

  • compiler: stringify error messages inside resolved scripts (d147c75)
  • parser: fix crash on improper negative BigIntLiterals, e.g. "42-" (5547ee7)

1.8.1 (2019-11-12)

Bug Fixes

  • compiler: avoid crash if 0th sample is the error (06d86d8)

1.8.0 (2019-11-12)

Bug Fixes

Features

  • compiler: add source property to ResolvedSegmentScriptBytecode (74d8625)

1.7.1 (2019-11-05)

Bug Fixes

  • types: export ResolvedSegment types (830d63e)

1.7.0 (2019-11-05)

Features

  • compiler: include source type in all bytecode resolve segments (754ae88)

1.6.7 (2019-11-05)

Bug Fixes

  • parser: make whitespace optional between recognized parsers (1f28d29)

1.6.6 (2019-11-02)

Bug Fixes

  • compiler: use CompilerKeyOperationsMinimal by default (0d27b48)

1.6.5 (2019-11-01)

1.6.4 (2019-11-01)

1.6.3 (2019-10-31)

Bug Fixes

  • compiler: only attempt to return bytecode on successful compilations (a987d54)

Build System

  • deps: bump lodash.merge from 4.6.1 to 4.6.2 (#35) (fbd038d)
  • deps: bump lodash.template from 4.4.0 to 4.5.0 (#36) (0cffd2f)
  • deps: bump mixin-deep from 1.3.1 to 1.3.2 (#34) (c5c835f)
  • scripts: add watch:module-only task (8ae64fe)

1.6.2 (2019-10-30)

Bug Fixes

  • parser: fix several parser bugs, add parseScript tests (bf56ea9)

1.6.1 (2019-10-30)

Bug Fixes

  • AuthenticationTemplate: add $schema as optional field on AuthenticationTemplate (875cc11)

Build System

  • package: switch typings from main to module build (bccab5f)

1.6.0 (2019-10-30)

Bug Fixes

  • compiler: correct use of "a" vs. "an" in error messages (4892685)

Build System

  • hashes: pin sha256 of rustup docker image (98b2a13)

Features

  • add JSON schema for authentication templates (f054757)

1.5.5 (2019-08-23)

Bug Fixes

  • opCheckMultiSig: fix potential undefined public key (dda926a)
  • sampledEvaluateReductionTraceNodes: allow empty scripts to be debugged properly (f6f8347)

1.5.4 (2019-08-21)

Bug Fixes

  • compiler: allow empty programs to be compiled (41275c0)

1.5.3 (2019-08-20)

Bug Fixes

  • module: include parsimmon in module build (eab7b87)

1.5.2 (2019-08-20)

Tests

  • stringify: improve docs, add tests (f599364)

1.5.1 (2019-08-15)

Bug Fixes

1.5.0 (2019-08-15)

Features

  • auth: complete BCH auth vm, schnorr, and BTL compiler (7d917e4)
  • auth: draft authentication-related APIs (c9fdf8e)

1.4.0 (2018-11-12)

Bug Fixes

  • secp256k1: Finalize implementation for tweak functions, compile new WASM (7726bae)
  • secp256k1: prettier (54e20a5)

Features

  • secp256k1: Add public and private key tweaking functions (bcc639e)
  • secp256k1: export tweak methods (f763916)

1.3.0 (2018-10-04)

Features

  • secp256k1: add recoverable ECDSA signature support (#13) (ae03dd4)

1.2.0 (2018-07-08)

Features

  • utils: export common utility functions for working with libauth (0124a2e)

1.1.1 (2018-06-27)

1.1.0 (2018-06-27)

Features

  • hashes: expose WebAssembly sha256, sha512, and sha1 implementations (797f738)
  • ripemd160: add a purely-functional, incremental, rust ripemd160 implementation (b7f4e37)
  • ripemd160: expose a purely-functional, WebAssembly ripemd160 implementation (315bf23)
  • ripemd160: include a rust ripemd160 implementation (792a01c)
  • sha256: include a rust sha256 implementation (76d8a30)

1.0.3 (2018-06-04)

1.0.2 (2018-06-04)

Bug Fixes

  • Secp256k1: copy the underlying buffer when returning values from Secp256k1 (62bfe06)

1.0.1 (2018-05-29)

Bug Fixes

  • package: allow consumers to install libauth with npm (e7a0c37)

1.0.0 (2018-05-29)

Features

  • secp256k1Wasm: expose a WebAssembly version of libsecp256k1 (31f768e)