mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 16:16:55 +00:00
공개 키 등록 구현
This commit is contained in:
10
src/lib/server/services/key.ts
Normal file
10
src/lib/server/services/key.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { error } from "@sveltejs/kit";
|
||||
import { createClient, getClientByPubKey } from "$lib/server/db/client";
|
||||
|
||||
export const registerPubKey = async (userId: number, pubKey: string) => {
|
||||
if (await getClientByPubKey(pubKey)) {
|
||||
error(409, "Public key already registered");
|
||||
}
|
||||
|
||||
await createClient(pubKey, userId);
|
||||
};
|
||||
Reference in New Issue
Block a user