mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-15 22:38:47 +00:00
Request Body의 필드마다 서명하지 않고, 데이터 전체에 대해 서명하도록 개선
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { callAPI } from "$lib/hooks";
|
||||
import { storeRSAKey } from "$lib/indexedDB";
|
||||
import { encodeToBase64, encryptRSAPlaintext, signRSAMessage } from "$lib/modules/crypto";
|
||||
import { encodeToBase64, encryptRSAPlaintext, signRequest } from "$lib/modules/crypto";
|
||||
import type { ClientKeys } from "$lib/stores";
|
||||
|
||||
export { requestTokenUpgrade } from "$lib/services/auth";
|
||||
@@ -47,16 +47,17 @@ export const requestInitialMekRegistration = async (
|
||||
signKey: CryptoKey,
|
||||
) => {
|
||||
const mekDraftEncrypted = await encryptRSAPlaintext(mekDraft, encryptKey);
|
||||
const mekDraftEncryptedSigned = await signRSAMessage(mekDraftEncrypted, signKey);
|
||||
const res = await callAPI("/api/mek/register/initial", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
mek: encodeToBase64(mekDraftEncrypted),
|
||||
sigMek: encodeToBase64(mekDraftEncryptedSigned),
|
||||
}),
|
||||
body: await signRequest(
|
||||
{
|
||||
mek: encodeToBase64(mekDraftEncrypted),
|
||||
},
|
||||
signKey,
|
||||
),
|
||||
});
|
||||
return res.ok || res.status === 409;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user