import { getUserAuthenticationRoleStore } from "./store.js";
import { setUserAuthenticationRole } from "./set-role.js";
export async function getUserAuthenticationRole(userId) {
    const store = getUserAuthenticationRoleStore();
    return await store.get(userId);
}
export async function getUserAuthenticationRoleForUser(user) {
    const role = await getUserAuthenticationRole(user.userId);
    if (!role)
        return role;
    // Update the expiry on access to allow retention
    //
    // No access, no user, data expires
    await setUserAuthenticationRole({
        ...role,
        expiresAt: user.expiresAt
    });
    return role;
}
//# sourceMappingURL=get-role.js.map