Treatment verify
crypto/signature/ed25519::verify
Parameters
↳ var encoding: string = "hex"
↳ var public_key: string
Inputs
⇥ data: Stream<byte>
⇥ signature: Block<Option<string>>
Outputs
↦ error: Block<string>
↦ failed: Block<void>
↦ invalid: Block<void>
↦ valid: Block<void>
Verifies the Ed25519 signature of data.
The bytes received through data are checked against signature with public_key,
once data ends, such as the X-Signature-Timestamp header followed by the body of
Discord interactions, signed in the X-Signature-Ed25519 header. public_key is a PEM
public key (-----BEGIN PUBLIC KEY-----), or the 32 bytes of the key encoded with
encoding, as signature is (hex, in any case, base64, or base64url, with or
without padding). The data is kept until it ends, as Ed25519 signs messages whole.
valid is emitted if signature matches, invalid otherwise, including when
signature is none or is not validly encoded.
If public_key or encoding is not valid, failed is emitted and error contains
the reason.