feat: complete project identities

This commit is contained in:
Scott Wilson
2025-11-13 12:52:38 +05:30
committed by =
parent 1fe635678e
commit b32544e76c
111 changed files with 4820 additions and 2113 deletions
@@ -0,0 +1,24 @@
import { TKeyStoreFactory } from "@app/keystore/keystore";
export const getIdentityActiveLockoutAuthMethods = async (
identityId: string,
keyStore: Pick<TKeyStoreFactory, "getKeysByPattern" | "getItem">
) => {
const activeLockouts = await keyStore.getKeysByPattern(`lockout:identity:${identityId}:*`);
const activeLockoutAuthMethods = new Set<string>();
for await (const key of activeLockouts) {
const parts = key.split(":");
if (parts.length > 3) {
const lockoutRaw = await keyStore.getItem(key);
if (lockoutRaw) {
const lockout = JSON.parse(lockoutRaw) as { lockedOut: boolean };
if (lockout.lockedOut) {
activeLockoutAuthMethods.add(parts[3]);
}
}
}
}
return Array.from(activeLockoutAuthMethods);
};