Using the Authentication Client
Use libauth to communicate with the authentication authority from your
application. C callers use <peios/auth.h>; Rust callers use peios-auth,
which wraps the same shared library.
Before you start #
Prepare the client dependencies:
- Install the
dev.peios.libauthruntime and thedev.peios.libauth-develsoftware development kit (SDK). - Use an account or service identity permitted to perform the operation.
- For Rust, add the
peios-authcrate from the matching authd source revision.
Link the application #
For a C application with a client.c source file:
-
Include the public header in C:
-
Obtain compiler and linker flags through
pkg-config:
For Rust applications built with Cargo, make auth.pc discoverable through
PKG_CONFIG_PATH. For an explicit development build, set PEIOS_AUTH_LIB_DIR
to the directory containing libauth.so. At runtime, the loader must also
find libauth.so.1. A development shell can set LD_LIBRARY_PATH to that
directory.
Drive an operation #
Use this sequence for each operation:
-
Create a client. Default options use the system sockets. Supply explicit socket paths only when selecting a trusted authority or a test server.
-
Begin the operation. Input strings and buffers are copied before the call returns. A null C handle means the arguments were invalid. A connection failure instead produces an operation with an error result.
-
Call
peios_auth_operation_step(). When it returnsPEIOS_AUTH_WAIT, obtain the descriptor, event mask, and maximum wait frompeios_auth_operation_poll_info(). Wait, then callstep()again, including after a timeout. Never read, write, or close that descriptor. -
At
PEIOS_AUTH_PROMPT, display the round's messages before collecting answers. Submit answers in prompt order, with their original references and the current round ID. Answer a message-only round with an empty answer array. Clear caller-owned secret buffers after submission. -
At a terminal state, inspect the typed result or error. If the operation granted a token, take it only when your program is ready to own the descriptor. Check
outcome_unknownbefore offering to repeat a change. -
Destroy the operation and client. Returned C views borrow the operation; copy any data needed after its next mutable call or destruction.
For blocking programs, peios_auth_operation_wait() performs the wait loop
until a prompt or terminal state. The Rust wrapper provides the same choice
through Operation::step() and Operation::wait(). Its result methods return
owned Rust data.
Check the result #
For Authenticate and Logon, peios_auth_operation_guid() returns a borrowed
authority operation identifier after a reply supplies it. The Rust accessor
is Operation::operation_guid(). An empty C span or Rust None means that
the identifier is unavailable. Copy the C span before mutating the operation.
The identifier links to object.authentication.operation.guid in authority
events. It is not proof of identity or permission. Older authorities can omit
the optional metadata. Malformed or inconsistent metadata removes the
correlation link without changing the credential or token result.
The getter is an additive symbol with unchanged ABI 6 layouts. A program using it needs a libauth build exporting the symbol. Existing clients remain compatible with that library, and the public framing remains PGSS version 6.
A completed permission query means that authd permitted the proposed action at the time of the query. A completed logon provides a token and session profile. Neither result changes the calling process's identity.
Use the public header for function signatures, constants, ownership rules, and the application binary interface (ABI) contract. Keep each operation under one caller's control; different operations can run concurrently.