49 lines
1.6 KiB
C
49 lines
1.6 KiB
C
#ifndef GW_PRIORITY_AUTH_C_H
|
|
#define GW_PRIORITY_AUTH_C_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct gw_priority_session gw_priority_session;
|
|
|
|
enum gw_priority_status {
|
|
GW_PRIORITY_SESSION_READY = 0,
|
|
GW_PRIORITY_ROUTE_READY = 1,
|
|
GW_PRIORITY_PUBLIC_FALLBACK = 2,
|
|
GW_PRIORITY_CANCELLED = 3,
|
|
GW_PRIORITY_AUTH_REJECTED = 4,
|
|
GW_PRIORITY_INVALID_RESPONSE = 5,
|
|
GW_PRIORITY_NETWORK_ERROR = 6,
|
|
GW_PRIORITY_TOKEN_EXPIRED = 7
|
|
};
|
|
|
|
typedef struct gw_priority_route {
|
|
int status;
|
|
int eligible;
|
|
char ipv4[16];
|
|
unsigned long long expires_at_monotonic_ms;
|
|
} gw_priority_route;
|
|
|
|
// These calls block. Invoke only from an owned pre-credential worker.
|
|
gw_priority_session* gw_priority_session_create(void);
|
|
void gw_priority_session_destroy(gw_priority_session* session);
|
|
void gw_priority_session_clear(gw_priority_session* session);
|
|
/* Thread-safe request; in-flight browser waits stop within one poll interval. */
|
|
void gw_priority_session_cancel(gw_priority_session* session);
|
|
int gw_priority_sign_in(gw_priority_session* session);
|
|
/* Background only: read the official launcher session without opening UI. */
|
|
int gw_priority_resume_launcher(gw_priority_session* session);
|
|
/* Client-owned DPAPI store. Absent/corrupt returns AUTH_REJECTED. */
|
|
int gw_priority_resume_saved(gw_priority_session* session);
|
|
/* Persist the current validated bearer from either launcher or browser. */
|
|
int gw_priority_store_current(gw_priority_session* session);
|
|
void gw_priority_delete_saved(void);
|
|
int gw_priority_select(gw_priority_session* session, gw_priority_route* route);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|