LC_TOKEN_NEW(3)

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.

DESCRIPTION
lc_token_new() creates and signs a new capability token.

token is a pointer to the token to sign.

signing_key is a pointer to the signing keypair, created with lc_keypair_new(3).

bearer_key is a pointer to the public key of the bearer of the token. The bearer is the entity using the token for sending.

chan is a pointer to the Librecast channel for which the token will be valid.

capbits is an 8-bit arbitrary value representing the capabilities to issue. These have no intrinsic meaning and are defined by the caller.

valid_sec is an unsigned 64-bit value representing the number of seconds from now that the token will be valid for.

RETURN VALUE
lc_socket_new() returns 0 if the call succeeds, or -1 if an error occurred. In the event of an error, errno is set to indicate the error.

ERRORS
lc_token_new() can fail with the following errors:

ENOTRECOVERABLE
    Signing the token failed.

lc_token_new() could also fail with any of the errors listed in clock_gettime(2)

SEE ALSO
lc_channel_token_set(3), lc_channel_filter_set(3), lc_channel_new(3), lc_keypair_new(3), clock_gettime(2)