1import { base64url } from "iso-base/rfc4648";
2
3/**
4 * @param {string} scheme
5 * @param {string} groupId
6 */
7export async function groupKeyHash(scheme, groupId) {
8 const rawBytes = new TextEncoder().encode(`${scheme}://${groupId}`);
9 const hashedBytes = await crypto.subtle.digest("SHA-256", rawBytes);
10 return base64url.encode(new Uint8Array(hashedBytes));
11}
12
13/**
14 * @param {string} filename
15 */
16export function isAudioFile(filename) {
17 return filename.match(/\.(flac|m4a|mp3|mp4|ogg|opus|wav|webm)$/);
18}