-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from paulmillr/micro
v2.0: massively reduce library size, remove features
- Loading branch information
Showing
21 changed files
with
6,341 additions
and
1,915 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "build", | ||
"private": true, | ||
"version": "1.0.0", | ||
"description": "Builds minified file", | ||
"main": "noble-secp256k1.js", | ||
"scripts": { | ||
"terser": "terser --ecma 2020 -m -c < ../index.js" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"terser": "5.16.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
export declare const CURVE: { | ||
a: bigint; | ||
d: bigint; | ||
P: bigint; | ||
l: bigint; | ||
n: bigint; | ||
h: number; | ||
Gx: bigint; | ||
Gy: bigint; | ||
}; | ||
declare type Bytes = Uint8Array; | ||
declare type Hex = Bytes | string; | ||
declare type PubKey = Hex | Point; | ||
interface AffinePoint { | ||
x: bigint; | ||
y: bigint; | ||
} | ||
declare class Point { | ||
readonly ex: bigint; | ||
readonly ey: bigint; | ||
readonly ez: bigint; | ||
readonly et: bigint; | ||
constructor(ex: bigint, ey: bigint, ez: bigint, et: bigint); | ||
static readonly BASE: Point; | ||
static readonly ZERO: Point; | ||
static fromAffine(p: AffinePoint): Point; | ||
get x(): bigint; | ||
get y(): bigint; | ||
eql(other: Point): boolean; | ||
neg(): Point; | ||
dbl(): Point; | ||
add(other: Point): Point; | ||
sub(p: Point): Point; | ||
mul(n: bigint, safe?: boolean): Point; | ||
multiply(scalar: bigint): Point; | ||
clearCofactor(): Point; | ||
isSmallOrder(): boolean; | ||
isTorsionFree(): boolean; | ||
aff(): AffinePoint; | ||
static fromHex(hex: Hex, strict?: boolean): Point; | ||
toRawBytes(): Bytes; | ||
toHex(): string; | ||
} | ||
export declare const ExtendedPoint: typeof Point; | ||
declare type Sha512FnSync = undefined | ((...messages: Bytes[]) => Bytes); | ||
declare type ExtK = { | ||
head: Bytes; | ||
prefix: Bytes; | ||
scalar: bigint; | ||
point: Point; | ||
pointBytes: Bytes; | ||
}; | ||
export declare const getPublicKeyAsync: (priv: Hex) => Promise<Bytes>; | ||
export declare const getPublicKey: (priv: Hex) => Bytes; | ||
export declare const signAsync: (msg: Hex, privKey: Hex) => Promise<Bytes>; | ||
export declare const sign: (msg: Hex, privKey: Hex) => Bytes; | ||
export declare const verifyAsync: (sig: Hex, msg: Hex, pubKey: PubKey) => Promise<boolean>; | ||
export declare const verify: (sig: Hex, msg: Hex, pubKey: PubKey) => boolean; | ||
export declare const etc: { | ||
bytesToHex: (b: Bytes) => string; | ||
hexToBytes: (hex: string) => Bytes; | ||
concatBytes: (...arrs: Bytes[]) => Uint8Array; | ||
mod: (a: bigint, b?: bigint) => bigint; | ||
invert: (num: bigint, md?: bigint) => bigint; | ||
randomBytes: (len: number) => Bytes; | ||
sha512Async: (...messages: Bytes[]) => Promise<Bytes>; | ||
sha512Sync: Sha512FnSync; | ||
}; | ||
export declare const utils: { | ||
getExtendedPublicKeyAsync: (priv: Hex) => Promise<ExtK>; | ||
getExtendedPublicKey: (priv: Hex) => ExtK; | ||
precompute(p: Point, w?: number): Point; | ||
randomPrivateKey: () => Bytes; | ||
}; | ||
export {}; |
Oops, something went wrong.