pub fn check_sig(
msg: Message<'_>,
sig: Signature<'_>,
key: &PublicKey,
) -> Result<bool>Expand description
Verify sig over msg for public key key.
msg and sig are wrapped in the distinct Message and Signature newtypes so the
compiler rejects a caller that swaps them; &PublicKey (33 bytes) enforces the key size at
the call site.
- secp256k1 keys (0x02/0x03): the host pre-hashes
msgwith SHA-512Half before ECDSA verify. - Ed25519 keys (0xED): the host verifies the raw
msgdirectly (no pre-hash), stripping the 0xED prefix; a non-canonical signature returnsOk(false).
An empty msg or empty sig is not an error — the host returns Ok(false).
Errors: InvalidParams if the key is malformed (not 33 bytes / bad prefix);
DataFieldTooLarge if any parameter exceeds 1024 bytes.