Python bindings for Lylacore (soul-crypto + coach-engine)
Project description
Lylacore Python Bindings
Authors: Joysusy & Violet Klaudia 💖
Python bindings for Lylacore - cryptographic primitives and communication style coaching for AI agent identity systems.
Features
- soul-crypto: AES-256-GCM encryption with Argon2id/PBKDF2/Scrypt key derivation
- coach-engine: Communication style analysis and adaptation (coming soon)
Installation
pip install lylacore
Quick Start
import asyncio
import lylacore
async def main():
# Generate a salt for key derivation
salt = lylacore.Salt.generate()
# Derive an encryption key from a passphrase
key = await lylacore.derive_key("my-secure-passphrase", salt)
# Encrypt some data
plaintext = b"Secret message"
nonce, ciphertext, auth_tag = lylacore.encrypt(plaintext, key)
# Decrypt the data
decrypted = lylacore.decrypt(ciphertext, key, nonce, auth_tag)
assert decrypted == plaintext
print("Encryption/decryption successful!")
asyncio.run(main())
API Reference
Classes
Salt
A 32-byte cryptographic salt for key derivation.
Salt.generate()- Generate a new random saltSalt(data: bytes)- Create from existing bytessalt.as_bytes()- Get raw bytes
Nonce
A 12-byte nonce for AES-GCM encryption.
Nonce.generate()- Generate a new random nonceNonce(data: bytes)- Create from existing bytesnonce.as_bytes()- Get raw bytes
Key
A 32-byte encryption key.
key.as_bytes()- Get raw bytes (handle with care!)
AuthTag
A 16-byte authentication tag for AES-GCM.
AuthTag(data: bytes)- Create from existing bytesauth_tag.as_bytes()- Get raw bytes
DeriveKeyOptions
Configuration for key derivation.
DeriveKeyOptions(algorithm="argon2id")- Options: "argon2id", "pbkdf2", "scrypt"
Functions
async derive_key(passphrase: str, salt: Salt, options: DeriveKeyOptions = None) -> Key
Derive an encryption key from a passphrase using a memory-hard KDF.
Parameters:
passphrase- User's passphrase (UTF-8 string)salt- 32-byte salt (useSalt.generate()for new keys)options- Optional KDF configuration (defaults to argon2id)
Returns: A 32-byte encryption key
encrypt(plaintext: bytes, key: Key) -> tuple[Nonce, bytes, AuthTag]
Encrypt data using AES-256-GCM.
Parameters:
plaintext- Data to encryptkey- Encryption key fromderive_key()
Returns: Tuple of (nonce, ciphertext, auth_tag)
decrypt(ciphertext: bytes, key: Key, nonce: Nonce, auth_tag: AuthTag) -> bytes
Decrypt data using AES-256-GCM.
Parameters:
ciphertext- Encrypted datakey- Same key used for encryptionnonce- Nonce fromencrypt()auth_tag- Authentication tag fromencrypt()
Returns: Original plaintext
Security Notes
- Never reuse a nonce with the same key
- Store salt, nonce, and auth_tag alongside ciphertext (they're safe to store publicly)
- Never log or display keys - use
key.as_bytes()only when necessary - Argon2id is recommended for new applications (best resistance against attacks)
Requirements
- Python 3.9+
- Works on Windows, macOS, and Linux
License
MIT License - see LICENSE file for details
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lylacore-0.1.3.tar.gz.
File metadata
- Download URL: lylacore-0.1.3.tar.gz
- Upload date:
- Size: 58.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3910d1eaaf20297355442ec53c3326283c6062ad457e004013cbcb77cb2bc65c
|
|
| MD5 |
9b42ebf1e9bf51f2174da2a6d2538dc5
|
|
| BLAKE2b-256 |
d71d2bee8cb4debd3e2d25874838f8c12782cb04ef3e566903bb822f82275ba5
|
Provenance
The following attestation bundles were made for lylacore-0.1.3.tar.gz:
Publisher:
release-python.yml on joySUSY/lylacore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lylacore-0.1.3.tar.gz -
Subject digest:
3910d1eaaf20297355442ec53c3326283c6062ad457e004013cbcb77cb2bc65c - Sigstore transparency entry: 1114971672
- Sigstore integration time:
-
Permalink:
joySUSY/lylacore@b45a54356a11813ea4f4522d31d1496a00ea704f -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/joySUSY
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@b45a54356a11813ea4f4522d31d1496a00ea704f -
Trigger Event:
push
-
Statement type:
File details
Details for the file lylacore-0.1.3-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: lylacore-0.1.3-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 308.2 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ce3b6753e61428b0e46abf9f72d4e01ba0f6e8479fe1c0428aac864ae441479
|
|
| MD5 |
0c60cdd69728142e1ed58d0715603011
|
|
| BLAKE2b-256 |
fe960cf1e8f96d6a2b6705db56ac1235d54fc9a7739f386657433dd106dbda5a
|
Provenance
The following attestation bundles were made for lylacore-0.1.3-cp39-abi3-win_amd64.whl:
Publisher:
release-python.yml on joySUSY/lylacore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lylacore-0.1.3-cp39-abi3-win_amd64.whl -
Subject digest:
5ce3b6753e61428b0e46abf9f72d4e01ba0f6e8479fe1c0428aac864ae441479 - Sigstore transparency entry: 1114971682
- Sigstore integration time:
-
Permalink:
joySUSY/lylacore@b45a54356a11813ea4f4522d31d1496a00ea704f -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/joySUSY
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@b45a54356a11813ea4f4522d31d1496a00ea704f -
Trigger Event:
push
-
Statement type:
File details
Details for the file lylacore-0.1.3-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: lylacore-0.1.3-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 334.5 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d6620b8e1fd870555da623bfceb80082af8ff3bf1c6af6ffdf3c84860dbf08f
|
|
| MD5 |
91c8c71964a0638be686ea106143a651
|
|
| BLAKE2b-256 |
32b420e4bf629df86d4391986b5daca115c8fbcc331e9576f1f40b1776f9435a
|
Provenance
The following attestation bundles were made for lylacore-0.1.3-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release-python.yml on joySUSY/lylacore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lylacore-0.1.3-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
3d6620b8e1fd870555da623bfceb80082af8ff3bf1c6af6ffdf3c84860dbf08f - Sigstore transparency entry: 1114971676
- Sigstore integration time:
-
Permalink:
joySUSY/lylacore@b45a54356a11813ea4f4522d31d1496a00ea704f -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/joySUSY
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@b45a54356a11813ea4f4522d31d1496a00ea704f -
Trigger Event:
push
-
Statement type:
File details
Details for the file lylacore-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: lylacore-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 385.5 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
561e3ee00c67a8e8e5311946595ae886f6c5722cb830966de2b15d4965e266b7
|
|
| MD5 |
0c7a390889520b7ff001ab758d648dd2
|
|
| BLAKE2b-256 |
5fff5e4b8f4fc05fd0ff1c779882d78c78d3e5a15baa1c5ffb01226f2ae7686c
|
Provenance
The following attestation bundles were made for lylacore-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release-python.yml on joySUSY/lylacore
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lylacore-0.1.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
561e3ee00c67a8e8e5311946595ae886f6c5722cb830966de2b15d4965e266b7 - Sigstore transparency entry: 1114971677
- Sigstore integration time:
-
Permalink:
joySUSY/lylacore@b45a54356a11813ea4f4522d31d1496a00ea704f -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/joySUSY
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@b45a54356a11813ea4f4522d31d1496a00ea704f -
Trigger Event:
push
-
Statement type: