Changeset View
Changeset View
Standalone View
Standalone View
lib/types/identity-service-types.js
Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | |||||
export type UserDevicesOlmInboundKeys = { | export type UserDevicesOlmInboundKeys = { | ||||
+keys: { | +keys: { | ||||
+[deviceID: string]: ?DeviceOlmInboundKeys, | +[deviceID: string]: ?DeviceOlmInboundKeys, | ||||
}, | }, | ||||
+username?: ?string, | +username?: ?string, | ||||
+walletAddress?: ?string, | +walletAddress?: ?string, | ||||
}; | }; | ||||
type FarcasterUser = { | |||||
+userID: string, | |||||
+username: string, | |||||
+farcasterID: string, | |||||
}; | |||||
export const farcasterUserValidator: TInterface<FarcasterUser> = | |||||
tShape<FarcasterUser>({ | |||||
userID: t.String, | |||||
username: t.String, | |||||
farcasterID: t.String, | |||||
}); | |||||
export const farcasterUsersValidator: TList<Array<FarcasterUser>> = t.list( | |||||
farcasterUserValidator, | |||||
); | |||||
export const userDeviceOlmInboundKeysValidator: TInterface<UserDevicesOlmInboundKeys> = | export const userDeviceOlmInboundKeysValidator: TInterface<UserDevicesOlmInboundKeys> = | ||||
tShape<UserDevicesOlmInboundKeys>({ | tShape<UserDevicesOlmInboundKeys>({ | ||||
keys: t.dict(t.String, t.maybe(deviceOlmInboundKeysValidator)), | keys: t.dict(t.String, t.maybe(deviceOlmInboundKeysValidator)), | ||||
username: t.maybe(t.String), | username: t.maybe(t.String), | ||||
walletAddress: t.maybe(t.String), | walletAddress: t.maybe(t.String), | ||||
}); | }); | ||||
export interface IdentityServiceClient { | export interface IdentityServiceClient { | ||||
Show All 35 Lines | export interface IdentityServiceClient { | ||||
) => Promise<$ReadOnlyArray<SignedDeviceList>>; | ) => Promise<$ReadOnlyArray<SignedDeviceList>>; | ||||
// updating device list is possible only on Native | // updating device list is possible only on Native | ||||
// web cannot be a primary device, so there's no need to expose it to JS | // web cannot be a primary device, so there's no need to expose it to JS | ||||
+updateDeviceList?: (newDeviceList: SignedDeviceList) => Promise<void>; | +updateDeviceList?: (newDeviceList: SignedDeviceList) => Promise<void>; | ||||
+uploadKeysForRegisteredDeviceAndLogIn: ( | +uploadKeysForRegisteredDeviceAndLogIn: ( | ||||
userID: string, | userID: string, | ||||
nonceChallengeResponse: SignedMessage, | nonceChallengeResponse: SignedMessage, | ||||
) => Promise<IdentityAuthResult>; | ) => Promise<IdentityAuthResult>; | ||||
// getFarcasterUsers is only implemented on native at the moment | |||||
+getFarcasterUsers?: ( | |||||
farcasterIDs: $ReadOnlyArray<string>, | |||||
) => Promise<$ReadOnlyArray<FarcasterUser>>; | |||||
} | } | ||||
export type IdentityServiceAuthLayer = { | export type IdentityServiceAuthLayer = { | ||||
+userID: string, | +userID: string, | ||||
+deviceID: string, | +deviceID: string, | ||||
+commServicesAccessToken: string, | +commServicesAccessToken: string, | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |