Skip to main content

Easy manipulation of RFC8959 secret-token URIs

Project description

secret-token

This is a utility library for working with RFC8959 secret-token URIs.

It provides 3 functions:

  • encode - Encodes a generated secret into a URI
  • decode - Decodes a URI for passing secrets to systems that do not support URI data
  • validate - Checks if a secret-token URI is conforms to the spec

There are two main expected use cases for this library:

  1. Creating a service that generates and validates user secrets such as an API server. As per the RFC all secrets should be stored at rest encoded as URIs, so the encode function is used immediately after generating tokens and the validate function is called when recieving tokens from users.
  2. Use in a service that talks to external services that do not support RFC8959 but where you would like to store all your secrets using it. For example, in an environment with an appropriate secret token present:
export API_TOKEN='secret-token:E92FB7EB-D882-47A4-A265-A0B6135DC842%20foo'

The decoding code will look like this:

import os

import secret_token

API_TOKEN = secret_token.decode(os.environ.get["API_TOKEN"])
print(API_TOKEN)

The code prints

E92FB7EB-D882-47A4-A265-A0B6135DC842 foo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

secret_token-1.2.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

secret_token-1.2.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file secret_token-1.2.0.tar.gz.

File metadata

  • Download URL: secret_token-1.2.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for secret_token-1.2.0.tar.gz
Algorithm Hash digest
SHA256 87bb2ee01cd8b712147fbc0fe953a1cfeda5b60c6f1b4326419a3d606eb4dbba
MD5 77a5591b2810f8e8feb0d48d34eaa228
BLAKE2b-256 ac0fff62dbc6bc42bef4f465368c3feb517fcab858e2a330041c05d5c9b437ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for secret_token-1.2.0.tar.gz:

Publisher: release.yml on Lexicality/secret-token

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file secret_token-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: secret_token-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for secret_token-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8fe18f2985eceb9e55358c0f32aa2fdef952678d8b8614108cca07390ad8d9cf
MD5 065c4e1e16de91b589e243d669497281
BLAKE2b-256 9b2e074c958e46c505aad7684ae47d4aebc2fd7eee093f67442f53bf55667b8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for secret_token-1.2.0-py3-none-any.whl:

Publisher: release.yml on Lexicality/secret-token

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page