first commit
This commit is contained in:
31
.github/workflows/publish.yml
vendored
Normal file
31
.github/workflows/publish.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
name: Publish Job
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
registry-url: "https://registry.npmjs.org/"
|
||||||
|
|
||||||
|
- name: Install deps
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Generate TS Protobuf
|
||||||
|
run: npm run generate
|
||||||
|
|
||||||
|
- name: Publish package
|
||||||
|
run: npm publish
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
node_modules/
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
pnpm-lock.yaml
|
||||||
|
.env
|
||||||
|
.DS_Store
|
||||||
|
.vscode/
|
||||||
|
.log
|
||||||
250
gen/auth.ts
Normal file
250
gen/auth.ts
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-ts_proto v2.11.6
|
||||||
|
// protoc v7.34.1
|
||||||
|
// source: auth.proto
|
||||||
|
|
||||||
|
/* eslint-disable */
|
||||||
|
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
||||||
|
import { Observable } from "rxjs";
|
||||||
|
import { Status } from "./google/rpc/status";
|
||||||
|
|
||||||
|
export const protobufPackage = "auth.v1";
|
||||||
|
|
||||||
|
export interface LoginRequest {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LoginResponse {
|
||||||
|
accessToken: string;
|
||||||
|
status: string;
|
||||||
|
need2fa: boolean;
|
||||||
|
tempToken: string;
|
||||||
|
message: string;
|
||||||
|
errorCode: string;
|
||||||
|
error: Status | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RegisterRequest {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RegisterResponse {
|
||||||
|
userId: string;
|
||||||
|
status: string;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Verify2FaRequest {
|
||||||
|
tempToken: string;
|
||||||
|
totpCode: string;
|
||||||
|
telegramCode: string;
|
||||||
|
reserveCode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Verify2FaResponse {
|
||||||
|
accessToken: string;
|
||||||
|
status: string;
|
||||||
|
message: string;
|
||||||
|
reserveCodes: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AuthenticatedAccessRequest {
|
||||||
|
accessToken: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetTwoFaStatusRequest {
|
||||||
|
accessToken: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetTwoFaStatusResponse {
|
||||||
|
totpEnabled: boolean;
|
||||||
|
telegramEnabled: boolean;
|
||||||
|
totpEnrollmentPending: boolean;
|
||||||
|
telegramEnrollmentPending: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StartTotpEnrollmentResponse {
|
||||||
|
secretBase32: string;
|
||||||
|
otpauthUri: string;
|
||||||
|
issuer: string;
|
||||||
|
accountLabel: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ConfirmTotpEnrollmentRequest {
|
||||||
|
accessToken: string;
|
||||||
|
totpCode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ConfirmTotpEnrollmentResponse {
|
||||||
|
status: string;
|
||||||
|
message: string;
|
||||||
|
reserveCodes: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CancelTotpEnrollmentResponse {
|
||||||
|
status: string;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DisableTotpRequest {
|
||||||
|
accessToken: string;
|
||||||
|
password: string;
|
||||||
|
totpCode?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DisableTotpResponse {
|
||||||
|
status: string;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StartTelegramEnrollmentResponse {
|
||||||
|
enrollmentToken: string;
|
||||||
|
deepLink: string;
|
||||||
|
botUsername: string;
|
||||||
|
expiresAtIso: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ConfirmTelegramEnrollmentRequest {
|
||||||
|
accessToken: string;
|
||||||
|
enrollmentToken: string;
|
||||||
|
otpCode: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ConfirmTelegramEnrollmentResponse {
|
||||||
|
status: string;
|
||||||
|
message: string;
|
||||||
|
reserveCodes: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DisableTelegramRequest {
|
||||||
|
accessToken: string;
|
||||||
|
password: string;
|
||||||
|
telegramOtpCode?: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DisableTelegramResponse {
|
||||||
|
status: string;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
||||||
|
|
||||||
|
export interface AuthServiceClient {
|
||||||
|
login(request: LoginRequest): Observable<LoginResponse>;
|
||||||
|
|
||||||
|
register(request: RegisterRequest): Observable<RegisterResponse>;
|
||||||
|
|
||||||
|
verify2Fa(request: Verify2FaRequest): Observable<Verify2FaResponse>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AuthServiceController {
|
||||||
|
login(request: LoginRequest): Promise<LoginResponse> | Observable<LoginResponse> | LoginResponse;
|
||||||
|
|
||||||
|
register(request: RegisterRequest): Promise<RegisterResponse> | Observable<RegisterResponse> | RegisterResponse;
|
||||||
|
|
||||||
|
verify2Fa(request: Verify2FaRequest): Promise<Verify2FaResponse> | Observable<Verify2FaResponse> | Verify2FaResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AuthServiceControllerMethods() {
|
||||||
|
return function (constructor: Function) {
|
||||||
|
const grpcMethods: string[] = ["login", "register", "verify2Fa"];
|
||||||
|
for (const method of grpcMethods) {
|
||||||
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
||||||
|
}
|
||||||
|
const grpcStreamMethods: string[] = [];
|
||||||
|
for (const method of grpcStreamMethods) {
|
||||||
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
|
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AUTH_SERVICE_NAME = "AuthService";
|
||||||
|
|
||||||
|
export interface TwoFaSrviceClient {
|
||||||
|
getTwoFaStatus(request: GetTwoFaStatusRequest): Observable<GetTwoFaStatusResponse>;
|
||||||
|
|
||||||
|
startTotpEnrollment(request: AuthenticatedAccessRequest): Observable<StartTotpEnrollmentResponse>;
|
||||||
|
|
||||||
|
confirmTotpErollment(request: ConfirmTotpEnrollmentRequest): Observable<ConfirmTotpEnrollmentResponse>;
|
||||||
|
|
||||||
|
cancelTotpEnrollment(request: AuthenticatedAccessRequest): Observable<CancelTotpEnrollmentResponse>;
|
||||||
|
|
||||||
|
disableTotp(request: DisableTotpRequest): Observable<DisableTotpResponse>;
|
||||||
|
|
||||||
|
startTelegramEnrollment(request: AuthenticatedAccessRequest): Observable<StartTelegramEnrollmentResponse>;
|
||||||
|
|
||||||
|
confirmTelegramEnrollment(request: ConfirmTelegramEnrollmentRequest): Observable<ConfirmTelegramEnrollmentResponse>;
|
||||||
|
|
||||||
|
disableTelegram(request: DisableTelegramRequest): Observable<DisableTelegramResponse>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TwoFaSrviceController {
|
||||||
|
getTwoFaStatus(
|
||||||
|
request: GetTwoFaStatusRequest,
|
||||||
|
): Promise<GetTwoFaStatusResponse> | Observable<GetTwoFaStatusResponse> | GetTwoFaStatusResponse;
|
||||||
|
|
||||||
|
startTotpEnrollment(
|
||||||
|
request: AuthenticatedAccessRequest,
|
||||||
|
): Promise<StartTotpEnrollmentResponse> | Observable<StartTotpEnrollmentResponse> | StartTotpEnrollmentResponse;
|
||||||
|
|
||||||
|
confirmTotpErollment(
|
||||||
|
request: ConfirmTotpEnrollmentRequest,
|
||||||
|
): Promise<ConfirmTotpEnrollmentResponse> | Observable<ConfirmTotpEnrollmentResponse> | ConfirmTotpEnrollmentResponse;
|
||||||
|
|
||||||
|
cancelTotpEnrollment(
|
||||||
|
request: AuthenticatedAccessRequest,
|
||||||
|
): Promise<CancelTotpEnrollmentResponse> | Observable<CancelTotpEnrollmentResponse> | CancelTotpEnrollmentResponse;
|
||||||
|
|
||||||
|
disableTotp(
|
||||||
|
request: DisableTotpRequest,
|
||||||
|
): Promise<DisableTotpResponse> | Observable<DisableTotpResponse> | DisableTotpResponse;
|
||||||
|
|
||||||
|
startTelegramEnrollment(
|
||||||
|
request: AuthenticatedAccessRequest,
|
||||||
|
):
|
||||||
|
| Promise<StartTelegramEnrollmentResponse>
|
||||||
|
| Observable<StartTelegramEnrollmentResponse>
|
||||||
|
| StartTelegramEnrollmentResponse;
|
||||||
|
|
||||||
|
confirmTelegramEnrollment(
|
||||||
|
request: ConfirmTelegramEnrollmentRequest,
|
||||||
|
):
|
||||||
|
| Promise<ConfirmTelegramEnrollmentResponse>
|
||||||
|
| Observable<ConfirmTelegramEnrollmentResponse>
|
||||||
|
| ConfirmTelegramEnrollmentResponse;
|
||||||
|
|
||||||
|
disableTelegram(
|
||||||
|
request: DisableTelegramRequest,
|
||||||
|
): Promise<DisableTelegramResponse> | Observable<DisableTelegramResponse> | DisableTelegramResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function TwoFaSrviceControllerMethods() {
|
||||||
|
return function (constructor: Function) {
|
||||||
|
const grpcMethods: string[] = [
|
||||||
|
"getTwoFaStatus",
|
||||||
|
"startTotpEnrollment",
|
||||||
|
"confirmTotpErollment",
|
||||||
|
"cancelTotpEnrollment",
|
||||||
|
"disableTotp",
|
||||||
|
"startTelegramEnrollment",
|
||||||
|
"confirmTelegramEnrollment",
|
||||||
|
"disableTelegram",
|
||||||
|
];
|
||||||
|
for (const method of grpcMethods) {
|
||||||
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
|
GrpcMethod("TwoFaSrvice", method)(constructor.prototype[method], method, descriptor);
|
||||||
|
}
|
||||||
|
const grpcStreamMethods: string[] = [];
|
||||||
|
for (const method of grpcStreamMethods) {
|
||||||
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
||||||
|
GrpcStreamMethod("TwoFaSrvice", method)(constructor.prototype[method], method, descriptor);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TWO_FA_SRVICE_SERVICE_NAME = "TwoFaSrvice";
|
||||||
16
gen/google/protobuf/any.ts
Normal file
16
gen/google/protobuf/any.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// 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";
|
||||||
18
gen/google/rpc/status.ts
Normal file
18
gen/google/rpc/status.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
// 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";
|
||||||
418
package-lock.json
generated
Normal file
418
package-lock.json
generated
Normal file
@@ -0,0 +1,418 @@
|
|||||||
|
{
|
||||||
|
"name": "contracts",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "contracts",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"@nestjs/microservices": "^11.1.17",
|
||||||
|
"rxjs": "^7.8.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@borewit/text-codec": {
|
||||||
|
"version": "0.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.2.2.tgz",
|
||||||
|
"integrity": "sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/Borewit"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@lukeed/csprng": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@nestjs/common": {
|
||||||
|
"version": "11.1.17",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-11.1.17.tgz",
|
||||||
|
"integrity": "sha512-hLODw5Abp8OQgA+mUO4tHou4krKgDtUcM9j5Ihxncst9XeyxYBTt2bwZm4e4EQr5E352S4Fyy6V3iFx9ggxKAg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"file-type": "21.3.2",
|
||||||
|
"iterare": "1.2.1",
|
||||||
|
"load-esm": "1.0.3",
|
||||||
|
"tslib": "2.8.1",
|
||||||
|
"uid": "2.0.2"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/nest"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"class-transformer": ">=0.4.1",
|
||||||
|
"class-validator": ">=0.13.2",
|
||||||
|
"reflect-metadata": "^0.1.12 || ^0.2.0",
|
||||||
|
"rxjs": "^7.1.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"class-transformer": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"class-validator": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@nestjs/core": {
|
||||||
|
"version": "11.1.17",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nestjs/core/-/core-11.1.17.tgz",
|
||||||
|
"integrity": "sha512-lD5mAYekTTurF3vDaa8C2OKPnjiz4tsfxIc5XlcSUzOhkwWf6Ay3HKvt6FmvuWQam6uIIHX52Clg+e6tAvf/cg==",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@nuxt/opencollective": "0.4.1",
|
||||||
|
"fast-safe-stringify": "2.1.1",
|
||||||
|
"iterare": "1.2.1",
|
||||||
|
"path-to-regexp": "8.3.0",
|
||||||
|
"tslib": "2.8.1",
|
||||||
|
"uid": "2.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 20"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/nest"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@nestjs/common": "^11.0.0",
|
||||||
|
"@nestjs/microservices": "^11.0.0",
|
||||||
|
"@nestjs/platform-express": "^11.0.0",
|
||||||
|
"@nestjs/websockets": "^11.0.0",
|
||||||
|
"reflect-metadata": "^0.1.12 || ^0.2.0",
|
||||||
|
"rxjs": "^7.1.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@nestjs/microservices": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"@nestjs/platform-express": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"@nestjs/websockets": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@nestjs/microservices": {
|
||||||
|
"version": "11.1.17",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nestjs/microservices/-/microservices-11.1.17.tgz",
|
||||||
|
"integrity": "sha512-rubBPEEXS9PwA3LwdNN/ytjEUmON+d8+4fbiUCIFGW8i+rR/g36vrpwuvoAzcGpxlu45/TpZPfHTb0nJciG9Yw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"iterare": "1.2.1",
|
||||||
|
"tslib": "2.8.1"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/nest"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@grpc/grpc-js": "*",
|
||||||
|
"@nestjs/common": "^11.0.0",
|
||||||
|
"@nestjs/core": "^11.0.0",
|
||||||
|
"@nestjs/websockets": "^11.0.0",
|
||||||
|
"amqp-connection-manager": "*",
|
||||||
|
"amqplib": "*",
|
||||||
|
"cache-manager": "*",
|
||||||
|
"ioredis": "*",
|
||||||
|
"kafkajs": "*",
|
||||||
|
"mqtt": "*",
|
||||||
|
"nats": "*",
|
||||||
|
"reflect-metadata": "^0.1.12 || ^0.2.0",
|
||||||
|
"rxjs": "^7.1.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@grpc/grpc-js": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"@nestjs/websockets": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"amqp-connection-manager": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"amqplib": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"cache-manager": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"ioredis": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"kafkajs": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"mqtt": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"nats": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@nuxt/opencollective": {
|
||||||
|
"version": "0.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nuxt/opencollective/-/opencollective-0.4.1.tgz",
|
||||||
|
"integrity": "sha512-GXD3wy50qYbxCJ652bDrDzgMr3NFEkIS374+IgFQKkCvk9yiYcLvX2XDYr7UyQxf4wK0e+yqDYRubZ0DtOxnmQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"consola": "^3.2.3"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"opencollective": "bin/opencollective.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^14.18.0 || >=16.10.0",
|
||||||
|
"npm": ">=5.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tokenizer/inflate": {
|
||||||
|
"version": "0.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.4.1.tgz",
|
||||||
|
"integrity": "sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.4.3",
|
||||||
|
"token-types": "^6.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/Borewit"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tokenizer/token": {
|
||||||
|
"version": "0.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz",
|
||||||
|
"integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true
|
||||||
|
},
|
||||||
|
"node_modules/consola": {
|
||||||
|
"version": "3.4.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz",
|
||||||
|
"integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "^14.18.0 || >=16.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/debug": {
|
||||||
|
"version": "4.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||||
|
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "^2.1.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"supports-color": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fast-safe-stringify": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true
|
||||||
|
},
|
||||||
|
"node_modules/file-type": {
|
||||||
|
"version": "21.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/file-type/-/file-type-21.3.2.tgz",
|
||||||
|
"integrity": "sha512-DLkUvGwep3poOV2wpzbHCOnSKGk1LzyXTv+aHFgN2VFl96wnp8YA9YjO2qPzg5PuL8q/SW9Pdi6WTkYOIh995w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@tokenizer/inflate": "^0.4.1",
|
||||||
|
"strtok3": "^10.3.4",
|
||||||
|
"token-types": "^6.1.1",
|
||||||
|
"uint8array-extras": "^1.4.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sindresorhus/file-type?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ieee754": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"peer": true
|
||||||
|
},
|
||||||
|
"node_modules/iterare": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/load-esm": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/load-esm/-/load-esm-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-v5xlu8eHD1+6r8EHTg6hfmO97LN8ugKtiXcy5e6oN72iD2r6u0RPfLl6fxM+7Wnh2ZRq15o0russMst44WauPA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/Borewit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "buymeacoffee",
|
||||||
|
"url": "https://buymeacoffee.com/borewit"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=13.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ms": {
|
||||||
|
"version": "2.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true
|
||||||
|
},
|
||||||
|
"node_modules/path-to-regexp": {
|
||||||
|
"version": "8.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz",
|
||||||
|
"integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/reflect-metadata": {
|
||||||
|
"version": "0.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz",
|
||||||
|
"integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"peer": true
|
||||||
|
},
|
||||||
|
"node_modules/rxjs": {
|
||||||
|
"version": "7.8.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz",
|
||||||
|
"integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/strtok3": {
|
||||||
|
"version": "10.3.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/strtok3/-/strtok3-10.3.5.tgz",
|
||||||
|
"integrity": "sha512-ki4hZQfh5rX0QDLLkOCj+h+CVNkqmp/CMf8v8kZpkNVK6jGQooMytqzLZYUVYIZcFZ6yDB70EfD8POcFXiF5oA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@tokenizer/token": "^0.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/Borewit"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/token-types": {
|
||||||
|
"version": "6.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/token-types/-/token-types-6.1.2.tgz",
|
||||||
|
"integrity": "sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@borewit/text-codec": "^0.2.1",
|
||||||
|
"@tokenizer/token": "^0.3.0",
|
||||||
|
"ieee754": "^1.2.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.16"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/Borewit"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||||
|
"license": "0BSD"
|
||||||
|
},
|
||||||
|
"node_modules/uid": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@lukeed/csprng": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/uint8array-extras": {
|
||||||
|
"version": "1.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/uint8array-extras/-/uint8array-extras-1.5.0.tgz",
|
||||||
|
"integrity": "sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
20
package.json
Normal file
20
package.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "@lendry-erp/contracts",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Protobuf definitions and generated TypeScript types",
|
||||||
|
"type": "commonjs",
|
||||||
|
"scripts": {
|
||||||
|
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"proto",
|
||||||
|
"gen"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@nestjs/microservices": "^11.1.17",
|
||||||
|
"rxjs": "^7.8.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
141
proto/auth.proto
Normal file
141
proto/auth.proto
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package auth.v1;
|
||||||
|
import "google/rpc/status.proto";
|
||||||
|
|
||||||
|
|
||||||
|
service AuthService {
|
||||||
|
rpc Login (LoginRequest) returns (LoginResponse);
|
||||||
|
rpc Register (RegisterRequest) returns (RegisterResponse);
|
||||||
|
rpc Verify2Fa (Verify2FaRequest) returns (Verify2FaResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
service TwoFaSrvice {
|
||||||
|
rpc GetTwoFaStatus (GetTwoFaStatusRequest) returns (GetTwoFaStatusResponse);
|
||||||
|
rpc StartTotpEnrollment (AuthenticatedAccessRequest) returns (StartTotpEnrollmentResponse);
|
||||||
|
rpc ConfirmTotpErollment (ConfirmTotpEnrollmentRequest) returns (ConfirmTotpEnrollmentResponse);
|
||||||
|
rpc CancelTotpEnrollment (AuthenticatedAccessRequest) returns (CancelTotpEnrollmentResponse);
|
||||||
|
rpc DisableTotp (DisableTotpRequest) returns (DisableTotpResponse);
|
||||||
|
rpc StartTelegramEnrollment (AuthenticatedAccessRequest) returns (StartTelegramEnrollmentResponse);
|
||||||
|
rpc ConfirmTelegramEnrollment (ConfirmTelegramEnrollmentRequest) returns (ConfirmTelegramEnrollmentResponse);
|
||||||
|
rpc DisableTelegram(DisableTelegramRequest) returns (DisableTelegramResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
message LoginRequest {
|
||||||
|
string username = 1;
|
||||||
|
string password = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message LoginResponse {
|
||||||
|
string access_token = 1;
|
||||||
|
string status = 2;
|
||||||
|
bool need2fa = 3;
|
||||||
|
string temp_token = 4;
|
||||||
|
string message = 5;
|
||||||
|
string error_code = 6;
|
||||||
|
google.rpc.Status error = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RegisterRequest {
|
||||||
|
string username = 1;
|
||||||
|
string password = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RegisterResponse {
|
||||||
|
string user_id = 1;
|
||||||
|
string status = 2;
|
||||||
|
string message = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Verify2FaRequest {
|
||||||
|
string temp_token = 1;
|
||||||
|
string totp_code = 2;
|
||||||
|
string telegram_code = 3;
|
||||||
|
string reserve_code = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message Verify2FaResponse {
|
||||||
|
string access_token = 1;
|
||||||
|
string status = 2;
|
||||||
|
string message = 3;
|
||||||
|
repeated string reserve_codes = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AuthenticatedAccessRequest {
|
||||||
|
string access_token = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetTwoFaStatusRequest {
|
||||||
|
string access_token = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetTwoFaStatusResponse {
|
||||||
|
bool totp_enabled = 1;
|
||||||
|
bool telegram_enabled = 2;
|
||||||
|
bool totp_enrollment_pending = 3;
|
||||||
|
bool telegram_enrollment_pending = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message StartTotpEnrollmentResponse {
|
||||||
|
string secret_base32 = 1;
|
||||||
|
string otpauth_uri = 2;
|
||||||
|
string issuer = 3;
|
||||||
|
string account_label = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ConfirmTotpEnrollmentRequest {
|
||||||
|
string access_token = 1;
|
||||||
|
string totp_code = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ConfirmTotpEnrollmentResponse {
|
||||||
|
string status = 1;
|
||||||
|
string message = 2;
|
||||||
|
repeated string reserve_codes = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CancelTotpEnrollmentResponse {
|
||||||
|
string status = 1;
|
||||||
|
string message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DisableTotpRequest {
|
||||||
|
string access_token = 1;
|
||||||
|
string password = 2;
|
||||||
|
optional string totp_code = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DisableTotpResponse {
|
||||||
|
string status = 1;
|
||||||
|
string message = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message StartTelegramEnrollmentResponse {
|
||||||
|
string enrollment_token = 1;
|
||||||
|
string deep_link = 2;
|
||||||
|
string bot_username = 3;
|
||||||
|
string expires_at_iso = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ConfirmTelegramEnrollmentRequest {
|
||||||
|
string access_token = 1;
|
||||||
|
string enrollment_token = 2;
|
||||||
|
string otp_code = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ConfirmTelegramEnrollmentResponse {
|
||||||
|
string status = 1;
|
||||||
|
string message = 2;
|
||||||
|
repeated string reserve_codes=3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DisableTelegramRequest {
|
||||||
|
string access_token = 1;
|
||||||
|
string password = 2;
|
||||||
|
optional string telegram_otp_code = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
message DisableTelegramResponse {
|
||||||
|
string status = 1;
|
||||||
|
string message = 2;
|
||||||
|
}
|
||||||
9
proto/google/protobuf/any.proto
Normal file
9
proto/google/protobuf/any.proto
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.protobuf;
|
||||||
|
|
||||||
|
message Any {
|
||||||
|
string type_url = 1;
|
||||||
|
bytes value = 2;
|
||||||
|
}
|
||||||
|
|
||||||
12
proto/google/rpc/status.proto
Normal file
12
proto/google/rpc/status.proto
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package google.rpc;
|
||||||
|
|
||||||
|
import "google/protobuf/any.proto";
|
||||||
|
|
||||||
|
message Status {
|
||||||
|
int32 code = 1;
|
||||||
|
string message = 2;
|
||||||
|
repeated google.protobuf.Any details = 3;
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user