auth.h(3)Bark

NAME

auth.h - Bark WebAuthn passkey registration and assertion primitives.

SYNOPSIS

Classes

struct bark_auth_result_t

Parsed WebAuthn registration or assertion result.

Typedefs

typedef struct bark_auth bark_auth_t

Opaque passkey vault handle.

typedef void(* bark_auth_cb_fn) (void *user, int ok, int is_register, const char *json_or_err)

Completion callback for asynchronous passkey ceremonies.

typedef void(* bark_auth_bool_cb_fn) (void *user, int ok)

Completion callback for boolean capability probes.

Enumerations

enum bark_auth_err_t { BARK_AUTH_ERR_OK = 0, BARK_AUTH_ERR_UNAVAILABLE, BARK_AUTH_ERR_CANCELED, BARK_AUTH_ERR_NO_CREDENTIAL, BARK_AUTH_ERR_BUSY, BARK_AUTH_ERR_FAILED }

Normalized WebAuthn ceremony error codes.

Functions

bark_auth_t * bark_auth_create (const char *store_path)

Open or create a passkey vault backed by store_path (ignored on WASM).

void bark_auth_destroy (bark_auth_t *auth)

Destroy a passkey vault handle.

int bark_auth_create_passkey_json (bark_auth_t *auth, const char *challenge, const char *rp_id, const char *origin, const char *user_id, const char *name, char *out_json, size_t out_cap)

Synchronously register a P-256 passkey and serialize the response JSON into out_json.

int bark_auth_get_assertion_json (bark_auth_t *auth, const char *challenge, const char *rp_id, const char *origin, char *out_json, size_t out_cap)

Synchronously sign a WebAuthn assertion and serialize the response JSON into out_json.

int bark_auth_verify_assertion (const char *spki_b64u, const char *rp_id, const char *auth_data_b64u, const char *client_data_b64u, const char *sig_b64u)

Verify an ES256 WebAuthn assertion offline against a base64url SPKI public key.

int bark_auth_rp_id_from_origin (const char *origin, char *out, size_t cap)

Extract the relying-party hostname (rpId) from an origin URL such as https://host:8443/path".

int bark_auth_parse_result (int ok, int is_register, const char *json_or_err, bark_auth_result_t *out)

Parse a raw bark_auth_cb_fn callback payload into bark_auth_result_t.

void bark_auth_create_passkey_async (bark_auth_t *auth, const char *challenge, const char *rp_id, const char *origin, const char *user_id, const char *name, bark_auth_cb_fn cb, void *user)

Start an asynchronous passkey registration ceremony (isomorphic native + browser WASM).

void bark_auth_get_assertion_async (bark_auth_t *auth, const char *challenge, const char *rp_id, const char *origin, bark_auth_cb_fn cb, void *user)

Start an asynchronous passkey assertion ceremony (isomorphic native + browser WASM).

int bark_auth_passkey_supported (void)

Return non-zero if WebAuthn / passkeys are supported in this runtime.

void bark_auth_platform_available_async (bark_auth_t *auth, bark_auth_bool_cb_fn cb, void *user)

Asynchronously probe whether a platform (built-in) passkey authenticator is available.

Detailed Description

Bark WebAuthn passkey registration and assertion primitives.

Headless WebAuthn / FIDO2 passkey authentication (ES256 P-256).

Provides identical passkey registration and assertion flows across native desktop hosts (local encrypted software passkey store) and browser WASM (navigator.credentials.create / navigator.credentials.get).

Typedef Documentation

typedef void(* bark_auth_cb_fn) (void *user, int ok, int is_register, const char *json_or_err)

Completion callback for asynchronous passkey ceremonies. Pass the raw parameters directly to bark_auth_parse_result() to unpack structured fields and normalized error codes.

Enumeration Type Documentation

enum bark_auth_err_t

Normalized WebAuthn ceremony error codes.

Enumerator

BARK_AUTH_ERR_OK
Ceremony succeeded.
BARK_AUTH_ERR_UNAVAILABLE
WebAuthn is unavailable in this runtime.
BARK_AUTH_ERR_CANCELED
User canceled or browser rejected prompt.
BARK_AUTH_ERR_NO_CREDENTIAL
No stored passkey matched the relying party.
BARK_AUTH_ERR_BUSY
Too many concurrent auth requests in flight.
BARK_AUTH_ERR_FAILED
Cryptographic, I/O, or generic ceremony failure.

Author

Generated automatically by Doxygen for Bark from the source code.