Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.12 instead.
Reason given by maintainers: Cannot Build

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.

Installation

To install sosecrets, you can use pip:

pip install sosecrets

Usage

Here's an example of how to use sosecrets:

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)  # Output: 14

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

In this example, we create a Secret object with the value "my secret value". We then use the apply method to apply the len function to the secret value while keeping it encapsulated. Finally, we use the expose_secret method to retrieve the value of the secret.

Use Cases

sosecrets can be used in a variety of scenarios where sensitive data needs to be securely handled. Here are some common use cases:

Storing API keys, passwords, and other credentials: sosecrets can be used to securely store sensitive information such as API keys, passwords, and other credentials that are required for authentication or authorization in an application.

Handling personal identifiable information (PII): sosecrets can be used to protect personal identifiable information (PII) such as names, addresses, social security numbers, and other sensitive data that needs to be kept confidential.

API Reference

Secret

The Secret class encapsulates a secret value and only exposes it through a controlled interface.

Secret(value: Optional[T] = None, func: Optional[Callable[[Any], T]] = None, func_args: Tuple[Any] = tuple(), func_kwargs: Dict[str, Any] = dict()) -> SecretType
  • value: The secret value to encapsulate.
  • func: A function to generate the secret value.
  • func_args: The positional arguments to pass to the func function.
  • func_kwargs: The keyword arguments to pass to the func function.

apply

The apply method applies a function to the secret value while keeping it encapsulated.

apply(self, func: Callable[[Any], Any], *args: Tuple[Any], **kwargs: Dict[str, Any]) -> SecretType:
  • func: The function to apply to the secret value.
  • args: The positional arguments to pass to the func function.
  • kwargs: The keyword arguments to pass to the func function.

expose_secret

The expose_secret method returns the value of the secret.

def expose_secret(self) -> T:

Exceptions

sosecrets defines the following exceptions:

CannotInstantiateExposeSecret

Raised when attempting to instantiate the __expose_secret__ class.

CannotInheritFromSecret

Raised when attempting to subclass the Secret class.

FuncAndValueCannotBeBothPassed

Raised when both value and func arguments are passed to the Secret constructor.

Contributing

Contributions are welcome! Let me know if you need help with anything else.

Download files

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

Source Distribution

sosecrets-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

sosecrets-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file sosecrets-0.1.0.tar.gz.

File metadata

  • Download URL: sosecrets-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.6 Windows/10

File hashes

Hashes for sosecrets-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a67dd06c4266e281f61430783ca285109849805bbc057e1a389b6be86f76113
MD5 0130da886828146f067f886b320ebac8
BLAKE2b-256 18cd2f3afb33e983e6919b91b1f9e95e172df5593e88211e9fcf031a8c8109e7

See more details on using hashes here.

File details

Details for the file sosecrets-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sosecrets-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.6 Windows/10

File hashes

Hashes for sosecrets-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b9f06c4428f230b0a9a10d0898fc9570627044b83877bbf8c677905f1bf85cf
MD5 eeaa05cf4d8146ccc358d626c2fe6366
BLAKE2b-256 10f4118ba46ff442954826d27c218274788cd139c15e776bf7e41d8fdc9353c4

See more details on using hashes here.

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