-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgetAppStartEvent.ts
More file actions
31 lines (30 loc) · 920 Bytes
/
getAppStartEvent.ts
File metadata and controls
31 lines (30 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { AppStartEvent } from "../common/audit/types";
export const getAppStartEvent = (inputs: {
sessionId: string;
userId: string;
issuer: string;
govukSigninJourneyId: string;
ipAddress: string;
redirectUri?: string;
txmaAuditEncoded?: string;
}): AppStartEvent => {
const timestampInMillis = Date.now();
return {
event_name: "DCMAW_ASYNC_CRI_APP_START",
user: {
user_id: inputs.userId,
session_id: inputs.sessionId,
ip_address: inputs.ipAddress,
govuk_signin_journey_id: inputs.govukSigninJourneyId,
},
event_timestamp_ms: timestampInMillis,
timestamp: Math.floor(timestampInMillis / 1000),
component_id: inputs.issuer,
...(inputs.redirectUri && {
extensions: { redirect_uri: inputs.redirectUri },
}),
...(inputs.txmaAuditEncoded && {
restricted: { device_information: { encoded: inputs.txmaAuditEncoded } },
}),
};
};