1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
.TH LC_TOKEN_NEW 3 2025-04-02 "LIBRECAST" "Librecast Programmer's Manual"
.SH NAME
lc_token_new \- create and sign capability token
.SH LIBRARY
Librecast library
.RI ( liblibrecast ", " \-llibrecast )
.SH SYNOPSIS
.nf
.B #include <librecast/key.h>
.PP
.BI "int lc_token_new(lc_token_t " *token ", lc_keypair_t " *signing_key ", uint8_t " *bearer_key ","
.BI lc_channel_t " *chan ", uint8_t " capbits ", uint64_t " valid_sec");
.fi
.PP
Compile and link with \fI\-llibrecast\fP.
.SH DESCRIPTION
.BR lc_token_new ()
creates and signs a new capability token.
.PP
.IR token
is a pointer to the token to sign.
.PP
.IR signing_key
is a pointer to the signing keypair, created with
.BR lc_keypair_new (3).
.PP
.IR 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.
.PP
.IR chan
is a pointer to the Librecast channel for which the token will be valid.
.PP
.IR capbits
is an 8-bit arbitrary value representing the capabilities to issue. These have
no intrinsic meaning and are defined by the caller.
.PP
.IR valid_sec
is an unsigned 64-bit value representing the number of seconds from now that the
token will be valid for.
.SH RETURN VALUE
.BR lc_socket_new ()
returns 0 if the call succeeds, or -1 if an error occurred. In the event of
an error,
.I errno
is set to indicate the error.
.SH ERRORS
.BR lc_token_new ()
can fail with the following errors:
.TP
.B ENOTRECOVERABLE
Signing the token failed.
.PP
.BR lc_token_new ()
could also fail with any of the errors listed in
.BR clock_gettime (2)
.SH SEE ALSO
.BR lc_channel_token_set (3),
.BR lc_channel_filter_set (3),
.BR lc_channel_new (3),
.BR lc_keypair_new (3),
.BR clock_gettime (2)
|