File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ class ECPair {
16
16
constructor ( __D , __Q , options ) {
17
17
this . __D = __D ;
18
18
this . __Q = __Q ;
19
+ this . lowR = false ;
19
20
if ( options === undefined ) options = { } ;
20
21
this . compressed =
21
22
options . compressed === undefined ? true : options . compressed ;
@@ -33,8 +34,9 @@ class ECPair {
33
34
if ( ! this . __D ) throw new Error ( 'Missing private key' ) ;
34
35
return wif . encode ( this . network . wif , this . __D , this . compressed ) ;
35
36
}
36
- sign ( hash , lowR = false ) {
37
+ sign ( hash , lowR ) {
37
38
if ( ! this . __D ) throw new Error ( 'Missing private key' ) ;
39
+ if ( lowR === undefined ) lowR = this . lowR ;
38
40
if ( lowR === false ) {
39
41
return ecc . sign ( hash , this . __D ) ;
40
42
} else {
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ export interface SignerAsync {
36
36
export interface ECPairInterface extends Signer {
37
37
compressed : boolean ;
38
38
network : Network ;
39
+ lowR : boolean ;
39
40
privateKey ?: Buffer ;
40
41
toWIF ( ) : string ;
41
42
verify ( hash : Buffer , signature : Buffer ) : boolean ;
@@ -44,12 +45,14 @@ export interface ECPairInterface extends Signer {
44
45
class ECPair implements ECPairInterface {
45
46
compressed : boolean ;
46
47
network : Network ;
48
+ lowR : boolean ;
47
49
48
50
constructor (
49
51
private __D ?: Buffer ,
50
52
private __Q ?: Buffer ,
51
53
options ?: ECPairOptions ,
52
54
) {
55
+ this . lowR = false ;
53
56
if ( options === undefined ) options = { } ;
54
57
this . compressed =
55
58
options . compressed === undefined ? true : options . compressed ;
@@ -73,8 +76,9 @@ class ECPair implements ECPairInterface {
73
76
return wif . encode ( this . network . wif , this . __D , this . compressed ) ;
74
77
}
75
78
76
- sign ( hash : Buffer , lowR : boolean = false ) : Buffer {
79
+ sign ( hash : Buffer , lowR ? : boolean ) : Buffer {
77
80
if ( ! this . __D ) throw new Error ( 'Missing private key' ) ;
81
+ if ( lowR === undefined ) lowR = this . lowR ;
78
82
if ( lowR === false ) {
79
83
return ecc . sign ( hash , this . __D ) ;
80
84
} else {
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export interface SignerAsync {
20
20
export interface ECPairInterface extends Signer {
21
21
compressed : boolean ;
22
22
network : Network ;
23
+ lowR : boolean ;
23
24
privateKey ?: Buffer ;
24
25
toWIF ( ) : string ;
25
26
verify ( hash : Buffer , signature : Buffer ) : boolean ;
@@ -29,6 +30,7 @@ declare class ECPair implements ECPairInterface {
29
30
private __Q ?;
30
31
compressed : boolean ;
31
32
network : Network ;
33
+ lowR : boolean ;
32
34
constructor ( __D ?: Buffer | undefined , __Q ?: Buffer | undefined , options ?: ECPairOptions ) ;
33
35
readonly privateKey : Buffer | undefined ;
34
36
readonly publicKey : Buffer ;
You can’t perform that action at this time.
0 commit comments