owned
A little tool to manage secrets.
The package uses the 'owner' library to embed information into byte content (weaving) and store it locally, as well as post the resulting hash to a blockchain for ownership verification. Includes helper functions to verify the posting of hashes on the blockchain.
To install: pip install owned
Main Functionalities
-
store_content(content, ...) -> str
- Optionally weaves metadata into the content (using 'owner') before storage.
- Saves the content in the ~/.config/owned folder under a file name derived from its hash.
- Returns the computed hash string (the 'key').
-
post_hash_to_blockchain(hash_str, provider_uri='http://127.0.0.1:8545', ...)
- Posts the hash to a chosen blockchain via web3.py.
- Returns transaction or logging information.
-
verify_hash_on_blockchain(hash_str, provider_uri='http://127.0.0.1:8545', ...)
- Verifies that a particular hash has been posted on the blockchain.
- Returns information such as block number, transaction details, or a boolean indicating presence.
Helper Functions
- DFLT_HASH: Default hashing function (sha256).
- weave_content(content, extra_info=None): Uses 'owner.HeadWeaver' to weave extra bytes into the content.
- unweave_content(woven_bytes): Recovers content and metadata from woven bytes.
- Additional internal functions for file handling and directory creation.
Examples
>>> from owned import store_content, unweave_content
>>> import os
Store some content (with weaving) and get its hash key.
>>> test_content = b"Hello, doctest!"
>>> key = store_content(test_content, extra_info=b"Extra info", use_weave=True)
Verify the file exists in ~/.config/owned
>>> file_path = os.path.expanduser(f"~/.config/owned/{key}")
>>> assert os.path.isfile(file_path)
Check the length of the SHA256 hash (64 hex chars).
>>> len(key)
64
Read the stored file and unweave the content.
>>> with open(file_path, "rb") as f:
... woven_data = f.read()
>>> original_content = unweave_content(woven_data)
>>> original_content == test_content
True
Metadata
Release files for owned 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| owned-0.0.7.tar.gz | 13.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| owned-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.6 kB
Release files / owned-0.0.7.tar.gz
| Download URL | owned-0.0.7.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24b4e547a4f0ec6adf8645683c9e0d4e0a766d222227b7d4b80b0fe1a7411b83
|
|
BLAKE2b-256 checksum How to use checksums |
3393b147c5c3d8bf45398d0b58b68a05cd39331e26e5f92ca18a2d4a40ec4b58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / owned-0.0.7-py3-none-any.whl
| Download URL | owned-0.0.7-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
22ea23e299585c64beb327679484bdc1999dc68c75876fe567443e2bbb5c8495
|
|
BLAKE2b-256 checksum How to use checksums |
e459ce25f18579f5ae28ef3922d3407679a4e6d0aa923c03ad3ab0343f17e23f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|