refactor(search,auth): export pure helpers for direct testing

encodeCursor/decodeCursor/firstSnippet (opensearch) and
decodeJwtPayload (verify) become public exports so tests can
hit them without round-tripping through fetch.
This commit is contained in:
Julien Calixte
2026-06-07 22:06:49 +02:00
parent 01048c753e
commit 49608cff20
2 changed files with 4 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ interface DidDocument {
service?: { id: string; serviceEndpoint: string }[];
}
function decodeJwtPayload(token: string): JwtPayload {
export function decodeJwtPayload(token: string): JwtPayload {
const parts = token.split(".");
if (parts.length !== 3) throw new Error("Invalid JWT format");
const payload = parts[1].replace(/-/g, "+").replace(/_/g, "/");