35 Commits

Author SHA1 Message Date
Дмитрий
add54d15e5 update: package json version 2026-03-30 18:32:23 +03:00
Дмитрий
4f1a68df5a update: update publish file add git
Some checks failed
Publish / Publish Job (push) Failing after 2m31s
2026-03-30 18:28:41 +03:00
Дмитрий
9f5afc5a36 fix: ganerate proto file for golang
All checks were successful
Publish / Publish Job (push) Successful in 2m34s
2026-03-30 18:12:33 +03:00
Дмитрий
6666bb1a74 add: add go repository
All checks were successful
Publish / Publish Job (push) Successful in 2m28s
2026-03-30 16:40:36 +03:00
Дмитрий
f6366f14b5 fix: remove imports google any and status protobufs and add go package proto files
All checks were successful
Publish / Publish Job (push) Successful in 2m6s
2026-03-30 16:30:22 +03:00
Дмитрий
39d0e360a2 fix: remove imports google any and status protobufs
Some checks failed
Publish / Publish Job (push) Failing after 2m0s
2026-03-30 16:24:42 +03:00
Дмитрий
4f038b0f92 fix: remove imports google any and status protobufs
Some checks failed
Publish / Publish Job (push) Has been cancelled
2026-03-30 16:23:40 +03:00
Дмитрий
f592ccc021 fix: remove imports google any and status protobufs 2026-03-30 16:22:49 +03:00
Дмитрий
b16f526fb5 fix: fix any.proto imptort
Some checks failed
Publish / Publish Job (push) Failing after 1m58s
2026-03-30 16:16:30 +03:00
Дмитрий
55cf38c8c2 fix: add go grpc and protoc generate
Some checks failed
Publish / Publish Job (push) Failing after 3m7s
2026-03-30 16:09:52 +03:00
Дмитрий
c5e57adf5b fix: install ts-proto global
Some checks failed
Publish / Publish Job (push) Failing after 1m11s
2026-03-30 16:06:05 +03:00
Дмитрий
ea6a3e7777 fix: fix protoc generate
Some checks failed
Publish / Publish Job (push) Failing after 1m9s
2026-03-30 15:58:02 +03:00
Дмитрий
3ef32ab618 add: add ldap protobuf
Some checks failed
Publish / Publish Job (push) Failing after 1m10s
2026-03-30 15:54:12 +03:00
Дмитрий
d81e20c41a remove: delete register methods and change version
All checks were successful
Publish / Publish Job (push) Successful in 1m15s
2026-03-28 11:47:16 +03:00
Дмитрий
b8715f8f31 remove: delete register methods
Some checks failed
Publish / Publish Job (push) Failing after 1m9s
2026-03-28 11:44:02 +03:00
Дмитрий
0d3bf2ca36 fix: change version
All checks were successful
Publish / Publish Job (push) Successful in 1m19s
2026-03-28 10:41:11 +03:00
Дмитрий
970873d536 feat: add success status pin and logout
Some checks failed
Publish / Publish Job (push) Has been cancelled
2026-03-27 18:36:41 +03:00
Дмитрий
b7d9039783 feat: add unlock pin methods
All checks were successful
Publish / Publish Job (push) Successful in 1m18s
2026-03-27 18:11:22 +03:00
Дмитрий
e530608121 feat: add logout method
All checks were successful
Publish / Publish Job (push) Successful in 1m13s
2026-03-27 16:46:54 +03:00
Дмитрий
91c262e2a6 fix: restructure request and respone methodes
All checks were successful
Publish / Publish Job (push) Successful in 1m14s
2026-03-27 15:30:33 +03:00
Дмитрий
60eb6068ec fix: restructure request and respone methodes
Some checks failed
Publish / Publish Job (push) Failing after 1m14s
2026-03-27 15:28:01 +03:00
Дмитрий
a225dd4a48 feat: add refresh token messages and RPC method
All checks were successful
Publish / Publish Job (push) Successful in 1m15s
2026-03-27 15:18:31 +03:00
Дмитрий
b00a823b50 fix: edit package version
All checks were successful
Publish / Publish Job (push) Successful in 1m14s
2026-03-27 10:55:52 +03:00
Дмитрий
15c2ed57c7 fix: publish yml edit level env
Some checks failed
Publish / Publish Job (push) Failing after 1m14s
2026-03-27 10:51:14 +03:00
Дмитрий
273bdd685b add: add npmrc file registry
Some checks failed
Publish / Publish Job (push) Failing after 1m14s
2026-03-27 10:19:31 +03:00
Дмитрий
f5d18a63e5 first commit
All checks were successful
Publish / Publish Job (push) Successful in 1m14s
2026-03-26 15:45:17 +03:00
Дмитрий
0c494faa6b fix: fix path name proto file 2026-03-25 16:31:12 +03:00
Дмитрий
54bff3da7d fix: rename path 2026-03-25 16:30:29 +03:00
Дмитрий
7cbe61f226 fix: add dist to files 2026-03-25 16:22:15 +03:00
Дмитрий
287cd340de feat: add PROTO_PATHS 2026-03-25 16:06:35 +03:00
Дмитрий
d4196e16f9 fix: npm install deps frozen lockfile 2026-03-25 13:58:47 +03:00
Дмитрий
4a1eb650f4 fix: npm install deps frozen lockfile 2026-03-25 13:56:54 +03:00
Дмитрий
e55fd159cb fix: totp and telegram codes is optional 2026-03-25 12:17:56 +03:00
Дмитрий
1eb1d4b946 fix: remove reserve codes from request 2026-03-25 12:09:51 +03:00
Дмитрий
c956cd29f0 fix: rename twofaservice 2026-03-25 11:33:30 +03:00
17 changed files with 244 additions and 105 deletions

