Changeset View
Changeset View
Standalone View
Standalone View
lib/types/session-types.js
// @flow | // @flow | ||||
import t, { type TInterface } from 'tcomb'; | |||||
import type { LogInActionSource } from './account-types.js'; | import type { LogInActionSource } from './account-types.js'; | ||||
import type { Shape } from './core.js'; | import type { Shape } from './core.js'; | ||||
import type { CalendarQuery } from './entry-types.js'; | import type { CalendarQuery } from './entry-types.js'; | ||||
import type { RawThreadInfo } from './thread-types.js'; | import type { RawThreadInfo } from './thread-types.js'; | ||||
import { | import { | ||||
type UserInfo, | type UserInfo, | ||||
type CurrentUserInfo, | type CurrentUserInfo, | ||||
type LoggedOutUserInfo, | type LoggedOutUserInfo, | ||||
} from './user-types.js'; | } from './user-types.js'; | ||||
import { tShape } from '../utils/validation-utils.js'; | |||||
export const cookieLifetime = 30 * 24 * 60 * 60 * 1000; // in milliseconds | export const cookieLifetime = 30 * 24 * 60 * 60 * 1000; // in milliseconds | ||||
// Interval the server waits after a state check before starting a new one | // Interval the server waits after a state check before starting a new one | ||||
export const sessionCheckFrequency = 3 * 60 * 1000; // in milliseconds | export const sessionCheckFrequency = 3 * 60 * 1000; // in milliseconds | ||||
// How long the server debounces after activity before initiating a state check | // How long the server debounces after activity before initiating a state check | ||||
export const stateCheckInactivityActivationInterval = 3 * 1000; // in milliseconds | export const stateCheckInactivityActivationInterval = 3 * 1000; // in milliseconds | ||||
// On native, we specify the cookie directly in the request and response body. | // On native, we specify the cookie directly in the request and response body. | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | export type SessionIdentification = Shape<{ | ||||
cookie: ?string, | cookie: ?string, | ||||
sessionID: ?string, | sessionID: ?string, | ||||
}>; | }>; | ||||
export type SessionPublicKeys = { | export type SessionPublicKeys = { | ||||
+identityKey: string, | +identityKey: string, | ||||
+oneTimeKey?: string, | +oneTimeKey?: string, | ||||
}; | }; | ||||
export const sessionPublicKeysValidator: TInterface<SessionPublicKeys> = | |||||
tShape<SessionPublicKeys>({ | |||||
identityKey: t.String, | |||||
oneTimeKey: t.maybe(t.String), | |||||
}); |