Skip to content

Commit 73bf983

Browse files
committed
Provide typescript declarations
1 parent 85b631b commit 73bf983

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ https://github.com/bitcoinjs/ecpair/issues/13
44
https://github.com/bitcoinjs/ecpair/pull/11
55
https://github.com/bitcoinjs/tiny-secp256k1/issues/91
66
https://github.com/bitcoinjs/tiny-secp256k1/issues/84#issuecomment-1210013688
7+
Test this: https://github.com/spsina/bip47
78
-->
89

910
# Secp256k1

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "@bitcoinerlab/secp256k1",
33
"homepage": "https://bitcoinerlab.com/secp256k1",
4-
"version": "1.0.1",
4+
"version": "1.0.2",
55
"description": "A library for performing elliptic curve operations on the secp256k1 curve. It is designed to integrate into the BitcoinJS & BitcoinerLAB ecosystems and uses the audited noble-secp256k1 library. It is compatible with environments that do not support WASM, such as React Native.",
66
"main": "dist/index.js",
7+
"types": "types/index.d.ts",
78
"scripts": {
89
"build": "rollup -c --bundleConfigAsCjs",
910
"prepublishOnly": "npm run build && npm test",

types/index.d.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
interface XOnlyPointAddTweakResult {
2+
parity: 1 | 0;
3+
xOnlyPubkey: Uint8Array;
4+
}
5+
6+
export declare function isPoint(p: Uint8Array): boolean;
7+
export declare function isPointCompressed(p: Uint8Array): boolean;
8+
export declare function isXOnlyPoint(p: Uint8Array): boolean;
9+
export declare function isPrivate(d: Uint8Array): boolean;
10+
export declare function pointAdd(pA: Uint8Array, pB: Uint8Array, compressed?: boolean): Uint8Array | null;
11+
export declare function pointAddScalar(p: Uint8Array, tweak: Uint8Array, compressed?: boolean): Uint8Array | null;
12+
export declare function pointCompress(p: Uint8Array, compressed?: boolean): Uint8Array;
13+
export declare function pointFromScalar(d: Uint8Array, compressed?: boolean): Uint8Array | null;
14+
export declare function xOnlyPointFromScalar(d: Uint8Array): Uint8Array;
15+
export declare function xOnlyPointFromPoint(p: Uint8Array): Uint8Array;
16+
export declare function pointMultiply(p: Uint8Array, tweak: Uint8Array, compressed?: boolean): Uint8Array | null;
17+
export declare function privateAdd(d: Uint8Array, tweak: Uint8Array): Uint8Array | null;
18+
export declare function privateSub(d: Uint8Array, tweak: Uint8Array): Uint8Array | null;
19+
export declare function privateNegate(d: Uint8Array): Uint8Array;
20+
export interface XOnlyPointAddTweakResult {
21+
parity: 1 | 0;
22+
xOnlyPubkey: Uint8Array;
23+
}
24+
export declare function xOnlyPointAddTweak(p: Uint8Array, tweak: Uint8Array): XOnlyPointAddTweakResult | null;
25+
export declare type TweakParity = 1 | 0;
26+
export declare function xOnlyPointAddTweakCheck(point: Uint8Array, tweak: Uint8Array, resultToCheck: Uint8Array, tweakParity?: TweakParity): boolean;
27+
export declare function sign(h: Uint8Array, d: Uint8Array, e?: Uint8Array): Uint8Array;
28+
export interface RecoverableSignature {
29+
signature: Uint8Array;
30+
recoveryId: RecoveryIdType;
31+
}
32+
export declare function signRecoverable(h: Uint8Array, d: Uint8Array, e?: Uint8Array): RecoverableSignature;
33+
export declare function signSchnorr(h: Uint8Array, d: Uint8Array, e?: Uint8Array): Uint8Array;
34+
export declare function verify(h: Uint8Array, Q: Uint8Array, signature: Uint8Array, strict?: boolean): boolean;
35+
export declare type RecoveryIdType = 0 | 1 | 2 | 3;
36+
export declare function recover(h: Uint8Array, signature: Uint8Array, recoveryId: RecoveryIdType, compressed?: boolean): Uint8Array | null;
37+
export declare function verifySchnorr(h: Uint8Array, Q: Uint8Array, signature: Uint8Array): boolean;
38+

0 commit comments

Comments
 (0)