mirror of
https://github.com/tale/headplane.git
synced 2026-07-26 07:48:14 +00:00
b3c0c1c691
- Generate a fresh pre-auth key for every agent startup - Preserve existing tailscale state to avoid creating a new host - Auto-approve pending auth requests via /api/v1/auth/approve - Show approval link in settings UI as fallback Closes HP-558
28 lines
627 B
TypeScript
28 lines
627 B
TypeScript
import type { Capabilities } from "../capabilities";
|
|
import type { Transport } from "../transport";
|
|
|
|
export interface AuthApi {
|
|
/**
|
|
* Approve a pending Headscale authentication request.
|
|
* Used by the Headplane agent to auto-approve its own registration.
|
|
*/
|
|
approve(authId: string): Promise<void>;
|
|
}
|
|
|
|
export function makeAuthApi(
|
|
transport: Transport,
|
|
_capabilities: Capabilities,
|
|
apiKey: string,
|
|
): AuthApi {
|
|
return {
|
|
approve: async (authId) => {
|
|
await transport.request({
|
|
method: "POST",
|
|
path: "v1/auth/approve",
|
|
apiKey,
|
|
body: { authId },
|
|
});
|
|
},
|
|
};
|
|
}
|