@babacarthiamdev/contracts 1.0.0 → 1.0.2
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 +123 -1
- package/package.json +1 -1
- package/proto/auth.proto +12 -0
package/gen/auth.ts
CHANGED
|
@@ -20,6 +20,17 @@ export interface SendOtpResponse {
|
|
|
20
20
|
ok: boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
export interface VerifyOtpRequest {
|
|
24
|
+
identifier: string;
|
|
25
|
+
code: string;
|
|
26
|
+
type: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface VerifyOptResponse {
|
|
30
|
+
accessToken: string;
|
|
31
|
+
refreshToken: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
23
34
|
export const AUTH_V1_PACKAGE_NAME = "auth.v1";
|
|
24
35
|
|
|
25
36
|
function createBaseSendOtpRequest(): SendOtpRequest {
|
|
@@ -107,17 +118,128 @@ export const SendOtpResponse: MessageFns<SendOtpResponse> = {
|
|
|
107
118
|
},
|
|
108
119
|
};
|
|
109
120
|
|
|
121
|
+
function createBaseVerifyOtpRequest(): VerifyOtpRequest {
|
|
122
|
+
return { identifier: "", code: "", type: "" };
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export const VerifyOtpRequest: MessageFns<VerifyOtpRequest> = {
|
|
126
|
+
encode(message: VerifyOtpRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
127
|
+
if (message.identifier !== "") {
|
|
128
|
+
writer.uint32(10).string(message.identifier);
|
|
129
|
+
}
|
|
130
|
+
if (message.code !== "") {
|
|
131
|
+
writer.uint32(18).string(message.code);
|
|
132
|
+
}
|
|
133
|
+
if (message.type !== "") {
|
|
134
|
+
writer.uint32(26).string(message.type);
|
|
135
|
+
}
|
|
136
|
+
return writer;
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
decode(input: BinaryReader | Uint8Array, length?: number): VerifyOtpRequest {
|
|
140
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
141
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
142
|
+
const message = createBaseVerifyOtpRequest();
|
|
143
|
+
while (reader.pos < end) {
|
|
144
|
+
const tag = reader.uint32();
|
|
145
|
+
switch (tag >>> 3) {
|
|
146
|
+
case 1: {
|
|
147
|
+
if (tag !== 10) {
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
message.identifier = reader.string();
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
case 2: {
|
|
155
|
+
if (tag !== 18) {
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
message.code = reader.string();
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
case 3: {
|
|
163
|
+
if (tag !== 26) {
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
message.type = reader.string();
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
reader.skip(tag & 7);
|
|
175
|
+
}
|
|
176
|
+
return message;
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
function createBaseVerifyOptResponse(): VerifyOptResponse {
|
|
181
|
+
return { accessToken: "", refreshToken: "" };
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export const VerifyOptResponse: MessageFns<VerifyOptResponse> = {
|
|
185
|
+
encode(message: VerifyOptResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
|
|
186
|
+
if (message.accessToken !== "") {
|
|
187
|
+
writer.uint32(10).string(message.accessToken);
|
|
188
|
+
}
|
|
189
|
+
if (message.refreshToken !== "") {
|
|
190
|
+
writer.uint32(18).string(message.refreshToken);
|
|
191
|
+
}
|
|
192
|
+
return writer;
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
decode(input: BinaryReader | Uint8Array, length?: number): VerifyOptResponse {
|
|
196
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
197
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
198
|
+
const message = createBaseVerifyOptResponse();
|
|
199
|
+
while (reader.pos < end) {
|
|
200
|
+
const tag = reader.uint32();
|
|
201
|
+
switch (tag >>> 3) {
|
|
202
|
+
case 1: {
|
|
203
|
+
if (tag !== 10) {
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
message.accessToken = reader.string();
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
case 2: {
|
|
211
|
+
if (tag !== 18) {
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
message.refreshToken = reader.string();
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
reader.skip(tag & 7);
|
|
223
|
+
}
|
|
224
|
+
return message;
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
|
|
110
228
|
export interface AuthServiceClient {
|
|
111
229
|
sendOtp(request: SendOtpRequest): Observable<SendOtpResponse>;
|
|
230
|
+
|
|
231
|
+
verifyOtp(request: VerifyOtpRequest): Observable<VerifyOptResponse>;
|
|
112
232
|
}
|
|
113
233
|
|
|
114
234
|
export interface AuthServiceController {
|
|
115
235
|
sendOtp(request: SendOtpRequest): Promise<SendOtpResponse> | Observable<SendOtpResponse> | SendOtpResponse;
|
|
236
|
+
|
|
237
|
+
verifyOtp(request: VerifyOtpRequest): Promise<VerifyOptResponse> | Observable<VerifyOptResponse> | VerifyOptResponse;
|
|
116
238
|
}
|
|
117
239
|
|
|
118
240
|
export function AuthServiceControllerMethods() {
|
|
119
241
|
return function (constructor: Function) {
|
|
120
|
-
const grpcMethods: string[] = ["sendOtp"];
|
|
242
|
+
const grpcMethods: string[] = ["sendOtp", "verifyOtp"];
|
|
121
243
|
for (const method of grpcMethods) {
|
|
122
244
|
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
123
245
|
GrpcMethod("AuthService", method)(constructor.prototype[method], method, descriptor);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babacarthiamdev/contracts",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Protobuf definitions and generated TypeScript types",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"generate": "protoc -I ./proto ./proto/*.proto --ts_proto_out=./gen --ts_proto_opt=nestJs=true,outputServices=nest,outputClientImpl=false,package=omit,outputEncodeMethods=false,outputJsonMethods=false"
|
package/proto/auth.proto
CHANGED
|
@@ -4,6 +4,7 @@ package auth.v1;
|
|
|
4
4
|
|
|
5
5
|
service AuthService {
|
|
6
6
|
rpc SendOtp (SendOtpRequest) returns (SendOtpResponse);
|
|
7
|
+
rpc VerifyOtp (VerifyOtpRequest) returns (VerifyOptResponse);
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
message SendOtpRequest {
|
|
@@ -14,3 +15,14 @@ message SendOtpRequest {
|
|
|
14
15
|
message SendOtpResponse {
|
|
15
16
|
bool ok = 1;
|
|
16
17
|
}
|
|
18
|
+
|
|
19
|
+
message VerifyOtpRequest {
|
|
20
|
+
string identifier = 1;
|
|
21
|
+
string code = 2;
|
|
22
|
+
string type = 3;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message VerifyOptResponse{
|
|
26
|
+
string access_token = 1;
|
|
27
|
+
string refresh_token = 2;
|
|
28
|
+
}
|