import { Hex } from 'viem'; /** * Encode a BLS12-381 G1 point into the canonical 128-byte EIP-2537 layout the contract stores as * `publicKey` (`x @ 16`, `y @ 80`, each a 48-byte big-endian Fp right-aligned in a 64-byte slot). * Accepts a G1 point in EIP-2537 (128-byte, validated pass-through) or zkcrypto compressed (48-byte) * / uncompressed (96-byte) form. */ declare function encodeG1Point(pubkey: Hex | Uint8Array): Hex; /** The complete tuple `registerWithProof(publicKey, popPoint, popSig)` consumes, plus the derived nodeId. */ interface DvtPop { /** G1 public key in 128-byte EIP-2537 layout — the `publicKey` argument. */ publicKey: Hex; /** `hashToCurve(publicKey, POP_DST)` as a 256-byte EIP-2537 G2 point — the `popPoint` argument. */ popPoint: Hex; /** `sk · popPoint` as a 256-byte EIP-2537 G2 point — the `popSig` argument. */ popSig: Hex; /** `keccak256(publicKey)` — the nodeId the contract will derive and bind (NOT caller-chosen). */ nodeId: Hex; } /** * Build the Proof-of-Possession tuple for {@link https://github.com/AAStarCommunity/YetAnotherAA-Validator | AAStarBLSAlgorithm}'s * `registerWithProof(publicKey, popPoint, popSig)` from a BLS12-381 secret key. * * The returned `nodeId` (`keccak256(publicKey)`) is what the contract binds to `msg.sender`; surface it * to the operator so the UI can show/track it before the tx lands. * * @param blsSecretKey 32-byte BLS12-381 secret scalar (hex), in [1, r-1]. * @throws if the secret key is out of range (0 or ≥ curve order). */ declare function buildDvtPop(blsSecretKey: Hex): DvtPop; /** * The deterministic PoP point for a public key: `hashToCurve(publicKey, POP_DST)` in the 256-byte * c0-first EIP-2537 G2 layout — the SAME value {@link buildDvtPop} puts in `popPoint`, but computed with * **no secret key**. Use it to CROSS-CHECK a `popPoint` produced elsewhere (e.g. a KMS-TEE `/pop` response * for a key-less node) before trusting it: `popPoint` is a public deterministic function of `publicKey`, so * a client can recompute and reject a mismatch, while the on-chain `_verifyPoP` pairing still gates `popSig`. * * @param publicKey G1 public key — 128-byte EIP-2537, 48-byte compressed, or 96-byte uncompressed. */ declare function dvtPopPoint(publicKey: Hex | Uint8Array): Hex; /** The nodeId the DVT validator derives and binds: `keccak256(publicKey)` (128-byte EIP-2537 normalized). */ declare function dvtNodeId(publicKey: Hex | Uint8Array): Hex; /** * Verify a {@link DvtPop} tuple the same way the on-chain `_verifyPoP` pairing does — WITHOUT a secret key: * every point is on-curve and non-infinity, and `e(publicKey, popPoint) == e(G1_generator, popSig)` (i.e. * `popSig = sk · popPoint` for the `sk` behind `publicKey`). Throws on any failure. * * Use this to fail fast on a malformed / incorrect PoP obtained from an external signer (e.g. a KMS-TEE * `/pop` response) BEFORE spending gas or locking stake, instead of only discovering it at the on-chain * register tx. NOTE: this proves knowledge of `sk` for the GIVEN `publicKey` — it does NOT tell you the * key belongs to the node you intended (a self-consistent tuple for a DIFFERENT key also passes). Pin the * expected `publicKey` separately for that. */ declare function verifyDvtPop(pop: Pick): void; export { type DvtPop as D, dvtNodeId as a, buildDvtPop as b, dvtPopPoint as d, encodeG1Point as e, verifyDvtPop as v };