2026-07-06 07:33:23 +11:00
|
|
|
export type GateState = 'pending' | 'authenticated' | 'locked' | 'error' | 'rate-limited';
|
|
|
|
|
|
2026-07-30 12:20:54 +03:00
|
|
|
export type RuntimeIdentity = {
|
|
|
|
|
apiBaseUrl: string;
|
|
|
|
|
runtimeKey: string;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const runtimeIdentityMatches = (left: RuntimeIdentity, right: RuntimeIdentity): boolean => {
|
|
|
|
|
return left.apiBaseUrl === right.apiBaseUrl && left.runtimeKey === right.runtimeKey;
|
|
|
|
|
};
|
|
|
|
|
|
2026-07-06 07:33:23 +11:00
|
|
|
export const resolveStatusCheckFailureState = (options: {
|
|
|
|
|
shouldUseDesktopShellPasswordLogin?: boolean;
|
|
|
|
|
}): Exclude<GateState, 'pending' | 'authenticated' | 'rate-limited'> => {
|
|
|
|
|
if (options.shouldUseDesktopShellPasswordLogin) {
|
|
|
|
|
return 'locked';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 'error';
|
|
|
|
|
};
|