Changeset View
Changeset View
Standalone View
Standalone View
lib/types/tunnelbroker-messages.js
// @flow | // @flow | ||||
import t, { type TInterface } from 'tcomb'; | |||||
import { tShape, tString } from '../utils/validation-utils.js'; | |||||
type TBSharedConnectionInitializationMessage = { | type TBSharedConnectionInitializationMessage = { | ||||
+type: 'sessionRequest', | +type: 'sessionRequest', | ||||
+deviceId: string, | +deviceId: string, | ||||
+accessToken: string, | +accessToken: string, | ||||
+deviceAppVersion?: string, | +deviceAppVersion?: string, | ||||
+userId: string, | +userId: string, | ||||
}; | }; | ||||
Show All 23 Lines | |||||
}); | }); | ||||
export type TBRefreshKeysRequest = { | export type TBRefreshKeysRequest = { | ||||
+type: 'RefreshKeyRequest', | +type: 'RefreshKeyRequest', | ||||
+deviceId: string, | +deviceId: string, | ||||
+numberOfKeys: number, | +numberOfKeys: number, | ||||
}; | }; | ||||
export const refreshKeysTBMessageValidator: TInterface<TBRefreshKeysRequest> = | |||||
tShape<TBRefreshKeysRequest>({ | |||||
type: tString('RefreshKeyRequest'), | |||||
deviceId: t.String, | |||||
numberOfKeys: t.Number, | |||||
}); | |||||
// Disjoint enumeration of all messages received from Tunnelbroker | // Disjoint enumeration of all messages received from Tunnelbroker | ||||
// Currently, only a single message | // Currently, only a single message | ||||
export type MessageFromTunnelbroker = TBRefreshKeysRequest; | export type MessageFromTunnelbroker = TBRefreshKeysRequest; |