async function resolveUserEmail(user, encryption) {
  const rawEmail = typeof user.email === "string" ? user.email : null;
  if (!rawEmail) return null;
  if (!encryption?.isEnabled()) return rawEmail;
  try {
    const decrypted = await encryption.decryptEntityPayload(
      "auth:user",
      { email: rawEmail },
      user.tenantId ? String(user.tenantId) : null,
      user.organizationId ? String(user.organizationId) : null
    );
    return typeof decrypted?.email === "string" && decrypted.email.length ? decrypted.email : rawEmail;
  } catch {
    return rawEmail;
  }
}
export {
  resolveUserEmail
};
//# sourceMappingURL=userEmail.js.map
