diff --git a/.github/workflows/identity_tests.yml b/.github/workflows/identity_tests.yml --- a/.github/workflows/identity_tests.yml +++ b/.github/workflows/identity_tests.yml @@ -5,7 +5,7 @@ branches: [master] paths: - 'services/identity/**' - - 'shared/protos/identity_client.proto' + - 'shared/protos/identity_unauthenticated.proto' - 'flake.*' - 'nix/**' diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs --- a/native/native_rust_library/src/lib.rs +++ b/native/native_rust_library/src/lib.rs @@ -7,7 +7,7 @@ OutboundKeysForUserRequest, UpdateUserPasswordFinishRequest, UpdateUserPasswordStartRequest, UploadOneTimeKeysRequest, }; -use grpc_clients::identity::protos::client::{ +use grpc_clients::identity::protos::unauth::{ DeviceKeyUpload, DeviceType, Empty, IdentityKeyInfo, OpaqueLoginFinishRequest, OpaqueLoginStartRequest, Prekey, RegistrationFinishRequest, RegistrationStartRequest, WalletLoginRequest, diff --git a/services/commtest/src/identity/device.rs b/services/commtest/src/identity/device.rs --- a/services/commtest/src/identity/device.rs +++ b/services/commtest/src/identity/device.rs @@ -7,7 +7,7 @@ }; use crate::service_addr; -use grpc_clients::identity::protos::client::{ +use grpc_clients::identity::protos::unauth::{ DeviceKeyUpload, DeviceType, IdentityKeyInfo, Prekey, RegistrationFinishRequest, RegistrationStartRequest, }; diff --git a/services/commtest/tests/identity_access_tokens_tests.rs b/services/commtest/tests/identity_access_tokens_tests.rs --- a/services/commtest/tests/identity_access_tokens_tests.rs +++ b/services/commtest/tests/identity_access_tokens_tests.rs @@ -3,7 +3,7 @@ }; use commtest::service_addr; use grpc_clients::identity::{ - get_unauthenticated_client, protos::client::VerifyUserAccessTokenRequest, + get_unauthenticated_client, protos::unauth::VerifyUserAccessTokenRequest, }; #[tokio::test] diff --git a/services/commtest/tests/identity_prekey_tests.rs b/services/commtest/tests/identity_prekey_tests.rs --- a/services/commtest/tests/identity_prekey_tests.rs +++ b/services/commtest/tests/identity_prekey_tests.rs @@ -4,7 +4,7 @@ use commtest::service_addr; use grpc_clients::identity::{ get_auth_client, - protos::{authenticated::RefreshUserPrekeysRequest, client::Prekey}, + protos::{authenticated::RefreshUserPrekeysRequest, unauth::Prekey}, }; #[tokio::test] diff --git a/services/identity/build.rs b/services/identity/build.rs --- a/services/identity/build.rs +++ b/services/identity/build.rs @@ -4,8 +4,8 @@ .build_client(false) .compile( &[ - "../../shared/protos/identity_client.proto", - "../../shared/protos/identity_authenticated.proto", + "../../shared/protos/identity_unauth.proto", + "../../shared/protos/identity_auth.proto", ], &["../../shared/protos/"], )?; 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 @@ -37,7 +37,7 @@ use crate::siwe::{is_valid_ethereum_address, parse_and_verify_siwe_message}; use crate::token::{AccessTokenData, AuthType}; -pub use crate::grpc_services::protos::client::identity_client_service_server::{ +pub use crate::grpc_services::protos::unauth::identity_client_service_server::{ IdentityClientService, IdentityClientServiceServer, }; diff --git a/services/identity/src/constants.rs b/services/identity/src/constants.rs --- a/services/identity/src/constants.rs +++ b/services/identity/src/constants.rs @@ -10,7 +10,7 @@ // Users can sign in either through username+password or Eth wallet. // // This structure should be aligned with the messages defined in -// shared/protos/identity_client.proto +// shared/protos/identity_unauthenticated.proto // // Structure for a user should be: // { diff --git a/services/identity/src/grpc_services/authenticated.rs b/services/identity/src/grpc_services/authenticated.rs --- a/services/identity/src/grpc_services/authenticated.rs +++ b/services/identity/src/grpc_services/authenticated.rs @@ -29,7 +29,7 @@ UpdateUserPasswordStartRequest, UpdateUserPasswordStartResponse, UploadOneTimeKeysRequest, }; -use super::protos::client::{Empty, IdentityKeyInfo, Prekey}; +use super::protos::unauth::{Empty, IdentityKeyInfo, Prekey}; #[derive(derive_more::Constructor)] pub struct AuthenticatedService { diff --git a/services/identity/src/grpc_services/mod.rs b/services/identity/src/grpc_services/mod.rs --- a/services/identity/src/grpc_services/mod.rs +++ b/services/identity/src/grpc_services/mod.rs @@ -3,14 +3,9 @@ pub mod protos { pub mod unauth { - tonic::include_proto!("identity.client"); + tonic::include_proto!("identity.unauth"); } pub mod auth { - tonic::include_proto!("identity.authenticated"); + tonic::include_proto!("identity.auth"); } - - // This must be named client, because generated code from the authenticated - // protobuf file references message structs from the client protobuf file - // with the client:: namespace - pub use self::unauth as client; } diff --git a/shared/grpc_clients/build.rs b/shared/grpc_clients/build.rs --- a/shared/grpc_clients/build.rs +++ b/shared/grpc_clients/build.rs @@ -3,15 +3,15 @@ .build_server(false) .compile( &[ - "../protos/identity_client.proto", - "../protos/identity_authenticated.proto", + "../protos/identity_unauth.proto", + "../protos/identity_auth.proto", "../protos/tunnelbroker.proto", ], &["../protos"], ) .unwrap_or_else(|e| panic!("Failed to compile protos {:?}", e)); - println!("cargo:rerun-if-changed=../protos/identity_client.proto"); - println!("cargo:rerun-if-changed=../protos/identity_authenticated.proto"); + println!("cargo:rerun-if-changed=../protos/identity_unauth.proto"); + println!("cargo:rerun-if-changed=../protos/identity_auth.proto"); println!("cargo:rerun-if-changed=../protos/tunnelbroker.proto"); } diff --git a/shared/grpc_clients/src/identity/device.rs b/shared/grpc_clients/src/identity/device.rs --- a/shared/grpc_clients/src/identity/device.rs +++ b/shared/grpc_clients/src/identity/device.rs @@ -1,7 +1,7 @@ use std::fmt::{Display, Formatter, Result as FmtResult}; use crate::error::Error; -pub use crate::identity::protos::client::DeviceType; +pub use crate::identity::protos::unauth::DeviceType; impl TryFrom for DeviceType { type Error = crate::error::Error; diff --git a/shared/grpc_clients/src/identity/mod.rs b/shared/grpc_clients/src/identity/mod.rs --- a/shared/grpc_clients/src/identity/mod.rs +++ b/shared/grpc_clients/src/identity/mod.rs @@ -4,15 +4,15 @@ pub mod unauthenticated; pub mod protos { - // This must be named client for authenticated generated code - pub mod client { - tonic::include_proto!("identity.client"); + // This must be named unauth for authenticated generated code + pub mod unauth { + tonic::include_proto!("identity.unauth"); } - pub use client as unauthenticated; - - pub mod authenticated { - tonic::include_proto!("identity.authenticated"); + pub mod auth { + tonic::include_proto!("identity.auth"); } + pub use auth as authenticated; + pub use unauth as unauthenticated; } pub use authenticated::get_auth_client; diff --git a/shared/grpc_clients/src/identity/unauthenticated/mod.rs b/shared/grpc_clients/src/identity/unauthenticated/mod.rs --- a/shared/grpc_clients/src/identity/unauthenticated/mod.rs +++ b/shared/grpc_clients/src/identity/unauthenticated/mod.rs @@ -4,7 +4,7 @@ use tonic::transport::Channel; use super::{ - protos::client::identity_client_service_client::IdentityClientServiceClient, + protos::unauth::identity_client_service_client::IdentityClientServiceClient, shared::CodeVersionLayer, }; use crate::error::Error; diff --git a/shared/protos/identity_authenticated.proto b/shared/protos/identity_auth.proto rename from shared/protos/identity_authenticated.proto rename to shared/protos/identity_auth.proto --- a/shared/protos/identity_authenticated.proto +++ b/shared/protos/identity_auth.proto @@ -1,8 +1,8 @@ syntax = "proto3"; -import "identity_client.proto"; +import "identity_unauth.proto"; -package identity.authenticated; +package identity.auth; // RPCs from a client (iOS, Android, or web) to identity service // @@ -14,11 +14,11 @@ // Replenish one-time preKeys rpc UploadOneTimeKeys(UploadOneTimeKeysRequest) - returns (identity.client.Empty) {} + returns (identity.unauth.Empty) {} // Rotate a device's prekey and prekey signature // Rotated for deniability of older messages rpc RefreshUserPrekeys(RefreshUserPrekeysRequest) - returns (identity.client.Empty) {} + returns (identity.unauth.Empty) {} // Called by clients to get all device keys associated with a user in order // to open a new channel of communication on any of their devices. @@ -38,12 +38,12 @@ rpc UpdateUserPasswordStart(UpdateUserPasswordStartRequest) returns (UpdateUserPasswordStartResponse) {} rpc UpdateUserPasswordFinish(UpdateUserPasswordFinishRequest) returns - (identity.client.Empty) {} + (identity.unauth.Empty) {} // Called by user to log out (clears device's keys and access token) - rpc LogOutUser(identity.client.Empty) returns (identity.client.Empty) {} + rpc LogOutUser(identity.unauth.Empty) returns (identity.unauth.Empty) {} // Called by a user to delete their own account - rpc DeleteUser(identity.client.Empty) returns (identity.client.Empty) {} + rpc DeleteUser(identity.unauth.Empty) returns (identity.unauth.Empty) {} // Called by clients to get required keys for opening a connection // to a user's keyserver @@ -72,15 +72,15 @@ // RefreshUserPreKeys message RefreshUserPrekeysRequest { - identity.client.Prekey new_content_prekeys = 1; - identity.client.Prekey new_notif_prekeys = 2; + identity.unauth.Prekey new_content_prekeys = 1; + identity.unauth.Prekey new_notif_prekeys = 2; } // Information needed when establishing communication to someone else's device message OutboundKeyInfo { - identity.client.IdentityKeyInfo identity_info = 1; - identity.client.Prekey content_prekey = 2; - identity.client.Prekey notif_prekey = 3; + identity.unauth.IdentityKeyInfo identity_info = 1; + identity.unauth.Prekey content_prekey = 2; + identity.unauth.Prekey notif_prekey = 3; optional string one_time_content_prekey = 4; optional string one_time_notif_prekey = 5; } @@ -106,9 +106,9 @@ // GetInboundKeysForUser message InboundKeyInfo { - identity.client.IdentityKeyInfo identity_info = 1; - identity.client.Prekey content_prekey = 2; - identity.client.Prekey notif_prekey = 3; + identity.unauth.IdentityKeyInfo identity_info = 1; + identity.unauth.Prekey content_prekey = 2; + identity.unauth.Prekey notif_prekey = 3; } message InboundKeysForUserResponse { diff --git a/shared/protos/identity_client.proto b/shared/protos/identity_unauth.proto rename from shared/protos/identity_client.proto rename to shared/protos/identity_unauth.proto --- a/shared/protos/identity_client.proto +++ b/shared/protos/identity_unauth.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package identity.client; +package identity.unauth; // RPCs from a client (iOS, Android, or web) to identity service service IdentityClientService { diff --git a/web/grpc/identity-service-client-wrapper.js b/web/grpc/identity-service-client-wrapper.js --- a/web/grpc/identity-service-client-wrapper.js +++ b/web/grpc/identity-service-client-wrapper.js @@ -5,8 +5,8 @@ import { VersionInterceptor, AuthInterceptor } from './interceptor.js'; import * as IdentityAuthClient from '../protobufs/identity-auth-client.cjs'; -import * as IdentityClient from '../protobufs/identity-client.cjs'; -import { Empty } from '../protobufs/identity-structs.cjs'; +import { Empty } from '../protobufs/identity-unauth-structs.cjs'; +import * as IdentityClient from '../protobufs/identity-unauth.cjs'; class IdentityServiceClientWrapper { authClient: ?IdentityAuthClient.IdentityClientServicePromiseClient; diff --git a/web/protobufs/identity-auth-client.cjs b/web/protobufs/identity-auth-client.cjs --- a/web/protobufs/identity-auth-client.cjs +++ b/web/protobufs/identity-auth-client.cjs @@ -20,7 +20,7 @@ grpc.web = require('grpc-web'); -var identity_client_pb = require('./identity-structs.cjs') +var identity_client_pb = require('./identity-unauth-structs.cjs'); const proto = {}; proto.identity = {}; proto.identity.authenticated = require('./identity-auth-structs.cjs'); diff --git a/web/protobufs/identity-auth-client.cjs.flow b/web/protobufs/identity-auth-client.cjs.flow --- a/web/protobufs/identity-auth-client.cjs.flow +++ b/web/protobufs/identity-auth-client.cjs.flow @@ -3,7 +3,7 @@ import * as grpcWeb from 'grpc-web'; import * as identityAuthStructs from './identity-auth-structs.cjs'; -import * as identityStructs from './identity-structs.cjs'; +import * as identityStructs from './identity-unauth-structs.cjs'; declare export class IdentityClientServiceClient { diff --git a/web/protobufs/identity-auth-structs.cjs b/web/protobufs/identity-auth-structs.cjs --- a/web/protobufs/identity-auth-structs.cjs +++ b/web/protobufs/identity-auth-structs.cjs @@ -22,7 +22,7 @@ (function () { return this; }).call(null) || Function('return this')(); -var identity_client_pb = require('./identity-structs.cjs'); +var identity_client_pb = require('./identity-unauth-structs.cjs'); goog.object.extend(proto, identity_client_pb); goog.exportSymbol('proto.identity.authenticated.FindUserIDRequest', null, global); goog.exportSymbol('proto.identity.authenticated.FindUserIDRequest.IdentifierCase', null, global); diff --git a/web/protobufs/identity-auth-structs.cjs.flow b/web/protobufs/identity-auth-structs.cjs.flow --- a/web/protobufs/identity-auth-structs.cjs.flow +++ b/web/protobufs/identity-auth-structs.cjs.flow @@ -7,7 +7,7 @@ Map as ProtoMap, } from 'google-protobuf'; -import * as identityStructs from './identity-structs.cjs'; +import * as identityStructs from './identity-unauth-structs.cjs'; declare export class UploadOneTimeKeysRequest extends Message { getContentonetimeprekeysList(): Array; diff --git a/web/protobufs/identity-structs.cjs b/web/protobufs/identity-unauth-structs.cjs rename from web/protobufs/identity-structs.cjs rename to web/protobufs/identity-unauth-structs.cjs diff --git a/web/protobufs/identity-structs.cjs.flow b/web/protobufs/identity-unauth-structs.cjs.flow rename from web/protobufs/identity-structs.cjs.flow rename to web/protobufs/identity-unauth-structs.cjs.flow diff --git a/web/protobufs/identity-client.cjs b/web/protobufs/identity-unauth.cjs rename from web/protobufs/identity-client.cjs rename to web/protobufs/identity-unauth.cjs --- a/web/protobufs/identity-client.cjs +++ b/web/protobufs/identity-unauth.cjs @@ -21,7 +21,7 @@ const proto = {}; proto.identity = {}; -proto.identity.client = require('./identity-structs.cjs'); +proto.identity.client = require('./identity-unauth-structs.cjs'); /** * @param {string} hostname diff --git a/web/protobufs/identity-client.cjs.flow b/web/protobufs/identity-unauth.cjs.flow rename from web/protobufs/identity-client.cjs.flow rename to web/protobufs/identity-unauth.cjs.flow --- a/web/protobufs/identity-client.cjs.flow +++ b/web/protobufs/identity-unauth.cjs.flow @@ -2,7 +2,7 @@ import * as grpcWeb from 'grpc-web'; -import * as identityStructs from './identity-structs.cjs'; +import * as identityStructs from './identity-unauth-structs.cjs'; declare export class IdentityClientServiceClient { constructor (hostname: string, diff --git a/web/scripts/codegen-identity-grpc.sh b/web/scripts/codegen-identity-grpc.sh --- a/web/scripts/codegen-identity-grpc.sh +++ b/web/scripts/codegen-identity-grpc.sh @@ -6,25 +6,26 @@ OUTPUT_DIR="protobufs" -protoc -I=$PROTO_PATH identity_client.proto identity_authenticated.proto \ +protoc -I=$PROTO_PATH identity_unauth.proto identity_auth.proto \ --js_out=import_style=commonjs:$OUTPUT_DIR \ --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:$OUTPUT_DIR -mv $OUTPUT_DIR/identity_client_pb.js \ - $OUTPUT_DIR/identity-structs.cjs -mv $OUTPUT_DIR/identity_client_grpc_web_pb.js \ - $OUTPUT_DIR/identity-client.cjs -mv $OUTPUT_DIR/identity_client_pb.d.ts \ - $OUTPUT_DIR/identity-structs.cjs.flow -mv $OUTPUT_DIR/identity_client_grpc_web_pb.d.ts \ - $OUTPUT_DIR/identity-client.cjs.flow -mv $OUTPUT_DIR/identity_authenticated_pb.js \ +mv $OUTPUT_DIR/identity_unauth_pb.js \ + $OUTPUT_DIR/identity-unauth-structs.cjs +mv $OUTPUT_DIR/identity_unauth_grpc_web_pb.js \ + $OUTPUT_DIR/identity-unauth.cjs +mv $OUTPUT_DIR/identity_unauth_pb.d.ts \ + $OUTPUT_DIR/identity-unauth-structs.cjs.flow +mv $OUTPUT_DIR/identity_unauth_grpc_web_pb.d.ts \ + $OUTPUT_DIR/identity-unauth.cjs.flow + +mv $OUTPUT_DIR/identity_auth_pb.js \ $OUTPUT_DIR/identity-auth-structs.cjs -mv $OUTPUT_DIR/identity_authenticated_grpc_web_pb.js \ +mv $OUTPUT_DIR/identity_auth_grpc_web_pb.js \ $OUTPUT_DIR/identity-auth-client.cjs -mv $OUTPUT_DIR/identity_authenticated_pb.d.ts \ +mv $OUTPUT_DIR/identity_auth_pb.d.ts \ $OUTPUT_DIR/identity-auth-structs.cjs.flow -mv $OUTPUT_DIR/identity_authenticated_grpc_web_pb.d.ts \ +mv $OUTPUT_DIR/identity_auth_grpc_web_pb.d.ts \ $OUTPUT_DIR/identity-auth-client.cjs.flow # This echo statement splits the string to ensure that Phabricator shows this file in reviews