Skip to main content

new_secret

Function new_secret 

Source
pub fn new_secret() -> String
Expand description

A new Standard Webhooks secret for an endpoint: whsec_ and 32 random bytes in base64.

Show it to the user once, store it (encrypted, see encryption), and pass it to deliver.

ยงExamples

let secret = ocre::webhooks::new_secret();
assert!(secret.starts_with("whsec_") && secret.len() == 6 + 44);
assert!(ocre::webhooks::sign_standard(&secret, "msg_1", 0, b"{}").is_ok());