Skip to content

Home

sosecrets

https://img.shields.io/github/commit-activity/t/jymchng/sosecrets https://img.shields.io/github/actions/workflow/status/jymchng/sosecrets/testing.yml https://img.shields.io/pypi/pyversions/sosecrets https://img.shields.io/pypi/dm/sosecrets https://img.shields.io/github/issues/jymchng/sosecrets https://img.shields.io/github/issues-pr/jymchng/sosecrets

sosecrets is a Python module that provides a secure way to handle sensitive data by encapsulating it and only exposing it through a controlled interface. It is designed to be used in scenarios where sensitive data needs to be securely handled and kept confidential.

This module provides a Secret class that encapsulates a secret value and only exposes it through a controlled interface. It also provides a number of related classes and exceptions to support this functionality.

from sosecrets import Secret

# Create a secret value
secret_value = Secret("my secret value")

# Use the secret value while keeping it encapsulated
result = secret_value.apply(len)
print(result.expose_secret())  # Output: 14

# Get the value of the secret
value = secret_value.expose_secret()
print(value)  # Output: "my secret value"

Why use sosecrets

Here are some reasons to use sosecrets in your Python projects:

  • Secure secrets management: Sosecrets ensures that secrets are stored securely and not exposed to the outside world. It uses encapsulation to hide the secret value from the rest of your code, and provides a controlled interface for accessing the value.

  • Encapsulation of secret values: With sosecrets, you can encapsulate secret values in a way that prevents accidental exposure. This means that even if a developer accidentally logs or returns the secret value, it will not be visible to an attacker.

  • Testable: Sosecrets is testable and integrates well with Python testing frameworks. You can easily write tests to ensure that your secrets are properly managed and not accidentally exposed.

  • Open source: Sosecrets is an open-source library, meaning that the code is available for inspection and can be audited for security vulnerabilities. This provides an extra layer of security and ensures that the library is trustworthy.

Overall, sosecrets is a powerful tool for managing secrets in your Python projects. It provides a secure and easy-to-use way to manage secrets, ensuring that they are not accidentally exposed and that your code is more secure. If you're working with secrets in your Python projects, sosecrets is definitely worth considering.