fix: convert strings to Uint8Array for @noble/hashes v2

@noble/hashes v2 no longer accepts strings directly, only Uint8Array.
Added utf8() helper to encode strings before hashing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
esdrasrenan 2025-12-07 16:34:28 -03:00
parent d01c37522f
commit 53376fe5b0
3 changed files with 11 additions and 5 deletions

View file

@ -11,8 +11,10 @@ function toHex(input: Uint8Array) {
.join("")
}
const utf8 = (s: string) => new TextEncoder().encode(s)
function hashToken(token: string) {
return toHex(sha256(token))
return toHex(sha256(utf8(token)))
}
export const USB_POLICY_VALUES = ["ALLOW", "BLOCK_ALL", "READONLY"] as const