@noble/curves 1.9.7 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +520 -505
- package/abstract/bls.d.ts +58 -120
- package/abstract/bls.d.ts.map +1 -1
- package/abstract/bls.js +108 -152
- package/abstract/bls.js.map +1 -1
- package/abstract/curve.d.ts +18 -54
- package/abstract/curve.d.ts.map +1 -1
- package/abstract/curve.js +30 -49
- package/abstract/curve.js.map +1 -1
- package/abstract/edwards.d.ts +18 -77
- package/abstract/edwards.d.ts.map +1 -1
- package/abstract/edwards.js +68 -144
- package/abstract/edwards.js.map +1 -1
- package/abstract/fft.js +14 -27
- package/abstract/fft.js.map +1 -1
- package/abstract/hash-to-curve.d.ts +35 -47
- package/abstract/hash-to-curve.d.ts.map +1 -1
- package/abstract/hash-to-curve.js +42 -46
- package/abstract/hash-to-curve.js.map +1 -1
- package/abstract/modular.d.ts +5 -17
- package/abstract/modular.d.ts.map +1 -1
- package/abstract/modular.js +170 -169
- package/abstract/modular.js.map +1 -1
- package/abstract/montgomery.d.ts +7 -12
- package/abstract/montgomery.d.ts.map +1 -1
- package/abstract/montgomery.js +22 -29
- package/abstract/montgomery.js.map +1 -1
- package/abstract/oprf.d.ts +282 -0
- package/abstract/oprf.d.ts.map +1 -0
- package/abstract/oprf.js +297 -0
- package/abstract/oprf.js.map +1 -0
- package/abstract/poseidon.d.ts.map +1 -1
- package/abstract/poseidon.js +26 -31
- package/abstract/poseidon.js.map +1 -1
- package/abstract/tower.d.ts.map +1 -1
- package/abstract/tower.js +43 -19
- package/abstract/tower.js.map +1 -1
- package/abstract/weierstrass.d.ts +77 -168
- package/abstract/weierstrass.d.ts.map +1 -1
- package/abstract/weierstrass.js +184 -389
- package/abstract/weierstrass.js.map +1 -1
- package/bls12-381.d.ts +5 -11
- package/bls12-381.d.ts.map +1 -1
- package/bls12-381.js +161 -181
- package/bls12-381.js.map +1 -1
- package/bn254.d.ts +59 -11
- package/bn254.d.ts.map +1 -1
- package/bn254.js +69 -97
- package/bn254.js.map +1 -1
- package/ed25519.d.ts +33 -48
- package/ed25519.d.ts.map +1 -1
- package/ed25519.js +147 -161
- package/ed25519.js.map +1 -1
- package/ed448.d.ts +27 -36
- package/ed448.d.ts.map +1 -1
- package/ed448.js +143 -164
- package/ed448.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +20 -4
- package/index.js.map +1 -1
- package/misc.d.ts +10 -14
- package/misc.d.ts.map +1 -1
- package/misc.js +53 -62
- package/misc.js.map +1 -1
- package/nist.d.ts +31 -16
- package/nist.d.ts.map +1 -1
- package/nist.js +75 -64
- package/nist.js.map +1 -1
- package/package.json +20 -234
- package/secp256k1.d.ts +17 -30
- package/secp256k1.d.ts.map +1 -1
- package/secp256k1.js +59 -73
- package/secp256k1.js.map +1 -1
- package/src/abstract/bls.ts +207 -354
- package/src/abstract/curve.ts +25 -84
- package/src/abstract/edwards.ts +68 -193
- package/src/abstract/hash-to-curve.ts +71 -85
- package/src/abstract/modular.ts +150 -134
- package/src/abstract/montgomery.ts +28 -35
- package/src/abstract/oprf.ts +600 -0
- package/src/abstract/poseidon.ts +6 -8
- package/src/abstract/tower.ts +0 -3
- package/src/abstract/weierstrass.ts +203 -525
- package/src/bls12-381.ts +133 -139
- package/src/bn254.ts +69 -93
- package/src/ed25519.ts +106 -133
- package/src/ed448.ts +111 -138
- package/src/index.ts +19 -3
- package/src/misc.ts +68 -51
- package/src/nist.ts +77 -70
- package/src/secp256k1.ts +46 -81
- package/src/utils.ts +67 -137
- package/src/webcrypto.ts +403 -0
- package/utils.d.ts +31 -38
- package/utils.d.ts.map +1 -1
- package/utils.js +66 -185
- package/utils.js.map +1 -1
- package/webcrypto.d.ts +99 -0
- package/webcrypto.d.ts.map +1 -0
- package/webcrypto.js +256 -0
- package/webcrypto.js.map +1 -0
- package/_shortw_utils.d.ts +0 -19
- package/_shortw_utils.d.ts.map +0 -1
- package/_shortw_utils.js +0 -20
- package/_shortw_utils.js.map +0 -1
- package/abstract/utils.d.ts +0 -78
- package/abstract/utils.d.ts.map +0 -1
- package/abstract/utils.js +0 -73
- package/abstract/utils.js.map +0 -1
- package/esm/_shortw_utils.d.ts +0 -19
- package/esm/_shortw_utils.d.ts.map +0 -1
- package/esm/_shortw_utils.js +0 -16
- package/esm/_shortw_utils.js.map +0 -1
- package/esm/abstract/bls.d.ts +0 -190
- package/esm/abstract/bls.d.ts.map +0 -1
- package/esm/abstract/bls.js +0 -408
- package/esm/abstract/bls.js.map +0 -1
- package/esm/abstract/curve.d.ts +0 -231
- package/esm/abstract/curve.d.ts.map +0 -1
- package/esm/abstract/curve.js +0 -465
- package/esm/abstract/curve.js.map +0 -1
- package/esm/abstract/edwards.d.ts +0 -243
- package/esm/abstract/edwards.d.ts.map +0 -1
- package/esm/abstract/edwards.js +0 -627
- package/esm/abstract/edwards.js.map +0 -1
- package/esm/abstract/fft.d.ts +0 -122
- package/esm/abstract/fft.d.ts.map +0 -1
- package/esm/abstract/fft.js +0 -425
- package/esm/abstract/fft.js.map +0 -1
- package/esm/abstract/hash-to-curve.d.ts +0 -102
- package/esm/abstract/hash-to-curve.d.ts.map +0 -1
- package/esm/abstract/hash-to-curve.js +0 -203
- package/esm/abstract/hash-to-curve.js.map +0 -1
- package/esm/abstract/modular.d.ts +0 -171
- package/esm/abstract/modular.d.ts.map +0 -1
- package/esm/abstract/modular.js +0 -530
- package/esm/abstract/modular.js.map +0 -1
- package/esm/abstract/montgomery.d.ts +0 -30
- package/esm/abstract/montgomery.d.ts.map +0 -1
- package/esm/abstract/montgomery.js +0 -157
- package/esm/abstract/montgomery.js.map +0 -1
- package/esm/abstract/poseidon.d.ts +0 -68
- package/esm/abstract/poseidon.d.ts.map +0 -1
- package/esm/abstract/poseidon.js +0 -296
- package/esm/abstract/poseidon.js.map +0 -1
- package/esm/abstract/tower.d.ts +0 -95
- package/esm/abstract/tower.d.ts.map +0 -1
- package/esm/abstract/tower.js +0 -714
- package/esm/abstract/tower.js.map +0 -1
- package/esm/abstract/utils.d.ts +0 -78
- package/esm/abstract/utils.d.ts.map +0 -1
- package/esm/abstract/utils.js +0 -70
- package/esm/abstract/utils.js.map +0 -1
- package/esm/abstract/weierstrass.d.ts +0 -416
- package/esm/abstract/weierstrass.d.ts.map +0 -1
- package/esm/abstract/weierstrass.js +0 -1413
- package/esm/abstract/weierstrass.js.map +0 -1
- package/esm/bls12-381.d.ts +0 -16
- package/esm/bls12-381.d.ts.map +0 -1
- package/esm/bls12-381.js +0 -705
- package/esm/bls12-381.js.map +0 -1
- package/esm/bn254.d.ts +0 -18
- package/esm/bn254.d.ts.map +0 -1
- package/esm/bn254.js +0 -214
- package/esm/bn254.js.map +0 -1
- package/esm/ed25519.d.ts +0 -106
- package/esm/ed25519.d.ts.map +0 -1
- package/esm/ed25519.js +0 -467
- package/esm/ed25519.js.map +0 -1
- package/esm/ed448.d.ts +0 -100
- package/esm/ed448.d.ts.map +0 -1
- package/esm/ed448.js +0 -459
- package/esm/ed448.js.map +0 -1
- package/esm/index.d.ts +0 -2
- package/esm/index.d.ts.map +0 -1
- package/esm/index.js +0 -17
- package/esm/index.js.map +0 -1
- package/esm/jubjub.d.ts +0 -12
- package/esm/jubjub.d.ts.map +0 -1
- package/esm/jubjub.js +0 -12
- package/esm/jubjub.js.map +0 -1
- package/esm/misc.d.ts +0 -19
- package/esm/misc.d.ts.map +0 -1
- package/esm/misc.js +0 -109
- package/esm/misc.js.map +0 -1
- package/esm/nist.d.ts +0 -21
- package/esm/nist.d.ts.map +0 -1
- package/esm/nist.js +0 -132
- package/esm/nist.js.map +0 -1
- package/esm/p256.d.ts +0 -16
- package/esm/p256.d.ts.map +0 -1
- package/esm/p256.js +0 -16
- package/esm/p256.js.map +0 -1
- package/esm/p384.d.ts +0 -16
- package/esm/p384.d.ts.map +0 -1
- package/esm/p384.js +0 -16
- package/esm/p384.js.map +0 -1
- package/esm/p521.d.ts +0 -16
- package/esm/p521.d.ts.map +0 -1
- package/esm/p521.js +0 -16
- package/esm/p521.js.map +0 -1
- package/esm/package.json +0 -4
- package/esm/pasta.d.ts +0 -10
- package/esm/pasta.d.ts.map +0 -1
- package/esm/pasta.js +0 -10
- package/esm/pasta.js.map +0 -1
- package/esm/secp256k1.d.ts +0 -89
- package/esm/secp256k1.d.ts.map +0 -1
- package/esm/secp256k1.js +0 -294
- package/esm/secp256k1.js.map +0 -1
- package/esm/utils.d.ts +0 -110
- package/esm/utils.d.ts.map +0 -1
- package/esm/utils.js +0 -322
- package/esm/utils.js.map +0 -1
- package/jubjub.d.ts +0 -12
- package/jubjub.d.ts.map +0 -1
- package/jubjub.js +0 -15
- package/jubjub.js.map +0 -1
- package/p256.d.ts +0 -16
- package/p256.d.ts.map +0 -1
- package/p256.js +0 -13
- package/p256.js.map +0 -1
- package/p384.d.ts +0 -16
- package/p384.d.ts.map +0 -1
- package/p384.js +0 -13
- package/p384.js.map +0 -1
- package/p521.d.ts +0 -16
- package/p521.d.ts.map +0 -1
- package/p521.js +0 -13
- package/p521.js.map +0 -1
- package/pasta.d.ts +0 -10
- package/pasta.d.ts.map +0 -1
- package/pasta.js +0 -13
- package/pasta.js.map +0 -1
- package/src/_shortw_utils.ts +0 -21
- package/src/abstract/utils.ts +0 -80
- package/src/jubjub.ts +0 -12
- package/src/p256.ts +0 -15
- package/src/p384.ts +0 -15
- package/src/p521.ts +0 -15
- package/src/package.json +0 -3
- package/src/pasta.ts +0 -9
package/esm/utils.js
DELETED
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hex, bytes and number utilities.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
6
|
-
import { abytes as abytes_, bytesToHex as bytesToHex_, concatBytes as concatBytes_, hexToBytes as hexToBytes_, isBytes as isBytes_, } from '@noble/hashes/utils.js';
|
|
7
|
-
export { abytes, anumber, bytesToHex, bytesToUtf8, concatBytes, hexToBytes, isBytes, randomBytes, utf8ToBytes, } from '@noble/hashes/utils.js';
|
|
8
|
-
const _0n = /* @__PURE__ */ BigInt(0);
|
|
9
|
-
const _1n = /* @__PURE__ */ BigInt(1);
|
|
10
|
-
export function abool(title, value) {
|
|
11
|
-
if (typeof value !== 'boolean')
|
|
12
|
-
throw new Error(title + ' boolean expected, got ' + value);
|
|
13
|
-
}
|
|
14
|
-
// tmp name until v2
|
|
15
|
-
export function _abool2(value, title = '') {
|
|
16
|
-
if (typeof value !== 'boolean') {
|
|
17
|
-
const prefix = title && `"${title}"`;
|
|
18
|
-
throw new Error(prefix + 'expected boolean, got type=' + typeof value);
|
|
19
|
-
}
|
|
20
|
-
return value;
|
|
21
|
-
}
|
|
22
|
-
// tmp name until v2
|
|
23
|
-
/** Asserts something is Uint8Array. */
|
|
24
|
-
export function _abytes2(value, length, title = '') {
|
|
25
|
-
const bytes = isBytes_(value);
|
|
26
|
-
const len = value?.length;
|
|
27
|
-
const needsLen = length !== undefined;
|
|
28
|
-
if (!bytes || (needsLen && len !== length)) {
|
|
29
|
-
const prefix = title && `"${title}" `;
|
|
30
|
-
const ofLen = needsLen ? ` of length ${length}` : '';
|
|
31
|
-
const got = bytes ? `length=${len}` : `type=${typeof value}`;
|
|
32
|
-
throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);
|
|
33
|
-
}
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
// Used in weierstrass, der
|
|
37
|
-
export function numberToHexUnpadded(num) {
|
|
38
|
-
const hex = num.toString(16);
|
|
39
|
-
return hex.length & 1 ? '0' + hex : hex;
|
|
40
|
-
}
|
|
41
|
-
export function hexToNumber(hex) {
|
|
42
|
-
if (typeof hex !== 'string')
|
|
43
|
-
throw new Error('hex string expected, got ' + typeof hex);
|
|
44
|
-
return hex === '' ? _0n : BigInt('0x' + hex); // Big Endian
|
|
45
|
-
}
|
|
46
|
-
// BE: Big Endian, LE: Little Endian
|
|
47
|
-
export function bytesToNumberBE(bytes) {
|
|
48
|
-
return hexToNumber(bytesToHex_(bytes));
|
|
49
|
-
}
|
|
50
|
-
export function bytesToNumberLE(bytes) {
|
|
51
|
-
abytes_(bytes);
|
|
52
|
-
return hexToNumber(bytesToHex_(Uint8Array.from(bytes).reverse()));
|
|
53
|
-
}
|
|
54
|
-
export function numberToBytesBE(n, len) {
|
|
55
|
-
return hexToBytes_(n.toString(16).padStart(len * 2, '0'));
|
|
56
|
-
}
|
|
57
|
-
export function numberToBytesLE(n, len) {
|
|
58
|
-
return numberToBytesBE(n, len).reverse();
|
|
59
|
-
}
|
|
60
|
-
// Unpadded, rarely used
|
|
61
|
-
export function numberToVarBytesBE(n) {
|
|
62
|
-
return hexToBytes_(numberToHexUnpadded(n));
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Takes hex string or Uint8Array, converts to Uint8Array.
|
|
66
|
-
* Validates output length.
|
|
67
|
-
* Will throw error for other types.
|
|
68
|
-
* @param title descriptive title for an error e.g. 'secret key'
|
|
69
|
-
* @param hex hex string or Uint8Array
|
|
70
|
-
* @param expectedLength optional, will compare to result array's length
|
|
71
|
-
* @returns
|
|
72
|
-
*/
|
|
73
|
-
export function ensureBytes(title, hex, expectedLength) {
|
|
74
|
-
let res;
|
|
75
|
-
if (typeof hex === 'string') {
|
|
76
|
-
try {
|
|
77
|
-
res = hexToBytes_(hex);
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
throw new Error(title + ' must be hex string or Uint8Array, cause: ' + e);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
else if (isBytes_(hex)) {
|
|
84
|
-
// Uint8Array.from() instead of hash.slice() because node.js Buffer
|
|
85
|
-
// is instance of Uint8Array, and its slice() creates **mutable** copy
|
|
86
|
-
res = Uint8Array.from(hex);
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
throw new Error(title + ' must be hex string or Uint8Array');
|
|
90
|
-
}
|
|
91
|
-
const len = res.length;
|
|
92
|
-
if (typeof expectedLength === 'number' && len !== expectedLength)
|
|
93
|
-
throw new Error(title + ' of length ' + expectedLength + ' expected, got ' + len);
|
|
94
|
-
return res;
|
|
95
|
-
}
|
|
96
|
-
// Compares 2 u8a-s in kinda constant time
|
|
97
|
-
export function equalBytes(a, b) {
|
|
98
|
-
if (a.length !== b.length)
|
|
99
|
-
return false;
|
|
100
|
-
let diff = 0;
|
|
101
|
-
for (let i = 0; i < a.length; i++)
|
|
102
|
-
diff |= a[i] ^ b[i];
|
|
103
|
-
return diff === 0;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Copies Uint8Array. We can't use u8a.slice(), because u8a can be Buffer,
|
|
107
|
-
* and Buffer#slice creates mutable copy. Never use Buffers!
|
|
108
|
-
*/
|
|
109
|
-
export function copyBytes(bytes) {
|
|
110
|
-
return Uint8Array.from(bytes);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols
|
|
114
|
-
* Should be safe to use for things expected to be ASCII.
|
|
115
|
-
* Returns exact same result as utf8ToBytes for ASCII or throws.
|
|
116
|
-
*/
|
|
117
|
-
export function asciiToBytes(ascii) {
|
|
118
|
-
return Uint8Array.from(ascii, (c, i) => {
|
|
119
|
-
const charCode = c.charCodeAt(0);
|
|
120
|
-
if (c.length !== 1 || charCode > 127) {
|
|
121
|
-
throw new Error(`string contains non-ASCII character "${ascii[i]}" with code ${charCode} at position ${i}`);
|
|
122
|
-
}
|
|
123
|
-
return charCode;
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
|
|
128
|
-
*/
|
|
129
|
-
// export const utf8ToBytes: typeof utf8ToBytes_ = utf8ToBytes_;
|
|
130
|
-
/**
|
|
131
|
-
* Converts bytes to string using UTF8 encoding.
|
|
132
|
-
* @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'
|
|
133
|
-
*/
|
|
134
|
-
// export const bytesToUtf8: typeof bytesToUtf8_ = bytesToUtf8_;
|
|
135
|
-
// Is positive bigint
|
|
136
|
-
const isPosBig = (n) => typeof n === 'bigint' && _0n <= n;
|
|
137
|
-
export function inRange(n, min, max) {
|
|
138
|
-
return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Asserts min <= n < max. NOTE: It's < max and not <= max.
|
|
142
|
-
* @example
|
|
143
|
-
* aInRange('x', x, 1n, 256n); // would assume x is in (1n..255n)
|
|
144
|
-
*/
|
|
145
|
-
export function aInRange(title, n, min, max) {
|
|
146
|
-
// Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)?
|
|
147
|
-
// consider P=256n, min=0n, max=P
|
|
148
|
-
// - a for min=0 would require -1: `inRange('x', x, -1n, P)`
|
|
149
|
-
// - b would commonly require subtraction: `inRange('x', x, 0n, P - 1n)`
|
|
150
|
-
// - our way is the cleanest: `inRange('x', x, 0n, P)
|
|
151
|
-
if (!inRange(n, min, max))
|
|
152
|
-
throw new Error('expected valid ' + title + ': ' + min + ' <= n < ' + max + ', got ' + n);
|
|
153
|
-
}
|
|
154
|
-
// Bit operations
|
|
155
|
-
/**
|
|
156
|
-
* Calculates amount of bits in a bigint.
|
|
157
|
-
* Same as `n.toString(2).length`
|
|
158
|
-
* TODO: merge with nLength in modular
|
|
159
|
-
*/
|
|
160
|
-
export function bitLen(n) {
|
|
161
|
-
let len;
|
|
162
|
-
for (len = 0; n > _0n; n >>= _1n, len += 1)
|
|
163
|
-
;
|
|
164
|
-
return len;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Gets single bit at position.
|
|
168
|
-
* NOTE: first bit position is 0 (same as arrays)
|
|
169
|
-
* Same as `!!+Array.from(n.toString(2)).reverse()[pos]`
|
|
170
|
-
*/
|
|
171
|
-
export function bitGet(n, pos) {
|
|
172
|
-
return (n >> BigInt(pos)) & _1n;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Sets single bit at position.
|
|
176
|
-
*/
|
|
177
|
-
export function bitSet(n, pos, value) {
|
|
178
|
-
return n | ((value ? _1n : _0n) << BigInt(pos));
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Calculate mask for N bits. Not using ** operator with bigints because of old engines.
|
|
182
|
-
* Same as BigInt(`0b${Array(i).fill('1').join('')}`)
|
|
183
|
-
*/
|
|
184
|
-
export const bitMask = (n) => (_1n << BigInt(n)) - _1n;
|
|
185
|
-
/**
|
|
186
|
-
* Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.
|
|
187
|
-
* @returns function that will call DRBG until 2nd arg returns something meaningful
|
|
188
|
-
* @example
|
|
189
|
-
* const drbg = createHmacDRBG<Key>(32, 32, hmac);
|
|
190
|
-
* drbg(seed, bytesToKey); // bytesToKey must return Key or undefined
|
|
191
|
-
*/
|
|
192
|
-
export function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
193
|
-
if (typeof hashLen !== 'number' || hashLen < 2)
|
|
194
|
-
throw new Error('hashLen must be a number');
|
|
195
|
-
if (typeof qByteLen !== 'number' || qByteLen < 2)
|
|
196
|
-
throw new Error('qByteLen must be a number');
|
|
197
|
-
if (typeof hmacFn !== 'function')
|
|
198
|
-
throw new Error('hmacFn must be a function');
|
|
199
|
-
// Step B, Step C: set hashLen to 8*ceil(hlen/8)
|
|
200
|
-
const u8n = (len) => new Uint8Array(len); // creates Uint8Array
|
|
201
|
-
const u8of = (byte) => Uint8Array.of(byte); // another shortcut
|
|
202
|
-
let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.
|
|
203
|
-
let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same
|
|
204
|
-
let i = 0; // Iterations counter, will throw when over 1000
|
|
205
|
-
const reset = () => {
|
|
206
|
-
v.fill(1);
|
|
207
|
-
k.fill(0);
|
|
208
|
-
i = 0;
|
|
209
|
-
};
|
|
210
|
-
const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values)
|
|
211
|
-
const reseed = (seed = u8n(0)) => {
|
|
212
|
-
// HMAC-DRBG reseed() function. Steps D-G
|
|
213
|
-
k = h(u8of(0x00), seed); // k = hmac(k || v || 0x00 || seed)
|
|
214
|
-
v = h(); // v = hmac(k || v)
|
|
215
|
-
if (seed.length === 0)
|
|
216
|
-
return;
|
|
217
|
-
k = h(u8of(0x01), seed); // k = hmac(k || v || 0x01 || seed)
|
|
218
|
-
v = h(); // v = hmac(k || v)
|
|
219
|
-
};
|
|
220
|
-
const gen = () => {
|
|
221
|
-
// HMAC-DRBG generate() function
|
|
222
|
-
if (i++ >= 1000)
|
|
223
|
-
throw new Error('drbg: tried 1000 values');
|
|
224
|
-
let len = 0;
|
|
225
|
-
const out = [];
|
|
226
|
-
while (len < qByteLen) {
|
|
227
|
-
v = h();
|
|
228
|
-
const sl = v.slice();
|
|
229
|
-
out.push(sl);
|
|
230
|
-
len += v.length;
|
|
231
|
-
}
|
|
232
|
-
return concatBytes_(...out);
|
|
233
|
-
};
|
|
234
|
-
const genUntil = (seed, pred) => {
|
|
235
|
-
reset();
|
|
236
|
-
reseed(seed); // Steps D-G
|
|
237
|
-
let res = undefined; // Step H: grind until k is in [1..n-1]
|
|
238
|
-
while (!(res = pred(gen())))
|
|
239
|
-
reseed();
|
|
240
|
-
reset();
|
|
241
|
-
return res;
|
|
242
|
-
};
|
|
243
|
-
return genUntil;
|
|
244
|
-
}
|
|
245
|
-
// Validating curves and fields
|
|
246
|
-
const validatorFns = {
|
|
247
|
-
bigint: (val) => typeof val === 'bigint',
|
|
248
|
-
function: (val) => typeof val === 'function',
|
|
249
|
-
boolean: (val) => typeof val === 'boolean',
|
|
250
|
-
string: (val) => typeof val === 'string',
|
|
251
|
-
stringOrUint8Array: (val) => typeof val === 'string' || isBytes_(val),
|
|
252
|
-
isSafeInteger: (val) => Number.isSafeInteger(val),
|
|
253
|
-
array: (val) => Array.isArray(val),
|
|
254
|
-
field: (val, object) => object.Fp.isValid(val),
|
|
255
|
-
hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen),
|
|
256
|
-
};
|
|
257
|
-
// type Record<K extends string | number | symbol, T> = { [P in K]: T; }
|
|
258
|
-
export function validateObject(object, validators, optValidators = {}) {
|
|
259
|
-
const checkField = (fieldName, type, isOptional) => {
|
|
260
|
-
const checkVal = validatorFns[type];
|
|
261
|
-
if (typeof checkVal !== 'function')
|
|
262
|
-
throw new Error('invalid validator function');
|
|
263
|
-
const val = object[fieldName];
|
|
264
|
-
if (isOptional && val === undefined)
|
|
265
|
-
return;
|
|
266
|
-
if (!checkVal(val, object)) {
|
|
267
|
-
throw new Error('param ' + String(fieldName) + ' is invalid. Expected ' + type + ', got ' + val);
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
for (const [fieldName, type] of Object.entries(validators))
|
|
271
|
-
checkField(fieldName, type, false);
|
|
272
|
-
for (const [fieldName, type] of Object.entries(optValidators))
|
|
273
|
-
checkField(fieldName, type, true);
|
|
274
|
-
return object;
|
|
275
|
-
}
|
|
276
|
-
// validate type tests
|
|
277
|
-
// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 };
|
|
278
|
-
// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok!
|
|
279
|
-
// // Should fail type-check
|
|
280
|
-
// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' });
|
|
281
|
-
// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });
|
|
282
|
-
// const z3 = validateObject(o, { test: 'boolean', z: 'bug' });
|
|
283
|
-
// const z4 = validateObject(o, { a: 'boolean', z: 'bug' });
|
|
284
|
-
export function isHash(val) {
|
|
285
|
-
return typeof val === 'function' && Number.isSafeInteger(val.outputLen);
|
|
286
|
-
}
|
|
287
|
-
export function _validateObject(object, fields, optFields = {}) {
|
|
288
|
-
if (!object || typeof object !== 'object')
|
|
289
|
-
throw new Error('expected valid options object');
|
|
290
|
-
function checkField(fieldName, expectedType, isOpt) {
|
|
291
|
-
const val = object[fieldName];
|
|
292
|
-
if (isOpt && val === undefined)
|
|
293
|
-
return;
|
|
294
|
-
const current = typeof val;
|
|
295
|
-
if (current !== expectedType || val === null)
|
|
296
|
-
throw new Error(`param "${fieldName}" is invalid: expected ${expectedType}, got ${current}`);
|
|
297
|
-
}
|
|
298
|
-
Object.entries(fields).forEach(([k, v]) => checkField(k, v, false));
|
|
299
|
-
Object.entries(optFields).forEach(([k, v]) => checkField(k, v, true));
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* throws not implemented error
|
|
303
|
-
*/
|
|
304
|
-
export const notImplemented = () => {
|
|
305
|
-
throw new Error('not implemented');
|
|
306
|
-
};
|
|
307
|
-
/**
|
|
308
|
-
* Memoizes (caches) computation result.
|
|
309
|
-
* Uses WeakMap: the value is going auto-cleaned by GC after last reference is removed.
|
|
310
|
-
*/
|
|
311
|
-
export function memoized(fn) {
|
|
312
|
-
const map = new WeakMap();
|
|
313
|
-
return (arg, ...args) => {
|
|
314
|
-
const val = map.get(arg);
|
|
315
|
-
if (val !== undefined)
|
|
316
|
-
return val;
|
|
317
|
-
const computed = fn(arg, ...args);
|
|
318
|
-
map.set(arg, computed);
|
|
319
|
-
return computed;
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
//# sourceMappingURL=utils.js.map
|
package/esm/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,sEAAsE;AACtE,OAAO,EACL,MAAM,IAAI,OAAO,EACjB,UAAU,IAAI,WAAW,EACzB,WAAW,IAAI,YAAY,EAC3B,UAAU,IAAI,WAAW,EACzB,OAAO,IAAI,QAAQ,GACpB,MAAM,wBAAwB,CAA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
* @deprecated
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
import { jubjub_findGroupHash, jubjub_groupHash, jubjub as jubjubn } from './misc.ts';
|
|
6
|
-
/** @deprecated use `import { jubjub } from '@noble/curves/misc.js';` */
|
|
7
|
-
export declare const jubjub: typeof jubjubn;
|
|
8
|
-
/** @deprecated use `import { jubjub_findGroupHash } from '@noble/curves/misc.js';` */
|
|
9
|
-
export declare const findGroupHash: typeof jubjub_findGroupHash;
|
|
10
|
-
/** @deprecated use `import { jubjub_groupHash } from '@noble/curves/misc.js';` */
|
|
11
|
-
export declare const groupHash: typeof jubjub_groupHash;
|
|
12
|
-
//# sourceMappingURL=jubjub.d.ts.map
|
package/jubjub.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jubjub.d.ts","sourceRoot":"","sources":["src/jubjub.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAEtF,wEAAwE;AACxE,eAAO,MAAM,MAAM,EAAE,OAAO,OAAiB,CAAC;AAC9C,sFAAsF;AACtF,eAAO,MAAM,aAAa,EAAE,OAAO,oBAA2C,CAAC;AAC/E,kFAAkF;AAClF,eAAO,MAAM,SAAS,EAAE,OAAO,gBAAmC,CAAC"}
|
package/jubjub.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.groupHash = exports.findGroupHash = exports.jubjub = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated
|
|
6
|
-
* @module
|
|
7
|
-
*/
|
|
8
|
-
const misc_ts_1 = require("./misc.js");
|
|
9
|
-
/** @deprecated use `import { jubjub } from '@noble/curves/misc.js';` */
|
|
10
|
-
exports.jubjub = misc_ts_1.jubjub;
|
|
11
|
-
/** @deprecated use `import { jubjub_findGroupHash } from '@noble/curves/misc.js';` */
|
|
12
|
-
exports.findGroupHash = misc_ts_1.jubjub_findGroupHash;
|
|
13
|
-
/** @deprecated use `import { jubjub_groupHash } from '@noble/curves/misc.js';` */
|
|
14
|
-
exports.groupHash = misc_ts_1.jubjub_groupHash;
|
|
15
|
-
//# sourceMappingURL=jubjub.js.map
|
package/jubjub.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jubjub.js","sourceRoot":"","sources":["src/jubjub.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAAsF;AAEtF,wEAAwE;AAC3D,QAAA,MAAM,GAAmB,gBAAO,CAAC;AAC9C,sFAAsF;AACzE,QAAA,aAAa,GAAgC,8BAAoB,CAAC;AAC/E,kFAAkF;AACrE,QAAA,SAAS,GAA4B,0BAAgB,CAAC"}
|
package/p256.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NIST secp256r1 aka p256.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
6
|
-
import { type H2CMethod } from './abstract/hash-to-curve.ts';
|
|
7
|
-
import { p256 as p256n } from './nist.ts';
|
|
8
|
-
/** @deprecated use `import { p256 } from '@noble/curves/nist.js';` */
|
|
9
|
-
export declare const p256: typeof p256n;
|
|
10
|
-
/** @deprecated use `import { p256 } from '@noble/curves/nist.js';` */
|
|
11
|
-
export declare const secp256r1: typeof p256n;
|
|
12
|
-
/** @deprecated use `import { p256_hasher } from '@noble/curves/nist.js';` */
|
|
13
|
-
export declare const hashToCurve: H2CMethod<bigint>;
|
|
14
|
-
/** @deprecated use `import { p256_hasher } from '@noble/curves/nist.js';` */
|
|
15
|
-
export declare const encodeToCurve: H2CMethod<bigint>;
|
|
16
|
-
//# sourceMappingURL=p256.d.ts.map
|
package/p256.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"p256.d.ts","sourceRoot":"","sources":["src/p256.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,sEAAsE;AACtE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAe,IAAI,IAAI,KAAK,EAAE,MAAM,WAAW,CAAC;AACvD,sEAAsE;AACtE,eAAO,MAAM,IAAI,EAAE,OAAO,KAAa,CAAC;AACxC,sEAAsE;AACtE,eAAO,MAAM,SAAS,EAAE,OAAO,KAAa,CAAC;AAC7C,6EAA6E;AAC7E,eAAO,MAAM,WAAW,EAAE,SAAS,CAAC,MAAM,CAAqD,CAAC;AAChG,6EAA6E;AAC7E,eAAO,MAAM,aAAa,EAAE,SAAS,CAAC,MAAM,CAAuD,CAAC"}
|
package/p256.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeToCurve = exports.hashToCurve = exports.secp256r1 = exports.p256 = void 0;
|
|
4
|
-
const nist_ts_1 = require("./nist.js");
|
|
5
|
-
/** @deprecated use `import { p256 } from '@noble/curves/nist.js';` */
|
|
6
|
-
exports.p256 = nist_ts_1.p256;
|
|
7
|
-
/** @deprecated use `import { p256 } from '@noble/curves/nist.js';` */
|
|
8
|
-
exports.secp256r1 = nist_ts_1.p256;
|
|
9
|
-
/** @deprecated use `import { p256_hasher } from '@noble/curves/nist.js';` */
|
|
10
|
-
exports.hashToCurve = (() => nist_ts_1.p256_hasher.hashToCurve)();
|
|
11
|
-
/** @deprecated use `import { p256_hasher } from '@noble/curves/nist.js';` */
|
|
12
|
-
exports.encodeToCurve = (() => nist_ts_1.p256_hasher.encodeToCurve)();
|
|
13
|
-
//# sourceMappingURL=p256.js.map
|
package/p256.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"p256.js","sourceRoot":"","sources":["src/p256.ts"],"names":[],"mappings":";;;AAMA,uCAAuD;AACvD,sEAAsE;AACzD,QAAA,IAAI,GAAiB,cAAK,CAAC;AACxC,sEAAsE;AACzD,QAAA,SAAS,GAAiB,cAAK,CAAC;AAC7C,6EAA6E;AAChE,QAAA,WAAW,GAAsC,CAAC,GAAG,EAAE,CAAC,qBAAW,CAAC,WAAW,CAAC,EAAE,CAAC;AAChG,6EAA6E;AAChE,QAAA,aAAa,GAAsC,CAAC,GAAG,EAAE,CAAC,qBAAW,CAAC,aAAa,CAAC,EAAE,CAAC"}
|
package/p384.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NIST secp384r1 aka p384.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
6
|
-
import { type H2CMethod } from './abstract/hash-to-curve.ts';
|
|
7
|
-
import { p384 as p384n } from './nist.ts';
|
|
8
|
-
/** @deprecated use `import { p384 } from '@noble/curves/nist.js';` */
|
|
9
|
-
export declare const p384: typeof p384n;
|
|
10
|
-
/** @deprecated use `import { p384 } from '@noble/curves/nist.js';` */
|
|
11
|
-
export declare const secp384r1: typeof p384n;
|
|
12
|
-
/** @deprecated use `import { p384_hasher } from '@noble/curves/nist.js';` */
|
|
13
|
-
export declare const hashToCurve: H2CMethod<bigint>;
|
|
14
|
-
/** @deprecated use `import { p384_hasher } from '@noble/curves/nist.js';` */
|
|
15
|
-
export declare const encodeToCurve: H2CMethod<bigint>;
|
|
16
|
-
//# sourceMappingURL=p384.d.ts.map
|
package/p384.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"p384.d.ts","sourceRoot":"","sources":["src/p384.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,sEAAsE;AACtE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAe,IAAI,IAAI,KAAK,EAAE,MAAM,WAAW,CAAC;AACvD,sEAAsE;AACtE,eAAO,MAAM,IAAI,EAAE,OAAO,KAAa,CAAC;AACxC,sEAAsE;AACtE,eAAO,MAAM,SAAS,EAAE,OAAO,KAAa,CAAC;AAC7C,6EAA6E;AAC7E,eAAO,MAAM,WAAW,EAAE,SAAS,CAAC,MAAM,CAAqD,CAAC;AAChG,6EAA6E;AAC7E,eAAO,MAAM,aAAa,EAAE,SAAS,CAAC,MAAM,CAAuD,CAAC"}
|
package/p384.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeToCurve = exports.hashToCurve = exports.secp384r1 = exports.p384 = void 0;
|
|
4
|
-
const nist_ts_1 = require("./nist.js");
|
|
5
|
-
/** @deprecated use `import { p384 } from '@noble/curves/nist.js';` */
|
|
6
|
-
exports.p384 = nist_ts_1.p384;
|
|
7
|
-
/** @deprecated use `import { p384 } from '@noble/curves/nist.js';` */
|
|
8
|
-
exports.secp384r1 = nist_ts_1.p384;
|
|
9
|
-
/** @deprecated use `import { p384_hasher } from '@noble/curves/nist.js';` */
|
|
10
|
-
exports.hashToCurve = (() => nist_ts_1.p384_hasher.hashToCurve)();
|
|
11
|
-
/** @deprecated use `import { p384_hasher } from '@noble/curves/nist.js';` */
|
|
12
|
-
exports.encodeToCurve = (() => nist_ts_1.p384_hasher.encodeToCurve)();
|
|
13
|
-
//# sourceMappingURL=p384.js.map
|
package/p384.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"p384.js","sourceRoot":"","sources":["src/p384.ts"],"names":[],"mappings":";;;AAMA,uCAAuD;AACvD,sEAAsE;AACzD,QAAA,IAAI,GAAiB,cAAK,CAAC;AACxC,sEAAsE;AACzD,QAAA,SAAS,GAAiB,cAAK,CAAC;AAC7C,6EAA6E;AAChE,QAAA,WAAW,GAAsC,CAAC,GAAG,EAAE,CAAC,qBAAW,CAAC,WAAW,CAAC,EAAE,CAAC;AAChG,6EAA6E;AAChE,QAAA,aAAa,GAAsC,CAAC,GAAG,EAAE,CAAC,qBAAW,CAAC,aAAa,CAAC,EAAE,CAAC"}
|
package/p521.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NIST secp521r1 aka p521.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
6
|
-
import { type H2CMethod } from './abstract/hash-to-curve.ts';
|
|
7
|
-
import { p521 as p521n } from './nist.ts';
|
|
8
|
-
/** @deprecated use `import { p521 } from '@noble/curves/nist.js';` */
|
|
9
|
-
export declare const p521: typeof p521n;
|
|
10
|
-
/** @deprecated use `import { p521 } from '@noble/curves/nist.js';` */
|
|
11
|
-
export declare const secp521r1: typeof p521n;
|
|
12
|
-
/** @deprecated use `import { p521_hasher } from '@noble/curves/nist.js';` */
|
|
13
|
-
export declare const hashToCurve: H2CMethod<bigint>;
|
|
14
|
-
/** @deprecated use `import { p521_hasher } from '@noble/curves/nist.js';` */
|
|
15
|
-
export declare const encodeToCurve: H2CMethod<bigint>;
|
|
16
|
-
//# sourceMappingURL=p521.d.ts.map
|
package/p521.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"p521.d.ts","sourceRoot":"","sources":["src/p521.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,sEAAsE;AACtE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAe,IAAI,IAAI,KAAK,EAAE,MAAM,WAAW,CAAC;AACvD,sEAAsE;AACtE,eAAO,MAAM,IAAI,EAAE,OAAO,KAAa,CAAC;AACxC,sEAAsE;AACtE,eAAO,MAAM,SAAS,EAAE,OAAO,KAAa,CAAC;AAC7C,6EAA6E;AAC7E,eAAO,MAAM,WAAW,EAAE,SAAS,CAAC,MAAM,CAAqD,CAAC;AAChG,6EAA6E;AAC7E,eAAO,MAAM,aAAa,EAAE,SAAS,CAAC,MAAM,CAAuD,CAAC"}
|
package/p521.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeToCurve = exports.hashToCurve = exports.secp521r1 = exports.p521 = void 0;
|
|
4
|
-
const nist_ts_1 = require("./nist.js");
|
|
5
|
-
/** @deprecated use `import { p521 } from '@noble/curves/nist.js';` */
|
|
6
|
-
exports.p521 = nist_ts_1.p521;
|
|
7
|
-
/** @deprecated use `import { p521 } from '@noble/curves/nist.js';` */
|
|
8
|
-
exports.secp521r1 = nist_ts_1.p521;
|
|
9
|
-
/** @deprecated use `import { p521_hasher } from '@noble/curves/nist.js';` */
|
|
10
|
-
exports.hashToCurve = (() => nist_ts_1.p521_hasher.hashToCurve)();
|
|
11
|
-
/** @deprecated use `import { p521_hasher } from '@noble/curves/nist.js';` */
|
|
12
|
-
exports.encodeToCurve = (() => nist_ts_1.p521_hasher.encodeToCurve)();
|
|
13
|
-
//# sourceMappingURL=p521.js.map
|
package/p521.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"p521.js","sourceRoot":"","sources":["src/p521.ts"],"names":[],"mappings":";;;AAMA,uCAAuD;AACvD,sEAAsE;AACzD,QAAA,IAAI,GAAiB,cAAK,CAAC;AACxC,sEAAsE;AACzD,QAAA,SAAS,GAAiB,cAAK,CAAC;AAC7C,6EAA6E;AAChE,QAAA,WAAW,GAAsC,CAAC,GAAG,EAAE,CAAC,qBAAW,CAAC,WAAW,CAAC,EAAE,CAAC;AAChG,6EAA6E;AAChE,QAAA,aAAa,GAAsC,CAAC,GAAG,EAAE,CAAC,qBAAW,CAAC,aAAa,CAAC,EAAE,CAAC"}
|
package/pasta.d.ts
DELETED
package/pasta.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pasta.d.ts","sourceRoot":"","sources":["src/pasta.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,IAAI,EAAE,EAAE,KAAK,IAAI,EAAE,EAAE,MAAM,WAAW,CAAC;AACtD,kBAAkB;AAClB,eAAO,MAAM,MAAM,EAAE,OAAO,EAAO,CAAC;AACpC,kBAAkB;AAClB,eAAO,MAAM,KAAK,EAAE,OAAO,EAAO,CAAC"}
|
package/pasta.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.vesta = exports.pallas = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated
|
|
6
|
-
* @module
|
|
7
|
-
*/
|
|
8
|
-
const misc_ts_1 = require("./misc.js");
|
|
9
|
-
/** @deprecated */
|
|
10
|
-
exports.pallas = misc_ts_1.pallas;
|
|
11
|
-
/** @deprecated */
|
|
12
|
-
exports.vesta = misc_ts_1.vesta;
|
|
13
|
-
//# sourceMappingURL=pasta.js.map
|
package/pasta.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pasta.js","sourceRoot":"","sources":["src/pasta.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,uCAAsD;AACtD,kBAAkB;AACL,QAAA,MAAM,GAAc,gBAAE,CAAC;AACpC,kBAAkB;AACL,QAAA,KAAK,GAAc,eAAE,CAAC"}
|
package/src/_shortw_utils.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities for short weierstrass curves, combined with noble-hashes.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
6
|
-
import { type CurveFn, type CurveType, weierstrass } from './abstract/weierstrass.ts';
|
|
7
|
-
import type { CHash } from './utils.ts';
|
|
8
|
-
|
|
9
|
-
/** connects noble-curves to noble-hashes */
|
|
10
|
-
export function getHash(hash: CHash): { hash: CHash } {
|
|
11
|
-
return { hash };
|
|
12
|
-
}
|
|
13
|
-
/** Same API as @noble/hashes, with ability to create curve with custom hash */
|
|
14
|
-
export type CurveDef = Readonly<Omit<CurveType, 'hash'>>;
|
|
15
|
-
export type CurveFnWithCreate = CurveFn & { create: (hash: CHash) => CurveFn };
|
|
16
|
-
|
|
17
|
-
/** @deprecated use new `weierstrass()` and `ecdsa()` methods */
|
|
18
|
-
export function createCurve(curveDef: CurveDef, defHash: CHash): CurveFnWithCreate {
|
|
19
|
-
const create = (hash: CHash): CurveFn => weierstrass({ ...curveDef, hash: hash });
|
|
20
|
-
return { ...create(defHash), create };
|
|
21
|
-
}
|
package/src/abstract/utils.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deprecated module: moved from curves/abstract/utils.js to curves/utils.js
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
import * as u from '../utils.ts';
|
|
6
|
-
|
|
7
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
8
|
-
export type Hex = u.Hex;
|
|
9
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
10
|
-
export type PrivKey = u.PrivKey;
|
|
11
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
12
|
-
export type CHash = u.CHash;
|
|
13
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
14
|
-
export type FHash = u.FHash;
|
|
15
|
-
|
|
16
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
17
|
-
export const abytes: typeof u.abytes = u.abytes;
|
|
18
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
19
|
-
export const anumber: typeof u.anumber = u.anumber;
|
|
20
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
21
|
-
export const bytesToHex: typeof u.bytesToHex = u.bytesToHex;
|
|
22
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
23
|
-
export const bytesToUtf8: typeof u.bytesToUtf8 = u.bytesToUtf8;
|
|
24
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
25
|
-
export const concatBytes: typeof u.concatBytes = u.concatBytes;
|
|
26
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
27
|
-
export const hexToBytes: typeof u.hexToBytes = u.hexToBytes;
|
|
28
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
29
|
-
export const isBytes: typeof u.isBytes = u.isBytes;
|
|
30
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
31
|
-
export const randomBytes: typeof u.randomBytes = u.randomBytes;
|
|
32
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
33
|
-
export const utf8ToBytes: typeof u.utf8ToBytes = u.utf8ToBytes;
|
|
34
|
-
|
|
35
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
36
|
-
export const abool: typeof u.abool = u.abool;
|
|
37
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
38
|
-
export const numberToHexUnpadded: typeof u.numberToHexUnpadded = u.numberToHexUnpadded;
|
|
39
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
40
|
-
export const hexToNumber: typeof u.hexToNumber = u.hexToNumber;
|
|
41
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
42
|
-
export const bytesToNumberBE: typeof u.bytesToNumberBE = u.bytesToNumberBE;
|
|
43
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
44
|
-
export const bytesToNumberLE: typeof u.bytesToNumberLE = u.bytesToNumberLE;
|
|
45
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
46
|
-
export const numberToBytesBE: typeof u.numberToBytesBE = u.numberToBytesBE;
|
|
47
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
48
|
-
export const numberToBytesLE: typeof u.numberToBytesLE = u.numberToBytesLE;
|
|
49
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
50
|
-
export const numberToVarBytesBE: typeof u.numberToVarBytesBE = u.numberToVarBytesBE;
|
|
51
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
52
|
-
export const ensureBytes: typeof u.ensureBytes = u.ensureBytes;
|
|
53
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
54
|
-
export const equalBytes: typeof u.equalBytes = u.equalBytes;
|
|
55
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
56
|
-
export const copyBytes: typeof u.copyBytes = u.copyBytes;
|
|
57
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
58
|
-
export const asciiToBytes: typeof u.asciiToBytes = u.asciiToBytes;
|
|
59
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
60
|
-
export const inRange: typeof u.inRange = u.inRange;
|
|
61
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
62
|
-
export const aInRange: typeof u.aInRange = u.aInRange;
|
|
63
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
64
|
-
export const bitLen: typeof u.bitLen = u.bitLen;
|
|
65
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
66
|
-
export const bitGet: typeof u.bitGet = u.bitGet;
|
|
67
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
68
|
-
export const bitSet: typeof u.bitSet = u.bitSet;
|
|
69
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
70
|
-
export const bitMask: typeof u.bitMask = u.bitMask;
|
|
71
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
72
|
-
export const createHmacDrbg: typeof u.createHmacDrbg = u.createHmacDrbg;
|
|
73
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
74
|
-
export const notImplemented: typeof u.notImplemented = u.notImplemented;
|
|
75
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
76
|
-
export const memoized: typeof u.memoized = u.memoized;
|
|
77
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
78
|
-
export const validateObject: typeof u.validateObject = u.validateObject;
|
|
79
|
-
/** @deprecated moved to `@noble/curves/utils.js` */
|
|
80
|
-
export const isHash: typeof u.isHash = u.isHash;
|