Don't use prefix matching if we can help it

This commit is contained in:
Jack Kingsman
2026-02-10 22:05:59 -08:00
parent bfdccc4a94
commit 1aa26c05d0
13 changed files with 227 additions and 55 deletions
+6 -2
View File
@@ -74,7 +74,9 @@ export function resolveChannelFromHashToken(token: string, channels: Channel[]):
if (byKey) return byKey;
// Backward compatibility for legacy name-based hashes.
return channels.find((c) => c.name === normalizedToken || c.name === `#${normalizedToken}`) || null;
return (
channels.find((c) => c.name === normalizedToken || c.name === `#${normalizedToken}`) || null
);
}
export function resolveContactFromHashToken(token: string, contacts: Contact[]): Contact | null {
@@ -86,7 +88,9 @@ export function resolveContactFromHashToken(token: string, contacts: Contact[]):
if (byKey) return byKey;
// Backward compatibility for legacy name/prefix-based hashes.
return contacts.find((c) => getContactDisplayName(c.name, c.public_key) === normalizedToken) || null;
return (
contacts.find((c) => getContactDisplayName(c.name, c.public_key) === normalizedToken) || null
);
}
/**