Store Google avatar bytes and slim the session JWT to id only.

Download profile images on login into picturebinary, return them as base64 from /auth/me, and resolve sessions via getById.
This commit is contained in:
seb
2026-08-05 11:12:36 +02:00
parent c78237a1dd
commit fc2b136c46
12 changed files with 133 additions and 41 deletions

View File

@@ -11,6 +11,11 @@ export async function getAllowedEmail(email) {
return (await store.google_auth.getByEmail(normalized)) ?? null;
}
export async function getById(authId) {
const store = await getStore();
return (await store.google_auth.getById(authId)) ?? null;
}
export async function addAllowedEmail(email) {
const normalized = email.trim().toLowerCase();
const store = await getStore();
@@ -32,7 +37,7 @@ export async function setSelectedCompany(authId, companyId) {
await store.google_auth.setSelectedCompany(authId, companyId);
}
export async function setProfile(authId, { picture = null, sub = null } = {}) {
export async function setProfile(authId, { picture = null, pictureBinary = null, sub = null } = {}) {
const store = await getStore();
await store.google_auth.setProfile(authId, { picture, sub });
await store.google_auth.setProfile(authId, { picture, pictureBinary, sub });
}