From fa73b7d5c62b3904728208a449a27002f95b12db Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Sat, 24 Jan 2026 14:55:39 +0300 Subject: [PATCH] feat: add verify to auth proto --- gen/auth.ts | 17 ++++++++++++++++- package.json | 2 +- proto/auth.proto | 13 +++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/gen/auth.ts b/gen/auth.ts index fd67837..0f50146 100644 --- a/gen/auth.ts +++ b/gen/auth.ts @@ -19,19 +19,34 @@ export interface SendOtpResponse { ok: boolean; } +export interface VerifyOtpRequest { + identifier: string; + type: string; + code: string; +} + +export interface VerifyOtpResponse { + accessToken: string; + refreshToken: string; +} + export const AUTH_V1_PACKAGE_NAME = "auth.v1"; export interface AuthServiceClient { sendOtp(request: SendOtpRequest): Observable; + + verifyOtp(request: VerifyOtpRequest): Observable; } export interface AuthServiceController { sendOtp(request: SendOtpRequest): Promise | Observable | SendOtpResponse; + + verifyOtp(request: VerifyOtpRequest): Promise | Observable | VerifyOtpResponse; } export function AuthServiceControllerMethods() { return function (constructor: Function) { - const grpcMethods: string[] = ["sendOtp"]; + const grpcMethods: string[] = ["sendOtp", "verifyOtp"]; for (const method of grpcMethods) { const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor); diff --git a/package.json b/package.json index 37b30ee..c615dca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@teacinema/contracts", - "version": "1.0.0", + "version": "1.0.1", "description": "Protocol Buffers contracts for microservices", "scripts": { "generate": "npx protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit" diff --git a/proto/auth.proto b/proto/auth.proto index f3b7ba1..09a0609 100644 --- a/proto/auth.proto +++ b/proto/auth.proto @@ -4,6 +4,7 @@ package auth.v1; service AuthService { rpc SendOtp(SendOtpRequest) returns (SendOtpResponse); + rpc VerifyOtp(VerifyOtpRequest) returns (VerifyOtpResponse); } message SendOtpRequest { @@ -14,3 +15,15 @@ message SendOtpRequest { message SendOtpResponse { bool ok = 1; } + + +message VerifyOtpRequest { + string identifier = 1; + string type = 2; + string code = 3; +} + +message VerifyOtpResponse { + string access_token = 1; + string refresh_token = 2; +}