method ed25519.verify
True when signature is valid for message under publicKey (any malformed input is simply false).
Example:
use std.crypto { ed25519 }
use std.ser { bytesOf }
fn main() io, rand {
let kp = ed25519.generate()
let sig = ed25519.sign(&kp.secretKey, bytesOf(&"pay 10"))!
print("{ed25519.verify(kp.publicKey, bytesOf(&"pay 10"), sig)} {ed25519.verify(kp.publicKey, bytesOf(&"pay 99"), sig)}")
}Output
true false
pub(api) static fn verify(publicKey: bytes, message: bytes, signature: bytes) -> boolComplexity. O(n) in the size of the message.
Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
publicKey | bytes |
message | bytes |
signature | bytes |
Returns
bool
Effects
none declared (pure unless the body says otherwise)
Defined in: std/crypto/crypto.oxl:661