14#ifndef ARANYA_CLIENT_H
15#define ARANYA_CLIENT_H
24#include <sys/socket.h>
26#ifndef __has_attribute
27 #define __has_attribute(x) 0
30#if !defined(ARANYA_ALIGNED)
31 #if __has_attribute(aligned)
32 #define ARANYA_ALIGNED(n) __attribute__((aligned(n)))
34 #error "compiler must support `aligned` attribute"
38#if !defined(ARANYA_DESIGNATED_INIT)
39 #if __has_attribute(designated_init)
40 #define ARANYA_DESIGNATED_INIT __attribute__((designated_init))
42 #define ARANYA_DESIGNATED_INIT
46#if !defined(ARANYA_MUST_USE)
47 #if __has_attribute(warn_unused_result)
48 #define ARANYA_MUST_USE __attribute__((warn_unused_result))
50 #define ARANYA_MUST_USE
54#if !defined(ARANYA_NO_RETURN)
55 #if __has_attribute(noreturn)
56 #define ARANYA_NO_RETURN __attribute__((noreturn))
58 #define ARANYA_NO_RETURN
62#if !defined(ARANYA_NON_NULL)
64 #if __has_attribute(nonnull)
65 #define ARANYA_NON_NULL __attribute__((nonnull))
67 #elif defined(__clang__)
68 #define ARANYA_NON_NULL _Nonnull
70 #define ARANYA_NON_NULL
74#if !defined(ARANYA_PACKED)
75 #if __has_attribute(packed)
76 #define ARANYA_PACKED __attribute__((packed))
82#if !defined(ARANYA_DEPRECATED)
83 #if __has_attribute(deprecated)
84 #define ARANYA_DEPRECATED __attribute__((deprecated))
85 #define ARANYA_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
87 #define ARANYA_DEPRECATED
88 #define ARANYA_DEPRECATED_MSG(msg)
93#define ARANYA_DURATION_SECONDS (1000 * ARANYA_DURATION_MILLISECONDS)
95#define ARANYA_DURATION_MILLISECONDS (1000 * ARANYA_DURATION_MICROSECONDS)
97#define ARANYA_DURATION_MICROSECONDS (1000 * ARANYA_DURATION_NANOSECONDS)
99#define ARANYA_DURATION_NANOSECONDS 1
104#define ARANYA_ID_LEN 32
109#define ARANYA_SEED_IKM_LEN 32
114#define ARANYA_ID_STR_LEN (((ARANYA_ID_LEN * 1375) / 1000) + 1)
116#if defined(ENABLE_ARANYA_AFC)
123#define ARANYA_AFC_CHANNEL_OVERHEAD 24
176#if defined(ENABLE_ARANYA_AFC)
177 ARANYA_ERROR_WRONG_CHANNEL_TYPE,
355 uint8_t __for_size_only[96];
367 uint8_t __for_size_only[3728];
381 uint8_t __for_size_only[56];
393 uint8_t __for_size_only[112];
426 uint8_t __for_size_only[112];
445 uint8_t __for_size_only[72];
459 uint8_t __for_size_only[288];
473 uint8_t __for_size_only[56];
494 uint8_t __for_size_only[56];
508 uint8_t __for_size_only[288];
520 uint8_t __for_size_only[328];
532 uint8_t __for_size_only[56];
553 uint8_t __for_size_only[320];
567 uint8_t __for_size_only[56];
579 uint8_t __for_size_only[40];
593 uint8_t __for_size_only[40];
601#if defined(ENABLE_ARANYA_PREVIEW)
605typedef struct ARANYA_ALIGNED(8) AranyaHelloSubscriptionConfigBuilder {
611 uint8_t __for_size_only[40];
612} AranyaHelloSubscriptionConfigBuilder;
615#if defined(ENABLE_ARANYA_PREVIEW)
621typedef struct ARANYA_ALIGNED(8) AranyaHelloSubscriptionConfig {
627 uint8_t __for_size_only[40];
628} AranyaHelloSubscriptionConfig;
666#if defined(ENABLE_ARANYA_AFC)
676 uint8_t __for_size_only[160];
680#if defined(ENABLE_ARANYA_AFC)
690 uint8_t __for_size_only[160];
694#if defined(ENABLE_ARANYA_AFC)
707 uint8_t __for_size_only[32];
711#if defined(ENABLE_ARANYA_AFC)
723 uint8_t __for_size_only[24];
727#if defined(ENABLE_ARANYA_AFC)
749const char *aranya_error_to_str(uint32_t err);
889 const char **__output);
941 const char **__output);
963 const char **__output);
991 uint8_t *public_key_bundle,
992 size_t *public_key_bundle_len);
1004 uint8_t *public_key_bundle,
1005 size_t *public_key_bundle_len,
1019ARANYA_DEPRECATED_MSG(
"Use `aranya_get_public_key_bundle`.")
1021 uint8_t *public_key_bundle,
1022 size_t *public_key_bundle_len);
1035ARANYA_DEPRECATED_MSG("Use `aranya_get_public_key_bundle`.")
1037 uint8_t *public_key_bundle,
1038 size_t *public_key_bundle_len,
1145 const
char *address);
1156 const
char *address,
1231 const uint8_t *encap_seed,
1232 size_t encap_seed_len);
1245 const uint8_t *encap_seed,
1246 size_t encap_seed_len,
1671#if defined(ENABLE_ARANYA_PREVIEW)
1683 uint32_t sync_on_hello);
1686#if defined(ENABLE_ARANYA_PREVIEW)
1698 uint32_t sync_on_hello,
1702#if defined(ENABLE_ARANYA_PREVIEW)
1711AranyaError aranya_hello_subscription_config_builder_init(
struct AranyaHelloSubscriptionConfigBuilder *out);
1714#if defined(ENABLE_ARANYA_PREVIEW)
1722AranyaError aranya_hello_subscription_config_builder_cleanup(
struct AranyaHelloSubscriptionConfigBuilder *ptr);
1725#if defined(ENABLE_ARANYA_PREVIEW)
1737AranyaError aranya_hello_subscription_config_build(
struct AranyaHelloSubscriptionConfigBuilder *cfg,
1738 struct AranyaHelloSubscriptionConfig *out);
1741#if defined(ENABLE_ARANYA_PREVIEW)
1753AranyaError aranya_hello_subscription_config_build_ext(
struct AranyaHelloSubscriptionConfigBuilder *cfg,
1754 struct AranyaHelloSubscriptionConfig *out,
1758#if defined(ENABLE_ARANYA_PREVIEW)
1770AranyaError aranya_hello_subscription_config_builder_set_graph_change_debounce(
struct AranyaHelloSubscriptionConfigBuilder *cfg,
1774#if defined(ENABLE_ARANYA_PREVIEW)
1786AranyaError aranya_hello_subscription_config_builder_set_graph_change_debounce_ext(
struct AranyaHelloSubscriptionConfigBuilder *cfg,
1791#if defined(ENABLE_ARANYA_PREVIEW)
1803AranyaError aranya_hello_subscription_config_builder_set_expiration(
struct AranyaHelloSubscriptionConfigBuilder *cfg,
1807#if defined(ENABLE_ARANYA_PREVIEW)
1819AranyaError aranya_hello_subscription_config_builder_set_expiration_ext(
struct AranyaHelloSubscriptionConfigBuilder *cfg,
1824#if defined(ENABLE_ARANYA_PREVIEW)
1835AranyaError aranya_hello_subscription_config_builder_set_periodic_interval(
struct AranyaHelloSubscriptionConfigBuilder *cfg,
1839#if defined(ENABLE_ARANYA_PREVIEW)
1850AranyaError aranya_hello_subscription_config_builder_set_periodic_interval_ext(
struct AranyaHelloSubscriptionConfigBuilder *cfg,
1986 size_t *roles_out_len);
2005 size_t *roles_out_len,
2637 const uint8_t *public_key_bundle,
2638 size_t public_key_bundle_len,
2664 const uint8_t *public_key_bundle,
2665 size_t public_key_bundle_len,
2757 const uint8_t *keybundle,
2758 size_t keybundle_len,
2780 const uint8_t *keybundle,
2781 size_t keybundle_len,
2887#if defined(ENABLE_ARANYA_PREVIEW)
2903 const struct AranyaHelloSubscriptionConfig *config);
2906#if defined(ENABLE_ARANYA_PREVIEW)
2922 const struct AranyaHelloSubscriptionConfig *config,
2926#if defined(ENABLE_ARANYA_PREVIEW)
2943#if defined(ENABLE_ARANYA_PREVIEW)
3025 size_t *devices_len);
3040 size_t *devices_len,
3094 uint8_t *public_key_bundle,
3095 size_t *public_key_bundle_len);
3111 uint8_t *public_key_bundle,
3112 size_t *public_key_bundle_len,
3128ARANYA_DEPRECATED_MSG(
"Use `aranya_team_device_public_key_bundle`.")
3132 uint8_t *public_key_bundle,
3133 size_t *public_key_bundle_len);
3148ARANYA_DEPRECATED_MSG("Use `aranya_team_device_public_key_bundle`.")
3152 uint8_t *public_key_bundle,
3153 size_t *public_key_bundle_len,
3175 size_t *labels_len);
3216 size_t *labels_len);
3306#if defined(ENABLE_ARANYA_AFC)
3317#if defined(ENABLE_ARANYA_AFC)
3328#if defined(ENABLE_ARANYA_AFC)
3339#if defined(ENABLE_ARANYA_AFC)
3350#if defined(ENABLE_ARANYA_AFC)
3379#if defined(ENABLE_ARANYA_AFC)
3409#if defined(ENABLE_ARANYA_AFC)
3423 const uint8_t *control,
3428#if defined(ENABLE_ARANYA_AFC)
3442 const uint8_t *control,
3448#if defined(ENABLE_ARANYA_AFC)
3459#if defined(ENABLE_ARANYA_AFC)
3471#if defined(ENABLE_ARANYA_AFC)
3482#if defined(ENABLE_ARANYA_AFC)
3494#if defined(ENABLE_ARANYA_AFC)
3505#if defined(ENABLE_ARANYA_AFC)
3517#if defined(ENABLE_ARANYA_AFC)
3528#if defined(ENABLE_ARANYA_AFC)
3540#if defined(ENABLE_ARANYA_AFC)
3551#if defined(ENABLE_ARANYA_AFC)
3563#if defined(ENABLE_ARANYA_AFC)
3574#if defined(ENABLE_ARANYA_AFC)
3586#if defined(ENABLE_ARANYA_AFC)
3597 const uint8_t **ptr,
3601#if defined(ENABLE_ARANYA_AFC)
3612 const uint8_t **ptr,
3617#if defined(ENABLE_ARANYA_AFC)
3630#if defined(ENABLE_ARANYA_AFC)
3644#if defined(ENABLE_ARANYA_AFC)
3656 const uint8_t *plaintext,
3657 size_t plaintext_len,
3662#if defined(ENABLE_ARANYA_AFC)
3674 const uint8_t *plaintext,
3675 size_t plaintext_len,
3681#if defined(ENABLE_ARANYA_AFC)
3694 const uint8_t *ciphertext,
3695 size_t ciphertext_len,
3701#if defined(ENABLE_ARANYA_AFC)
3714 const uint8_t *ciphertext,
3715 size_t ciphertext_len,
3722#if defined(ENABLE_ARANYA_AFC)
3738#if defined(ENABLE_ARANYA_AFC)
3755#if defined(ENABLE_ARANYA_AFC)
3771#if defined(ENABLE_ARANYA_AFC)
const char * AranyaRoleName
A role name.
Definition aranya-client.h:636
#define ARANYA_SEED_IKM_LEN
The size in bytes of a PSK seed IKM.
Definition aranya-client.h:109
AranyaError aranya_afc_ctrl_msg_get_bytes_ext(const struct AranyaAfcCtrlMsg *control, const uint8_t **ptr, size_t *len, struct AranyaExtError *__ext_err)
Returns the raw data for a given `AranyaAfcCtrlMsg`.
AranyaError aranya_afc_channel_seal_ext(struct AranyaAfcSendChannel *channel, const uint8_t *plaintext, size_t plaintext_len, uint8_t *dst, size_t *dst_len, struct AranyaExtError *__ext_err)
Encrypts and authenticates plaintext, and writes it to dst.
AranyaError aranya_afc_ctrl_msg_get_bytes(const struct AranyaAfcCtrlMsg *control, const uint8_t **ptr, size_t *len)
Returns the raw data for a given `AranyaAfcCtrlMsg`.
#define ARANYA_ID_LEN
The size in bytes of an ID.
Definition aranya-client.h:104
int64_t AranyaRank
A numerical rank used for authorization in the rank-based hierarchy.
Definition aranya-client.h:643
uint64_t AranyaDuration
A type to represent a span of time in nanoseconds.
Definition aranya-client.h:599
AranyaError aranya_afc_send_channel_get_id(const struct AranyaAfcSendChannel *channel, struct AranyaAfcChannelId *__output)
Returns the `AranyaAfcChannelId` for the associated `AranyaAfcSendChannel`.
AranyaError aranya_afc_channel_open_ext(const struct AranyaAfcReceiveChannel *channel, const uint8_t *ciphertext, size_t ciphertext_len, uint8_t *dst, size_t *dst_len, struct AranyaAfcSeq *seq, struct AranyaExtError *__ext_err)
Decrypts and authenticates ciphertext, and writes it to dst.
AranyaError aranya_afc_send_channel_get_id_ext(const struct AranyaAfcSendChannel *channel, struct AranyaAfcChannelId *__output, struct AranyaExtError *__ext_err)
Returns the `AranyaAfcChannelId` for the associated `AranyaAfcSendChannel`.
const char * AranyaAddr
A network socket address for an Aranya client.
Definition aranya-client.h:664
AranyaError aranya_init_logging(void)
Initializes logging.
AranyaError aranya_afc_receive_channel_get_peer_id_ext(const struct AranyaAfcReceiveChannel *channel, struct AranyaDeviceId *__output, struct AranyaExtError *__ext_err)
Returns the device ID of the peer on the other side of the channel.
AranyaError aranya_afc_receive_channel_get_id(const struct AranyaAfcReceiveChannel *channel, struct AranyaAfcChannelId *__output)
Returns the `AranyaAfcChannelId` for the associated `AranyaAfcReceiveChannel`.
AranyaError aranya_afc_send_channel_get_label_id_ext(const struct AranyaAfcSendChannel *channel, struct AranyaLabelId *__output, struct AranyaExtError *__ext_err)
Returns the `AranyaLabelId` for the associated `AranyaAfcSendChannel`.
AranyaError aranya_afc_receive_channel_get_peer_id(const struct AranyaAfcReceiveChannel *channel, struct AranyaDeviceId *__output)
Returns the device ID of the peer on the other side of the channel.
AranyaError aranya_afc_channel_seal(struct AranyaAfcSendChannel *channel, const uint8_t *plaintext, size_t plaintext_len, uint8_t *dst, size_t *dst_len)
Encrypts and authenticates plaintext, and writes it to dst.
AranyaError aranya_afc_send_channel_get_label_id(const struct AranyaAfcSendChannel *channel, struct AranyaLabelId *__output)
Returns the `AranyaLabelId` for the associated `AranyaAfcSendChannel`.
AranyaError aranya_add_perm_to_role_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaRoleId *role, AranyaPermission perm, struct AranyaExtError *__ext_err)
Add a permission to a role.
AranyaError aranya_afc_seq_cmp_ext(const struct AranyaAfcSeq *seq1, const struct AranyaAfcSeq *seq2, int *__output, struct AranyaExtError *__ext_err)
Returns the three-way comparison between seq1 and seq2.
const char * AranyaLabelName
A label name.
Definition aranya-client.h:650
AranyaError aranya_remove_perm_from_role_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaRoleId *role, AranyaPermission perm, struct AranyaExtError *__ext_err)
Remove a permission from a role.
AranyaError aranya_afc_send_channel_get_peer_id(const struct AranyaAfcSendChannel *channel, struct AranyaDeviceId *__output)
Returns the device ID of the peer on the other side of the channel.
AranyaError aranya_afc_seq_cmp(const struct AranyaAfcSeq *seq1, const struct AranyaAfcSeq *seq2, int *__output)
Returns the three-way comparison between seq1 and seq2.
AranyaPermission
Simple permission.
Definition aranya-client.h:217
@ ARANYA_PERMISSION_CAN_USE_AFC
The role can use AFC.
Definition aranya-client.h:281
@ ARANYA_PERMISSION_CREATE_ROLE
The role can create a role.
Definition aranya-client.h:238
@ ARANYA_PERMISSION_TERMINATE_TEAM
The role can terminate the team.
Definition aranya-client.h:230
@ ARANYA_PERMISSION_DELETE_LABEL
The role can delete a label.
Definition aranya-client.h:268
@ ARANYA_PERMISSION_CHANGE_ROLE_PERMS
The role can change permissions on roles.
Definition aranya-client.h:254
@ ARANYA_PERMISSION_DELETE_ROLE
The role can delete a role.
Definition aranya-client.h:242
@ ARANYA_PERMISSION_ADD_DEVICE
The role can add a device to the team.
Definition aranya-client.h:221
@ ARANYA_PERMISSION_CREATE_LABEL
The role can create a label.
Definition aranya-client.h:264
@ ARANYA_PERMISSION_SETUP_DEFAULT_ROLE
The role can set up default roles.
Definition aranya-client.h:260
@ ARANYA_PERMISSION_REMOVE_DEVICE
The role can remove a device from the team.
Definition aranya-client.h:225
@ ARANYA_PERMISSION_CREATE_AFC_UNI_CHANNEL
The role can create a unidirectional AFC channel.
Definition aranya-client.h:285
@ ARANYA_PERMISSION_ASSIGN_LABEL
The role can assign a label to a device.
Definition aranya-client.h:272
@ ARANYA_PERMISSION_ASSIGN_ROLE
The role can assign a role to other devices.
Definition aranya-client.h:246
@ ARANYA_PERMISSION_REVOKE_LABEL
The role can revoke a label from a device.
Definition aranya-client.h:276
@ ARANYA_PERMISSION_CHANGE_RANK
The role can change the rank of objects.
Definition aranya-client.h:234
@ ARANYA_PERMISSION_REVOKE_ROLE
The role can revoke a role from other devices.
Definition aranya-client.h:250
AranyaError aranya_init_logging_ext(struct AranyaExtError *__ext_err)
Initializes logging.
AranyaError aranya_add_perm_to_role(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaRoleId *role, AranyaPermission perm)
Add a permission to a role.
AranyaError aranya_afc_receive_channel_get_label_id(const struct AranyaAfcReceiveChannel *channel, struct AranyaLabelId *__output)
Returns the `AranyaLabelId` for the associated `AranyaAfcReceiveChannel`.
AranyaError
An error code.
Definition aranya-client.h:135
@ ARANYA_ERROR_INVALID_ARGUMENT
Invalid argument.
Definition aranya-client.h:151
@ ARANYA_ERROR_CONFIG
Unable to create configuration info.
Definition aranya-client.h:190
@ ARANYA_ERROR_IPC
Could not send request to daemon.
Definition aranya-client.h:171
@ ARANYA_ERROR_INVALID_UTF8
Invalid UTF-8.
Definition aranya-client.h:163
@ ARANYA_ERROR_TIMEOUT
Timed out.
Definition aranya-client.h:147
@ ARANYA_ERROR_BUFFER_TOO_SMALL
Buffer is too small.
Definition aranya-client.h:159
@ ARANYA_ERROR_BUG
Internal bug discovered.
Definition aranya-client.h:143
@ ARANYA_ERROR_INVALID_ADDR
Invalid Address.
Definition aranya-client.h:167
@ ARANYA_ERROR_SERIALIZATION
Serialization error.
Definition aranya-client.h:194
@ ARANYA_ERROR_SUCCESS
Success.
Definition aranya-client.h:139
@ ARANYA_ERROR_NOT_ENABLED
Component is not enabled.
Definition aranya-client.h:155
@ ARANYA_ERROR_OTHER
Some other error occurred.
Definition aranya-client.h:202
@ ARANYA_ERROR_ARANYA
An Aranya error.
Definition aranya-client.h:175
@ ARANYA_ERROR_CLOSED
A connection got unexpectedly closed.
Definition aranya-client.h:186
@ ARANYA_ERROR_WOULD_BLOCK
Tried to poll an endpoint but nothing received yet.
Definition aranya-client.h:182
@ ARANYA_ERROR_DOES_NOT_EXIST
The requested resource does not exist.
Definition aranya-client.h:198
AranyaChanOp
Valid channel operations for a label assignment.
Definition aranya-client.h:298
@ ARANYA_CHAN_OP_SEND_ONLY
The device can only send data in channels with this label.
Definition aranya-client.h:308
@ ARANYA_CHAN_OP_SEND_RECV
The device can send or receive data in channels with this label.
Definition aranya-client.h:313
@ ARANYA_CHAN_OP_RECV_ONLY
The device can only receive data in channels with this label.
Definition aranya-client.h:303
AranyaError aranya_afc_channel_open(const struct AranyaAfcReceiveChannel *channel, const uint8_t *ciphertext, size_t ciphertext_len, uint8_t *dst, size_t *dst_len, struct AranyaAfcSeq *seq)
Decrypts and authenticates ciphertext, and writes it to dst.
AranyaError aranya_afc_send_channel_get_peer_id_ext(const struct AranyaAfcSendChannel *channel, struct AranyaDeviceId *__output, struct AranyaExtError *__ext_err)
Returns the device ID of the peer on the other side of the channel.
AranyaError aranya_remove_perm_from_role(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaRoleId *role, AranyaPermission perm)
Remove a permission from a role.
AranyaError aranya_afc_receive_channel_get_id_ext(const struct AranyaAfcReceiveChannel *channel, struct AranyaAfcChannelId *__output, struct AranyaExtError *__ext_err)
Returns the `AranyaAfcChannelId` for the associated `AranyaAfcReceiveChannel`.
AranyaError aranya_afc_receive_channel_get_label_id_ext(const struct AranyaAfcReceiveChannel *channel, struct AranyaLabelId *__output, struct AranyaExtError *__ext_err)
Returns the `AranyaLabelId` for the associated `AranyaAfcReceiveChannel`.
A builder for initializing an `AranyaAddTeamConfig`.
Definition aranya-client.h:514
Team configuration used when joining a team.
Definition aranya-client.h:547
A builder for initializing an `AranyaAddTeamQuicSyncConfig`.
Definition aranya-client.h:453
QUIC syncer configuration.
Definition aranya-client.h:502
Channel ID for AFC channel.
Definition aranya-client.h:731
An AFC Control Message, used to create the other end of a channel.
Definition aranya-client.h:701
AranyaError aranya_afc_ctrl_msg_cleanup(struct AranyaAfcCtrlMsg *ptr)
Releases any resources associated with ptr.
An AFC Receiving Channel Object.
Definition aranya-client.h:684
AranyaError aranya_afc_receive_channel_cleanup(struct AranyaAfcReceiveChannel *ptr)
Releases any resources associated with ptr.
An AFC Sending Channel Object.
Definition aranya-client.h:670
AranyaError aranya_afc_send_channel_cleanup(struct AranyaAfcSendChannel *ptr)
Releases any resources associated with ptr.
An AFC Sequence Number, for reordering messages.
Definition aranya-client.h:717
AranyaError aranya_afc_seq_cleanup(struct AranyaAfcSeq *ptr)
Releases any resources associated with ptr.
Configuration info builder for an Aranya client config `AranyaClientConfig`.
Definition aranya-client.h:439
Configuration info for Aranya.
Definition aranya-client.h:375
A handle to an Aranya Client.
Definition aranya-client.h:361
AranyaError aranya_remove_team_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, struct AranyaExtError *__ext_err)
Remove a team from local device storage.
AranyaError aranya_afc_send_channel_delete_ext(const struct AranyaClient *client, struct AranyaAfcSendChannel *channel, struct AranyaExtError *__ext_err)
Removes an `AranyaAfcSendChannel` from use.
AranyaError aranya_encrypt_psk_seed_for_peer(const struct AranyaClient *client, const struct AranyaTeamId *team_id, const uint8_t *public_key_bundle, size_t public_key_bundle_len, uint8_t *seed, size_t *seed_len)
Return serialized PSK seed encrypted for another device on the team.
AranyaError aranya_afc_accept_channel_ext(const struct AranyaClient *client, const struct AranyaTeamId *team_id, const uint8_t *control, size_t control_len, struct AranyaAfcReceiveChannel *channel, struct AranyaExtError *__ext_err)
Accept a receive-only AFC channel from by a peer by processing a control message.
AranyaError aranya_assign_label_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, const struct AranyaLabelId *label_id, AranyaChanOp op, struct AranyaExtError *__ext_err)
Assign a label to a device so that it can be used for a channel.
AranyaError aranya_sync_now_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, AranyaAddr addr, const struct AranyaSyncPeerConfig *config, struct AranyaExtError *__ext_err)
Sync with peer immediately.
AranyaError aranya_encrypt_psk_seed_for_peer_ext(const struct AranyaClient *client, const struct AranyaTeamId *team_id, const uint8_t *public_key_bundle, size_t public_key_bundle_len, uint8_t *seed, size_t *seed_len, struct AranyaExtError *__ext_err)
Return serialized PSK seed encrypted for another device on the team.
AranyaError aranya_delete_label(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaLabelId *label_id)
Delete a channel label.
AranyaError aranya_change_role_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, const struct AranyaRoleId *old_role, const struct AranyaRoleId *new_role, struct AranyaExtError *__ext_err)
Changes the role on a device.
AranyaError aranya_afc_accept_channel(const struct AranyaClient *client, const struct AranyaTeamId *team_id, const uint8_t *control, size_t control_len, struct AranyaAfcReceiveChannel *channel)
Accept a receive-only AFC channel from by a peer by processing a control message.
AranyaError aranya_revoke_role(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, const struct AranyaRoleId *role_id)
Revoke a role from a device.
AranyaError aranya_add_sync_peer_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, AranyaAddr addr, const struct AranyaSyncPeerConfig *config, struct AranyaExtError *__ext_err)
Add the peer for automatic periodic Aranya state syncing.
AranyaError aranya_sync_now(const struct AranyaClient *client, const struct AranyaTeamId *team, AranyaAddr addr, const struct AranyaSyncPeerConfig *config)
Sync with peer immediately.
AranyaError aranya_change_rank_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaObjectId *object_id, AranyaRank old_rank, AranyaRank new_rank, struct AranyaExtError *__ext_err)
Change the rank of an object (device or label).
AranyaError aranya_delete_label_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaLabelId *label_id, struct AranyaExtError *__ext_err)
Delete a channel label.
AranyaError aranya_revoke_label(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, const struct AranyaLabelId *label_id)
Revoke a label from a device.
AranyaError aranya_setup_default_roles(struct AranyaClient *client, const struct AranyaTeamId *team, struct AranyaRole *roles_out, size_t *roles_len)
Setup default roles on team.
AranyaError aranya_team_device_public_key_bundle_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, uint8_t *public_key_bundle, size_t *public_key_bundle_len, struct AranyaExtError *__ext_err)
Query device's public key bundle.
AranyaError aranya_add_team_ext(const struct AranyaClient *client, const struct AranyaAddTeamConfig *cfg, struct AranyaExtError *__ext_err)
Add a team to the local device store.
AranyaError aranya_team_devices_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, struct AranyaDeviceId *devices, size_t *devices_len, struct AranyaExtError *__ext_err)
Query devices on team.
AranyaError aranya_client_cleanup(struct AranyaClient *ptr)
Releases any resources associated with ptr.
AranyaError aranya_revoke_label_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, const struct AranyaLabelId *label_id, struct AranyaExtError *__ext_err)
Revoke a label from a device.
AranyaError aranya_team_roles(const struct AranyaClient *client, const struct AranyaTeamId *team, struct AranyaRole *roles_out, size_t *roles_out_len)
Returns all of the roles for this team.
AranyaError aranya_remove_team(const struct AranyaClient *client, const struct AranyaTeamId *team)
Remove a team from local device storage.
AranyaError aranya_team_device_role_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, struct AranyaRole *role_out, bool *has_role, struct AranyaExtError *__ext_err)
Returns the role assigned to the device, if any.
AranyaError aranya_remove_device_from_team(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device)
Remove a device from the team.
AranyaError aranya_team_device_public_key_bundle(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, uint8_t *public_key_bundle, size_t *public_key_bundle_len)
Query device's public key bundle.
AranyaError aranya_close_team(const struct AranyaClient *client, const struct AranyaTeamId *team)
Close the team and stop all operations on the graph.
AranyaError aranya_setup_default_roles_ext(struct AranyaClient *client, const struct AranyaTeamId *team, struct AranyaRole *roles_out, size_t *roles_len, struct AranyaExtError *__ext_err)
Setup default roles on team.
AranyaError aranya_query_role_perms_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaRoleId *role, AranyaPermission *perms_out, size_t *perms_len, struct AranyaExtError *__ext_err)
Query all permissions assigned to a role.
AranyaError aranya_team_devices(const struct AranyaClient *client, const struct AranyaTeamId *team, struct AranyaDeviceId *devices, size_t *devices_len)
Query devices on team.
AranyaError aranya_afc_create_channel_ext(const struct AranyaClient *client, const struct AranyaTeamId *team_id, const struct AranyaDeviceId *peer_id, const struct AranyaLabelId *label_id, struct AranyaAfcSendChannel *channel, struct AranyaAfcCtrlMsg *control, struct AranyaExtError *__ext_err)
Create a send-only AFC channel between this device and a peer.
AranyaError aranya_afc_create_channel(const struct AranyaClient *client, const struct AranyaTeamId *team_id, const struct AranyaDeviceId *peer_id, const struct AranyaLabelId *label_id, struct AranyaAfcSendChannel *channel, struct AranyaAfcCtrlMsg *control)
Create a send-only AFC channel between this device and a peer.
AranyaError aranya_create_team(const struct AranyaClient *client, const struct AranyaCreateTeamConfig *cfg, struct AranyaTeamId *__output)
Create a new graph/team with the current device as the owner.
AranyaError aranya_client_init(struct AranyaClient *client, const struct AranyaClientConfig *config)
Initializes a new client instance.
AranyaError aranya_get_public_key_bundle(const struct AranyaClient *client, uint8_t *public_key_bundle, size_t *public_key_bundle_len)
Gets the public key bundle for this device.
AranyaError aranya_change_rank(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaObjectId *object_id, AranyaRank old_rank, AranyaRank new_rank)
Change the rank of an object (device or label).
AranyaError aranya_delete_role(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaRoleId *role)
Delete a role.
AranyaError aranya_get_public_key_bundle_ext(const struct AranyaClient *client, uint8_t *public_key_bundle, size_t *public_key_bundle_len, struct AranyaExtError *__ext_err)
Gets the public key bundle for this device.
AranyaError aranya_afc_receive_channel_delete(const struct AranyaClient *client, struct AranyaAfcReceiveChannel *channel)
Removes an `AranyaAfcReceiveChannel` from use.
AranyaError aranya_team_device_role(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, struct AranyaRole *role_out, bool *has_role)
Returns the role assigned to the device, if any.
AranyaError aranya_assign_role(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, const struct AranyaRoleId *role_id)
Assign a role to a device.
AranyaError aranya_create_role(const struct AranyaClient *client, const struct AranyaTeamId *team, AranyaRoleName role_name, AranyaRank rank, struct AranyaRole *role_out)
Create a role.
AranyaError aranya_rand(const struct AranyaClient *client, uint8_t *buf, size_t buf_len)
Return random bytes from Aranya's CSPRNG.
AranyaError aranya_remove_sync_peer(const struct AranyaClient *client, const struct AranyaTeamId *team, AranyaAddr addr)
Remove the peer from automatic Aranya state syncing.
AranyaError aranya_create_team_ext(const struct AranyaClient *client, const struct AranyaCreateTeamConfig *cfg, struct AranyaTeamId *__output, struct AranyaExtError *__ext_err)
Create a new graph/team with the current device as the owner.
AranyaError aranya_remove_device_from_team_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, struct AranyaExtError *__ext_err)
Remove a device from the team.
AranyaError aranya_query_role_perms(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaRoleId *role, AranyaPermission *perms_out, size_t *perms_len)
Query all permissions assigned to a role.
AranyaError aranya_create_role_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, AranyaRoleName role_name, AranyaRank rank, struct AranyaRole *role_out, struct AranyaExtError *__ext_err)
Create a role.
AranyaError aranya_team_roles_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, struct AranyaRole *roles_out, size_t *roles_out_len, struct AranyaExtError *__ext_err)
Returns all of the roles for this team.
AranyaError aranya_afc_receive_channel_delete_ext(const struct AranyaClient *client, struct AranyaAfcReceiveChannel *channel, struct AranyaExtError *__ext_err)
Removes an `AranyaAfcReceiveChannel` from use.
AranyaError aranya_delete_role_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaRoleId *role, struct AranyaExtError *__ext_err)
Delete a role.
AranyaError aranya_add_team(const struct AranyaClient *client, const struct AranyaAddTeamConfig *cfg)
Add a team to the local device store.
AranyaError aranya_change_role(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, const struct AranyaRoleId *old_role, const struct AranyaRoleId *new_role)
Changes the role on a device.
AranyaError aranya_add_device_to_team_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const uint8_t *keybundle, size_t keybundle_len, const struct AranyaRoleId *role_id, AranyaRank rank, struct AranyaExtError *__ext_err)
Add a device to the team with an explicit rank.
AranyaError aranya_add_device_to_team(const struct AranyaClient *client, const struct AranyaTeamId *team, const uint8_t *keybundle, size_t keybundle_len, const struct AranyaRoleId *role_id, AranyaRank rank)
Add a device to the team with an explicit rank.
AranyaError aranya_query_rank(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaObjectId *object_id, AranyaRank *__output)
Query the rank of an object.
AranyaError aranya_rand_ext(const struct AranyaClient *client, uint8_t *buf, size_t buf_len, struct AranyaExtError *__ext_err)
Return random bytes from Aranya's CSPRNG.
AranyaError aranya_client_init_ext(struct AranyaClient *client, const struct AranyaClientConfig *config, struct AranyaExtError *__ext_err)
Initializes a new client instance.
AranyaError aranya_create_label(const struct AranyaClient *client, const struct AranyaTeamId *team, AranyaLabelName name, AranyaRank rank, struct AranyaLabelId *__output)
Create a channel label with an explicit rank.
AranyaError aranya_query_rank_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaObjectId *object_id, AranyaRank *__output, struct AranyaExtError *__ext_err)
Query the rank of an object.
AranyaError aranya_add_sync_peer(const struct AranyaClient *client, const struct AranyaTeamId *team, AranyaAddr addr, const struct AranyaSyncPeerConfig *config)
Add the peer for automatic periodic Aranya state syncing.
AranyaError aranya_assign_role_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, const struct AranyaRoleId *role_id, struct AranyaExtError *__ext_err)
Assign a role to a device.
AranyaError aranya_revoke_role_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, const struct AranyaRoleId *role_id, struct AranyaExtError *__ext_err)
Revoke a role from a device.
AranyaError aranya_afc_send_channel_delete(const struct AranyaClient *client, struct AranyaAfcSendChannel *channel)
Removes an `AranyaAfcSendChannel` from use.
AranyaError aranya_remove_sync_peer_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, AranyaAddr addr, struct AranyaExtError *__ext_err)
Remove the peer from automatic Aranya state syncing.
AranyaError aranya_close_team_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, struct AranyaExtError *__ext_err)
Close the team and stop all operations on the graph.
AranyaError aranya_assign_label(const struct AranyaClient *client, const struct AranyaTeamId *team, const struct AranyaDeviceId *device, const struct AranyaLabelId *label_id, AranyaChanOp op)
Assign a label to a device so that it can be used for a channel.
AranyaError aranya_create_label_ext(const struct AranyaClient *client, const struct AranyaTeamId *team, AranyaLabelName name, AranyaRank rank, struct AranyaLabelId *__output, struct AranyaExtError *__ext_err)
Create a channel label with an explicit rank.
A builder for initializing a `AranyaCreateTeamConfig`.
Definition aranya-client.h:526
Team configuration used when creating a team.
Definition aranya-client.h:561
A builder for initializing a `AranyaCreateTeamQuicSyncConfig`.
Definition aranya-client.h:467
QUIC syncer configuration.
Definition aranya-client.h:488
Device ID.
Definition aranya-client.h:413
Functions suffixed with _ext accept an extra struct AranyaExtError *ext_err parameter for extended er...
Definition aranya-client.h:349
AranyaError aranya_ext_error_msg_ext(const struct AranyaExtError *err, char *msg, size_t *msg_len, struct AranyaExtError *__ext_err)
Copies the extended error's message into msg.
AranyaError aranya_ext_error_init(struct AranyaExtError *out)
Initializes AranyaExtError.
AranyaError aranya_ext_error_msg(const struct AranyaExtError *err, char *msg, size_t *msg_len)
Copies the extended error's message into msg.
AranyaError aranya_ext_error_cleanup(struct AranyaExtError *ptr)
Releases any resources associated with ptr.
Cryptographically secure Aranya ID.
Definition aranya-client.h:399
AranyaError aranya_id_from_str(const char *str, struct AranyaId *__output)
Decodes str into an `AranyaId`.
AranyaError aranya_id_to_str(const struct AranyaId *id, char *str, size_t *str_len)
Writes the human-readable encoding of id to str.
Label ID.
Definition aranya-client.h:432
A label.
Definition aranya-client.h:420
AranyaError aranya_label_get_author(const struct AranyaLabel *label, struct AranyaDeviceId *__output)
Get the author of a label.
AranyaError aranya_label_get_id(const struct AranyaLabel *label, struct AranyaLabelId *__output)
Get ID of label.
AranyaError aranya_label_cleanup(struct AranyaLabel *ptr)
Releases any resources associated with ptr.
AranyaError aranya_label_get_name(const struct AranyaLabel *label, const char **__output)
Get name of label.
An identifier for any object with a unique Aranya ID defined in the policy.
Definition aranya-client.h:655
Uniquely identifies a `AranyaRole`.
Definition aranya-client.h:406
A role.
Definition aranya-client.h:387
AranyaError aranya_role_get_author(const struct AranyaRole *role, struct AranyaDeviceId *__output)
Get the author of a role.
AranyaError aranya_role_get_id_ext(const struct AranyaRole *role, struct AranyaRoleId *__output, struct AranyaExtError *__ext_err)
Get ID of role.
AranyaError aranya_role_cleanup(struct AranyaRole *ptr)
Releases any resources associated with ptr.
AranyaError aranya_role_get_name(const struct AranyaRole *role, const char **__output)
Get name of role.
AranyaError aranya_role_get_id(const struct AranyaRole *role, struct AranyaRoleId *__output)
Get ID of role.
AranyaError aranya_role_get_author_ext(const struct AranyaRole *role, struct AranyaDeviceId *__output, struct AranyaExtError *__ext_err)
Get the author of a role.
Raw PSK seed IKM for QUIC syncer.
Definition aranya-client.h:479
Builder for a Sync Peer config `AranyaSyncPeerConfig`.
Definition aranya-client.h:573
Sync Peer config.
Definition aranya-client.h:587
Team ID.
Definition aranya-client.h:538