MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / approveDeviceAuthRequest

Function approveDeviceAuthRequest

apps/web/src/lib/device-auth/device-auth.ts:97–124  ·  view source on GitHub ↗
(code: string, userId: string)

Source from the content-addressed store, hash-verified

95 await db.insert(device_auth_requests).values({
96 code: userCode,
97 user_code: userCode,
98 device_code_hash: deviceCodeHash,
99 status: 'pending',
100 expires_at: expiresAt.toISOString(),
101 user_agent: userAgent,
102 ip_address: ipAddress,
103 });
104
105 return { code: userCode, userCode, deviceCode: deviceSecret, expiresAt };
106}
107
108/**
109 * Get device auth request by code (legacy path).
110 */
111export async function getDeviceAuthRequest(code: string) {
112 const [request] = await db
113 .select()
114 .from(device_auth_requests)
115 .where(eq(device_auth_requests.code, code))
116 .limit(1);
117
118 return request;
119}
120
121/**
122 * Check if a device auth request has expired.
123 */
124export function isDeviceAuthRequestExpired(request: {
125 expires_at: string;
126 status: string;
127}): boolean {

Callers 2

POSTFunction · 0.90

Calls 4

getDeviceAuthRequestFunction · 0.85
setMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected