Skip to main content

Module signed

Module signed 

Source
Expand description

Signed routes — SignedUrls and ValidateSignature.

ⓘ
// Generating one, from a named route.
let link = signed.route("unsubscribe", &[("user", "42")])?;
let link = signed.temporary_route("verify-email", expires_at, &[("user", "42")])?;

// Checking it.
router.get("/verify-email", verify).name("verify-email")
    .middleware(ValidateSignature::resolved());

The point is what it removes: an unsubscribe link, a verification link or a one-time download needs no token table, no lookup and no sweep job, because the URL carries its own proof.

Read UrlSigner for what is signed and — more importantly — for the two things a signature is not: single-use, and secret.

Structs§

SignedUrls
Signed URLs for this application’s named routes.
ValidateSignature
Refuses a request whose URL is not signed by this application.