Skip to content

Commit 60368b2

Browse files
committed
chore: fix formatting
1 parent de61de6 commit 60368b2

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

packages/wallet/src/prover/proveDLogProtocol.ts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import { FleetError, _0n, concatBytes } from "@fleet-sdk/common";
2-
import {
3-
bigintBE,
4-
blake2b256,
5-
hex,
6-
randomBytes,
7-
validateEcPoint,
8-
} from "@fleet-sdk/crypto";
2+
import { bigintBE, blake2b256, hex, randomBytes, validateEcPoint } from "@fleet-sdk/crypto";
93
import { secp256k1 } from "@noble/curves/secp256k1";
104

115
const { ProjectivePoint: ECPoint, CURVE } = secp256k1;
@@ -43,10 +37,7 @@ export function sign(message: Uint8Array, secretKey: Uint8Array) {
4337
* @returns The generated signature as a Uint8Array, or undefined if the verification fails.
4438
* @throws Error if failed to generate commitment.
4539
*/
46-
export function genSignature(
47-
message: Uint8Array,
48-
secretKey: Uint8Array,
49-
): undefined | Uint8Array {
40+
export function genSignature(message: Uint8Array, secretKey: Uint8Array): undefined | Uint8Array {
5041
const sk = bigintBE.encode(secretKey);
5142
const pk = G.multiply(sk).toRawBytes();
5243
const k = genRandomSecret();
@@ -107,18 +98,12 @@ export function umod(a: bigint, b: bigint): bigint {
10798
* @returns A boolean indicating whether the signature is valid or not.
10899
* @throws FleetError if the public key is invalid.
109100
*/
110-
export function verify(
111-
message: Uint8Array,
112-
proof: Uint8Array,
113-
publicKey: Uint8Array,
114-
) {
101+
export function verify(message: Uint8Array, proof: Uint8Array, publicKey: Uint8Array) {
115102
if (!proof || proof.length !== ERGO_SCHNORR_SIG_LEN) return false;
116103
if (!validateEcPoint(publicKey)) throw new FleetError("Invalid Public Key.");
117104

118105
const c = bigintBE.encode(proof.slice(0, ERGO_SOUNDNESS_BYTES));
119-
const z = bigintBE.encode(
120-
proof.slice(ERGO_SOUNDNESS_BYTES, ERGO_SCHNORR_SIG_LEN),
121-
);
106+
const z = bigintBE.encode(proof.slice(ERGO_SOUNDNESS_BYTES, ERGO_SCHNORR_SIG_LEN));
122107

123108
const t = ECPoint.fromHex(publicKey).multiply(CURVE.n - c);
124109
const w = G.multiply(z).add(t).toRawBytes();

0 commit comments

Comments
 (0)