Files
headroom/frontend/node_modules/effect/dist/esm/internal/encoding/base64Url.js
Santhosh Janardhanan de2d83092e feat: Reinitialize frontend with SvelteKit and TypeScript
- Delete old Vite+Svelte frontend
- Initialize new SvelteKit project with TypeScript
- Configure Tailwind CSS v4 + DaisyUI
- Implement JWT authentication with auto-refresh
- Create login page with form validation (Zod)
- Add protected route guards
- Update Docker configuration for single-stage build
- Add E2E tests with Playwright (6/11 passing)
- Fix Svelte 5 reactivity with $state() runes

Known issues:
- 5 E2E tests failing (timing/async issues)
- Token refresh implementation needs debugging
- Validation error display timing
2026-02-17 16:19:59 -05:00

21 lines
941 B
JavaScript

import * as Either from "../../Either.js";
import * as Base64 from "./base64.js";
import { DecodeException } from "./common.js";
/** @internal */
export const encode = data => Base64.encode(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
/** @internal */
export const decode = str => {
const stripped = Base64.stripCrlf(str);
const length = stripped.length;
if (length % 4 === 1) {
return Either.left(DecodeException(stripped, `Length should be a multiple of 4, but is ${length}`));
}
if (!/^[-_A-Z0-9]*?={0,2}$/i.test(stripped)) {
return Either.left(DecodeException(stripped, "Invalid input"));
}
// Some variants allow or require omitting the padding '=' signs
let sanitized = length % 4 === 2 ? `${stripped}==` : length % 4 === 3 ? `${stripped}=` : stripped;
sanitized = sanitized.replace(/-/g, "+").replace(/_/g, "/");
return Base64.decode(sanitized);
};
//# sourceMappingURL=base64Url.js.map