credentials.proto 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. syntax = "proto3";
  2. package smartbotic.proto;
  3. option cc_enable_arenas = true;
  4. // Credential service for runners to fetch authentication headers
  5. service CredentialService {
  6. // Get HTTP authentication header for a credential
  7. rpc GetCredentialAuth(GetCredentialAuthRequest) returns (GetCredentialAuthResponse);
  8. // Get IMAP credentials for a credential
  9. rpc GetImapCredentials(GetImapCredentialsRequest) returns (GetImapCredentialsResponse);
  10. // Get SMTP credentials for a credential
  11. rpc GetSmtpCredentials(GetSmtpCredentialsRequest) returns (GetSmtpCredentialsResponse);
  12. // Get MySQL credentials for a credential
  13. rpc GetMysqlCredentials(GetMysqlCredentialsRequest) returns (GetMysqlCredentialsResponse);
  14. // Get PostgreSQL credentials for a credential
  15. rpc GetPostgresqlCredentials(GetPostgresqlCredentialsRequest) returns (GetPostgresqlCredentialsResponse);
  16. // List available credentials (metadata only)
  17. rpc ListCredentials(ListCredentialsRequest) returns (ListCredentialsResponse);
  18. }
  19. // Request to get credential auth header
  20. message GetCredentialAuthRequest {
  21. string credential_id = 1;
  22. string workflow_id = 2; // For access control verification
  23. }
  24. // Response with auth header
  25. message GetCredentialAuthResponse {
  26. bool success = 1;
  27. string header_name = 2; // e.g., "Authorization"
  28. string header_value = 3; // e.g., "Bearer token123"
  29. string error = 4; // Error message if success is false
  30. }
  31. // Credential info (metadata only, no secrets)
  32. message CredentialInfo {
  33. string id = 1;
  34. string name = 2;
  35. string type = 3; // "basic", "bearer", "api_key", "oauth2", "imap", "smtp", "mysql", "postgresql"
  36. string description = 4;
  37. }
  38. // Request to get IMAP credentials
  39. message GetImapCredentialsRequest {
  40. string credential_id = 1;
  41. string workflow_id = 2; // For access control verification
  42. }
  43. // Response with IMAP credentials
  44. message GetImapCredentialsResponse {
  45. bool success = 1;
  46. string host = 2;
  47. int32 port = 3;
  48. string username = 4;
  49. string password = 5;
  50. bool use_ssl = 6;
  51. string error = 7; // Error message if success is false
  52. }
  53. // Request to get SMTP credentials
  54. message GetSmtpCredentialsRequest {
  55. string credential_id = 1;
  56. string workflow_id = 2; // For access control verification
  57. }
  58. // Response with SMTP credentials. An imap credential answers here too, so an
  59. // account stored for reading mail can also be used to send it.
  60. message GetSmtpCredentialsResponse {
  61. bool success = 1;
  62. string host = 2;
  63. int32 port = 3;
  64. string username = 4;
  65. string password = 5;
  66. string security = 6; // "starttls", "ssl" or "none"
  67. string from_address = 7;
  68. string from_name = 8;
  69. string error = 9;
  70. }
  71. // Request to get MySQL credentials
  72. message GetMysqlCredentialsRequest {
  73. string credential_id = 1;
  74. string workflow_id = 2; // For access control verification
  75. }
  76. // Response with MySQL credentials
  77. message GetMysqlCredentialsResponse {
  78. bool success = 1;
  79. string host = 2;
  80. int32 port = 3;
  81. string username = 4;
  82. string password = 5;
  83. string database = 6;
  84. bool use_ssl = 7;
  85. string error = 8; // Error message if success is false
  86. }
  87. // Request to get PostgreSQL credentials
  88. message GetPostgresqlCredentialsRequest {
  89. string credential_id = 1;
  90. string workflow_id = 2; // For access control verification
  91. }
  92. // Response with PostgreSQL credentials
  93. message GetPostgresqlCredentialsResponse {
  94. bool success = 1;
  95. string host = 2;
  96. int32 port = 3;
  97. string username = 4;
  98. string password = 5;
  99. string database = 6;
  100. bool use_ssl = 7;
  101. string error = 8; // Error message if success is false
  102. }
  103. // Request to list credentials
  104. message ListCredentialsRequest {
  105. string workflow_id = 1; // Optional: filter by workflow access
  106. }
  107. // Response with credential list
  108. message ListCredentialsResponse {
  109. repeated CredentialInfo credentials = 1;
  110. }