feat(freight-api): drop fan claim from fayda verification

esignet userinfo carries no national id number. keep sub/name/email/
phone/address, remove fanClaims config and the hard-fail gate that
would've blocked every real verification.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Nathnael
2026-07-28 13:44:06 +00:00
parent 03b8ca0ce7
commit dcda8d7d37
4 changed files with 39 additions and 10 deletions

View File

@@ -13,14 +13,14 @@ export class StartVerificationDto {
purpose?: 'LOGIN' | 'VERIFY';
@ApiPropertyOptional({
enum: ['WEB', 'MOBILE'],
enum: ['WEB', 'MOBILE', 'PORTAL'],
default: 'WEB',
description:
'Client platform. Selects which OAuth redirect_uri is sent to eSignet: WEB uses FAYDA_WEB_REDIRECT_URI, MOBILE uses FAYDA_REDIRECT_URI. Both land on the same /complete endpoint with identical handling.',
'Client platform. Selects which OAuth redirect_uri is sent to eSignet: WEB (backoffice) uses FAYDA_WEB_REDIRECT_URI, PORTAL uses FAYDA_PORTAL_REDIRECT_URI, MOBILE uses FAYDA_REDIRECT_URI. All land on the same /complete handling.',
})
@IsOptional()
@IsIn(['WEB', 'MOBILE'])
platform?: 'WEB' | 'MOBILE';
@IsIn(['WEB', 'MOBILE', 'PORTAL'])
platform?: 'WEB' | 'MOBILE' | 'PORTAL';
@ApiPropertyOptional({
type: Boolean,
@@ -57,6 +57,12 @@ export class CompleteVerificationResultDto {
agentId?: string;
};
@ApiPropertyOptional({
description:
'Fayda OIDC subject — the stable key a verified identity is stored under (VERIFY flow). Pairwise pseudonymous.',
})
sub?: string;
@ApiPropertyOptional({ description: 'Verified full name from Fayda (VERIFY flow).' })
fullName?: string;
@@ -74,6 +80,11 @@ export class CompleteVerificationResultDto {
@ApiPropertyOptional({ description: 'Verified gender from Fayda (VERIFY flow).' })
gender?: string;
@ApiPropertyOptional({
description: 'Verified address from Fayda, English rendering (VERIFY flow).',
})
address?: string;
@ApiPropertyOptional({ description: 'Whether the verified identity was saved to IAM. False if the IAM write failed.' })
userDataSaved?: boolean;

View File

@@ -56,11 +56,15 @@ export interface CompleteVerificationResult {
promptPasswordSetup?: boolean;
iamUserId?: string;
user?: FaydaUserSummary;
/** Fayda OIDC subject — the stable key a verified identity is stored under. */
sub?: string;
fullName?: string;
email?: string;
phoneNumber?: string;
birthdate?: string;
gender?: string;
/** Verified address, English rendering (falls back to Amharic). */
address?: string;
userDataSaved?: boolean;
}
@@ -125,11 +129,15 @@ export class VerifaydaService {
});
}
/** WEB clients use `webRedirectUri`; MOBILE uses the base `redirectUri`. */
/**
* Each client lands on its own registered redirect_uri: MOBILE on the base
* one, the customer portal on its own origin, everything else (backoffice) on
* the web one. All three must be registered with eSignet.
*/
private redirectUriForPlatform(platform?: FaydaPlatform): string {
return platform === 'MOBILE'
? this.faydaConfig.redirectUri
: this.faydaConfig.webRedirectUri;
if (platform === 'MOBILE') return this.faydaConfig.redirectUri;
if (platform === 'PORTAL') return this.faydaConfig.portalRedirectUri;
return this.faydaConfig.webRedirectUri;
}
async completeVerification(
@@ -210,11 +218,13 @@ export class VerifaydaService {
result = {
purpose: 'VERIFY',
verified: true,
sub: normalized.sub,
fullName: normalized.fullName,
email: normalized.email,
phoneNumber: normalized.phoneNumber,
birthdate: normalized.birthdate,
gender: normalized.gender,
address: normalized.addressEn ?? normalized.addressAm,
userDataSaved,
iamUserId: iamUserId ?? undefined,
token: sessionToken?.token,