@arbiwallet/contracts 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gen/auth.ts +101 -19
- package/gen/notification.ts +78 -0
- package/package.json +1 -1
- package/proto/auth.proto +55 -11
- package/proto/notification.proto +24 -0
package/gen/auth.ts
CHANGED
|
@@ -11,47 +11,129 @@ import { Observable } from "rxjs";
|
|
|
11
11
|
export const protobufPackage = "auth";
|
|
12
12
|
|
|
13
13
|
export interface TelegramAuthRequest {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* Contains auth_date, hash, user (JSON), query_id, etc.
|
|
17
|
-
*/
|
|
18
|
-
initData: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface TelegramAuthResponse {
|
|
22
|
-
token: string;
|
|
23
|
-
telegramId: number;
|
|
14
|
+
id: string;
|
|
15
|
+
hash: string;
|
|
24
16
|
username: string;
|
|
25
17
|
firstName: string;
|
|
26
18
|
lastName: string;
|
|
19
|
+
authDate: string;
|
|
27
20
|
photoUrl: string;
|
|
28
21
|
}
|
|
29
22
|
|
|
23
|
+
export interface GoogleAuthRequest {
|
|
24
|
+
idToken: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface AppleAuthRequest {
|
|
28
|
+
identityToken: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface PhoneRequestCodeRequest {
|
|
32
|
+
phone: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface PhoneVerifyCodeRequest {
|
|
36
|
+
phone: string;
|
|
37
|
+
code: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface RefreshTokenRequest {
|
|
41
|
+
refreshToken: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface AccessTokenRequest {
|
|
45
|
+
accessToken: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface AuthTokensResponse {
|
|
49
|
+
accessToken: string;
|
|
50
|
+
refreshToken: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface AccessTokenResponse {
|
|
54
|
+
accessToken: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface MessageResponse {
|
|
58
|
+
message: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface MeResponse {
|
|
62
|
+
sub: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
30
65
|
export const AUTH_PACKAGE_NAME = "auth";
|
|
31
66
|
|
|
32
|
-
export interface
|
|
33
|
-
telegramAuth(request: TelegramAuthRequest): Observable<
|
|
67
|
+
export interface AuthServiceClient {
|
|
68
|
+
telegramAuth(request: TelegramAuthRequest): Observable<AuthTokensResponse>;
|
|
69
|
+
|
|
70
|
+
googleAuth(request: GoogleAuthRequest): Observable<AuthTokensResponse>;
|
|
71
|
+
|
|
72
|
+
appleAuth(request: AppleAuthRequest): Observable<AuthTokensResponse>;
|
|
73
|
+
|
|
74
|
+
requestPhoneCode(request: PhoneRequestCodeRequest): Observable<MessageResponse>;
|
|
75
|
+
|
|
76
|
+
verifyPhoneCode(request: PhoneVerifyCodeRequest): Observable<AuthTokensResponse>;
|
|
77
|
+
|
|
78
|
+
refreshToken(request: RefreshTokenRequest): Observable<AccessTokenResponse>;
|
|
79
|
+
|
|
80
|
+
logout(request: RefreshTokenRequest): Observable<MessageResponse>;
|
|
81
|
+
|
|
82
|
+
getMe(request: AccessTokenRequest): Observable<MeResponse>;
|
|
34
83
|
}
|
|
35
84
|
|
|
36
|
-
export interface
|
|
85
|
+
export interface AuthServiceController {
|
|
37
86
|
telegramAuth(
|
|
38
87
|
request: TelegramAuthRequest,
|
|
39
|
-
): Promise<
|
|
88
|
+
): Promise<AuthTokensResponse> | Observable<AuthTokensResponse> | AuthTokensResponse;
|
|
89
|
+
|
|
90
|
+
googleAuth(
|
|
91
|
+
request: GoogleAuthRequest,
|
|
92
|
+
): Promise<AuthTokensResponse> | Observable<AuthTokensResponse> | AuthTokensResponse;
|
|
93
|
+
|
|
94
|
+
appleAuth(
|
|
95
|
+
request: AppleAuthRequest,
|
|
96
|
+
): Promise<AuthTokensResponse> | Observable<AuthTokensResponse> | AuthTokensResponse;
|
|
97
|
+
|
|
98
|
+
requestPhoneCode(
|
|
99
|
+
request: PhoneRequestCodeRequest,
|
|
100
|
+
): Promise<MessageResponse> | Observable<MessageResponse> | MessageResponse;
|
|
101
|
+
|
|
102
|
+
verifyPhoneCode(
|
|
103
|
+
request: PhoneVerifyCodeRequest,
|
|
104
|
+
): Promise<AuthTokensResponse> | Observable<AuthTokensResponse> | AuthTokensResponse;
|
|
105
|
+
|
|
106
|
+
refreshToken(
|
|
107
|
+
request: RefreshTokenRequest,
|
|
108
|
+
): Promise<AccessTokenResponse> | Observable<AccessTokenResponse> | AccessTokenResponse;
|
|
109
|
+
|
|
110
|
+
logout(request: RefreshTokenRequest): Promise<MessageResponse> | Observable<MessageResponse> | MessageResponse;
|
|
111
|
+
|
|
112
|
+
getMe(request: AccessTokenRequest): Promise<MeResponse> | Observable<MeResponse> | MeResponse;
|
|
40
113
|
}
|
|
41
114
|
|
|
42
|
-
export function
|
|
115
|
+
export function AuthServiceControllerMethods() {
|
|
43
116
|
return function (constructor: Function) {
|
|
44
|
-
const grpcMethods: string[] = [
|
|
117
|
+
const grpcMethods: string[] = [
|
|
118
|
+
"telegramAuth",
|
|
119
|
+
"googleAuth",
|
|
120
|
+
"appleAuth",
|
|
121
|
+
"requestPhoneCode",
|
|
122
|
+
"verifyPhoneCode",
|
|
123
|
+
"refreshToken",
|
|
124
|
+
"logout",
|
|
125
|
+
"getMe",
|
|
126
|
+
];
|
|
45
127
|
for (const method of grpcMethods) {
|
|
46
128
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
47
|
-
GrpcMethod("
|
|
129
|
+
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
48
130
|
}
|
|
49
131
|
const grpcStreamMethods: string[] = [];
|
|
50
132
|
for (const method of grpcStreamMethods) {
|
|
51
133
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
52
|
-
GrpcStreamMethod("
|
|
134
|
+
GrpcStreamMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
|
53
135
|
}
|
|
54
136
|
};
|
|
55
137
|
}
|
|
56
138
|
|
|
57
|
-
export const
|
|
139
|
+
export const AUTH_SERVICE_NAME = "AuthService";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.4
|
|
4
|
+
// protoc v7.34.0
|
|
5
|
+
// source: notification.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "notification";
|
|
12
|
+
|
|
13
|
+
export interface EmailVerificationCodeRequest {
|
|
14
|
+
email: string;
|
|
15
|
+
code: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface PhoneVerificationCodeRequest {
|
|
19
|
+
phone: string;
|
|
20
|
+
code: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface NotificationResultResponse {
|
|
24
|
+
success: boolean;
|
|
25
|
+
message: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const NOTIFICATION_PACKAGE_NAME = "notification";
|
|
29
|
+
|
|
30
|
+
export interface NotificationServiceClient {
|
|
31
|
+
sendEmailVerificationCode(request: EmailVerificationCodeRequest): Observable<NotificationResultResponse>;
|
|
32
|
+
|
|
33
|
+
sendSmsVerificationCode(request: PhoneVerificationCodeRequest): Observable<NotificationResultResponse>;
|
|
34
|
+
|
|
35
|
+
sendTelegramVerificationCode(request: PhoneVerificationCodeRequest): Observable<NotificationResultResponse>;
|
|
36
|
+
|
|
37
|
+
sendPhoneVerificationCode(request: PhoneVerificationCodeRequest): Observable<NotificationResultResponse>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface NotificationServiceController {
|
|
41
|
+
sendEmailVerificationCode(
|
|
42
|
+
request: EmailVerificationCodeRequest,
|
|
43
|
+
): Promise<NotificationResultResponse> | Observable<NotificationResultResponse> | NotificationResultResponse;
|
|
44
|
+
|
|
45
|
+
sendSmsVerificationCode(
|
|
46
|
+
request: PhoneVerificationCodeRequest,
|
|
47
|
+
): Promise<NotificationResultResponse> | Observable<NotificationResultResponse> | NotificationResultResponse;
|
|
48
|
+
|
|
49
|
+
sendTelegramVerificationCode(
|
|
50
|
+
request: PhoneVerificationCodeRequest,
|
|
51
|
+
): Promise<NotificationResultResponse> | Observable<NotificationResultResponse> | NotificationResultResponse;
|
|
52
|
+
|
|
53
|
+
sendPhoneVerificationCode(
|
|
54
|
+
request: PhoneVerificationCodeRequest,
|
|
55
|
+
): Promise<NotificationResultResponse> | Observable<NotificationResultResponse> | NotificationResultResponse;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function NotificationServiceControllerMethods() {
|
|
59
|
+
return function (constructor: Function) {
|
|
60
|
+
const grpcMethods: string[] = [
|
|
61
|
+
"sendEmailVerificationCode",
|
|
62
|
+
"sendSmsVerificationCode",
|
|
63
|
+
"sendTelegramVerificationCode",
|
|
64
|
+
"sendPhoneVerificationCode",
|
|
65
|
+
];
|
|
66
|
+
for (const method of grpcMethods) {
|
|
67
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
68
|
+
GrpcMethod("NotificationService", method)(constructor.prototype[method], method, descriptor);
|
|
69
|
+
}
|
|
70
|
+
const grpcStreamMethods: string[] = [];
|
|
71
|
+
for (const method of grpcStreamMethods) {
|
|
72
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
73
|
+
GrpcStreamMethod("NotificationService", method)(constructor.prototype[method], method, descriptor);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const NOTIFICATION_SERVICE_NAME = "NotificationService";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbiwallet/contracts",
|
|
3
3
|
"descriptions": "Generate and manage smart contracts for ArbiWallet",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.6",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,package=omit"
|
|
7
7
|
},
|
package/proto/auth.proto
CHANGED
|
@@ -1,21 +1,65 @@
|
|
|
1
1
|
syntax = "proto3";
|
|
2
2
|
package auth;
|
|
3
3
|
|
|
4
|
-
service
|
|
5
|
-
rpc TelegramAuth (TelegramAuthRequest) returns (
|
|
4
|
+
service AuthService {
|
|
5
|
+
rpc TelegramAuth (TelegramAuthRequest) returns (AuthTokensResponse);
|
|
6
|
+
rpc GoogleAuth (GoogleAuthRequest) returns (AuthTokensResponse);
|
|
7
|
+
rpc AppleAuth (AppleAuthRequest) returns (AuthTokensResponse);
|
|
8
|
+
rpc RequestPhoneCode (PhoneRequestCodeRequest) returns (MessageResponse);
|
|
9
|
+
rpc VerifyPhoneCode (PhoneVerifyCodeRequest) returns (AuthTokensResponse);
|
|
10
|
+
rpc RefreshToken (RefreshTokenRequest) returns (AccessTokenResponse);
|
|
11
|
+
rpc Logout (RefreshTokenRequest) returns (MessageResponse);
|
|
12
|
+
rpc GetMe (AccessTokenRequest) returns (MeResponse);
|
|
6
13
|
}
|
|
7
14
|
|
|
8
15
|
message TelegramAuthRequest {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
string init_data = 1;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
message TelegramAuthResponse {
|
|
15
|
-
string token = 1;
|
|
16
|
-
int64 telegram_id = 2;
|
|
16
|
+
string id = 1;
|
|
17
|
+
string hash = 2;
|
|
17
18
|
string username = 3;
|
|
18
19
|
string first_name = 4;
|
|
19
20
|
string last_name = 5;
|
|
20
|
-
string
|
|
21
|
+
string auth_date = 6;
|
|
22
|
+
string photo_url = 7;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message GoogleAuthRequest {
|
|
26
|
+
string id_token = 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message AppleAuthRequest {
|
|
30
|
+
string identity_token = 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
message PhoneRequestCodeRequest {
|
|
34
|
+
string phone = 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
message PhoneVerifyCodeRequest {
|
|
38
|
+
string phone = 1;
|
|
39
|
+
string code = 2;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
message RefreshTokenRequest {
|
|
43
|
+
string refresh_token = 1;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
message AccessTokenRequest {
|
|
47
|
+
string access_token = 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
message AuthTokensResponse {
|
|
51
|
+
string access_token = 1;
|
|
52
|
+
string refresh_token = 2;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
message AccessTokenResponse {
|
|
56
|
+
string access_token = 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
message MessageResponse {
|
|
60
|
+
string message = 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
message MeResponse {
|
|
64
|
+
string sub = 1;
|
|
21
65
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
package notification;
|
|
3
|
+
|
|
4
|
+
service NotificationService {
|
|
5
|
+
rpc SendEmailVerificationCode (EmailVerificationCodeRequest) returns (NotificationResultResponse);
|
|
6
|
+
rpc SendSmsVerificationCode (PhoneVerificationCodeRequest) returns (NotificationResultResponse);
|
|
7
|
+
rpc SendTelegramVerificationCode (PhoneVerificationCodeRequest) returns (NotificationResultResponse);
|
|
8
|
+
rpc SendPhoneVerificationCode (PhoneVerificationCodeRequest) returns (NotificationResultResponse);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
message EmailVerificationCodeRequest {
|
|
12
|
+
string email = 1;
|
|
13
|
+
string code = 2;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
message PhoneVerificationCodeRequest {
|
|
17
|
+
string phone = 1;
|
|
18
|
+
string code = 2;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
message NotificationResultResponse {
|
|
22
|
+
bool success = 1;
|
|
23
|
+
string message = 2;
|
|
24
|
+
}
|