Token Refresh/Upgrade와 관련된 DB 제약 위반 수정

This commit is contained in:
static
2024-12-31 05:00:03 +09:00
parent 08a23b61b2
commit 0f87975040
3 changed files with 48 additions and 23 deletions

View File

@@ -36,7 +36,7 @@ export const generateRSASigKeyPair = async () => {
return keyPair;
};
export const makeRSAKeyNonextractable = async (key: CryptoKey, type: RSAKeyType) => {
export const makeRSAEncKeyNonextractable = async (key: CryptoKey, type: RSAKeyType) => {
const { format, key: exportedKey } = await exportRSAKey(key, type);
return await window.crypto.subtle.importKey(
format,
@@ -50,6 +50,20 @@ export const makeRSAKeyNonextractable = async (key: CryptoKey, type: RSAKeyType)
);
};
export const makeRSASigKeyNonextractable = async (key: CryptoKey, type: RSAKeyType) => {
const { format, key: exportedKey } = await exportRSAKey(key, type);
return await window.crypto.subtle.importKey(
format,
exportedKey,
{
name: "RSA-PSS",
hash: "SHA-256",
} satisfies RsaHashedImportParams,
false,
[type === "public" ? "verify" : "sign"],
);
};
const exportRSAKey = async (key: CryptoKey, type: RSAKeyType) => {
const format = type === "public" ? ("spki" as const) : ("pkcs8" as const);
return {