413725cfb3
This PR makes it so that if you only use _one_ export: ```ts import { ed25519 } from '@noble/curves`; ``` …then only the `twistedEdwards` call that constructs that export will remain after bundling and tree-shaking. Before this change, the compiled bundle contains all the code that constructs `ed25519ph` and `ed25519ctx` remains. ```js var ed25519 = twistedEdwards(ed25519Defaults); function ed25519_domain(data, ctx, phflag) { if (ctx.length > 255) throw new Error("Context is too big"); return concatBytes(utf8ToBytes("SigEd25519 no Ed25519 collisions"), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data); } twistedEdwards({ ...ed25519Defaults, domain: ed25519_domain }); twistedEdwards({ ...ed25519Defaults, domain: ed25519_domain, prehash: sha512 }); ``` ```js var ed25519 = twistedEdwards(ed25519Defaults); ``` |
||
---|---|---|
.. | ||
abstract | ||
_shortw_utils.ts | ||
bls12-381.ts | ||
bn254.ts | ||
ed448.ts | ||
ed25519.ts | ||
index.ts | ||
jubjub.ts | ||
p256.ts | ||
p384.ts | ||
p521.ts | ||
pasta.ts | ||
secp256k1.ts |