(str: string)
| 18 | * Convert Base64URL string to Uint8Array. |
| 19 | */ |
| 20 | export function fromBase64Url(str: string): Uint8Array | null { |
| 21 | try { |
| 22 | let base64 = str.replace(/-/g, '+').replace(/_/g, '/'); |
| 23 | while (base64.length % 4 !== 0) { |
| 24 | base64 += '='; |
| 25 | } |
| 26 | |
| 27 | const binary = atob(base64); |
| 28 | const bytes = new Uint8Array(binary.length); |
| 29 | for (let i = 0; i < binary.length; i++) { |
| 30 | bytes[i] = binary.charCodeAt(i); |
| 31 | } |
| 32 | return bytes; |
| 33 | } catch { |
| 34 | return null; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Encode camera state to binary (72 bytes: 9 Float64 values). |
no outgoing calls
no test coverage detected