Skip to main content

fs_create_network

Function fs_create_network 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn fs_create_network( addr: *const c_char, server_name: *const c_char, ca_cert_path: *const c_char, cache_blocks: u32, auth_token: *const u8, auth_token_len: usize, master_key: *const u8, master_key_len: usize, ) -> *mut FsHandle
Expand description

Create a filesystem handle backed by a remote doublecrypt-server over TLS.

The connection uses key-derived authentication (HKDF from the master key) and wraps the network store in a write-back LRU cache.

Create a filesystem handle backed by a remote doublecrypt-server over TLS.

The connection uses key-derived authentication (HKDF from the master key) and wraps the network store in a write-back LRU cache.

addr: null-terminated server address, e.g. "10.0.0.5:9100". server_name: null-terminated TLS SNI hostname, e.g. "dc-server". ca_cert_path: null-terminated path to the CA certificate PEM file. cache_blocks: number of blocks to cache locally (0 = default 256). auth_token: pointer to 32 bytes of auth token, or null to derive from master_key. auth_token_len: length of auth_token in bytes (must be 32 if non-null, ignored if null). master_key: pointer to the master encryption key bytes. master_key_len: length of master_key in bytes (should be 32).

When auth_token is null, the auth token is derived from master_key via HKDF (the original behaviour). When auth_token is provided, it is used directly and master_key is used only for encryption.

Returns a pointer to an opaque handle, or null on failure (connection refused, TLS error, authentication failure, etc.).

ยงSafety

  • addr, server_name, and ca_cert_path must be valid null-terminated C strings.
  • auth_token, if non-null, must point to auth_token_len valid bytes.
  • master_key must point to master_key_len valid bytes.