View File

@@ -9,6 +9,8 @@ jobs:
publish: publish:
name: Publish Job name: Publish Job
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -17,18 +19,51 @@ jobs:
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
registry-url: "https://registry.npmjs.org/" registry-url: "https://git.lendry.ru/api/packages/lendry-erp/npm/"
scope: "@lendry-erp"
# 1. Устанавливаем Go (нужен для скачивания плагинов генерации)
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.22" # Можно указать нужную тебе версию
# 2. Устанавливаем плагины генерации для Go и добавляем их в PATH
- name: Install Go Protoc Plugins
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Install protoc - name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Install deps - name: Install deps
run: npm install run: npm ci
- name: Generate TS Protobuf - name: Build
run: npm run generate run: npm run build
# 3. Исправленный шаг генерации (команды разделены, добавлено создание папки)
- name: Generate Protobuf
run: |
npm install -g ts-proto
mkdir -p ./gen/go # Создаем вложенную папку для Go
protoc -I ./proto ./proto/*.proto \
--ts_proto_out=nestJs=true,package=omit:./gen \
--go_out=paths=source_relative:./gen/go \
--go-grpc_out=paths=source_relative:./gen/go
- name: Commit and push changes
run: |
# Представляемся Git-ботом
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Добавляем папку gen в индекс
git add ./gen
# Проверяем, есть ли изменения. Если есть — коммитим и пушим.
git diff --quiet && git diff --staged --quiet || (git commit -m "chore: auto-generate protobuf files [skip ci]" && git push)
- name: Publish package - name: Publish package
run: npm publish run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
@lendry-erp:registry=https://git.lendry.ru/api/packages/lendry-erp/npm/

View File

@@ -1,16 +0,0 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.11.6
// protoc v7.34.1
// source: google/protobuf/any.proto
/* eslint-disable */
export const protobufPackage = "google.protobuf";
export interface Any {
typeUrl: string;
value: Uint8Array;
}
export const GOOGLE_PROTOBUF_PACKAGE_NAME = "google.protobuf";

View File

