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
use crateget_slice_mut;
use crateKeyBuilder;
/// [C binding] Generate a random key.
///
/// # Parameters
///
/// - `buff`: pointer to the buffer that will be filled with the random key
/// - `buff_len`: length of the buffer, in bytes
///
/// # Return code
///
/// 0 in case of success, 1 if anything failed.
///
/// ## Examples
/// ```c
/// char key[DEFAULT_KEY_SIZE + 1] = {0};
/// int32_t ret = libreauth_keygen(key, DEFAULT_KEY_SIZE);
/// if (ret != EXIT_SUCCESS) {
/// // Handle the error.
/// }
/// ```
///
/// # Safety
///
/// This function is a C binding and is therefore unsafe. It is not meant to be used in Rust.
pub unsafe extern "C"