stripe/model/apps_secret.rs
1use serde::{Serialize, Deserialize};
2use super::SecretServiceResourceScope;
3/**Secret Store is an API that allows Stripe Apps developers to securely persist secrets for use by UI Extensions and app backends.
4
5The primary resource in Secret Store is a `secret`. Other apps can't view secrets created by an app. Additionally, secrets are scoped to provide further permission control.
6
7All Dashboard users and the app backend share `account` scoped secrets. Use the `account` scope for secrets that don't change per-user, like a third-party API key.
8
9A `user` scoped secret is accessible by the app backend and one specific Dashboard user. Use the `user` scope for per-user secrets like per-user OAuth tokens, where different users might have different permissions.
10
11Related guide: [Store data between page reloads](https://stripe.com/docs/stripe-apps/store-auth-data-custom-objects)*/
12#[derive(Debug, Clone, Serialize, Deserialize, Default)]
13pub struct AppsSecret {
14 ///Time at which the object was created. Measured in seconds since the Unix epoch.
15 pub created: i64,
16 ///If true, indicates that this secret has been deleted
17 #[serde(skip_serializing_if = "Option::is_none")]
18 pub deleted: Option<bool>,
19 ///The Unix timestamp for the expiry time of the secret, after which the secret deletes.
20 #[serde(skip_serializing_if = "Option::is_none")]
21 pub expires_at: Option<i64>,
22 ///Unique identifier for the object.
23 pub id: String,
24 ///Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
25 pub livemode: bool,
26 ///A name for the secret that's unique within the scope.
27 pub name: String,
28 ///String representing the object's type. Objects of the same type share the same value.
29 pub object: String,
30 ///The plaintext secret value to be stored.
31 #[serde(skip_serializing_if = "Option::is_none")]
32 pub payload: Option<String>,
33 ///
34 pub scope: SecretServiceResourceScope,
35}
36impl std::fmt::Display for AppsSecret {
37 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
38 write!(f, "{}", serde_json::to_string(self).unwrap())
39 }
40}