fix(mesh): satisfy strict index access in federationContactId (#39 build)
Destructure the first 4 pubkey bytes into typed locals so vue-tsc's noUncheckedIndexedAccess doesn't fail the build (the bytes.length<4 guard doesn't narrow per-element access). No behaviour change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d4c0587df0
commit
2c93e25faf
@ -667,7 +667,8 @@ const mergedPeers = computed<MergedPeer[]>(() => {
|
||||
function federationContactId(pubkeyHex: string): number {
|
||||
const bytes = pubkeyHex.match(/../g)?.map(h => parseInt(h, 16)) ?? []
|
||||
if (bytes.length < 4) return 0x80000001
|
||||
const low = ((bytes[0]) | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24)) >>> 0
|
||||
const [b0, b1, b2, b3] = bytes as [number, number, number, number]
|
||||
const low = (b0 | (b1 << 8) | (b2 << 16) | (b3 << 24)) >>> 0
|
||||
return ((0x80000000 | (low & 0x7fffffff)) >>> 0)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user