|
329 | 329 | return apiKeys; |
330 | 330 | } |
331 | 331 |
|
332 | | - export async function getPreauthKeys(userId: string): Promise<PreAuthKey[]> { |
| 332 | + export async function getPreauthKeys(userName: string): Promise<PreAuthKey[]> { |
333 | 333 | // variables in local storage |
334 | 334 | let headscaleURL = localStorage.getItem('headscaleURL') || ''; |
335 | 335 | let headscaleAPIKey = localStorage.getItem('headscaleAPIKey') || ''; |
|
341 | 341 | let headscalePreAuthKey = [new PreAuthKey()]; |
342 | 342 | let headscalePreAuthKeyResponse: Response = new Response(); |
343 | 343 |
|
344 | | - await fetch(headscaleURL + endpointURL + '?user=' + userId, { |
| 344 | + await fetch(headscaleURL + endpointURL + '?user=' + userName, { |
345 | 345 | method: 'GET', |
346 | 346 | headers: { |
347 | 347 | Accept: 'application/json', |
|
367 | 367 | return headscalePreAuthKey; |
368 | 368 | } |
369 | 369 |
|
370 | | - export async function newPreAuthKey(userId: string, expiry: string, reusable: boolean, ephemeral: boolean): Promise<any> { |
| 370 | + export async function newPreAuthKey(userName: string, expiry: string, reusable: boolean, ephemeral: boolean): Promise<any> { |
371 | 371 | // variables in local storage |
372 | 372 | let headscaleURL = localStorage.getItem('headscaleURL') || ''; |
373 | 373 | let headscaleAPIKey = localStorage.getItem('headscaleAPIKey') || ''; |
|
381 | 381 | Authorization: `Bearer ${headscaleAPIKey}` |
382 | 382 | }, |
383 | 383 | body: JSON.stringify({ |
384 | | - user: userId, |
| 384 | + user: userName, |
385 | 385 | expiration: expiry, |
386 | 386 | reusable: reusable, |
387 | 387 | ephemeral: ephemeral |
|
401 | 401 | }); |
402 | 402 | } |
403 | 403 |
|
404 | | - export async function removePreAuthKey(userId: string, preAuthKey: string): Promise<any> { |
| 404 | + export async function removePreAuthKey(userName: string, preAuthKey: string): Promise<any> { |
405 | 405 | // variables in local storage |
406 | 406 | let headscaleURL = localStorage.getItem('headscaleURL') || ''; |
407 | 407 | let headscaleAPIKey = localStorage.getItem('headscaleAPIKey') || ''; |
|
416 | 416 | Authorization: `Bearer ${headscaleAPIKey}` |
417 | 417 | }, |
418 | 418 | body: JSON.stringify({ |
419 | | - user: userId, |
| 419 | + user: userName, |
420 | 420 | key: preAuthKey |
421 | 421 | }) |
422 | 422 | }) |
|
0 commit comments