Skip to main content

Module admin

Module admin 

Source
Expand description

Admin API authentication using JWT.

The Ghost Admin API uses short-lived JWTs signed with HMAC-SHA256 (HS256). Admin API keys have the format {id}:{hex_secret} where id is placed in the JWT kid header and hex_secret (hex-decoded) is the HMAC signing key.

Tokens expire after 5 minutes and carry only iat and exp claims.

§Example

use ghost_io_api::auth::admin::AdminApiKey;

let raw = "6748592f4b9b7700010f6564:b1b5b9c1d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1";
let key = AdminApiKey::new(raw).unwrap();
let token = key.generate_jwt().unwrap();
assert!(!token.is_empty());

Structs§

AdminApiKey
Admin API key for JWT-based authentication.