forked from tornado-packages/noble-curves
Bring back common.js for now. Need more thorough work with consumers
This commit is contained in:
parent
fe68da61f6
commit
d77ac16f51
@ -56,7 +56,7 @@ Instead, you need to import specific primitives. This is done to ensure small si
|
|||||||
Each curve can be used in the following way:
|
Each curve can be used in the following way:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { secp256k1 } from '@noble/curves/secp256k1'; // ECMAScript Modules (ESM)
|
import { secp256k1 } from '@noble/curves/secp256k1'; // ECMAScript Modules (ESM) and Common.js
|
||||||
// import { secp256k1 } from 'npm:@noble/curves@1.2.0/secp256k1'; // Deno
|
// import { secp256k1 } from 'npm:@noble/curves@1.2.0/secp256k1'; // Deno
|
||||||
const priv = secp256k1.utils.randomPrivateKey();
|
const priv = secp256k1.utils.randomPrivateKey();
|
||||||
const pub = secp256k1.getPublicKey(priv);
|
const pub = secp256k1.getPublicKey(priv);
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"browser": {
|
"browser": {
|
||||||
"crypto": false,
|
"crypto": false,
|
||||||
"./crypto": "./esm/cryptoBrowser.js"
|
"./crypto": "./esm/crypto.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
30
package.json
30
package.json
@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "@noble/curves",
|
"name": "@noble/curves",
|
||||||
"version": "0.8.0",
|
"version": "0.8.0",
|
||||||
"description": "Audited & minimal JS implementation of elliptic curve cryptography",
|
"description": "Minimal, auditable JS implementation of elliptic curve cryptography",
|
||||||
"files": [
|
"files": [
|
||||||
"abstract",
|
"abstract",
|
||||||
|
"esm",
|
||||||
"src",
|
"src",
|
||||||
"*.js",
|
"*.js",
|
||||||
"*.js.map",
|
"*.js.map",
|
||||||
@ -12,9 +13,9 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"bench": "cd benchmark; node secp256k1.js; node curves.js; node ecdh.js; node bls.js",
|
"bench": "cd benchmark; node secp256k1.js; node curves.js; node ecdh.js; node bls.js",
|
||||||
"build": "tsc",
|
"build": "tsc && tsc -p tsconfig.esm.json",
|
||||||
"build:clean": "rm *.{js,d.ts,js.map} esm/*.{js,js.map} 2> /dev/null",
|
|
||||||
"build:release": "rollup -c rollup.config.js",
|
"build:release": "rollup -c rollup.config.js",
|
||||||
|
"build:clean": "rm *.{js,d.ts,js.map} esm/*.{js,js.map} 2> /dev/null",
|
||||||
"lint": "prettier --check 'src/**/*.{js,ts}' 'test/*.js'",
|
"lint": "prettier --check 'src/**/*.{js,ts}' 'test/*.js'",
|
||||||
"format": "prettier --write 'src/**/*.{js,ts}' 'test/*.js'",
|
"format": "prettier --write 'src/**/*.{js,ts}' 'test/*.js'",
|
||||||
"test": "node test/index.test.js"
|
"test": "node test/index.test.js"
|
||||||
@ -40,94 +41,115 @@
|
|||||||
"typescript": "4.7.3"
|
"typescript": "4.7.3"
|
||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"type": "module",
|
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"types": "./index.d.ts",
|
"types": "./index.d.ts",
|
||||||
|
"import": "./esm/index.js",
|
||||||
"default": "./index.js"
|
"default": "./index.js"
|
||||||
},
|
},
|
||||||
"./abstract/edwards": {
|
"./abstract/edwards": {
|
||||||
"types": "./abstract/edwards.d.ts",
|
"types": "./abstract/edwards.d.ts",
|
||||||
|
"import": "./esm/abstract/edwards.js",
|
||||||
"default": "./abstract/edwards.js"
|
"default": "./abstract/edwards.js"
|
||||||
},
|
},
|
||||||
"./abstract/modular": {
|
"./abstract/modular": {
|
||||||
"types": "./abstract/modular.d.ts",
|
"types": "./abstract/modular.d.ts",
|
||||||
|
"import": "./esm/abstract/modular.js",
|
||||||
"default": "./abstract/modular.js"
|
"default": "./abstract/modular.js"
|
||||||
},
|
},
|
||||||
"./abstract/montgomery": {
|
"./abstract/montgomery": {
|
||||||
"types": "./abstract/montgomery.d.ts",
|
"types": "./abstract/montgomery.d.ts",
|
||||||
|
"import": "./esm/abstract/montgomery.js",
|
||||||
"default": "./abstract/montgomery.js"
|
"default": "./abstract/montgomery.js"
|
||||||
},
|
},
|
||||||
"./abstract/weierstrass": {
|
"./abstract/weierstrass": {
|
||||||
"types": "./abstract/weierstrass.d.ts",
|
"types": "./abstract/weierstrass.d.ts",
|
||||||
|
"import": "./esm/abstract/weierstrass.js",
|
||||||
"default": "./abstract/weierstrass.js"
|
"default": "./abstract/weierstrass.js"
|
||||||
},
|
},
|
||||||
"./abstract/bls": {
|
"./abstract/bls": {
|
||||||
"types": "./abstract/bls.d.ts",
|
"types": "./abstract/bls.d.ts",
|
||||||
|
"import": "./esm/abstract/bls.js",
|
||||||
"default": "./abstract/bls.js"
|
"default": "./abstract/bls.js"
|
||||||
},
|
},
|
||||||
"./abstract/hash-to-curve": {
|
"./abstract/hash-to-curve": {
|
||||||
"types": "./abstract/hash-to-curve.d.ts",
|
"types": "./abstract/hash-to-curve.d.ts",
|
||||||
|
"import": "./esm/abstract/hash-to-curve.js",
|
||||||
"default": "./abstract/hash-to-curve.js"
|
"default": "./abstract/hash-to-curve.js"
|
||||||
},
|
},
|
||||||
"./abstract/curve": {
|
"./abstract/curve": {
|
||||||
"types": "./abstract/curve.d.ts",
|
"types": "./abstract/curve.d.ts",
|
||||||
|
"import": "./esm/abstract/curve.js",
|
||||||
"default": "./abstract/curve.js"
|
"default": "./abstract/curve.js"
|
||||||
},
|
},
|
||||||
"./abstract/utils": {
|
"./abstract/utils": {
|
||||||
"types": "./abstract/utils.d.ts",
|
"types": "./abstract/utils.d.ts",
|
||||||
|
"import": "./esm/abstract/utils.js",
|
||||||
"default": "./abstract/utils.js"
|
"default": "./abstract/utils.js"
|
||||||
},
|
},
|
||||||
"./abstract/poseidon": {
|
"./abstract/poseidon": {
|
||||||
"types": "./abstract/poseidon.d.ts",
|
"types": "./abstract/poseidon.d.ts",
|
||||||
|
"import": "./esm/abstract/poseidon.js",
|
||||||
"default": "./abstract/poseidon.js"
|
"default": "./abstract/poseidon.js"
|
||||||
},
|
},
|
||||||
"./_shortw_utils": {
|
"./_shortw_utils": {
|
||||||
"types": "./_shortw_utils.d.ts",
|
"types": "./_shortw_utils.d.ts",
|
||||||
|
"import": "./esm/_shortw_utils.js",
|
||||||
"default": "./_shortw_utils.js"
|
"default": "./_shortw_utils.js"
|
||||||
},
|
},
|
||||||
"./bls12-381": {
|
"./bls12-381": {
|
||||||
"types": "./bls12-381.d.ts",
|
"types": "./bls12-381.d.ts",
|
||||||
|
"import": "./esm/bls12-381.js",
|
||||||
"default": "./bls12-381.js"
|
"default": "./bls12-381.js"
|
||||||
},
|
},
|
||||||
"./bn": {
|
"./bn": {
|
||||||
"types": "./bn.d.ts",
|
"types": "./bn.d.ts",
|
||||||
|
"import": "./esm/bn.js",
|
||||||
"default": "./bn.js"
|
"default": "./bn.js"
|
||||||
},
|
},
|
||||||
"./ed25519": {
|
"./ed25519": {
|
||||||
"types": "./ed25519.d.ts",
|
"types": "./ed25519.d.ts",
|
||||||
|
"import": "./esm/ed25519.js",
|
||||||
"default": "./ed25519.js"
|
"default": "./ed25519.js"
|
||||||
},
|
},
|
||||||
"./ed448": {
|
"./ed448": {
|
||||||
"types": "./ed448.d.ts",
|
"types": "./ed448.d.ts",
|
||||||
|
"import": "./esm/ed448.js",
|
||||||
"default": "./ed448.js"
|
"default": "./ed448.js"
|
||||||
},
|
},
|
||||||
"./index": {
|
"./index": {
|
||||||
"types": "./index.d.ts",
|
"types": "./index.d.ts",
|
||||||
|
"import": "./esm/index.js",
|
||||||
"default": "./index.js"
|
"default": "./index.js"
|
||||||
},
|
},
|
||||||
"./jubjub": {
|
"./jubjub": {
|
||||||
"types": "./jubjub.d.ts",
|
"types": "./jubjub.d.ts",
|
||||||
|
"import": "./esm/jubjub.js",
|
||||||
"default": "./jubjub.js"
|
"default": "./jubjub.js"
|
||||||
},
|
},
|
||||||
"./p256": {
|
"./p256": {
|
||||||
"types": "./p256.d.ts",
|
"types": "./p256.d.ts",
|
||||||
|
"import": "./esm/p256.js",
|
||||||
"default": "./p256.js"
|
"default": "./p256.js"
|
||||||
},
|
},
|
||||||
"./p384": {
|
"./p384": {
|
||||||
"types": "./p384.d.ts",
|
"types": "./p384.d.ts",
|
||||||
|
"import": "./esm/p384.js",
|
||||||
"default": "./p384.js"
|
"default": "./p384.js"
|
||||||
},
|
},
|
||||||
"./p521": {
|
"./p521": {
|
||||||
"types": "./p521.d.ts",
|
"types": "./p521.d.ts",
|
||||||
|
"import": "./esm/p521.js",
|
||||||
"default": "./p521.js"
|
"default": "./p521.js"
|
||||||
},
|
},
|
||||||
"./pasta": {
|
"./pasta": {
|
||||||
"types": "./pasta.d.ts",
|
"types": "./pasta.d.ts",
|
||||||
|
"import": "./esm/pasta.js",
|
||||||
"default": "./pasta.js"
|
"default": "./pasta.js"
|
||||||
},
|
},
|
||||||
"./secp256k1": {
|
"./secp256k1": {
|
||||||
"types": "./secp256k1.d.ts",
|
"types": "./secp256k1.d.ts",
|
||||||
|
"import": "./esm/secp256k1.js",
|
||||||
"default": "./secp256k1.js"
|
"default": "./secp256k1.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
||||||
import { createCurve } from '../_shortw_utils.js';
|
import { createCurve } from '../esm/_shortw_utils.js';
|
||||||
import { sha224, sha256 } from '@noble/hashes/sha256';
|
import { sha224, sha256 } from '@noble/hashes/sha256';
|
||||||
import { Fp } from '../abstract/modular.js';
|
import { Fp } from '../esm/abstract/modular.js';
|
||||||
|
|
||||||
// NIST secp192r1 aka P192
|
// NIST secp192r1 aka P192
|
||||||
// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/secg/secp192r1
|
// https://www.secg.org/sec2-v2.pdf, https://neuromancer.sk/std/secg/secp192r1
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
||||||
import { sha256 } from '@noble/hashes/sha256';
|
import { sha256 } from '@noble/hashes/sha256';
|
||||||
import { utf8ToBytes } from '@noble/hashes/utils';
|
import { utf8ToBytes } from '@noble/hashes/utils';
|
||||||
import { Fp, validateField } from '../abstract/modular.js';
|
import { Fp, validateField } from '../esm/abstract/modular.js';
|
||||||
import { poseidon } from '../abstract/poseidon.js';
|
import { poseidon } from '../esm/abstract/poseidon.js';
|
||||||
import * as u from '../abstract/utils.js';
|
import * as u from '../esm/abstract/utils.js';
|
||||||
|
|
||||||
// Poseidon hash https://docs.starkware.co/starkex/stark-curve.html
|
// Poseidon hash https://docs.starkware.co/starkex/stark-curve.html
|
||||||
export const Fp253 = Fp(
|
export const Fp253 = Fp(
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
import { deepStrictEqual, throws } from 'assert';
|
import { deepStrictEqual, throws } from 'assert';
|
||||||
import { should, describe } from 'micro-should';
|
import { should, describe } from 'micro-should';
|
||||||
import * as fc from 'fast-check';
|
import * as fc from 'fast-check';
|
||||||
import * as mod from '../abstract/modular.js';
|
import * as mod from '../esm/abstract/modular.js';
|
||||||
import { bytesToHex as toHex } from '../abstract/utils.js';
|
import { bytesToHex as toHex } from '../esm/abstract/utils.js';
|
||||||
// Generic tests for all curves in package
|
// Generic tests for all curves in package
|
||||||
import { secp192r1, secp224r1 } from './_more-curves.helpers.js';
|
import { secp192r1, secp224r1 } from './_more-curves.helpers.js';
|
||||||
import { secp256r1 } from '../p256.js';
|
import { secp256r1 } from '../esm/p256.js';
|
||||||
import { secp384r1 } from '../p384.js';
|
import { secp384r1 } from '../esm/p384.js';
|
||||||
import { secp521r1 } from '../p521.js';
|
import { secp521r1 } from '../esm/p521.js';
|
||||||
import { secp256k1 } from '../secp256k1.js';
|
import { secp256k1 } from '../esm/secp256k1.js';
|
||||||
import { ed25519, ed25519ctx, ed25519ph, x25519 } from '../ed25519.js';
|
import { ed25519, ed25519ctx, ed25519ph, x25519 } from '../esm/ed25519.js';
|
||||||
import { ed448, ed448ph } from '../ed448.js';
|
import { ed448, ed448ph } from '../esm/ed448.js';
|
||||||
import { pallas, vesta } from '../pasta.js';
|
import { pallas, vesta } from '../esm/pasta.js';
|
||||||
import { bn254 } from '../bn.js';
|
import { bn254 } from '../esm/bn.js';
|
||||||
import { jubjub } from '../jubjub.js';
|
import { jubjub } from '../esm/jubjub.js';
|
||||||
import { bls12_381 } from '../bls12-381.js';
|
import { bls12_381 } from '../esm/bls12-381.js';
|
||||||
|
|
||||||
// Fields tests
|
// Fields tests
|
||||||
const FIELDS = {
|
const FIELDS = {
|
||||||
|
@ -2,10 +2,10 @@ import { deepStrictEqual, notDeepStrictEqual, throws } from 'assert';
|
|||||||
import * as fc from 'fast-check';
|
import * as fc from 'fast-check';
|
||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import { describe, should } from 'micro-should';
|
import { describe, should } from 'micro-should';
|
||||||
import { wNAF } from '../abstract/curve.js';
|
import { wNAF } from '../esm/abstract/curve.js';
|
||||||
import { bytesToHex, utf8ToBytes } from '../abstract/utils.js';
|
import { bytesToHex, utf8ToBytes } from '../esm/abstract/utils.js';
|
||||||
import { hash_to_field } from '../abstract/hash-to-curve.js';
|
import { hash_to_field } from '../esm/abstract/hash-to-curve.js';
|
||||||
import { bls12_381 as bls } from '../bls12-381.js';
|
import { bls12_381 as bls } from '../esm/bls12-381.js';
|
||||||
|
|
||||||
import zkVectors from './bls12-381/zkcrypto/converted.json' assert { type: 'json' };
|
import zkVectors from './bls12-381/zkcrypto/converted.json' assert { type: 'json' };
|
||||||
import pairingVectors from './bls12-381/go_pairing_vectors/pairing.json' assert { type: 'json' };
|
import pairingVectors from './bls12-381/go_pairing_vectors/pairing.json' assert { type: 'json' };
|
||||||
|
@ -2,9 +2,9 @@ import { sha512 } from '@noble/hashes/sha512';
|
|||||||
import { hexToBytes, bytesToHex, randomBytes } from '@noble/hashes/utils';
|
import { hexToBytes, bytesToHex, randomBytes } from '@noble/hashes/utils';
|
||||||
import { deepStrictEqual, strictEqual, throws } from 'assert';
|
import { deepStrictEqual, strictEqual, throws } from 'assert';
|
||||||
import { describe, should } from 'micro-should';
|
import { describe, should } from 'micro-should';
|
||||||
import { bytesToNumberLE, numberToBytesLE } from '../abstract/utils.js';
|
import { bytesToNumberLE, numberToBytesLE } from '../esm/abstract/utils.js';
|
||||||
import { default as x25519vectors } from './wycheproof/x25519_test.json' assert { type: 'json' };
|
import { default as x25519vectors } from './wycheproof/x25519_test.json' assert { type: 'json' };
|
||||||
import { ed25519ctx, ed25519ph, RistrettoPoint, x25519 } from '../ed25519.js';
|
import { ed25519ctx, ed25519ph, RistrettoPoint, x25519 } from '../esm/ed25519.js';
|
||||||
|
|
||||||
// const ed = ed25519;
|
// const ed = ed25519;
|
||||||
const hex = bytesToHex;
|
const hex = bytesToHex;
|
||||||
|
@ -1 +1 @@
|
|||||||
export { ed25519, ED25519_TORSION_SUBGROUP } from '../ed25519.js';
|
export { ed25519, ED25519_TORSION_SUBGROUP } from '../esm/ed25519.js';
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { deepStrictEqual, throws } from 'assert';
|
import { deepStrictEqual, throws } from 'assert';
|
||||||
import { describe, should } from 'micro-should';
|
import { describe, should } from 'micro-should';
|
||||||
import * as fc from 'fast-check';
|
import * as fc from 'fast-check';
|
||||||
import { ed448, ed448ph, x448 } from '../ed448.js';
|
import { ed448, ed448ph, x448 } from '../esm/ed448.js';
|
||||||
import { hexToBytes, bytesToHex, randomBytes } from '@noble/hashes/utils';
|
import { hexToBytes, bytesToHex, randomBytes } from '@noble/hashes/utils';
|
||||||
import { numberToBytesLE } from '../abstract/utils.js';
|
import { numberToBytesLE } from '../esm/abstract/utils.js';
|
||||||
import { default as ed448vectors } from './wycheproof/ed448_test.json' assert { type: 'json' };
|
import { default as ed448vectors } from './wycheproof/ed448_test.json' assert { type: 'json' };
|
||||||
import { default as x448vectors } from './wycheproof/x448_test.json' assert { type: 'json' };
|
import { default as x448vectors } from './wycheproof/x448_test.json' assert { type: 'json' };
|
||||||
|
|
||||||
|
@ -5,15 +5,15 @@ import { bytesToHex } from '@noble/hashes/utils';
|
|||||||
import { sha256 } from '@noble/hashes/sha256';
|
import { sha256 } from '@noble/hashes/sha256';
|
||||||
import { sha512 } from '@noble/hashes/sha512';
|
import { sha512 } from '@noble/hashes/sha512';
|
||||||
import { shake128, shake256 } from '@noble/hashes/sha3';
|
import { shake128, shake256 } from '@noble/hashes/sha3';
|
||||||
import * as secp256r1 from '../p256.js';
|
import * as secp256r1 from '../esm/p256.js';
|
||||||
import * as secp384r1 from '../p384.js';
|
import * as secp384r1 from '../esm/p384.js';
|
||||||
import * as secp521r1 from '../p521.js';
|
import * as secp521r1 from '../esm/p521.js';
|
||||||
import * as ed25519 from '../ed25519.js';
|
import * as ed25519 from '../esm/ed25519.js';
|
||||||
import * as ed448 from '../ed448.js';
|
import * as ed448 from '../esm/ed448.js';
|
||||||
import * as secp256k1 from '../secp256k1.js';
|
import * as secp256k1 from '../esm/secp256k1.js';
|
||||||
import { bls12_381 } from '../bls12-381.js';
|
import { bls12_381 } from '../esm/bls12-381.js';
|
||||||
import { expand_message_xmd, expand_message_xof } from '../abstract/hash-to-curve.js';
|
import { expand_message_xmd, expand_message_xof } from '../esm/abstract/hash-to-curve.js';
|
||||||
import { utf8ToBytes } from '../abstract/utils.js';
|
import { utf8ToBytes } from '../esm/abstract/utils.js';
|
||||||
// XMD
|
// XMD
|
||||||
import { default as xmd_sha256_38 } from './hash-to-curve/expand_message_xmd_SHA256_38.json' assert { type: 'json' };
|
import { default as xmd_sha256_38 } from './hash-to-curve/expand_message_xmd_SHA256_38.json' assert { type: 'json' };
|
||||||
import { default as xmd_sha256_256 } from './hash-to-curve/expand_message_xmd_SHA256_256.json' assert { type: 'json' };
|
import { default as xmd_sha256_256 } from './hash-to-curve/expand_message_xmd_SHA256_256.json' assert { type: 'json' };
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { jubjub, findGroupHash } from '../jubjub.js';
|
import { jubjub, findGroupHash } from '../esm/jubjub.js';
|
||||||
import { describe, should } from 'micro-should';
|
import { describe, should } from 'micro-should';
|
||||||
import { deepStrictEqual, throws } from 'assert';
|
import { deepStrictEqual, throws } from 'assert';
|
||||||
const Point = jubjub.ExtendedPoint;
|
const Point = jubjub.ExtendedPoint;
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { deepStrictEqual } from 'assert';
|
import { deepStrictEqual } from 'assert';
|
||||||
import { describe, should } from 'micro-should';
|
import { describe, should } from 'micro-should';
|
||||||
import { secp192r1, secp224r1, P192, P224 } from './_more-curves.helpers.js';
|
import { secp192r1, secp224r1, P192, P224 } from './_more-curves.helpers.js';
|
||||||
import { secp256r1, P256 } from '../p256.js';
|
import { secp256r1, P256 } from '../esm/p256.js';
|
||||||
import { secp384r1, P384 } from '../p384.js';
|
import { secp384r1, P384 } from '../esm/p384.js';
|
||||||
import { secp521r1, P521 } from '../p521.js';
|
import { secp521r1, P521 } from '../esm/p521.js';
|
||||||
import { secp256k1 } from '../secp256k1.js';
|
import { secp256k1 } from '../esm/secp256k1.js';
|
||||||
import { hexToBytes, bytesToHex } from '../abstract/utils.js';
|
import { hexToBytes, bytesToHex } from '../esm/abstract/utils.js';
|
||||||
import { default as ecdsa } from './wycheproof/ecdsa_test.json' assert { type: 'json' };
|
import { default as ecdsa } from './wycheproof/ecdsa_test.json' assert { type: 'json' };
|
||||||
import { default as ecdh } from './wycheproof/ecdh_test.json' assert { type: 'json' };
|
import { default as ecdh } from './wycheproof/ecdh_test.json' assert { type: 'json' };
|
||||||
import { default as rfc6979 } from './fixtures/rfc6979.json' assert { type: 'json' };
|
import { default as rfc6979 } from './fixtures/rfc6979.json' assert { type: 'json' };
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { deepStrictEqual, throws } from 'assert';
|
import { deepStrictEqual, throws } from 'assert';
|
||||||
import { should, describe } from 'micro-should';
|
import { should, describe } from 'micro-should';
|
||||||
import * as poseidon from '../abstract/poseidon.js';
|
import * as poseidon from '../esm/abstract/poseidon.js';
|
||||||
import * as stark from './_poseidon.helpers.js';
|
import * as stark from './_poseidon.helpers.js';
|
||||||
import * as mod from '../abstract/modular.js';
|
import * as mod from '../esm/abstract/modular.js';
|
||||||
import { default as pvectors } from './vectors/poseidon.json' assert { type: 'json' };
|
import { default as pvectors } from './vectors/poseidon.json' assert { type: 'json' };
|
||||||
const { st1, st2, st3, st4 } = pvectors;
|
const { st1, st2, st3, st4 } = pvectors;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { deepStrictEqual, throws } from 'assert';
|
|||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import { should, describe } from 'micro-should';
|
import { should, describe } from 'micro-should';
|
||||||
import { bytesToHex as hex } from '@noble/hashes/utils';
|
import { bytesToHex as hex } from '@noble/hashes/utils';
|
||||||
import { schnorr } from '../secp256k1.js';
|
import { schnorr } from '../esm/secp256k1.js';
|
||||||
const schCsv = readFileSync('./test/vectors/schnorr.csv', 'utf-8');
|
const schCsv = readFileSync('./test/vectors/schnorr.csv', 'utf-8');
|
||||||
|
|
||||||
describe('schnorr.sign()', () => {
|
describe('schnorr.sign()', () => {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export { secp256k1 as secp } from '../secp256k1.js';
|
export { secp256k1 as secp } from '../esm/secp256k1.js';
|
||||||
import { secp256k1 as _secp } from '../secp256k1.js';
|
import { secp256k1 as _secp } from '../esm/secp256k1.js';
|
||||||
export { bytesToNumberBE, numberToBytesBE } from '../abstract/utils.js';
|
export { bytesToNumberBE, numberToBytesBE } from '../esm/abstract/utils.js';
|
||||||
export { mod } from '../abstract/modular.js';
|
export { mod } from '../esm/abstract/modular.js';
|
||||||
export const sigFromDER = (der) => {
|
export const sigFromDER = (der) => {
|
||||||
return _secp.Signature.fromDER(der);
|
return _secp.Signature.fromDER(der);
|
||||||
};
|
};
|
||||||
|
20
tsconfig.esm.json
Normal file
20
tsconfig.esm.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"strict": true,
|
||||||
|
"outDir": "esm",
|
||||||
|
"target": "es2020",
|
||||||
|
"module": "es6",
|
||||||
|
"moduleResolution": "node16",
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@noble/hashes/crypto": [ "src/crypto" ]
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"include": ["src"],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"lib",
|
||||||
|
],
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user