Skip to content

Commit d0c460f

Browse files
committed
New jsbt, new ts target, noble-hashes beta for tests
1 parent 72ab301 commit d0c460f

14 files changed

+271
-243
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
types: [created]
55
jobs:
66
release-js:
7-
name: 'jsbt v0.4.0' # Should match commit below
8-
uses: paulmillr/jsbt/.github/workflows/release.yml@3b4712c94bff7a5da5c968f783292061e81b218c
7+
name: 'jsbt v0.4.1'
8+
uses: paulmillr/jsbt/.github/workflows/release.yml@2318b9efe24831b4bd4cadf720c96f071c69c64d
99
with:
1010
build-path: test/build
1111
# slow-types: false

.github/workflows/test-js-polyfill.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/test-js.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Run tests
1+
name: Run JS tests
22
on:
33
- push
44
- pull_request
55
jobs:
66
test-js:
7-
name: 'jsbt v0.4.0' # Should match commit below
8-
uses: paulmillr/jsbt/.github/workflows/test-js.yml@3b4712c94bff7a5da5c968f783292061e81b218c
7+
name: 'jsbt v0.4.1'
8+
uses: paulmillr/jsbt/.github/workflows/test-js.yml@2318b9efe24831b4bd4cadf720c96f071c69c64d
99
# with:
1010
# submodules: false

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ Only async methods are available by default, to keep the library dependency-free
6666
To enable sync methods:
6767

6868
```ts
69-
import { hmac } from '@noble/hashes/hmac';
70-
import { sha256 } from '@noble/hashes/sha256';
69+
import { hmac } from '@noble/hashes/hmac.js';
70+
import { sha256 } from '@noble/hashes/sha2.js';
7171
secp.etc.hmacSha256Sync = (k, ...m) => hmac(sha256, k, secp.etc.concatBytes(...m));
7272
```
7373

7474
### React Native: polyfill getRandomValues and sha512
7575

7676
```ts
7777
import 'react-native-get-random-values';
78-
import { hmac } from '@noble/hashes/hmac';
79-
import { sha256 } from '@noble/hashes/sha256';
78+
import { hmac } from '@noble/hashes/hmac.js';
79+
import { sha256 } from '@noble/hashes/sha2.js';
8080
secp.etc.hmacSha256Sync = (k, ...m) => hmac(sha256, k, secp.etc.concatBytes(...m));
8181
secp.etc.hmacSha256Async = (k, ...m) => Promise.resolve(secp.etc.hmacSha256Sync(k, ...m));
8282
```

index.d.ts

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* secp256k1 curve parameters. Equation is x³ + ax + b.
2+
* secp256k1 curve parameters. Equation is x³ + ax + b, but a=0 - which makes it x³+b.
33
* Gx and Gy are generator coordinates. p is field order, n is group order.
44
*/
55
declare const CURVE: {
@@ -32,22 +32,14 @@ export interface AffinePoint {
3232
}
3333
/** Point in 3d xyz projective coordinates. 3d takes less inversions than 2d. */
3434
declare class Point {
35+
static BASE: Point;
36+
static ZERO: Point;
3537
readonly px: bigint;
3638
readonly py: bigint;
3739
readonly pz: bigint;
3840
constructor(px: bigint, py: bigint, pz: bigint);
39-
/** Generator / base point */
40-
static readonly BASE: Point;
41-
/** Identity / zero point */
42-
static readonly ZERO: Point;
43-
/** Create 3d xyz point from 2d xy. (0, 0) => (0, 1, 0), not (0, 0, 1) */
44-
static fromAffine(p: AffinePoint): Point;
4541
/** Convert Uint8Array or hex string to Point. */
46-
static fromHex(hex: Hex): Point;
47-
/** Create point from a private key. */
48-
static fromPrivateKey(k: PrivKey): Point;
49-
get x(): bigint;
50-
get y(): bigint;
42+
static fromBytes(bytes: Bytes): Point;
5143
/** Equality check: compare points P&Q. */
5244
equals(other: Point): boolean;
5345
/** Flip point over y coordinate. */
@@ -61,16 +53,22 @@ declare class Point {
6153
*/
6254
add(other: Point): Point;
6355
mul(n: bigint, safe?: boolean): Point;
64-
mulAddQUns(R: Point, u1: bigint, u2: bigint): Point;
6556
/** Convert point to 2d xy affine point. (x, y, z) ∋ (x=x/z, y=y/z) */
66-
toAffine(): AffinePoint;
67-
/** Checks if the point is valid and on-curve. */
68-
assertValidity(): Point;
69-
multiply(n: bigint): Point;
7057
aff(): AffinePoint;
58+
/** Checks if the point is valid and on-curve. */
7159
ok(): Point;
60+
toBytes(isCompressed?: boolean): Bytes;
61+
/** Create 3d xyz point from 2d xy. (0, 0) => (0, 1, 0), not (0, 0, 1) */
62+
static fromAffine(p: AffinePoint): Point;
63+
static fromPrivateKey(k: PrivKey): Point;
64+
static fromHex(hex: Hex): Point;
65+
get x(): bigint;
66+
get y(): bigint;
67+
multiply(n: bigint): Point;
68+
toAffine(): AffinePoint;
7269
toHex(isCompressed?: boolean): string;
73-
toRawBytes(isCompressed?: boolean): Bytes;
70+
toRawBytes(c?: boolean): Bytes;
71+
assertValidity(): Point;
7472
}
7573
/** Creates 33/65-byte public key from 32-byte private key. */
7674
declare const getPublicKey: (privKey: PrivKey, isCompressed?: boolean) => Bytes;

0 commit comments

Comments
 (0)