83 lines
1.7 KiB
Protocol Buffer
83 lines
1.7 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package webui;
|
|
|
|
// Login request from Web UI
|
|
message WebUiLoginRequest {
|
|
string username = 1; // 1-32 chars
|
|
string password = 2; // 1-64 chars (plain or hashed)
|
|
}
|
|
|
|
// Login response
|
|
message WebUiLoginResponse {
|
|
bool success = 1;
|
|
optional string token = 2; // session/JWT when success
|
|
optional string error = 3; // error message when failed
|
|
}
|
|
|
|
// Logout response
|
|
message WebUiLogoutResponse {
|
|
bool success = 1;
|
|
string error = 2;
|
|
}
|
|
|
|
// User data structure
|
|
message WebUiUser {
|
|
string username = 1; // 1-32 chars
|
|
bytes password_hash = 2; // 32 bytes (SHA-256)
|
|
}
|
|
|
|
// User list (max 5 users)
|
|
message WebUiUserList {
|
|
repeated WebUiUser users = 1;
|
|
}
|
|
|
|
// Request to get users
|
|
message GetUsersRequest {
|
|
}
|
|
|
|
// Response with users
|
|
message GetUsersResponse {
|
|
repeated string usernames = 1; // List of usernames
|
|
}
|
|
|
|
// Request to add user
|
|
message AddUserRequest {
|
|
string username = 1;
|
|
string password = 2;
|
|
}
|
|
|
|
// Response to add user
|
|
message AddUserResponse {
|
|
bool success = 1;
|
|
optional string error = 2; // e.g., "table full", "user exists"
|
|
}
|
|
|
|
// Request to delete user
|
|
message DeleteUserRequest {
|
|
string username = 1;
|
|
}
|
|
|
|
// Response to delete user
|
|
message DeleteUserResponse {
|
|
bool success = 1;
|
|
optional string error = 2; // e.g., "user not found"
|
|
}
|
|
|
|
// Request to update user password
|
|
message UpdateUserPasswordRequest {
|
|
string username = 1;
|
|
string new_password = 2;
|
|
}
|
|
|
|
// Response to update user password
|
|
message UpdateUserPasswordResponse {
|
|
bool success = 1;
|
|
optional string error = 2; // e.g., "user not found"
|
|
}
|
|
|
|
// Auth check response
|
|
message WebUiAuthCheckResponse {
|
|
bool authenticated = 1;
|
|
optional string username = 2;
|
|
} |