![]() |
Aranya
a software development tool for governing access to data and services over a decentralized, zero-trust framework with secure end-to-end encrypted data exchange built-in.
|
External header file containing C function definitions for the Aranya client library. More...
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include <sys/socket.h>
Go to the source code of this file.
Data Structures | |
struct | AranyaExtError |
Extended error information. More... | |
struct | AranyaClient |
A handle to an Aranya Client. More... | |
struct | AranyaClientConfig |
Configuration info for Aranya. More... | |
struct | AranyaId |
struct | AranyaDeviceId |
Device ID. More... | |
struct | AranyaClientConfigBuilder |
Configuration info builder for Aranya. More... | |
struct | AranyaAqcConfigBuilder |
Configuration info builder for Aranya QUIC Channels. More... | |
struct | AranyaAqcConfig |
Configuration info for Aranya QUIC Channels. More... | |
struct | AranyaQuicSyncConfigBuilder |
struct | AranyaSeedIkm |
Raw PSK seed IKM for QUIC syncer. More... | |
struct | AranyaQuicSyncConfig |
struct | AranyaTeamConfigBuilder |
struct | AranyaTeamConfig |
struct | AranyaSyncPeerConfigBuilder |
Builder for a Sync Peer config. More... | |
struct | AranyaSyncPeerConfig |
Sync Peer config. More... | |
struct | AranyaTeamId |
Team ID. More... | |
struct | AranyaLabelId |
Label ID. More... | |
struct | AranyaAqcPeerChannel |
A type containing the AQC channel variant. More... | |
struct | AranyaAqcBidiChannel |
An AQC Bidirectional Channel Object. More... | |
struct | AranyaAqcSendChannel |
An AQC Sender Channel Object. More... | |
struct | AranyaAqcReceiveChannel |
An AQC Receiver Channel Object. More... | |
struct | AranyaAqcBidiStream |
An AQC Bidirectional Stream Object. More... | |
struct | AranyaAqcSendStream |
An AQC Sender Stream Object. More... | |
struct | AranyaAqcReceiveStream |
An AQC Receiver Stream Object. More... | |
Macros | |
#define | __has_attribute(x) 0 |
#define | ARANYA_NO_RETURN |
#define | ARANYA_NON_NULL |
#define | ARANYA_PACKED |
#define | ARANYA_DURATION_SECONDS (1000 * ARANYA_DURATION_MILLISECONDS) |
#define | ARANYA_DURATION_MILLISECONDS (1000 * ARANYA_DURATION_MICROSECONDS) |
#define | ARANYA_DURATION_MICROSECONDS (1000 * ARANYA_DURATION_NANOSECONDS) |
#define | ARANYA_DURATION_NANOSECONDS 1 |
#define | ARANYA_ID_LEN 32 |
The size in bytes of an ID. | |
#define | ARANYA_SEED_IKM_LEN 32 |
The size in bytes of a PSK seed IKM. | |
#define | ARANYA_ID_STR_LEN (((ARANYA_ID_LEN * 1375) / 1000) + 1) |
The size in bytes of an ID converted to a human-readable base58 string. | |
Typedefs | |
typedef uint8_t | AranyaAqcChannelType |
typedef uint8_t | AranyaChanOp |
typedef uint32_t | AranyaError |
typedef uint8_t | AranyaRole |
typedef struct AranyaExtError | AranyaExtError |
Extended error information. | |
typedef struct AranyaClient | AranyaClient |
A handle to an Aranya Client. | |
typedef struct AranyaClientConfig | AranyaClientConfig |
Configuration info for Aranya. | |
typedef struct AranyaId | AranyaId |
typedef struct AranyaDeviceId | AranyaDeviceId |
Device ID. | |
typedef struct AranyaClientConfigBuilder | AranyaClientConfigBuilder |
Configuration info builder for Aranya. | |
typedef struct AranyaAqcConfigBuilder | AranyaAqcConfigBuilder |
Configuration info builder for Aranya QUIC Channels. | |
typedef struct AranyaAqcConfig | AranyaAqcConfig |
Configuration info for Aranya QUIC Channels. | |
typedef struct AranyaQuicSyncConfigBuilder | AranyaQuicSyncConfigBuilder |
typedef struct AranyaSeedIkm | AranyaSeedIkm |
Raw PSK seed IKM for QUIC syncer. | |
typedef struct AranyaQuicSyncConfig | AranyaQuicSyncConfig |
typedef struct AranyaTeamConfigBuilder | AranyaTeamConfigBuilder |
typedef struct AranyaTeamConfig | AranyaTeamConfig |
typedef struct AranyaSyncPeerConfigBuilder | AranyaSyncPeerConfigBuilder |
Builder for a Sync Peer config. | |
typedef struct AranyaSyncPeerConfig | AranyaSyncPeerConfig |
Sync Peer config. | |
typedef uint64_t | AranyaDuration |
A type to represent a span of time in nanoseconds. | |
typedef struct AranyaTeamId | AranyaTeamId |
Team ID. | |
typedef const char * | AranyaLabelName |
An AQC label name. | |
typedef struct AranyaLabelId | AranyaLabelId |
Label ID. | |
typedef const char * | AranyaAddr |
A network socket address for an Aranya client. | |
typedef const char * | AranyaNetIdentifier |
A network identifier for an Aranya client. | |
typedef struct AranyaAqcPeerChannel | AranyaAqcPeerChannel |
A type containing the AQC channel variant. | |
typedef struct AranyaAqcBidiChannel | AranyaAqcBidiChannel |
An AQC Bidirectional Channel Object. | |
typedef struct AranyaAqcSendChannel | AranyaAqcSendChannel |
An AQC Sender Channel Object. | |
typedef struct AranyaAqcReceiveChannel | AranyaAqcReceiveChannel |
An AQC Receiver Channel Object. | |
typedef struct AranyaAqcBidiStream | AranyaAqcBidiStream |
An AQC Bidirectional Stream Object. | |
typedef struct AranyaAqcSendStream | AranyaAqcSendStream |
An AQC Sender Stream Object. | |
typedef struct AranyaAqcReceiveStream | AranyaAqcReceiveStream |
An AQC Receiver Stream Object. | |
Enumerations | |
enum | AranyaAqcChannelType { ARANYA_AQC_CHANNEL_TYPE_BIDIRECTIONAL , ARANYA_AQC_CHANNEL_TYPE_RECEIVER } |
An enum containing all `AranyaAqcPeerChannel` variants. | |
enum | AranyaChanOp { ARANYA_CHAN_OP_RECV_ONLY , ARANYA_CHAN_OP_SEND_ONLY , ARANYA_CHAN_OP_SEND_RECV } |
Valid channel operations for a label assignment. More... | |
enum | AranyaError { ARANYA_ERROR_SUCCESS , ARANYA_ERROR_BUG , ARANYA_ERROR_TIMEOUT , ARANYA_ERROR_INVALID_ARGUMENT , ARANYA_ERROR_BUFFER_TOO_SMALL , ARANYA_ERROR_INVALID_UTF8 , ARANYA_ERROR_INVALID_ADDR , ARANYA_ERROR_IPC , ARANYA_ERROR_ARANYA , ARANYA_ERROR_AQC , ARANYA_ERROR_WOULD_BLOCK , ARANYA_ERROR_CLOSED , ARANYA_ERROR_CONFIG , ARANYA_ERROR_SERIALIZATION , ARANYA_ERROR_OTHER } |
An error code. More... | |
enum | AranyaRole { ARANYA_ROLE_OWNER , ARANYA_ROLE_ADMIN , ARANYA_ROLE_OPERATOR , ARANYA_ROLE_MEMBER } |
An enum containing team roles defined in the Aranya policy. More... | |
External header file containing C function definitions for the Aranya client library.
typedef const char* AranyaAddr |
A network socket address for an Aranya client.
E.g. "localhost:8080", "127.0.0.1:8080"
typedef struct AranyaAqcPeerChannel AranyaAqcPeerChannel |
A type containing the AQC channel variant.
Note that this data is only valid after a successful call to try_receive_channel
, and is invalidated after calling get_bidi_channel
/get_receive_channel
.
typedef const char* AranyaLabelName |
An AQC label name.
E.g. "TELEMETRY_LABEL"
typedef const char* AranyaNetIdentifier |
A network identifier for an Aranya client.
E.g. "localhost:8080", "127.0.0.1:8080"
enum AranyaChanOp |
Valid channel operations for a label assignment.
enum AranyaError |
An error code.
For extended error information, see `AranyaExtError`.
enum AranyaRole |
AranyaError aranya_aqc_config_build | ( | struct AranyaAqcConfigBuilder * | cfg, |
struct AranyaAqcConfig * | out | ||
) |
Attempts to construct an `AranyaAqcConfig`.
This function consumes and releases any resources associated with the memory pointed to by cfg
.
cfg | a pointer to the aqc config builder |
out | a pointer to write the aqc config to |
AranyaError aranya_aqc_config_build_ext | ( | struct AranyaAqcConfigBuilder * | cfg, |
struct AranyaAqcConfig * | out, | ||
struct AranyaExtError * | __ext_err | ||
) |
Attempts to construct an `AranyaAqcConfig`.
This function consumes and releases any resources associated with the memory pointed to by cfg
.
cfg | a pointer to the aqc config builder |
out | a pointer to write the aqc config to |
AranyaError aranya_aqc_config_builder_set_address | ( | struct AranyaAqcConfigBuilder * | cfg, |
const char * | address | ||
) |
Sets the network address that the AQC server should listen on.
cfg | a pointer to the aqc config builder |
address | a string with the address to bind to |
AranyaError aranya_aqc_config_builder_set_address_ext | ( | struct AranyaAqcConfigBuilder * | cfg, |
const char * | address, | ||
struct AranyaExtError * | __ext_err | ||
) |
Sets the network address that the AQC server should listen on.
cfg | a pointer to the aqc config builder |
address | a string with the address to bind to |
AranyaError aranya_client_config_build | ( | struct AranyaClientConfigBuilder * | cfg, |
struct AranyaClientConfig * | out | ||
) |
Attempts to construct a `AranyaClientConfig`.
This function consumes and releases any resources associated with the memory pointed to by cfg
.
cfg | a pointer to the client config builder |
out | a pointer to write the client config to |
AranyaError aranya_client_config_build_ext | ( | struct AranyaClientConfigBuilder * | cfg, |
struct AranyaClientConfig * | out, | ||
struct AranyaExtError * | __ext_err | ||
) |
Attempts to construct a `AranyaClientConfig`.
This function consumes and releases any resources associated with the memory pointed to by cfg
.
cfg | a pointer to the client config builder |
out | a pointer to write the client config to |
AranyaError aranya_client_config_builder_set_aqc_config | ( | struct AranyaClientConfigBuilder * | cfg, |
const struct AranyaAqcConfig * | aqc_config | ||
) |
Sets the configuration for Aranya QUIC Channels.
cfg | a pointer to the client config builder |
aqc_config | a pointer to a valid AQC config (see `AranyaAqcConfigBuilder`) |
AranyaError aranya_client_config_builder_set_aqc_config_ext | ( | struct AranyaClientConfigBuilder * | cfg, |
const struct AranyaAqcConfig * | aqc_config, | ||
struct AranyaExtError * | __ext_err | ||
) |
Sets the configuration for Aranya QUIC Channels.
cfg | a pointer to the client config builder |
aqc_config | a pointer to a valid AQC config (see `AranyaAqcConfigBuilder`) |
AranyaError aranya_client_config_builder_set_daemon_uds_path | ( | struct AranyaClientConfigBuilder * | cfg, |
const char * | address | ||
) |
Sets Unix Domain Socket path that the daemon is listening on.
cfg | a pointer to the client config builder |
address | a string containing the address |
AranyaError aranya_client_config_builder_set_daemon_uds_path_ext | ( | struct AranyaClientConfigBuilder * | cfg, |
const char * | address, | ||
struct AranyaExtError * | __ext_err | ||
) |
Sets Unix Domain Socket path that the daemon is listening on.
cfg | a pointer to the client config builder |
address | a string containing the address |
AranyaError aranya_decode_hex | ( | uint8_t * | dst, |
size_t | dst_len, | ||
const uint8_t * | src, | ||
size_t | src_len, | ||
size_t * | __output | ||
) |
Decodes the hexadecimal string src
into dst
and returns the number of bytes written to dst
.
If src
is a valid hexadecimal string, the number of bytes written to dst
will be exactly half the length of src
. Therefore, dst
must be at least half as long as src
.
dst | the output buffer |
src | the input hexadecimal string |
AranyaError aranya_decode_hex_ext | ( | uint8_t * | dst, |
size_t | dst_len, | ||
const uint8_t * | src, | ||
size_t | src_len, | ||
size_t * | __output, | ||
struct AranyaExtError * | __ext_err | ||
) |
Decodes the hexadecimal string src
into dst
and returns the number of bytes written to dst
.
If src
is a valid hexadecimal string, the number of bytes written to dst
will be exactly half the length of src
. Therefore, dst
must be at least half as long as src
.
dst | the output buffer |
src | the input hexadecimal string |
AranyaError aranya_init_logging | ( | void | ) |
Initializes logging.
Assumes the ARANYA_CAPI
environment variable has been set to the desired tracing log level. E.g. ARANYA_CAPI=debug
.
AranyaError aranya_init_logging_ext | ( | struct AranyaExtError * | __ext_err | ) |
Initializes logging.
Assumes the ARANYA_CAPI
environment variable has been set to the desired tracing log level. E.g. ARANYA_CAPI=debug
.
AranyaError aranya_quic_sync_config_build | ( | struct AranyaQuicSyncConfigBuilder * | cfg, |
struct AranyaQuicSyncConfig * | out | ||
) |
Attempts to construct a `AranyaQuicSyncConfig`.
This function consumes and releases any resources associated with the memory pointed to by cfg
.
cfg | a pointer to the QUIC sync config builder [QuicSyncConfigBuilder ] |
out | a pointer to write the QUIC sync config to `AranyaQuicSyncConfig` |
AranyaError aranya_quic_sync_config_build_ext | ( | struct AranyaQuicSyncConfigBuilder * | cfg, |
struct AranyaQuicSyncConfig * | out, | ||
struct AranyaExtError * | __ext_err | ||
) |
Attempts to construct a `AranyaQuicSyncConfig`.
This function consumes and releases any resources associated with the memory pointed to by cfg
.
cfg | a pointer to the QUIC sync config builder [QuicSyncConfigBuilder ] |
out | a pointer to write the QUIC sync config to `AranyaQuicSyncConfig` |
AranyaError aranya_quic_sync_config_generate | ( | struct AranyaQuicSyncConfigBuilder * | cfg | ) |
Attempts to set PSK seed generation mode value on `AranyaQuicSyncConfigBuilder`.
cfg | a pointer to the quic sync config builder |
AranyaError aranya_quic_sync_config_generate_ext | ( | struct AranyaQuicSyncConfigBuilder * | cfg, |
struct AranyaExtError * | __ext_err | ||
) |
Attempts to set PSK seed generation mode value on `AranyaQuicSyncConfigBuilder`.
cfg | a pointer to the quic sync config builder |
AranyaError aranya_quic_sync_config_raw_seed_ikm | ( | struct AranyaQuicSyncConfigBuilder * | cfg, |
const struct AranyaSeedIkm * | ikm | ||
) |
Attempts to set raw PSK seed IKM value on `AranyaQuicSyncConfigBuilder`.
cfg | a pointer to the quic sync config builder |
ikm | a pointer the raw PSK seed IKM |
AranyaError aranya_quic_sync_config_raw_seed_ikm_ext | ( | struct AranyaQuicSyncConfigBuilder * | cfg, |
const struct AranyaSeedIkm * | ikm, | ||
struct AranyaExtError * | __ext_err | ||
) |
Attempts to set raw PSK seed IKM value on `AranyaQuicSyncConfigBuilder`.
cfg | a pointer to the quic sync config builder |
ikm | a pointer the raw PSK seed IKM |
AranyaError aranya_quic_sync_config_wrapped_seed | ( | struct AranyaQuicSyncConfigBuilder * | cfg, |
const uint8_t * | encap_seed, | ||
size_t | encap_seed_len | ||
) |
Attempts to set wrapped PSK seed value on `AranyaQuicSyncConfigBuilder`.
cfg | a pointer to the quic sync config builder |
encap_seed | a pointer the encapsulated PSK seed |
AranyaError aranya_quic_sync_config_wrapped_seed_ext | ( | struct AranyaQuicSyncConfigBuilder * | cfg, |
const uint8_t * | encap_seed, | ||
size_t | encap_seed_len, | ||
struct AranyaExtError * | __ext_err | ||
) |
Attempts to set wrapped PSK seed value on `AranyaQuicSyncConfigBuilder`.
cfg | a pointer to the quic sync config builder |
encap_seed | a pointer the encapsulated PSK seed |
AranyaError aranya_rand | ( | struct AranyaClient * | client, |
uint8_t * | buf, | ||
size_t | buf_len | ||
) |
Return random bytes from Aranya's CSPRNG.
This method can be used to generate a PSK seed IKM for the QUIC syncer.
[in] | client | the Aranya Client `AranyaClient`. |
[out] | buf | buffer where random bytes are written to. |
[in] | buf_len | the size of the buffer. |
AranyaError aranya_rand_ext | ( | struct AranyaClient * | client, |
uint8_t * | buf, | ||
size_t | buf_len, | ||
struct AranyaExtError * | __ext_err | ||
) |
Return random bytes from Aranya's CSPRNG.
This method can be used to generate a PSK seed IKM for the QUIC syncer.
[in] | client | the Aranya Client `AranyaClient`. |
[out] | buf | buffer where random bytes are written to. |
[in] | buf_len | the size of the buffer. |
AranyaError aranya_sync_peer_config_build | ( | struct AranyaSyncPeerConfigBuilder * | cfg, |
struct AranyaSyncPeerConfig * | out | ||
) |
Attempts to build a `AranyaSyncPeerConfig`.
This function consumes and releases any resources associated with the memory pointed to by cfg
.
cfg | a pointer to the builder for a sync config |
AranyaError aranya_sync_peer_config_build_ext | ( | struct AranyaSyncPeerConfigBuilder * | cfg, |
struct AranyaSyncPeerConfig * | out, | ||
struct AranyaExtError * | __ext_err | ||
) |
Attempts to build a `AranyaSyncPeerConfig`.
This function consumes and releases any resources associated with the memory pointed to by cfg
.
cfg | a pointer to the builder for a sync config |
AranyaError aranya_sync_peer_config_builder_set_interval | ( | struct AranyaSyncPeerConfigBuilder * | cfg, |
AranyaDuration | interval | ||
) |
Configures how often the peer will be synced with.
By default, the interval is not set. It is an error to call `aranya_sync_peer_config_build` before setting the interval with this function
cfg | a pointer to the builder for a sync config |
interval | Set the interval at which syncing occurs |
AranyaError aranya_sync_peer_config_builder_set_interval_ext | ( | struct AranyaSyncPeerConfigBuilder * | cfg, |
AranyaDuration | interval, | ||
struct AranyaExtError * | __ext_err | ||
) |
Configures how often the peer will be synced with.
By default, the interval is not set. It is an error to call `aranya_sync_peer_config_build` before setting the interval with this function
cfg | a pointer to the builder for a sync config |
interval | Set the interval at which syncing occurs |
AranyaError aranya_sync_peer_config_builder_set_sync_later | ( | struct AranyaSyncPeerConfigBuilder * | cfg | ) |
Updates the config to disable immediate syncing with the peer.
Overrides `aranya_sync_peer_config_builder_set_sync_now` if invoked afterward.
By default, the peer is synced with immediately.
cfg | a pointer to the builder for a sync config |
AranyaError aranya_sync_peer_config_builder_set_sync_later_ext | ( | struct AranyaSyncPeerConfigBuilder * | cfg, |
struct AranyaExtError * | __ext_err | ||
) |
Updates the config to disable immediate syncing with the peer.
Overrides `aranya_sync_peer_config_builder_set_sync_now` if invoked afterward.
By default, the peer is synced with immediately.
cfg | a pointer to the builder for a sync config |
AranyaError aranya_sync_peer_config_builder_set_sync_now | ( | struct AranyaSyncPeerConfigBuilder * | cfg | ) |
Updates the config to enable immediate syncing with the peer.
Overrides `aranya_sync_peer_config_builder_set_sync_later` if invoked afterward.
By default, the peer is synced with immediately.
cfg | a pointer to the builder for a sync config |
AranyaError aranya_sync_peer_config_builder_set_sync_now_ext | ( | struct AranyaSyncPeerConfigBuilder * | cfg, |
struct AranyaExtError * | __ext_err | ||
) |
Updates the config to enable immediate syncing with the peer.
Overrides `aranya_sync_peer_config_builder_set_sync_later` if invoked afterward.
By default, the peer is synced with immediately.
cfg | a pointer to the builder for a sync config |
AranyaError aranya_team_config_build | ( | struct AranyaTeamConfigBuilder * | cfg, |
struct AranyaTeamConfig * | out | ||
) |
Attempts to construct a `AranyaTeamConfig`.
This function consumes and releases any resources associated with the memory pointed to by cfg
.
cfg | a pointer to the team config builder |
out | a pointer to write the team config to |
AranyaError aranya_team_config_build_ext | ( | struct AranyaTeamConfigBuilder * | cfg, |
struct AranyaTeamConfig * | out, | ||
struct AranyaExtError * | __ext_err | ||
) |
Attempts to construct a `AranyaTeamConfig`.
This function consumes and releases any resources associated with the memory pointed to by cfg
.
cfg | a pointer to the team config builder |
out | a pointer to write the team config to |
AranyaError aranya_team_config_builder_set_quic_syncer | ( | struct AranyaTeamConfigBuilder * | cfg, |
struct AranyaQuicSyncConfig * | quic | ||
) |
Configures QUIC syncer for `AranyaTeamConfigBuilder`.
By default, the QUIC syncer config is not set. It is an error to call `aranya_team_config_build` before setting the interval with this function
cfg | a pointer to the builder for a team config |
quic | set the QUIC syncer config |
AranyaError aranya_team_config_builder_set_quic_syncer_ext | ( | struct AranyaTeamConfigBuilder * | cfg, |
struct AranyaQuicSyncConfig * | quic, | ||
struct AranyaExtError * | __ext_err | ||
) |
Configures QUIC syncer for `AranyaTeamConfigBuilder`.
By default, the QUIC syncer config is not set. It is an error to call `aranya_team_config_build` before setting the interval with this function
cfg | a pointer to the builder for a team config |
quic | set the QUIC syncer config |