diff --git a/keyserver/addons/rust-node-addon/rust-binding-types.js b/keyserver/addons/rust-node-addon/rust-binding-types.js --- a/keyserver/addons/rust-node-addon/rust-binding-types.js +++ b/keyserver/addons/rust-node-addon/rust-binding-types.js @@ -1,10 +1,9 @@ // @flow import type { SignedIdentityKeysBlob } from 'lib/types/crypto-types.js'; -import type { - InboundKeyInfoResponse, - UserLoginResponse, -} from 'lib/types/identity-service-types.js'; +import type { InboundKeyInfoResponse } from 'lib/types/identity-service-types.js'; + +import type { IdentityInfo } from '../../src/user/identity.js'; type RustNativeBindingAPI = { +loginUser: ( @@ -17,7 +16,7 @@ notifPrekeySignature: string, contentOneTimeKeys: $ReadOnlyArray, notifOneTimeKeys: $ReadOnlyArray, - ) => Promise, + ) => Promise, +registerUser: ( username: string, password: string, @@ -28,7 +27,7 @@ notifPrekeySignature: string, contentOneTimeKeys: $ReadOnlyArray, notifOneTimeKeys: $ReadOnlyArray, - ) => Promise, + ) => Promise, +addReservedUsernames: (message: string, signature: string) => Promise, +removeReservedUsername: ( message: 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 @@ -12,8 +12,8 @@ } from './request-types.js'; import { tShape } from '../utils/validation-utils.js'; -export type UserLoginResponse = { - +userId: string, +export type UserAuthMetadata = { + +userID: string, +accessToken: string, }; diff --git a/native/components/access-token-handler.react.js b/native/components/access-token-handler.react.js --- a/native/components/access-token-handler.react.js +++ b/native/components/access-token-handler.react.js @@ -3,7 +3,7 @@ import * as React from 'react'; import { setAccessTokenActionType } from 'lib/actions/user-actions.js'; -import type { UserLoginResponse } from 'lib/types/identity-service-types.js'; +import type { UserAuthMetadata } from 'lib/types/identity-service-types.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; import { getCommServicesAuthMetadataEmitter } from '../event-emitters/csa-auth-metadata-emitter.js'; @@ -27,7 +27,7 @@ const metadataEmitter = getCommServicesAuthMetadataEmitter(); const subscription = metadataEmitter.addListener( 'commServicesAuthMetadata', - (authMetadata: UserLoginResponse) => { + (authMetadata: UserAuthMetadata) => { dispatch({ type: setAccessTokenActionType, payload: authMetadata.accessToken, diff --git a/native/event-emitters/csa-auth-metadata-emitter.js b/native/event-emitters/csa-auth-metadata-emitter.js --- a/native/event-emitters/csa-auth-metadata-emitter.js +++ b/native/event-emitters/csa-auth-metadata-emitter.js @@ -2,7 +2,7 @@ import { NativeModules, NativeEventEmitter } from 'react-native'; -import { type UserLoginResponse } from 'lib/types/identity-service-types.js'; +import { type UserAuthMetadata } from 'lib/types/identity-service-types.js'; type CommServicesAuthMetadataEmitterConstants = { +COMM_SERVICES_AUTH_METADATA: 'commServicesAuthMetadata', @@ -19,7 +19,7 @@ NativeModules.CommServicesAuthMetadataEmitter; function getCommServicesAuthMetadataEmitter(): NativeEventEmitter<{ - +commServicesAuthMetadata: [UserLoginResponse], + +commServicesAuthMetadata: [UserAuthMetadata], }> { return new NativeEventEmitter(CommServicesAuthMetadataEmitterModule); } diff --git a/native/identity-service/identity-service-context-provider.react.js b/native/identity-service/identity-service-context-provider.react.js --- a/native/identity-service/identity-service-context-provider.react.js +++ b/native/identity-service/identity-service-context-provider.react.js @@ -13,7 +13,7 @@ deviceOlmOutboundKeysValidator, type IdentityServiceClient, type UserDevicesOlmOutboundKeys, - type UserLoginResponse, + type UserAuthMetadata, ONE_TIME_KEYS_NUMBER, identityAuthResultValidator, } from 'lib/types/identity-service-types.js'; @@ -42,8 +42,8 @@ const metadataEmitter = getCommServicesAuthMetadataEmitter(); const subscription = metadataEmitter.addListener( 'commServicesAuthMetadata', - (authMetadata: UserLoginResponse) => { - userIDPromiseRef.current = Promise.resolve(authMetadata.userId); + (authMetadata: UserAuthMetadata) => { + userIDPromiseRef.current = Promise.resolve(authMetadata.userID); }, ); return () => subscription.remove();