Skip to main content

public_id

Function public_id 

Source
pub fn public_id() -> String
Expand description

A random id for URLs: 22 URL-safe characters (128 bits), the value of a public_id:token column. Unguessable, so a page at /videos/<public_id> cannot be found by counting, and it says nothing about how many rows exist.

§Panics

As generate.

§Examples

let id = ocre::token::public_id();
assert_eq!(id.len(), 22);
assert!(id.chars().all(|c| c.is_ascii_alphanumeric() || c == '-' || c == '_'));