|
1 | 1 | 'use strict';
|
2 | 2 | Object.defineProperty(exports, '__esModule', { value: true });
|
3 |
| -exports.oneOf = exports.Null = exports.BufferN = exports.Function = exports.UInt32 = exports.UInt8 = exports.tuple = exports.maybe = exports.Hex = exports.Buffer = exports.String = exports.Boolean = exports.Array = exports.Number = exports.Hash256bit = exports.Hash160bit = exports.Buffer256bit = exports.Network = exports.ECPoint = exports.Satoshi = exports.Signer = exports.BIP32Path = exports.UInt31 = exports.isPoint = exports.GROUP_ORDER = exports.EC_P = exports.ZERO32 = exports.typeforce = void 0; |
| 3 | +exports.oneOf = exports.Null = exports.BufferN = exports.Function = exports.UInt32 = exports.UInt8 = exports.tuple = exports.maybe = exports.Hex = exports.Buffer = exports.String = exports.Boolean = exports.Array = exports.Number = exports.Hash256bit = exports.Hash160bit = exports.Buffer256bit = exports.Network = exports.ECPoint = exports.Satoshi = exports.Signer = exports.BIP32Path = exports.UInt31 = exports.isPoint = exports.typeforce = void 0; |
4 | 4 | const buffer_1 = require('buffer');
|
5 | 5 | exports.typeforce = require('typeforce');
|
6 |
| -exports.ZERO32 = buffer_1.Buffer.alloc(32, 0); |
7 |
| -exports.EC_P = buffer_1.Buffer.from( |
| 6 | +const ZERO32 = buffer_1.Buffer.alloc(32, 0); |
| 7 | +const EC_P = buffer_1.Buffer.from( |
8 | 8 | 'fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f',
|
9 | 9 | 'hex',
|
10 | 10 | );
|
11 |
| -exports.GROUP_ORDER = buffer_1.Buffer.from( |
12 |
| - 'fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141', |
13 |
| - 'hex', |
14 |
| -); |
15 | 11 | function isPoint(p) {
|
16 | 12 | if (!buffer_1.Buffer.isBuffer(p)) return false;
|
17 | 13 | if (p.length < 33) return false;
|
18 | 14 | const t = p[0];
|
19 | 15 | const x = p.slice(1, 33);
|
20 |
| - if (x.compare(exports.ZERO32) === 0) return false; |
21 |
| - if (x.compare(exports.EC_P) >= 0) return false; |
| 16 | + if (x.compare(ZERO32) === 0) return false; |
| 17 | + if (x.compare(EC_P) >= 0) return false; |
22 | 18 | if ((t === 0x02 || t === 0x03) && p.length === 33) {
|
23 | 19 | return true;
|
24 | 20 | }
|
25 | 21 | const y = p.slice(33);
|
26 |
| - if (y.compare(exports.ZERO32) === 0) return false; |
27 |
| - if (y.compare(exports.EC_P) >= 0) return false; |
| 22 | + if (y.compare(ZERO32) === 0) return false; |
| 23 | + if (y.compare(EC_P) >= 0) return false; |
28 | 24 | if (t === 0x04 && p.length === 65) return true;
|
29 | 25 | return false;
|
30 | 26 | }
|
|
0 commit comments