fix: update ui ed25519 + bluebubbles actions

This commit is contained in:
Peter Steinberger
2026-01-20 13:43:16 +00:00
parent b56e9964f5
commit a81989048d
2 changed files with 11 additions and 6 deletions

View File

@@ -20,10 +20,15 @@ export const BLUEBUBBLES_ACTIONS = {
sendAttachment: { gate: "sendAttachment" }, sendAttachment: { gate: "sendAttachment" },
} as const satisfies Partial<Record<ChannelMessageActionName, BlueBubblesActionSpec>>; } as const satisfies Partial<Record<ChannelMessageActionName, BlueBubblesActionSpec>>;
const BLUEBUBBLES_ACTION_SPECS = BLUEBUBBLES_ACTIONS as Record<
keyof typeof BLUEBUBBLES_ACTIONS,
BlueBubblesActionSpec
>;
export const BLUEBUBBLES_ACTION_NAMES = Object.keys( export const BLUEBUBBLES_ACTION_NAMES = Object.keys(
BLUEBUBBLES_ACTIONS, BLUEBUBBLES_ACTIONS,
) as ChannelMessageActionName[]; ) as (keyof typeof BLUEBUBBLES_ACTIONS)[];
export const BLUEBUBBLES_GROUP_ACTIONS = new Set<ChannelMessageActionName>( export const BLUEBUBBLES_GROUP_ACTIONS = new Set<ChannelMessageActionName>(
BLUEBUBBLES_ACTION_NAMES.filter((action) => BLUEBUBBLES_ACTIONS[action]?.groupOnly), BLUEBUBBLES_ACTION_NAMES.filter((action) => BLUEBUBBLES_ACTION_SPECS[action]?.groupOnly),
); );

View File

@@ -1,4 +1,4 @@
import { ed25519 } from "@noble/ed25519"; import * as ed25519 from "@noble/ed25519";
type StoredIdentity = { type StoredIdentity = {
version: 1; version: 1;
@@ -43,8 +43,8 @@ async function fingerprintPublicKey(publicKey: Uint8Array): Promise<string> {
} }
async function generateIdentity(): Promise<DeviceIdentity> { async function generateIdentity(): Promise<DeviceIdentity> {
const privateKey = ed25519.utils.randomPrivateKey(); const privateKey = ed25519.utils.randomSecretKey();
const publicKey = await ed25519.getPublicKey(privateKey); const publicKey = await ed25519.getPublicKeyAsync(privateKey);
const deviceId = await fingerprintPublicKey(publicKey); const deviceId = await fingerprintPublicKey(publicKey);
return { return {
deviceId, deviceId,
@@ -103,6 +103,6 @@ export async function loadOrCreateDeviceIdentity(): Promise<DeviceIdentity> {
export async function signDevicePayload(privateKeyBase64Url: string, payload: string) { export async function signDevicePayload(privateKeyBase64Url: string, payload: string) {
const key = base64UrlDecode(privateKeyBase64Url); const key = base64UrlDecode(privateKeyBase64Url);
const data = new TextEncoder().encode(payload); const data = new TextEncoder().encode(payload);
const sig = await ed25519.sign(data, key); const sig = await ed25519.signAsync(data, key);
return base64UrlEncode(sig); return base64UrlEncode(sig);
} }