Convenience: issue a token and return it as a lowercase hex string.
(
secret: &[u8; 32],
for_node: u64,
expiry_unix_secs: u64,
)
| 66 | |
| 67 | /// Convenience: issue a token and return it as a lowercase hex string. |
| 68 | pub fn issue_token( |
| 69 | secret: &[u8; 32], |
| 70 | for_node: u64, |
| 71 | expiry_unix_secs: u64, |
| 72 | ) -> Result<String, TokenError> { |
| 73 | let bytes = issue_token_bytes(secret, for_node, expiry_unix_secs)?; |
| 74 | Ok(token_to_hex(&bytes)) |
| 75 | } |
| 76 | |
| 77 | /// Encode raw token bytes as a lowercase hex string. |
| 78 | pub fn token_to_hex(bytes: &[u8]) -> String { |