Files
services/otp/proto/otp.proto
2021-09-02 15:23:24 +01:00

39 lines
813 B
Protocol Buffer

syntax = "proto3";
package otp;
option go_package = "./proto;otp";
service Otp {
rpc Generate(GenerateRequest) returns (GenerateResponse) {}
rpc Validate(ValidateRequest) returns (ValidateResponse) {}
}
// Generate an OTP (one time pass) code
message GenerateRequest {
// unique id, email or user to generate an OTP for
string id = 1;
// number of characters (default: 6)
int64 size = 2;
// expiration in seconds (default: 60)
int64 expiry = 3;
}
message GenerateResponse {
// one time pass code
string code = 1;
}
// Validate the OTP code
message ValidateRequest {
// unique id, email or user for which the code was generated
string id = 1;
// one time pass code to validate
string code = 2;
}
message ValidateResponse {
// returns true if the code is valid for the ID
bool success = 1;
}