agent_sdk_store_supabase/
auth.rs1use core::fmt;
2
3#[derive(Clone, Eq, PartialEq)]
4pub struct SupabaseAuth {
6 api_key: String,
7 bearer_token: String,
8}
9
10impl SupabaseAuth {
11 pub fn service_role(secret: impl Into<String>) -> Self {
13 let secret = secret.into();
14 Self {
15 api_key: secret.clone(),
16 bearer_token: secret,
17 }
18 }
19
20 pub fn new(api_key: impl Into<String>, bearer_token: impl Into<String>) -> Self {
22 Self {
23 api_key: api_key.into(),
24 bearer_token: bearer_token.into(),
25 }
26 }
27
28 pub fn api_key(&self) -> &str {
30 &self.api_key
31 }
32
33 pub fn bearer_token(&self) -> &str {
35 &self.bearer_token
36 }
37}
38
39impl fmt::Debug for SupabaseAuth {
40 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
41 formatter
42 .debug_struct("SupabaseAuth")
43 .field("api_key", &"<redacted>")
44 .field("bearer_token", &"<redacted>")
45 .finish()
46 }
47}