Skip to content

Declared in <galanthus/c_api/gln_capi.h>.

GLN_API gln_status_t GLN_CALL gln_open_revolut_backend(
    const gln_revolut_config_t* in_config,
    const gln_secret_t*         in_client_assertion_key_pem,
    gln_state_store_t*          in_state_store,
    gln_revolut_token_store_t*  in_token_store,
    gln_backend_t**             out_backend,
    gln_error_t*                out_error);
  • Family: Create and open functions
  • Return type: gln_status_t

Purpose

Opens a Revolut backend handle from a typed Revolut configuration, a client assertion private-key secret, a state store, and a Revolut token store.

On success, out_backend receives a caller-owned backend handle that must be closed with gln_close_backend.

Return

Returns GLN_OK on success and a non-OK gln_status_t value on failure.

TypeNullabilityOwnership
gln_status_tvaluevalue

Parameters

NameDirectionTypeNullabilityOwnership
in_configinputconst gln_revolut_config_t*nonnullborrowed
in_client_assertion_key_peminputconst gln_secret_t*nonnullborrowed
in_state_storeinputgln_state_store_t*nonnullborrowed
in_token_storeinputgln_revolut_token_store_t*nonnullborrowed
out_backendoutputgln_backend_t**nonnulltransferred_out
out_erroroutputgln_error_t*nullablecaller_allocated_output

Configuration

Initialize gln_revolut_config_t by calling gln_default_revolut_config so struct_size and optional defaults match the loaded header.

The required config fields are client_id, redirect_uri, and client_assertion_kid. environment_or_null may be absent, sandbox, or production; absence selects the sandbox environment.

The C strings in in_config are borrowed only for the open call. The implementation copies them into the Revolut client object before returning. in_client_assertion_key_pem is also borrowed for the call and copied into an owned secure string that is wiped when the backend is closed.

profile_name_or_null and plugin_dll_path_or_null are copied when present and non-empty; they are stored for Revolut surfaces that require a local profile or plugin path.

Ownership And Lifetime

in_state_store and in_token_store are required and borrowed by the backend. Keep both handles alive until after gln_close_backend closes every backend using them.

The token store persists Revolut OAuth token state. The file token-store constructor records the store directory, token blob path, and optional sidecar key path; the backend uses the supplied store handle but does not destroy it.

On success, out_backend is caller-owned and must be released with gln_close_backend. The function clears *out_backend to NULL before validation when the output slot itself is non-NULL.

Failure Cases

The call returns GLN_ERR_INVALID_ARG when out_backend, in_config, in_client_assertion_key_pem, in_state_store, or in_token_store is NULL, when in_config->struct_size does not match sizeof(gln_revolut_config_t), when a required config string is missing, when the assertion-key secret is empty, or when the environment string is not sandbox or production.

Client construction or backend allocation failures return a non-OK status. When out_error is a valid non-NULL error slot, the function clears it on entry and writes failure details for these validation and construction failures.

out_error may be NULL. If it is non-NULL, its struct_size must describe a valid gln_error_t; otherwise the call fails before writing diagnostic fields.

Capability Probing

Code that accepts an arbitrary backend should probe specific operations with gln_check_backend_operation_support; use gln_get_backend_operation_name and gln_parse_backend_operation_name when converting between enum values and operation names.

Example

gln_revolut_config_t config = {0};
gln_default_revolut_config(&config);
config.client_id = "revolut-client-id";
config.redirect_uri = "https://app.example/oauth/callback";
config.client_assertion_kid = "assertion-key-id";
config.environment_or_null = "sandbox";

gln_backend_t* backend = NULL;
gln_error_t error = {0};
gln_default_error(&error);
gln_status_t rc = gln_open_revolut_backend(
    &config,
    client_assertion_key_pem,
    state_store,
    token_store,
    &backend,
    &error);
if (rc == GLN_OK) {
    remember_open_backend(backend);
}

gln_close_backend(backend);
gln_release_error(&error);

See Also