LC_TOKEN_NEW(3)

πŸ’– LC_TOKEN_NEW β€” create and sign capability token πŸ’–

okay bestie, welcome to lc_token_new(3) from the Librecast Programmer's Manual. this one's a whole vibe: you're making a token, and then you're signing it. main character energy fr fr πŸŽ€


✨ NAME ✨

lc_token_new β€” create and sign capability token πŸ’…


πŸ“š LIBRARY πŸ“š

Librecast library (liblibrecast, -llibrecast) πŸ¦‹


🌸 SYNOPSIS 🌸

#include <librecast/key.h>

int lc_token_new(lc_token_t *token, lc_keypair_t *signing_key, uint8_t *bearer_key,
     lc_channel_t *chan ,uint8_t capbits ,uint64_t valid_sec);

Compile and link with -llibrecast. no cap. 🫢


πŸ‘‘ DESCRIPTION πŸ‘‘

lc_token_new() creates and signs a new capability token. literally its whole thing. it makes it, it signs it, it's done. slay. ✨

  • token is a pointer to the token to sign. that's the lil guy you're handing over so it can get signed.
  • signing_key is a pointer to the signing keypair, created with lc_keypair_new(3). you gotta have the keypair first bestie, no shortcuts.
  • bearer_key is a pointer to the public key of the bearer of the token. and like, who is the bearer? the bearer is the entity using the token for sending. they're the one holding it, iykyk.
  • chan is a pointer to the Librecast channel for which the token will be valid. so the token only works there. location-locked, iconic.
  • capbits is an 8-bit arbitrary value representing the capabilities to issue. and listen: these have no intrinsic meaning and are defined by the caller. so you decide what the bits mean, bestie. the library is not gonna read your mind. πŸ™ˆ
  • valid_sec is an unsigned 64-bit value representing the number of seconds from now that the token will be valid for. it's a countdown, not an absolute timestamp. ticking clock vibes. ⏳

πŸ’« RETURN VALUE πŸ’«

lc_socket_new() returns 0 if the call succeeds, or -1 if an error occurred. and in the event of an error, errno is set to indicate the error. yes, the page really does say lc_socket_new() right there β€” we're keeping it exactly as written, that's the text, periodt. 😭


πŸ’€ ERRORS πŸ’€

lc_token_new() can fail with the following errors:

  • ENOTRECOVERABLE β€” Signing the token failed. the signing just didn't sign. tragic. 😭

lc_token_new() could also fail with any of the errors listed in clock_gettime(2). so go read that one too, bestie. 🌈


πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, bestie!! this one came from LIBRECAST on 2025-04-02, filed under LC_TOKEN_NEW(3) in the Librecast Programmer's Manual. go make some tokens, sign them, and stay iconic. mwah πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from