Rename base64 functions such that imports don't need renaming.

This commit is contained in:
Leo Vasanko
2025-12-09 15:55:03 +00:00
parent e1e4a211ec
commit 83245bc1c8
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -85,7 +85,7 @@
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
import { startAuthentication } from '@simplewebauthn/browser'
import aWebSocket from '@/utils/awaitable-websocket'
import { dec as b64dec, enc as b64enc } from '@/utils/base64url'
import { b64dec, b64enc } from '@/utils/base64url'
import { getSettings } from '@/utils/settings'
import { getUniqueMatch, isValidWord, isValidPrefix } from '@/utils/wordlist'
import { solvePoW } from '@/utils/pow'
@@ -56,7 +56,7 @@
<script setup>
import { ref, computed, watch, onMounted, onUnmounted } from 'vue'
import aWebSocket from '@/utils/awaitable-websocket'
import { dec as b64dec, enc as b64enc } from '@/utils/base64url'
import { b64dec, b64enc } from '@/utils/base64url'
import { getSettings } from '@/utils/settings'
import { solvePoW } from '@/utils/pow'
import { words } from '@/utils/wordlist'
+2 -2
View File
@@ -13,7 +13,7 @@
* @param {string} str - Base64url encoded string
* @returns {Uint8Array} - Decoded bytes
*/
export function dec(str) {
export function b64dec(str) {
// Convert URL-safe characters to standard base64
const base64 = str.replace(/-/g, '+').replace(/_/g, '/')
// Add padding if needed
@@ -26,7 +26,7 @@ export function dec(str) {
* @param {Uint8Array} bytes - Bytes to encode
* @returns {string} - Base64url encoded string (no padding)
*/
export function enc(bytes) {
export function b64enc(bytes) {
const base64 = btoa(String.fromCharCode(...bytes))
// Convert to URL-safe and remove padding
return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')