mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-16 06:58:46 +00:00
/api/client/list Endpoint 추가
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
createClient,
|
||||
getClientByPubKey,
|
||||
createUserClient,
|
||||
getAllUserClients,
|
||||
getUserClient,
|
||||
createUserClientChallenge,
|
||||
getUserClientChallenge,
|
||||
@@ -13,6 +14,16 @@ import {
|
||||
} from "$lib/server/db/client";
|
||||
import env from "$lib/server/loadenv";
|
||||
|
||||
export const getUserClientList = async (userId: number) => {
|
||||
const userClients = await getAllUserClients(userId);
|
||||
return {
|
||||
userClients: userClients.map(({ clientId, state }) => ({
|
||||
id: clientId,
|
||||
state,
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
||||
const expiresIn = ms(env.challenge.pubKeyExp);
|
||||
const expiresAt = () => new Date(Date.now() + expiresIn);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user