@noble/curves 0.5.1 → 0.5.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.
@@ -1,7 +1,7 @@
1
1
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
2
2
  import * as mod from './modular.js';
3
+ import * as ut from './utils.js';
3
4
  import { Hex, PrivKey } from './utils.js';
4
- import * as utils from './utils.js';
5
5
  import { htfOpts } from './hash-to-curve.js';
6
6
  import { Group, GroupConstructor } from './group.js';
7
7
  declare type HmacFnSync = (key: Uint8Array, ...messages: Uint8Array[]) => Uint8Array;
@@ -14,10 +14,11 @@ declare type EndomorphismOpts = {
14
14
  k2: bigint;
15
15
  };
16
16
  };
17
- export declare type BasicCurve<T> = utils.BasicCurve<T> & {
17
+ export declare type BasicCurve<T> = ut.BasicCurve<T> & {
18
18
  a: T;
19
19
  b: T;
20
20
  normalizePrivateKey?: (key: PrivKey) => PrivKey;
21
+ wrapPrivateKey?: boolean;
21
22
  endo?: EndomorphismOpts;
22
23
  isTorsionFree?: (c: ProjectiveConstructor<T>, point: ProjectivePointType<T>) => boolean;
23
24
  clearCofactor?: (c: ProjectiveConstructor<T>, point: ProjectivePointType<T>) => ProjectivePointType<T>;
@@ -28,7 +29,7 @@ export declare type BasicCurve<T> = utils.BasicCurve<T> & {
28
29
  };
29
30
  };
30
31
  declare type Entropy = Hex | true;
31
- declare type SignOpts = {
32
+ export declare type SignOpts = {
32
33
  lowS?: boolean;
33
34
  extraEntropy?: Entropy;
34
35
  };
@@ -127,7 +128,7 @@ export declare type SignatureConstructor = {
127
128
  export declare type PubKey = Hex | PointType<bigint>;
128
129
  export declare type CurveType = BasicCurve<bigint> & {
129
130
  lowS?: boolean;
130
- hash: utils.CHash;
131
+ hash: ut.CHash;
131
132
  hmac: HmacFnSync;
132
133
  randomBytes: (bytesLength?: number) => Uint8Array;
133
134
  truncateHash?: (hash: Uint8Array, truncateOnly?: boolean) => bigint;
@@ -145,7 +146,7 @@ declare function validateOpts(curve: CurveType): Readonly<{
145
146
  readonly allowInfinityPoint?: boolean | undefined;
146
147
  readonly a: bigint;
147
148
  readonly b: bigint;
148
- readonly normalizePrivateKey?: ((key: PrivKey) => PrivKey) | undefined;
149
+ readonly normalizePrivateKey?: ((key: ut.PrivKey) => ut.PrivKey) | undefined;
149
150
  readonly endo?: EndomorphismOpts | undefined;
150
151
  readonly isTorsionFree?: ((c: ProjectiveConstructor<bigint>, point: ProjectivePointType<bigint>) => boolean) | undefined;
151
152
  readonly clearCofactor?: ((c: ProjectiveConstructor<bigint>, point: ProjectivePointType<bigint>) => ProjectivePointType<bigint>) | undefined;
@@ -155,7 +156,7 @@ declare function validateOpts(curve: CurveType): Readonly<{
155
156
  y: bigint;
156
157
  }) | undefined;
157
158
  lowS: boolean;
158
- readonly hash: utils.CHash;
159
+ readonly hash: ut.CHash;
159
160
  readonly hmac: HmacFnSync;
160
161
  readonly randomBytes: (bytesLength?: number | undefined) => Uint8Array;
161
162
  readonly truncateHash?: ((hash: Uint8Array, truncateOnly?: boolean | undefined) => bigint) | undefined;
@@ -165,6 +166,7 @@ export declare type CurveFn = {
165
166
  getPublicKey: (privateKey: PrivKey, isCompressed?: boolean) => Uint8Array;
166
167
  getSharedSecret: (privateA: PrivKey, publicB: PubKey, isCompressed?: boolean) => Uint8Array;
167
168
  sign: (msgHash: Hex, privKey: PrivKey, opts?: SignOpts) => SignatureType;
169
+ signUnhashed: (msg: Uint8Array, privKey: PrivKey, opts?: SignOpts) => SignatureType;
168
170
  verify: (signature: Hex | SignatureType, msgHash: Hex, publicKey: PubKey, opts?: {
169
171
  lowS?: boolean;
170
172
  }) => boolean;
@@ -172,8 +174,6 @@ export declare type CurveFn = {
172
174
  ProjectivePoint: ProjectiveConstructor<bigint>;
173
175
  Signature: SignatureConstructor;
174
176
  utils: {
175
- mod: (a: bigint, b?: bigint) => bigint;
176
- invert: (number: bigint, modulo?: bigint) => bigint;
177
177
  _bigintToBytes: (num: bigint) => Uint8Array;
178
178
  _bigintToString: (num: bigint) => string;
179
179
  _normalizePrivateKey: (key: PrivKey) => bigint;