aboutsummaryrefslogtreecommitdiff
path: root/client-web/source/protocol/crypto.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-01-27 20:08:18 +0100
committermetamuffin <metamuffin@disroot.org>2024-01-27 20:08:18 +0100
commitc8063785853e516280cd68e9d8e9ae79b2081989 (patch)
treeabf27a18afaae287563fee440e57741a59af3714 /client-web/source/protocol/crypto.ts
parent91259369b2b87eb647e9743c874d7e58894149c1 (diff)
downloadkeks-meet-1.0.1.tar
keks-meet-1.0.1.tar.bz2
keks-meet-1.0.1.tar.zst
cache room hashes, bump versionv1.0.1
Diffstat (limited to 'client-web/source/protocol/crypto.ts')
-rw-r--r--client-web/source/protocol/crypto.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/client-web/source/protocol/crypto.ts b/client-web/source/protocol/crypto.ts
index 784bd49..ebb552a 100644
--- a/client-web/source/protocol/crypto.ts
+++ b/client-web/source/protocol/crypto.ts
@@ -12,7 +12,7 @@ const IV_LENGTH = 12
const CRYPTO_SALT = base64_to_buf("keksmeet/cryptosaltAAA==")
const HASH_SALT = base64_to_buf("keksmeet/roomhashsaltA==")
-export async function crypto_seeded_key(seed: string): Promise<CryptoKey> {
+export async function derive_seeded_key(seed: string): Promise<CryptoKey> {
log("crypto", "deriving crytographic key...")
const seed_key = await window.crypto.subtle.importKey(
"raw",
@@ -32,7 +32,7 @@ export async function crypto_seeded_key(seed: string): Promise<CryptoKey> {
return key
}
-export async function crypto_hash(input: string): Promise<string> {
+export async function room_hash(input: string): Promise<string> {
log("crypto", "deriving room hash...")
const seed_key = await window.crypto.subtle.importKey(
"raw",
@@ -50,7 +50,7 @@ export async function crypto_hash(input: string): Promise<string> {
return hex
}
-export async function crypto_encrypt(key: CryptoKey, data: string): Promise<string> {
+export async function encrypt(key: CryptoKey, data: string): Promise<string> {
const iv = window.crypto.getRandomValues(new Uint8Array(IV_LENGTH));
const ciphertext = new Uint8Array(await window.crypto.subtle.encrypt(
{ name: "AES-GCM", iv },
@@ -64,7 +64,7 @@ export async function crypto_encrypt(key: CryptoKey, data: string): Promise<stri
return b64;
}
-export async function crypt_decrypt(key: CryptoKey, data: string): Promise<string> {
+export async function decrypt(key: CryptoKey, data: string): Promise<string> {
try {
const buf = base64_to_buf(data);
const iv = buf.slice(0, IV_LENGTH);