pdk_contracts_lib/api/
credentials.rs1use std::{
6 any::type_name,
7 fmt::{Debug, Display},
8};
9
10use zeroize::ZeroizeOnDrop;
11
12#[derive(Debug, Clone)]
14pub struct ClientId(String);
15
16impl ClientId {
17 pub fn new(id: String) -> Self {
19 Self(id)
20 }
21
22 pub fn into_string(self) -> String {
23 self.0
24 }
25
26 pub fn as_str(&self) -> &str {
27 &self.0
28 }
29}
30
31impl Display for ClientId {
32 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33 f.write_str(&self.0)
34 }
35}
36
37#[derive(Clone, ZeroizeOnDrop)]
41pub struct ClientSecret(String);
42
43impl ClientSecret {
44 pub fn new(client_secret: String) -> Self {
46 Self(client_secret)
47 }
48
49 pub(crate) fn as_str(&self) -> &str {
50 self.0.as_str()
51 }
52}
53
54impl Debug for ClientSecret {
55 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
56 f.debug_tuple(type_name::<Self>())
57 .field(&"**********")
58 .finish()
59 }
60}