(encoded: string)
| 72 | const bytes = base64urlToBytes(encoded); |
| 73 | return bytesToBase64url(bytes) === encoded ? bytes : null; |
| 74 | } catch { |
| 75 | return null; |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | function bytesToBase32Hex(bytes: Uint8Array): string { |
| 80 | let output = ''; |
| 81 | let buffer = 0; |
| 82 | let bits = 0; |
| 83 | |
| 84 | for (const byte of bytes) { |
| 85 | buffer = (buffer << 8) | byte; |
| 86 | bits += 8; |
| 87 | |
| 88 | while (bits >= 5) { |
| 89 | bits -= 5; |
no test coverage detected