diff --git a/services/identity/src/client_service.rs b/services/identity/src/client_service.rs --- a/services/identity/src/client_service.rs +++ b/services/identity/src/client_service.rs @@ -19,14 +19,14 @@ }; use crate::error::{DeviceListError, Error as DBError}; use crate::grpc_services::protos::unauth::{ - find_user_id_request, AddReservedUsernamesRequest, Empty, FindUserIdRequest, - FindUserIdResponse, GenerateNonceResponse, OpaqueLoginFinishRequest, - OpaqueLoginFinishResponse, OpaqueLoginStartRequest, OpaqueLoginStartResponse, - RegistrationFinishRequest, RegistrationFinishResponse, - RegistrationStartRequest, RegistrationStartResponse, - RemoveReservedUsernameRequest, ReservedRegistrationStartRequest, - ReservedWalletLoginRequest, VerifyUserAccessTokenRequest, - VerifyUserAccessTokenResponse, WalletLoginRequest, WalletLoginResponse, + find_user_id_request, AddReservedUsernamesRequest, AuthResponse, Empty, + FindUserIdRequest, FindUserIdResponse, GenerateNonceResponse, + OpaqueLoginFinishRequest, OpaqueLoginStartRequest, OpaqueLoginStartResponse, + RegistrationFinishRequest, RegistrationStartRequest, + RegistrationStartResponse, RemoveReservedUsernameRequest, + ReservedRegistrationStartRequest, ReservedWalletLoginRequest, + VerifyUserAccessTokenRequest, VerifyUserAccessTokenResponse, + WalletLoginRequest, }; use crate::grpc_services::shared::get_value; use crate::grpc_utils::DeviceKeyUploadActions; @@ -202,7 +202,7 @@ async fn register_password_user_finish( &self, request: tonic::Request, - ) -> Result, tonic::Status> { + ) -> Result, tonic::Status> { let code_version = get_code_version(&request); let message = request.into_inner(); @@ -246,7 +246,7 @@ .await .map_err(handle_db_error)?; - let response = RegistrationFinishResponse { + let response = AuthResponse { user_id, access_token, }; @@ -321,7 +321,7 @@ async fn log_in_password_user_finish( &self, request: tonic::Request, - ) -> Result, tonic::Status> { + ) -> Result, tonic::Status> { let code_version = get_code_version(&request); let message = request.into_inner(); @@ -364,7 +364,7 @@ .await .map_err(handle_db_error)?; - let response = OpaqueLoginFinishResponse { + let response = AuthResponse { user_id: state.user_id, access_token, }; @@ -377,7 +377,7 @@ async fn log_in_wallet_user( &self, request: tonic::Request, - ) -> Result, tonic::Status> { + ) -> Result, tonic::Status> { let code_version = get_code_version(&request); let message = request.into_inner(); @@ -490,7 +490,7 @@ .await .map_err(handle_db_error)?; - let response = WalletLoginResponse { + let response = AuthResponse { user_id, access_token, }; @@ -500,7 +500,7 @@ async fn log_in_reserved_wallet_user( &self, request: tonic::Request, - ) -> Result, tonic::Status> { + ) -> Result, tonic::Status> { let code_version = get_code_version(&request); let message = request.into_inner(); @@ -582,7 +582,7 @@ .await .map_err(handle_db_error)?; - let response = WalletLoginResponse { + let response = AuthResponse { user_id, access_token, }; diff --git a/shared/protos/identity_unauth.proto b/shared/protos/identity_unauth.proto --- a/shared/protos/identity_unauth.proto +++ b/shared/protos/identity_unauth.proto @@ -16,15 +16,15 @@ rpc RegisterReservedPasswordUserStart(ReservedRegistrationStartRequest) returns (RegistrationStartResponse) {} rpc RegisterPasswordUserFinish(RegistrationFinishRequest) returns ( - RegistrationFinishResponse) {} + AuthResponse) {} // Called by user to register device and get an access token rpc LogInPasswordUserStart(OpaqueLoginStartRequest) returns (OpaqueLoginStartResponse) {} rpc LogInPasswordUserFinish(OpaqueLoginFinishRequest) returns - (OpaqueLoginFinishResponse) {} - rpc LogInWalletUser(WalletLoginRequest) returns (WalletLoginResponse) {} + (AuthResponse) {} + rpc LogInWalletUser(WalletLoginRequest) returns (AuthResponse) {} rpc LogInReservedWalletUser(ReservedWalletLoginRequest) returns - (WalletLoginResponse) {} + (AuthResponse) {} // Sign-In with Ethereum actions @@ -145,10 +145,9 @@ bytes opaque_registration_response = 2; } -message RegistrationFinishResponse { - // Unique identifier for newly registered user +message AuthResponse { + // Unique identifier for user string user_id = 1; - // After successful unpacking of user credentials, return token string access_token = 2; } @@ -178,13 +177,6 @@ bytes opaque_login_response = 2; } -message OpaqueLoginFinishResponse { - string user_id = 1; - // Mint and return a new access token upon successful login - string access_token = 2; - -} - message WalletLoginRequest { string siwe_message = 1; string siwe_signature = 2; @@ -206,11 +198,6 @@ string keyserver_signature = 5; } -message WalletLoginResponse { - string user_id = 1; - string access_token = 2; -} - // GenerateNonce message GenerateNonceResponse{ diff --git a/web/protobufs/identity-unauth-structs.cjs b/web/protobufs/identity-unauth-structs.cjs --- a/web/protobufs/identity-unauth-structs.cjs +++ b/web/protobufs/identity-unauth-structs.cjs @@ -23,6 +23,7 @@ Function('return this')(); goog.exportSymbol('proto.identity.unauth.AddReservedUsernamesRequest', null, global); +goog.exportSymbol('proto.identity.unauth.AuthResponse', null, global); goog.exportSymbol('proto.identity.unauth.DeviceKeyUpload', null, global); goog.exportSymbol('proto.identity.unauth.DeviceType', null, global); goog.exportSymbol('proto.identity.unauth.Empty', null, global); @@ -32,12 +33,10 @@ goog.exportSymbol('proto.identity.unauth.GenerateNonceResponse', null, global); goog.exportSymbol('proto.identity.unauth.IdentityKeyInfo', null, global); goog.exportSymbol('proto.identity.unauth.OpaqueLoginFinishRequest', null, global); -goog.exportSymbol('proto.identity.unauth.OpaqueLoginFinishResponse', null, global); goog.exportSymbol('proto.identity.unauth.OpaqueLoginStartRequest', null, global); goog.exportSymbol('proto.identity.unauth.OpaqueLoginStartResponse', null, global); goog.exportSymbol('proto.identity.unauth.Prekey', null, global); goog.exportSymbol('proto.identity.unauth.RegistrationFinishRequest', null, global); -goog.exportSymbol('proto.identity.unauth.RegistrationFinishResponse', null, global); goog.exportSymbol('proto.identity.unauth.RegistrationStartRequest', null, global); goog.exportSymbol('proto.identity.unauth.RegistrationStartResponse', null, global); goog.exportSymbol('proto.identity.unauth.RemoveReservedUsernameRequest', null, global); @@ -46,7 +45,6 @@ goog.exportSymbol('proto.identity.unauth.VerifyUserAccessTokenRequest', null, global); goog.exportSymbol('proto.identity.unauth.VerifyUserAccessTokenResponse', null, global); goog.exportSymbol('proto.identity.unauth.WalletLoginRequest', null, global); -goog.exportSymbol('proto.identity.unauth.WalletLoginResponse', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -225,16 +223,16 @@ * @extends {jspb.Message} * @constructor */ -proto.identity.unauth.RegistrationFinishResponse = function(opt_data) { +proto.identity.unauth.AuthResponse = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.identity.unauth.RegistrationFinishResponse, jspb.Message); +goog.inherits(proto.identity.unauth.AuthResponse, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.identity.unauth.RegistrationFinishResponse.displayName = 'proto.identity.unauth.RegistrationFinishResponse'; + proto.identity.unauth.AuthResponse.displayName = 'proto.identity.unauth.AuthResponse'; } /** * Generated by JsPbCodeGenerator. @@ -299,27 +297,6 @@ */ proto.identity.unauth.OpaqueLoginStartResponse.displayName = 'proto.identity.unauth.OpaqueLoginStartResponse'; } -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.identity.unauth.OpaqueLoginFinishResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.identity.unauth.OpaqueLoginFinishResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.identity.unauth.OpaqueLoginFinishResponse.displayName = 'proto.identity.unauth.OpaqueLoginFinishResponse'; -} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -362,27 +339,6 @@ */ proto.identity.unauth.ReservedWalletLoginRequest.displayName = 'proto.identity.unauth.ReservedWalletLoginRequest'; } -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.identity.unauth.WalletLoginResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.identity.unauth.WalletLoginResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.identity.unauth.WalletLoginResponse.displayName = 'proto.identity.unauth.WalletLoginResponse'; -} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -2301,8 +2257,8 @@ * http://goto/soy-param-migration * @return {!Object} */ -proto.identity.unauth.RegistrationFinishResponse.prototype.toObject = function(opt_includeInstance) { - return proto.identity.unauth.RegistrationFinishResponse.toObject(opt_includeInstance, this); +proto.identity.unauth.AuthResponse.prototype.toObject = function(opt_includeInstance) { + return proto.identity.unauth.AuthResponse.toObject(opt_includeInstance, this); }; @@ -2311,11 +2267,11 @@ * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.identity.unauth.RegistrationFinishResponse} msg The msg instance to transform. + * @param {!proto.identity.unauth.AuthResponse} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.identity.unauth.RegistrationFinishResponse.toObject = function(includeInstance, msg) { +proto.identity.unauth.AuthResponse.toObject = function(includeInstance, msg) { var f, obj = { userId: jspb.Message.getFieldWithDefault(msg, 1, ""), accessToken: jspb.Message.getFieldWithDefault(msg, 2, "") @@ -2332,23 +2288,23 @@ /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.identity.unauth.RegistrationFinishResponse} + * @return {!proto.identity.unauth.AuthResponse} */ -proto.identity.unauth.RegistrationFinishResponse.deserializeBinary = function(bytes) { +proto.identity.unauth.AuthResponse.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.identity.unauth.RegistrationFinishResponse; - return proto.identity.unauth.RegistrationFinishResponse.deserializeBinaryFromReader(msg, reader); + var msg = new proto.identity.unauth.AuthResponse; + return proto.identity.unauth.AuthResponse.deserializeBinaryFromReader(msg, reader); }; /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.identity.unauth.RegistrationFinishResponse} msg The message object to deserialize into. + * @param {!proto.identity.unauth.AuthResponse} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.identity.unauth.RegistrationFinishResponse} + * @return {!proto.identity.unauth.AuthResponse} */ -proto.identity.unauth.RegistrationFinishResponse.deserializeBinaryFromReader = function(msg, reader) { +proto.identity.unauth.AuthResponse.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2376,9 +2332,9 @@ * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.identity.unauth.RegistrationFinishResponse.prototype.serializeBinary = function() { +proto.identity.unauth.AuthResponse.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.identity.unauth.RegistrationFinishResponse.serializeBinaryToWriter(this, writer); + proto.identity.unauth.AuthResponse.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2386,11 +2342,11 @@ /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.identity.unauth.RegistrationFinishResponse} message + * @param {!proto.identity.unauth.AuthResponse} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.identity.unauth.RegistrationFinishResponse.serializeBinaryToWriter = function(message, writer) { +proto.identity.unauth.AuthResponse.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getUserId(); if (f.length > 0) { @@ -2413,16 +2369,16 @@ * optional string user_id = 1; * @return {string} */ -proto.identity.unauth.RegistrationFinishResponse.prototype.getUserId = function() { +proto.identity.unauth.AuthResponse.prototype.getUserId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** * @param {string} value - * @return {!proto.identity.unauth.RegistrationFinishResponse} returns this + * @return {!proto.identity.unauth.AuthResponse} returns this */ -proto.identity.unauth.RegistrationFinishResponse.prototype.setUserId = function(value) { +proto.identity.unauth.AuthResponse.prototype.setUserId = function(value) { return jspb.Message.setProto3StringField(this, 1, value); }; @@ -2431,16 +2387,16 @@ * optional string access_token = 2; * @return {string} */ -proto.identity.unauth.RegistrationFinishResponse.prototype.getAccessToken = function() { +proto.identity.unauth.AuthResponse.prototype.getAccessToken = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** * @param {string} value - * @return {!proto.identity.unauth.RegistrationFinishResponse} returns this + * @return {!proto.identity.unauth.AuthResponse} returns this */ -proto.identity.unauth.RegistrationFinishResponse.prototype.setAccessToken = function(value) { +proto.identity.unauth.AuthResponse.prototype.setAccessToken = function(value) { return jspb.Message.setProto3StringField(this, 2, value); }; @@ -3051,166 +3007,6 @@ -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.identity.unauth.OpaqueLoginFinishResponse.prototype.toObject = function(opt_includeInstance) { - return proto.identity.unauth.OpaqueLoginFinishResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.identity.unauth.OpaqueLoginFinishResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.identity.unauth.OpaqueLoginFinishResponse.toObject = function(includeInstance, msg) { - var f, obj = { - userId: jspb.Message.getFieldWithDefault(msg, 1, ""), - accessToken: jspb.Message.getFieldWithDefault(msg, 2, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.identity.unauth.OpaqueLoginFinishResponse} - */ -proto.identity.unauth.OpaqueLoginFinishResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.identity.unauth.OpaqueLoginFinishResponse; - return proto.identity.unauth.OpaqueLoginFinishResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.identity.unauth.OpaqueLoginFinishResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.identity.unauth.OpaqueLoginFinishResponse} - */ -proto.identity.unauth.OpaqueLoginFinishResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setUserId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setAccessToken(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.identity.unauth.OpaqueLoginFinishResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.identity.unauth.OpaqueLoginFinishResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.identity.unauth.OpaqueLoginFinishResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.identity.unauth.OpaqueLoginFinishResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getUserId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getAccessToken(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } -}; - - -/** - * optional string user_id = 1; - * @return {string} - */ -proto.identity.unauth.OpaqueLoginFinishResponse.prototype.getUserId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.identity.unauth.OpaqueLoginFinishResponse} returns this - */ -proto.identity.unauth.OpaqueLoginFinishResponse.prototype.setUserId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string access_token = 2; - * @return {string} - */ -proto.identity.unauth.OpaqueLoginFinishResponse.prototype.getAccessToken = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.identity.unauth.OpaqueLoginFinishResponse} returns this - */ -proto.identity.unauth.OpaqueLoginFinishResponse.prototype.setAccessToken = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - - - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -3693,166 +3489,6 @@ -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.identity.unauth.WalletLoginResponse.prototype.toObject = function(opt_includeInstance) { - return proto.identity.unauth.WalletLoginResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.identity.unauth.WalletLoginResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.identity.unauth.WalletLoginResponse.toObject = function(includeInstance, msg) { - var f, obj = { - userId: jspb.Message.getFieldWithDefault(msg, 1, ""), - accessToken: jspb.Message.getFieldWithDefault(msg, 2, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.identity.unauth.WalletLoginResponse} - */ -proto.identity.unauth.WalletLoginResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.identity.unauth.WalletLoginResponse; - return proto.identity.unauth.WalletLoginResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.identity.unauth.WalletLoginResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.identity.unauth.WalletLoginResponse} - */ -proto.identity.unauth.WalletLoginResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setUserId(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setAccessToken(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.identity.unauth.WalletLoginResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.identity.unauth.WalletLoginResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.identity.unauth.WalletLoginResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.identity.unauth.WalletLoginResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getUserId(); - if (f.length > 0) { - writer.writeString( - 1, - f - ); - } - f = message.getAccessToken(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } -}; - - -/** - * optional string user_id = 1; - * @return {string} - */ -proto.identity.unauth.WalletLoginResponse.prototype.getUserId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.identity.unauth.WalletLoginResponse} returns this - */ -proto.identity.unauth.WalletLoginResponse.prototype.setUserId = function(value) { - return jspb.Message.setProto3StringField(this, 1, value); -}; - - -/** - * optional string access_token = 2; - * @return {string} - */ -proto.identity.unauth.WalletLoginResponse.prototype.getAccessToken = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.identity.unauth.WalletLoginResponse} returns this - */ -proto.identity.unauth.WalletLoginResponse.prototype.setAccessToken = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - - - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. diff --git a/web/protobufs/identity-unauth-structs.cjs.flow b/web/protobufs/identity-unauth-structs.cjs.flow --- a/web/protobufs/identity-unauth-structs.cjs.flow +++ b/web/protobufs/identity-unauth-structs.cjs.flow @@ -216,22 +216,22 @@ opaqueRegistrationResponse: Uint8Array | string, }; -declare export class RegistrationFinishResponse extends Message { +declare export class AuthResponse extends Message { getUserId(): string; - setUserId(value: string): RegistrationFinishResponse; + setUserId(value: string): AuthResponse; getAccessToken(): string; - setAccessToken(value: string): RegistrationFinishResponse; + setAccessToken(value: string): AuthResponse; serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): RegistrationFinishResponseObject; - static toObject(includeInstance: boolean, msg: RegistrationFinishResponse): RegistrationFinishResponseObject; - static serializeBinaryToWriter(message: RegistrationFinishResponse, writer: BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): RegistrationFinishResponse; - static deserializeBinaryFromReader(message: RegistrationFinishResponse, reader: BinaryReader): RegistrationFinishResponse; + toObject(includeInstance?: boolean): AuthResponseObject; + static toObject(includeInstance: boolean, msg: AuthResponse): AuthResponseObject; + static serializeBinaryToWriter(message: AuthResponse, writer: BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): AuthResponse; + static deserializeBinaryFromReader(message: AuthResponse, reader: BinaryReader): AuthResponse; } -export type RegistrationFinishResponseObject = { +export type AuthResponseObject = { userId: string, accessToken: string, }; @@ -308,26 +308,6 @@ opaqueLoginResponse: Uint8Array | string, }; -declare export class OpaqueLoginFinishResponse extends Message { - getUserId(): string; - setUserId(value: string): OpaqueLoginFinishResponse; - - getAccessToken(): string; - setAccessToken(value: string): OpaqueLoginFinishResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): OpaqueLoginFinishResponseObject; - static toObject(includeInstance: boolean, msg: OpaqueLoginFinishResponse): OpaqueLoginFinishResponseObject; - static serializeBinaryToWriter(message: OpaqueLoginFinishResponse, writer: BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): OpaqueLoginFinishResponse; - static deserializeBinaryFromReader(message: OpaqueLoginFinishResponse, reader: BinaryReader): OpaqueLoginFinishResponse; -} - -export type OpaqueLoginFinishResponseObject = { - userId: string, - accessToken: string, -}; - declare export class WalletLoginRequest extends Message { getSiweMessage(): string; setSiweMessage(value: string): WalletLoginRequest; @@ -388,26 +368,6 @@ keyserverSignature: string, }; -declare export class WalletLoginResponse extends Message { - getUserId(): string; - setUserId(value: string): WalletLoginResponse; - - getAccessToken(): string; - setAccessToken(value: string): WalletLoginResponse; - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): WalletLoginResponseObject; - static toObject(includeInstance: boolean, msg: WalletLoginResponse): WalletLoginResponseObject; - static serializeBinaryToWriter(message: WalletLoginResponse, writer: BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): WalletLoginResponse; - static deserializeBinaryFromReader(message: WalletLoginResponse, reader: BinaryReader): WalletLoginResponse; -} - -export type WalletLoginResponseObject = { - userId: string, - accessToken: string, -}; - declare export class GenerateNonceResponse extends Message { getNonce(): string; setNonce(value: string): GenerateNonceResponse; diff --git a/web/protobufs/identity-unauth.cjs b/web/protobufs/identity-unauth.cjs --- a/web/protobufs/identity-unauth.cjs +++ b/web/protobufs/identity-unauth.cjs @@ -202,13 +202,13 @@ * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.RegistrationFinishRequest, - * !proto.identity.unauth.RegistrationFinishResponse>} + * !proto.identity.unauth.AuthResponse>} */ const methodDescriptor_IdentityClientService_RegisterPasswordUserFinish = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/RegisterPasswordUserFinish', grpc.web.MethodType.UNARY, proto.identity.unauth.RegistrationFinishRequest, - proto.identity.unauth.RegistrationFinishResponse, + proto.identity.unauth.AuthResponse, /** * @param {!proto.identity.unauth.RegistrationFinishRequest} request * @return {!Uint8Array} @@ -216,7 +216,7 @@ function(request) { return request.serializeBinary(); }, - proto.identity.unauth.RegistrationFinishResponse.deserializeBinary + proto.identity.unauth.AuthResponse.deserializeBinary ); @@ -225,9 +225,9 @@ * request proto * @param {?Object} metadata User defined * call metadata - * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.RegistrationFinishResponse)} + * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.AuthResponse)} * callback The callback function(error, response) - * @return {!grpc.web.ClientReadableStream|undefined} + * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.registerPasswordUserFinish = @@ -246,7 +246,7 @@ * request proto * @param {?Object=} metadata User defined * call metadata - * @return {!Promise} + * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.registerPasswordUserFinish = @@ -324,13 +324,13 @@ * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.OpaqueLoginFinishRequest, - * !proto.identity.unauth.OpaqueLoginFinishResponse>} + * !proto.identity.unauth.AuthResponse>} */ const methodDescriptor_IdentityClientService_LogInPasswordUserFinish = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/LogInPasswordUserFinish', grpc.web.MethodType.UNARY, proto.identity.unauth.OpaqueLoginFinishRequest, - proto.identity.unauth.OpaqueLoginFinishResponse, + proto.identity.unauth.AuthResponse, /** * @param {!proto.identity.unauth.OpaqueLoginFinishRequest} request * @return {!Uint8Array} @@ -338,7 +338,7 @@ function(request) { return request.serializeBinary(); }, - proto.identity.unauth.OpaqueLoginFinishResponse.deserializeBinary + proto.identity.unauth.AuthResponse.deserializeBinary ); @@ -347,9 +347,9 @@ * request proto * @param {?Object} metadata User defined * call metadata - * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.OpaqueLoginFinishResponse)} + * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.AuthResponse)} * callback The callback function(error, response) - * @return {!grpc.web.ClientReadableStream|undefined} + * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.logInPasswordUserFinish = @@ -368,7 +368,7 @@ * request proto * @param {?Object=} metadata User defined * call metadata - * @return {!Promise} + * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.logInPasswordUserFinish = @@ -385,13 +385,13 @@ * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.WalletLoginRequest, - * !proto.identity.unauth.WalletLoginResponse>} + * !proto.identity.unauth.AuthResponse>} */ const methodDescriptor_IdentityClientService_LogInWalletUser = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/LogInWalletUser', grpc.web.MethodType.UNARY, proto.identity.unauth.WalletLoginRequest, - proto.identity.unauth.WalletLoginResponse, + proto.identity.unauth.AuthResponse, /** * @param {!proto.identity.unauth.WalletLoginRequest} request * @return {!Uint8Array} @@ -399,7 +399,7 @@ function(request) { return request.serializeBinary(); }, - proto.identity.unauth.WalletLoginResponse.deserializeBinary + proto.identity.unauth.AuthResponse.deserializeBinary ); @@ -408,9 +408,9 @@ * request proto * @param {?Object} metadata User defined * call metadata - * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.WalletLoginResponse)} + * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.AuthResponse)} * callback The callback function(error, response) - * @return {!grpc.web.ClientReadableStream|undefined} + * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.logInWalletUser = @@ -429,7 +429,7 @@ * request proto * @param {?Object=} metadata User defined * call metadata - * @return {!Promise} + * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.logInWalletUser = @@ -446,13 +446,13 @@ * @const * @type {!grpc.web.MethodDescriptor< * !proto.identity.unauth.ReservedWalletLoginRequest, - * !proto.identity.unauth.WalletLoginResponse>} + * !proto.identity.unauth.AuthResponse>} */ const methodDescriptor_IdentityClientService_LogInReservedWalletUser = new grpc.web.MethodDescriptor( '/identity.unauth.IdentityClientService/LogInReservedWalletUser', grpc.web.MethodType.UNARY, proto.identity.unauth.ReservedWalletLoginRequest, - proto.identity.unauth.WalletLoginResponse, + proto.identity.unauth.AuthResponse, /** * @param {!proto.identity.unauth.ReservedWalletLoginRequest} request * @return {!Uint8Array} @@ -460,7 +460,7 @@ function(request) { return request.serializeBinary(); }, - proto.identity.unauth.WalletLoginResponse.deserializeBinary + proto.identity.unauth.AuthResponse.deserializeBinary ); @@ -469,9 +469,9 @@ * request proto * @param {?Object} metadata User defined * call metadata - * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.WalletLoginResponse)} + * @param {function(?grpc.web.RpcError, ?proto.identity.unauth.AuthResponse)} * callback The callback function(error, response) - * @return {!grpc.web.ClientReadableStream|undefined} + * @return {!grpc.web.ClientReadableStream|undefined} * The XHR Node Readable Stream */ proto.identity.unauth.IdentityClientServiceClient.prototype.logInReservedWalletUser = @@ -490,7 +490,7 @@ * request proto * @param {?Object=} metadata User defined * call metadata - * @return {!Promise} + * @return {!Promise} * Promise that resolves to the response */ proto.identity.unauth.IdentityClientServicePromiseClient.prototype.logInReservedWalletUser = diff --git a/web/protobufs/identity-unauth.cjs.flow b/web/protobufs/identity-unauth.cjs.flow --- a/web/protobufs/identity-unauth.cjs.flow +++ b/web/protobufs/identity-unauth.cjs.flow @@ -27,8 +27,8 @@ request: identityStructs.RegistrationFinishRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, - response: identityStructs.RegistrationFinishResponse) => void - ): grpcWeb.ClientReadableStream; + response: identityStructs.AuthResponse) => void + ): grpcWeb.ClientReadableStream; logInPasswordUserStart( request: identityStructs.OpaqueLoginStartRequest, @@ -41,22 +41,22 @@ request: identityStructs.OpaqueLoginFinishRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, - response: identityStructs.OpaqueLoginFinishResponse) => void - ): grpcWeb.ClientReadableStream; + response: identityStructs.AuthResponse) => void + ): grpcWeb.ClientReadableStream; logInWalletUser( request: identityStructs.WalletLoginRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, - response: identityStructs.WalletLoginResponse) => void - ): grpcWeb.ClientReadableStream; + response: identityStructs.AuthResponse) => void + ): grpcWeb.ClientReadableStream; logInReservedWalletUser( request: identityStructs.ReservedWalletLoginRequest, metadata: grpcWeb.Metadata | void, callback: (err: grpcWeb.RpcError, - response: identityStructs.WalletLoginResponse) => void - ): grpcWeb.ClientReadableStream; + response: identityStructs.AuthResponse) => void + ): grpcWeb.ClientReadableStream; generateNonce( request: identityStructs.Empty, @@ -120,7 +120,7 @@ registerPasswordUserFinish( request: identityStructs.RegistrationFinishRequest, metadata?: grpcWeb.Metadata - ): Promise; + ): Promise; logInPasswordUserStart( request: identityStructs.OpaqueLoginStartRequest, @@ -130,17 +130,17 @@ logInPasswordUserFinish( request: identityStructs.OpaqueLoginFinishRequest, metadata?: grpcWeb.Metadata - ): Promise; + ): Promise; logInWalletUser( request: identityStructs.WalletLoginRequest, metadata?: grpcWeb.Metadata - ): Promise; + ): Promise; logInReservedWalletUser( request: identityStructs.ReservedWalletLoginRequest, metadata?: grpcWeb.Metadata - ): Promise; + ): Promise; generateNonce( request: identityStructs.Empty,