sosecrets-core
Version: 1.0.20
This Repo is a Cython implementation of a Secret class that allows you to hide a value or function behind a layer of security.
The idea is that you can expose the secret value only a limited number of times, and only through a function call that checks the current exposure count against a maximum exposure count.
The Secret class has four attributes:
inner_secret: a private attribute that stores the actual secret value or function.expose_count: a readonly attribute that keeps track of how many times the secret has been exposed.max_expose_count: a public (read and write) attribute that sets the maximum number of times the secret can be exposed. If set to any negative integers, there is no limit to the number of exposures.apply: a public method that applies a given function to the exposed secret and returns a newSecretobject with the result.
API
Secret
Secret[T] is generic over any type T.
A class representing a secret value with controlled exposure.
__init__(self, value: Optional[T] = ..., *, func: Optional[Callable[..., T]] = ..., func_args: Tuple[Any, ...] = ..., func_kwargs: Dict[str, Any] = ..., max_expose_count: int = ...) -> Secret[T]
Initialize a Secret object.
Notes:
Secretis not thread-safe, becauseexpose_countis not atomically-mutated.
- value: The initial value of the
Secretobject. If provided, it takes precedence overfunc. - func: A function used to generate the initial value of the
Secretobject. Ignored if value is provided. - func_args: Positional arguments to pass to the
funcfunction. - func_kwargs: Keyword arguments to pass to the
funcfunction. - max_expose_count: The maximum number of times the
Secretobject can be exposed. Initialized to -1 for unlimited.
Raises:
- ValueError: If both
valueandfuncarguments are provided.
Secret.expose_secret()
Exposes the secret value.
expose_secret(self) -> T
Returns:
The inner secret value.
Raises:
- AttributeError: If the
Secretobject has reached the maximum exposure count.
Secret.apply(...)
Apply a function to the inner secret value and return a new Secret object.
apply(self, func: Callable[[Any, ...], U], *, func_args: Tuple[Any, ...] = ..., func_kwargs: Dict[str, Any] = ...) -> Secret[U]
- func: The function to apply to the inner secret value.
- func_args: Positional arguments to pass to the
funcfunction. - func_kwargs: Keyword arguments to pass to the
funcfunction.
Returns:
A new Secret object with the result of applying the function to the inner secret value.
License
This code is released under the MIT License.
Metadata
Release files for sosecrets-core 1.0.20
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sosecrets_core-1.0.20.tar.gz | 46.2 kB | Without provenance | Details for sosecrets_core-1.0.20.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sosecrets_core-1.0.20-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details for sosecrets_core-1.0.20-cp310-cp310-win_amd64.whl |
Total release size: 110.1 kB
Release files / sosecrets_core-1.0.20.tar.gz
| Download URL | sosecrets_core-1.0.20.tar.gz |
|---|---|
| Size | 46.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b0bebf70e2009962117d807f21e8d59cb7546c4c2ddd3d801b1a16a66a1f63dd
|
|
BLAKE2b-256 checksum How to use checksums |
8d80c6609e4c3ae3fb208f9fcbf7215e999a09baa69d7fd501e7cefdf8f39c30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / sosecrets_core-1.0.20-cp310-cp310-win_amd64.whl
| Download URL | sosecrets_core-1.0.20-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 63.8 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
01d378da2d4edc098497be147b1af313b64d78172de6fbc557ff08087638e677
|
|
BLAKE2b-256 checksum How to use checksums |
def45bd6f23995e13bea13468480f106bb35564c0a45495df64a5228f12844b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Security for sosecrets-core 1.0.20
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.