View Source Stripe.Apps.Secret (stripity_stripe v3.2.0)

Secret Store is an API that allows Stripe Apps developers to securely persist secrets for use by UI Extensions and app backends.

The 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.

All 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.

A 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.

Related guide: Store data between page reloads

Summary

Types

t()

The apps.secret type.

Functions

Create or replace a secret in the secret store.

Deletes a secret from the secret store by name and scope.

Finds a secret in the secret store by name and scope.

List all secrets stored on the given scope.

Types

@type scope() :: %{optional(:type) => :account | :user, optional(:user) => binary()}
@type t() :: %Stripe.Apps.Secret{
  created: integer(),
  deleted: boolean(),
  expires_at: integer() | nil,
  id: binary(),
  livemode: boolean(),
  name: binary(),
  object: binary(),
  payload: binary() | nil,
  scope: term()
}

The apps.secret type.

  • created Time at which the object was created. Measured in seconds since the Unix epoch.
  • deleted If true, indicates that this secret has been deleted
  • expires_at The Unix timestamp for the expiry time of the secret, after which the secret deletes.
  • id Unique identifier for the object.
  • livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
  • name A name for the secret that's unique within the scope.
  • object String representing the object's type. Objects of the same type share the same value.
  • payload The plaintext secret value to be stored.
  • scope

Functions

Link to this function

create(params \\ %{}, opts \\ [])

View Source
@spec create(
  params :: %{
    optional(:expand) => [binary()],
    optional(:expires_at) => integer(),
    optional(:name) => binary(),
    optional(:payload) => binary(),
    optional(:scope) => scope()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Create or replace a secret in the secret store.

Details

  • Method: post
  • Path: /v1/apps/secrets
Link to this function

delete_where(params \\ %{}, opts \\ [])

View Source
@spec delete_where(
  params :: %{
    optional(:expand) => [binary()],
    optional(:name) => binary(),
    optional(:scope) => scope()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Deletes a secret from the secret store by name and scope.

Details

  • Method: post
  • Path: /v1/apps/secrets/delete
Link to this function

find(params \\ %{}, opts \\ [])

View Source
@spec find(
  params :: %{
    optional(:expand) => [binary()],
    optional(:name) => binary(),
    optional(:scope) => scope()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Finds a secret in the secret store by name and scope.

Details

  • Method: get
  • Path: /v1/apps/secrets/find
Link to this function

list(params \\ %{}, opts \\ [])

View Source
@spec list(
  params :: %{
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:limit) => integer(),
    optional(:scope) => scope(),
    optional(:starting_after) => binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

List all secrets stored on the given scope.

Details

  • Method: get
  • Path: /v1/apps/secrets