diff --git a/lib/types/identity-search/auth-message-types.js b/lib/types/identity-search/auth-message-types.js --- a/lib/types/identity-search/auth-message-types.js +++ b/lib/types/identity-search/auth-message-types.js @@ -15,7 +15,7 @@ import type { TInterface } from 'tcomb'; import t from 'tcomb'; -import { tShape, tString } from '../../utils/validation-utils.js'; +import { tShape, tString, tUserID } from '../../utils/validation-utils.js'; export type IdentitySearchAuthMessage = { +type: 'IdentitySearchAuthMessage', @@ -27,7 +27,7 @@ export const identityAuthMessageValidator: TInterface = tShape({ type: tString('IdentitySearchAuthMessage'), - userID: t.String, + userID: tUserID, deviceID: t.String, accessToken: t.String, }); diff --git a/lib/types/identity-search/search-response-types.js b/lib/types/identity-search/search-response-types.js --- a/lib/types/identity-search/search-response-types.js +++ b/lib/types/identity-search/search-response-types.js @@ -15,7 +15,7 @@ import type { TInterface, TUnion } from 'tcomb'; import t from 'tcomb'; -import { tShape, tString } from '../../utils/validation-utils.js'; +import { tShape, tString, tUserID } from '../../utils/validation-utils.js'; export type IdentitySearchFailure = { +id: string, @@ -35,7 +35,7 @@ export const identitySearchUserValidator: TInterface = tShape({ - userID: t.String, + userID: tUserID, username: t.String, }); diff --git a/lib/types/identity-service-types.js b/lib/types/identity-service-types.js --- a/lib/types/identity-service-types.js +++ b/lib/types/identity-service-types.js @@ -17,7 +17,7 @@ currentUserInfoValidator, type CurrentUserInfo, } from './user-types.js'; -import { tShape } from '../utils/validation-utils.js'; +import { tUserID, tShape } from '../utils/validation-utils.js'; export type UserAuthMetadata = { +userID: string, @@ -99,7 +99,7 @@ export const farcasterUserValidator: TInterface = tShape({ - userID: t.String, + userID: tUserID, username: t.String, farcasterID: t.String, }); @@ -188,7 +188,7 @@ }; export const identityAuthResultValidator: TInterface = tShape({ - userID: t.String, + userID: tUserID, accessToken: t.String, username: t.String, preRequestUserState: t.maybe(currentUserInfoValidator), diff --git a/lib/types/relationship-types.js b/lib/types/relationship-types.js --- a/lib/types/relationship-types.js +++ b/lib/types/relationship-types.js @@ -5,7 +5,12 @@ import type { AccountUserInfo } from './user-types.js'; import { values } from '../utils/objects.js'; -import { tNumEnum, tShape, tString } from '../utils/validation-utils.js'; +import { + tUserID, + tNumEnum, + tShape, + tString, +} from '../utils/validation-utils.js'; export const undirectedStatus = Object.freeze({ KNOW_OF: 0, @@ -86,7 +91,7 @@ export const farcasterRelationshipRequestValidator: TInterface = tShape({ action: tString('farcaster'), - userIDsToFID: t.dict(t.String, t.String), + userIDsToFID: t.dict(tUserID, t.String), }); type SharedRelationshipRow = { diff --git a/lib/types/report-types.js b/lib/types/report-types.js --- a/lib/types/report-types.js +++ b/lib/types/report-types.js @@ -9,7 +9,11 @@ import type { AppState, BaseAction } from './redux-types.js'; import { type MixedRawThreadInfos } from './thread-types.js'; import type { UserInfo, UserInfos } from './user-types.js'; -import { tPlatformDetails, tShape } from '../utils/validation-utils.js'; +import { + tPlatformDetails, + tShape, + tUserID, +} from '../utils/validation-utils.js'; export type EnabledReports = { +crashReports: boolean, @@ -218,7 +222,7 @@ export const reportInfoValidator: TInterface = tShape({ id: t.String, - viewerID: t.String, + viewerID: tUserID, platformDetails: tPlatformDetails, creationTime: t.Number, }); diff --git a/lib/types/request-types.js b/lib/types/request-types.js --- a/lib/types/request-types.js +++ b/lib/types/request-types.js @@ -28,7 +28,7 @@ accountUserInfoValidator, } from './user-types.js'; import { mixedRawThreadInfoValidator } from '../permissions/minimally-encoded-raw-thread-info-validators.js'; -import { tNumber, tShape, tID } from '../utils/validation-utils.js'; +import { tNumber, tShape, tID, tUserID } from '../utils/validation-utils.js'; // "Server requests" are requests for information that the server delivers to // clients. Clients then respond to those requests with a "client response". @@ -138,7 +138,7 @@ userInfos: t.maybe(t.list(accountUserInfoValidator)), deleteThreadIDs: t.maybe(t.list(tID)), deleteEntryIDs: t.maybe(t.list(tID)), - deleteUserInfoIDs: t.maybe(t.list(t.String)), + deleteUserInfoIDs: t.maybe(t.list(tUserID)), }), ), }); diff --git a/lib/types/tunnelbroker/peer-to-peer-message-types.js b/lib/types/tunnelbroker/peer-to-peer-message-types.js --- a/lib/types/tunnelbroker/peer-to-peer-message-types.js +++ b/lib/types/tunnelbroker/peer-to-peer-message-types.js @@ -3,7 +3,7 @@ import type { TInterface, TUnion } from 'tcomb'; import t from 'tcomb'; -import { tShape, tString } from '../../utils/validation-utils.js'; +import { tShape, tString, tUserID } from '../../utils/validation-utils.js'; import { type EncryptedData, encryptedDataValidator } from '../crypto-types.js'; import { signedDeviceListValidator, @@ -15,7 +15,7 @@ +deviceID: string, }; const senderInfoValidator: TInterface = tShape({ - userID: t.String, + userID: tUserID, deviceID: t.String, }); @@ -84,7 +84,7 @@ export const deviceListUpdatedValidator: TInterface = tShape({ type: tString(peerToPeerMessageTypes.DEVICE_LIST_UPDATED), - userID: t.String, + userID: tUserID, signedDeviceList: signedDeviceListValidator, }); diff --git a/lib/types/tunnelbroker/qr-code-auth-message-types.js b/lib/types/tunnelbroker/qr-code-auth-message-types.js --- a/lib/types/tunnelbroker/qr-code-auth-message-types.js +++ b/lib/types/tunnelbroker/qr-code-auth-message-types.js @@ -3,7 +3,7 @@ import type { TInterface, TUnion } from 'tcomb'; import t from 'tcomb'; -import { tShape, tString } from '../../utils/validation-utils.js'; +import { tShape, tString, tUserID } from '../../utils/validation-utils.js'; export const qrCodeAuthMessageTypes = Object.freeze({ DEVICE_LIST_UPDATE_SUCCESS: 'DeviceListUpdateSuccess', @@ -19,7 +19,7 @@ export const deviceListUpdateSuccessValidator: TInterface = tShape({ type: tString(qrCodeAuthMessageTypes.DEVICE_LIST_UPDATE_SUCCESS), - userID: t.String, + userID: tUserID, primaryDeviceID: t.String, }); diff --git a/lib/types/tunnelbroker/session-types.js b/lib/types/tunnelbroker/session-types.js --- a/lib/types/tunnelbroker/session-types.js +++ b/lib/types/tunnelbroker/session-types.js @@ -3,7 +3,7 @@ import type { TInterface } from 'tcomb'; import t from 'tcomb'; -import { tShape, tString } from '../../utils/validation-utils.js'; +import { tShape, tString, tUserID } from '../../utils/validation-utils.js'; export type TunnelbrokerDeviceTypes = 'mobile' | 'web' | 'keyserver'; @@ -35,7 +35,7 @@ type: tString('ConnectionInitializationMessage'), deviceID: t.String, accessToken: t.String, - userID: t.String, + userID: tUserID, notifyToken: t.maybe(t.String), deviceType: t.enums.of(['mobile', 'web', 'keyserver']), deviceAppVersion: t.maybe(t.String), diff --git a/lib/utils/entity-text.js b/lib/utils/entity-text.js --- a/lib/utils/entity-text.js +++ b/lib/utils/entity-text.js @@ -6,7 +6,7 @@ import type { GetENSNames } from './ens-helpers.js'; import type { GetFCNames } from './farcaster-helpers.js'; -import { tID, tShape, tString } from './validation-utils.js'; +import { tID, tShape, tString, tUserID } from './validation-utils.js'; import { useENSNames } from '../hooks/ens-cache.js'; import { useFCNames } from '../hooks/fc-cache.js'; import { threadNoun } from '../shared/thread-utils.js'; @@ -31,7 +31,7 @@ }; export const userEntityValidator: TInterface = tShape({ type: tString('user'), - id: t.String, + id: tUserID, username: t.maybe(t.String), isViewer: t.maybe(t.Boolean), possessive: t.maybe(t.Boolean), diff --git a/lib/utils/url-utils.js b/lib/utils/url-utils.js --- a/lib/utils/url-utils.js +++ b/lib/utils/url-utils.js @@ -7,6 +7,7 @@ tID, tShape, pendingThreadIDRegex, + tUserID, } from './validation-utils.js'; type MutableURLInfo = { @@ -50,7 +51,7 @@ ]), ), threadCreation: t.maybe(t.Boolean), - selectedUserList: t.maybe(t.list(t.String)), + selectedUserList: t.maybe(t.list(tUserID)), inviteSecret: t.maybe(t.String), qrCode: t.maybe(t.Boolean), });