@@ -1,18 +0,0 @@
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v2.11.6
// protoc v7.34.1
// source: google/rpc/status.proto
/* eslint-disable */
import { Any } from "../protobuf/any";
export const protobufPackage = "google.rpc";
export interface Status {
code: number;
message: string;
details: Any[];
}
export const GOOGLE_RPC_PACKAGE_NAME = "google.rpc";

View File

@@ -2,14 +2,14 @@
// versions: // versions:
// protoc-gen-ts_proto v2.11.6 // protoc-gen-ts_proto v2.11.6
// protoc v7.34.1 // protoc v7.34.1
// source: auth.proto // source: identity.proto
/* eslint-disable */ /* eslint-disable */
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices"; import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
import { Observable } from "rxjs"; import { Observable } from "rxjs";
import { Status } from "./google/rpc/status"; import { Status } from "./google/rpc/status";
export const protobufPackage = "auth.v1"; export const protobufPackage = "identity";
export interface LoginRequest { export interface LoginRequest {
username: string; username: string;
@@ -18,34 +18,52 @@ export interface LoginRequest {
export interface LoginResponse { export interface LoginResponse {
accessToken: string; accessToken: string;
refreshToken: string;
status: string; status: string;
need2fa: boolean; need2fa: boolean;
tempToken: string; tempToken?: string | undefined;
message?: string | undefined;
errorCode?: string | undefined;
error?: Status | undefined;
}
export interface RefreshRequest {
refreshToken: string;
}
export interface RefreshResponse {
accessToken: string;
refreshToken: string;
}
export interface LogoutRequest {
accessToken: string;
}
export interface LogoutResponse {
success: boolean;
message: string; message: string;
errorCode: string;
error: Status | undefined;
} }
export interface RegisterRequest { export interface UnlockPinRequest {
username: string; accessToken: string;
password: string; pinCode: string;
} }
export interface RegisterResponse { export interface UnlockPinResponse {
userId: string; success: boolean;
status: string;
message: string; message: string;
} }
export interface Verify2FaRequest { export interface Verify2FaRequest {
tempToken: string; tempToken: string;
totpCode: string; totpCode?: string | undefined;
telegramCode: string; telegramCode?: string | undefined;
reserveCode: string;
} }
export interface Verify2FaResponse { export interface Verify2FaResponse {
accessToken: string; accessToken: string;
refreshToken: string;
status: string; status: string;
message: string; message: string;
reserveCodes: string[]; reserveCodes: string[];
@@ -130,12 +148,16 @@ export interface DisableTelegramResponse {
message: string; message: string;
} }
export const AUTH_V1_PACKAGE_NAME = "auth.v1"; export const IDENTITY_PACKAGE_NAME = "identity";
export interface AuthServiceClient { export interface AuthServiceClient {
login(request: LoginRequest): Observable<LoginResponse>; login(request: LoginRequest): Observable<LoginResponse>;
register(request: RegisterRequest): Observable<RegisterResponse>; refresh(request: RefreshRequest): Observable<RefreshResponse>;
logout(request: LogoutRequest): Observable<LogoutResponse>;
unlockPin(request: UnlockPinRequest): Observable<UnlockPinResponse>;
verify2Fa(request: Verify2FaRequest): Observable<Verify2FaResponse>; verify2Fa(request: Verify2FaRequest): Observable<Verify2FaResponse>;
} }
@@ -143,14 +165,18 @@ export interface AuthServiceClient {
export interface AuthServiceController { export interface AuthServiceController {
login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse; login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse; refresh(request: RefreshRequest): Promise<RefreshResponse> | Observable<RefreshResponse> | RefreshResponse;
logout(request: LogoutRequest): Promise<LogoutResponse> | Observable<LogoutResponse> | LogoutResponse;
unlockPin(request: UnlockPinRequest): Promise<UnlockPinResponse> | Observable<UnlockPinResponse> | UnlockPinResponse;
verify2Fa(request: Verify2FaRequest): Promise<Verify2FaResponse> | Observable<Verify2FaResponse> | Verify2FaResponse; verify2Fa(request: Verify2FaRequest): Promise<Verify2FaResponse> | Observable<Verify2FaResponse> | Verify2FaResponse;
} }
export function AuthServiceControllerMethods() { export function AuthServiceControllerMethods() {
return function (constructor: Function) { return function (constructor: Function) {
const grpcMethods: string[] = ["login", "register", "verify2Fa"]; const grpcMethods: string[] = ["login", "refresh", "logout", "unlockPin", "verify2Fa"];
for (const method of grpcMethods) { for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor); GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
@@ -165,7 +191,7 @@ export function AuthServiceControllerMethods() {
export const AUTH_SERVICE_NAME = "AuthService"; export const AUTH_SERVICE_NAME = "AuthService";
export interface TwoFaSrviceClient { export interface TwoFaServiceClient {
getTwoFaStatus(request: GetTwoFaStatusRequest): Observable<GetTwoFaStatusResponse>; getTwoFaStatus(request: GetTwoFaStatusRequest): Observable<GetTwoFaStatusResponse>;
startTotpEnrollment(request: AuthenticatedAccessRequest): Observable<StartTotpEnrollmentResponse>; startTotpEnrollment(request: AuthenticatedAccessRequest): Observable<StartTotpEnrollmentResponse>;
@@ -183,7 +209,7 @@ export interface TwoFaSrviceClient {
disableTelegram(request: DisableTelegramRequest): Observable<DisableTelegramResponse>; disableTelegram(request: DisableTelegramRequest): Observable<DisableTelegramResponse>;
} }
export interface TwoFaSrviceController { export interface TwoFaServiceController {
getTwoFaStatus( getTwoFaStatus(
request: GetTwoFaStatusRequest, request: GetTwoFaStatusRequest,
): Promise<GetTwoFaStatusResponse> | Observable<GetTwoFaStatusResponse> | GetTwoFaStatusResponse; ): Promise<GetTwoFaStatusResponse> | Observable<GetTwoFaStatusResponse> | GetTwoFaStatusResponse;
@@ -223,7 +249,7 @@ export interface TwoFaSrviceController {
): Promise<DisableTelegramResponse> | Observable<DisableTelegramResponse> | DisableTelegramResponse; ): Promise<DisableTelegramResponse> | Observable<DisableTelegramResponse> | DisableTelegramResponse;
} }
export function TwoFaSrviceControllerMethods() { export function TwoFaServiceControllerMethods() {
return function (constructor: Function) { return function (constructor: Function) {
const grpcMethods: string[] = [ const grpcMethods: string[] = [
"getTwoFaStatus", "getTwoFaStatus",
@@ -237,14 +263,14 @@ export function TwoFaSrviceControllerMethods() {
]; ];
for (const method of grpcMethods) { for (const method of grpcMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcMethod("TwoFaSrvice", method)(constructor.prototype[method], method, descriptor); GrpcMethod("TwoFaService", method)(constructor.prototype[method], method, descriptor);
} }
const grpcStreamMethods: string[] = []; const grpcStreamMethods: string[] = [];
for (const method of grpcStreamMethods) { for (const method of grpcStreamMethods) {
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
GrpcStreamMethod("TwoFaSrvice", method)(constructor.prototype[method], method, descriptor); GrpcStreamMethod("TwoFaService", method)(constructor.prototype[method], method, descriptor);
} }
}; };
} }
export const TWO_FA_SRVICE_SERVICE_NAME = "TwoFaSrvice"; export const TWO_FA_SERVICE_NAME = "TwoFaService";

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module git.lendry.ru/lendry-erp/proto
go 1.26.1

50
package-lock.json generated
View File

@@ -1,16 +1,21 @@
{ {
"name": "@lendry-erp/contracts", "name": "@lendry-erp/contracts",
"version": "1.0.0", "version": "1.0.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@lendry-erp/contracts", "name": "@lendry-erp/contracts",
"version": "1.0.0", "version": "1.0.2",
"dependencies": { "dependencies": {
"@lendry-erp/contracts": "^1.0.2",
"@nestjs/microservices": "^11.1.17", "@nestjs/microservices": "^11.1.17",
"rxjs": "^7.8.2", "rxjs": "^7.8.2",
"ts-proto": "^2.11.6" "ts-proto": "^2.11.6"
},
"devDependencies": {
"@types/node": "^25.5.0",
"typescript": "^6.0.2"
} }
}, },
"node_modules/@borewit/text-codec": { "node_modules/@borewit/text-codec": {
@@ -30,6 +35,16 @@
"integrity": "sha512-sBXGT13cpmPR5BMgHE6UEEfEaShh5Ror6rfN3yEK5si7QVrtZg8LEPQb0VVhiLRUslD2yLnXtnRzG035J/mZXQ==", "integrity": "sha512-sBXGT13cpmPR5BMgHE6UEEfEaShh5Ror6rfN3yEK5si7QVrtZg8LEPQb0VVhiLRUslD2yLnXtnRzG035J/mZXQ==",
"license": "(Apache-2.0 AND BSD-3-Clause)" "license": "(Apache-2.0 AND BSD-3-Clause)"
}, },
"node_modules/@lendry-erp/contracts": {
"version": "1.0.2",
"resolved": "https://git.lendry.ru/api/packages/lendry-erp/npm/%40lendry-erp%2Fcontracts/-/1.0.2/contracts-1.0.2.tgz",
"integrity": "sha512-39NulQ6mn3dmrX/GXwzYYPyX/rE+4gO1En+uJJR9bHXZ3awWi0U3drIvgwM25gyi829Ae0U8vVtzMaP3gON90A==",
"dependencies": {
"@nestjs/microservices": "^11.1.17",
"rxjs": "^7.8.2",
"ts-proto": "^2.11.6"
}
},
"node_modules/@lukeed/csprng": { "node_modules/@lukeed/csprng": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz", "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz",
@@ -214,6 +229,16 @@
"license": "MIT", "license": "MIT",
"peer": true "peer": true
}, },
"node_modules/@types/node": {
"version": "25.5.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.0.tgz",
"integrity": "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~7.18.0"
}
},
"node_modules/case-anything": { "node_modules/case-anything": {
"version": "2.1.13", "version": "2.1.13",
"resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz", "resolved": "https://registry.npmjs.org/case-anything/-/case-anything-2.1.13.tgz",
@@ -460,6 +485,20 @@
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD" "license": "0BSD"
}, },
"node_modules/typescript": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.2.tgz",
"integrity": "sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/uid": { "node_modules/uid": {
"version": "2.0.2", "version": "2.0.2",
"resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz", "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz",
@@ -485,6 +524,13 @@
"funding": { "funding": {
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
},
"node_modules/undici-types": {
"version": "7.18.2",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
"integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
"dev": true,
"license": "MIT"
} }
} }
} }

View File

@@ -1,12 +1,15 @@
{ {
"name": "@lendry-erp/contracts", "name": "@lendry-erp/contracts",
"version": "1.0.2", "version": "1.0.12",
"description": "Protobuf definitions and generated TypeScript types", "description": "Protobuf definitions and generated TypeScript types",
"type": "commonjs", "type": "commonjs",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": { "scripts": {
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit" "build": "tsc -p tsconfig.build.json"
}, },
"files": [ "files": [
"dist",
"proto", "proto",
"gen" "gen"
], ],
@@ -17,5 +20,9 @@
"@nestjs/microservices": "^11.1.17", "@nestjs/microservices": "^11.1.17",
"rxjs": "^7.8.2", "rxjs": "^7.8.2",
"ts-proto": "^2.11.6" "ts-proto": "^2.11.6"
},
"devDependencies": {
"@types/node": "^25.5.0",
"typescript": "^6.0.2"
} }
} }

View File

@@ -1,9 +0,0 @@
syntax = "proto3";
package google.protobuf;
message Any {
string type_url = 1;
bytes value = 2;
}

View File

@@ -1,12 +0,0 @@
syntax = "proto3";
package google.rpc;
import "google/protobuf/any.proto";
message Status {
int32 code = 1;
string message = 2;
repeated google.protobuf.Any details = 3;
}

View File

@@ -1,12 +1,14 @@
syntax = "proto3"; syntax = "proto3";
package identity; package identity;
import "google/rpc/status.proto";
option go_package = './gen';
service AuthService { service AuthService {
rpc Login (LoginRequest) returns (LoginResponse); rpc Login (LoginRequest) returns (LoginResponse);
rpc Register (RegisterRequest) returns (RegisterResponse); rpc Refresh (RefreshRequest) returns (RefreshResponse);
rpc Logout (LogoutRequest) returns (LogoutResponse);
rpc UnlockPin (UnlockPinRequest) returns (UnlockPinResponse);
rpc Verify2Fa (Verify2FaRequest) returns (Verify2FaResponse); rpc Verify2Fa (Verify2FaRequest) returns (Verify2FaResponse);
} }
@@ -31,28 +33,44 @@ message LoginResponse {
string refresh_token = 2; string refresh_token = 2;
string status = 3; string status = 3;
bool need2fa = 4; bool need2fa = 4;
string temp_token = 5; optional string temp_token = 5;
string message = 6; optional string message = 6;
string error_code = 7; optional string error_code = 7;
google.rpc.Status error = 8;
} }
message RegisterRequest { message RefreshRequest {
string username = 1; string refresh_token = 1;
string password = 2;
} }
message RegisterResponse { message RefreshResponse {
string user_id = 1; string access_token = 1;
string status = 2; string refresh_token = 2;
string message = 3;
} }
message LogoutRequest {
string access_token = 1;
}
message LogoutResponse {
bool success = 1;
string message = 2;
}
message UnlockPinRequest {
string access_token = 1;
string pin_code = 2;
}
message UnlockPinResponse {
bool success = 1;
string message = 2;
}
message Verify2FaRequest { message Verify2FaRequest {
string temp_token = 1; string temp_token = 1;
string totp_code = 2; optional string totp_code = 2;
string telegram_code = 3; optional string telegram_code = 3;
string reserve_code = 4;
} }
message Verify2FaResponse { message Verify2FaResponse {

28
proto/ldap.proto Normal file
View File

@@ -0,0 +1,28 @@
syntax = "proto3";
package ldap_service;
option go_package = "git.lendry.ru/lendry-erp/gen;ldap_service";
service LdapAuth {
rpc VerifyUser (VerifyRequest) returns (VerifyResponse);
}
message VerifyRequest {
string username = 1;
string password = 2;
}
message VerifyResponse {
bool success = 1;
string error_message = 2;
UserData user = 3;
}
message UserData {
string dn = 1;
string display_name = 2;
repeated string groups = 3;
bool is_active = 4;
}

1
src/index.ts Normal file
View File

@@ -0,0 +1 @@
export * from "./proto";

1
src/proto/index.ts Normal file
View File

@@ -0,0 +1 @@
export * from "./paths";

6
src/proto/paths.ts Normal file
View File

@@ -0,0 +1,6 @@
import { join } from "path";
export const PROTO_PATHS = {
AUTH: join(__dirname, "../../proto/identity.proto"),
LDAP: join(__dirname, "../../proto/ldap.proto"),
} as const;

11
tsconfig.build.json Normal file
View File

@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"outDir": "./dist",
"rootDir": "./src",
"types": ["node"]
},
"include": ["src/**/*"],
"exclude": ["node_module", "dist", "test"]
}

11
tsconfig.json Normal file
View File

@@ -0,0 +1,11 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es2024",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"strictNullChecks": false
}
}