pyrage
======
[![CI](https://github.com/woodruffw/pyrage/actions/workflows/ci.yml/badge.svg)](https://github.com/woodruffw/pyrage/actions/workflows/ci.yml)
[![PyPI version](https://badge.fury.io/py/pyrage.svg)](https://badge.fury.io/py/pyrage)
Python bindings for the [Rust implementation of `age`](https://github.com/str4d/rage).
## Index
* [Installation](#installation)
* [Usage](#usage)
* [Development](#development)
* [Licensing](#licensing)
## Installation
You can install `pyrage` with `pip`:
```console
$ python -m pip install pyrage
```
[PEP 561](https://peps.python.org/pep-0561/)-style type stubs are also available:
```console
$ python -m pip install pyrage-stubs
```
See the [development instructions](#development) below for manual installations.
## Usage
### Identity generation (x25519 only)
```python
from pyrage import x25519
ident = x25519.Identity.generate()
# returns the public key
ident.to_public()
# returns the private key
str(ident)
```
### Identity-based encryption and decryption
```python
from pyrage import encrypt, decrypt, ssh, x25519
# load some identities
alice = x25519.Identity.from_str("AGE-SECRET-KEY-...")
bob = ssh.Identity.from_buffer(b"---BEGIN OPENSSH PRIVATE KEY----...")
# load some recipients
carol = x25519.Recipient.from_str("age1z...")
dave = ssh.Recipient.from_str("ssh-ed25519 ...")
# encryption
encrypted = encrypt(b"bob can't be trusted", [carol, dave, alice.to_public()])
# decryption
decrypted = decrypt(encrypted, [alice, bob])
```
### Passphrase encryption and decryption
```python
from pyrage import passphrase
encrypted = passphrase.encrypt(b"something secret", "my extremely secure password")
decrypted = passphrase.decrypt(encrypted, "my extremely secure password")
```
## Development
```console
$ source env/bin/activate
$ make develop
```
## Licensing
`pyrage` is released and distributed under the terms of the [MIT License](./LICENSE).
Raw data
{
"_id": null,
"home_page": "https://github.com/woodruffw/pyrage",
"name": "pyrage",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "William Woodruff <william@yossarian.net>",
"author_email": "William Woodruff <william@yossarian.net>",
"download_url": "https://files.pythonhosted.org/packages/6b/d6/5f40ede2378758bb9746cb40089008a447e08bfb4b19079b9dbae3ff44f7/pyrage-1.2.3.tar.gz",
"platform": null,
"description": "pyrage\n======\n\n[![CI](https://github.com/woodruffw/pyrage/actions/workflows/ci.yml/badge.svg)](https://github.com/woodruffw/pyrage/actions/workflows/ci.yml)\n[![PyPI version](https://badge.fury.io/py/pyrage.svg)](https://badge.fury.io/py/pyrage)\n\nPython bindings for the [Rust implementation of `age`](https://github.com/str4d/rage).\n\n## Index\n\n* [Installation](#installation)\n* [Usage](#usage)\n* [Development](#development)\n* [Licensing](#licensing)\n\n## Installation\n\nYou can install `pyrage` with `pip`:\n\n```console\n$ python -m pip install pyrage\n```\n\n[PEP 561](https://peps.python.org/pep-0561/)-style type stubs are also available:\n\n```console\n$ python -m pip install pyrage-stubs\n```\n\nSee the [development instructions](#development) below for manual installations.\n\n## Usage\n\n### Identity generation (x25519 only)\n\n```python\nfrom pyrage import x25519\n\nident = x25519.Identity.generate()\n\n# returns the public key\nident.to_public()\n\n# returns the private key\nstr(ident)\n```\n\n### Identity-based encryption and decryption\n\n```python\nfrom pyrage import encrypt, decrypt, ssh, x25519\n\n# load some identities\nalice = x25519.Identity.from_str(\"AGE-SECRET-KEY-...\")\nbob = ssh.Identity.from_buffer(b\"---BEGIN OPENSSH PRIVATE KEY----...\")\n\n# load some recipients\ncarol = x25519.Recipient.from_str(\"age1z...\")\ndave = ssh.Recipient.from_str(\"ssh-ed25519 ...\")\n\n# encryption\nencrypted = encrypt(b\"bob can't be trusted\", [carol, dave, alice.to_public()])\n\n# decryption\ndecrypted = decrypt(encrypted, [alice, bob])\n```\n\n### Passphrase encryption and decryption\n\n```python\nfrom pyrage import passphrase\n\nencrypted = passphrase.encrypt(b\"something secret\", \"my extremely secure password\")\ndecrypted = passphrase.decrypt(encrypted, \"my extremely secure password\")\n```\n\n## Development\n\n```console\n$ source env/bin/activate\n$ make develop\n```\n\n## Licensing\n\n`pyrage` is released and distributed under the terms of the [MIT License](./LICENSE).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python bindings for rage (age in Rust)",
"version": "1.2.3",
"project_urls": {
"Homepage": "https://github.com/woodruffw/pyrage",
"Source Code": "https://github.com/woodruffw/pyrage"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3f35efbd61ce99ec38d4c384d3ca5fb8f5dcbf12ad466071e7edf64cce5b47d1",
"md5": "75c35247769bf7289f276e7890f7eb5c",
"sha256": "49891edc629b7c409d643feb0356daca241f936cad1373dd79895985522de42a"
},
"downloads": -1,
"filename": "pyrage-1.2.3-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl",
"has_sig": false,
"md5_digest": "75c35247769bf7289f276e7890f7eb5c",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 1670760,
"upload_time": "2024-12-19T01:43:02",
"upload_time_iso_8601": "2024-12-19T01:43:02.203352Z",
"url": "https://files.pythonhosted.org/packages/3f/35/efbd61ce99ec38d4c384d3ca5fb8f5dcbf12ad466071e7edf64cce5b47d1/pyrage-1.2.3-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ae5127a42a28aae6500fe7dcd549a6fa6690738e994726bd41e1b62a3cffa19b",
"md5": "c03b772aa639b621b0c2b9927e6af4c6",
"sha256": "c5f9bb50b881b80cdd311eeff2c7b7b5aa5fa034f874651f471bce8ecc40681e"
},
"downloads": -1,
"filename": "pyrage-1.2.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "c03b772aa639b621b0c2b9927e6af4c6",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 944020,
"upload_time": "2024-12-19T01:43:05",
"upload_time_iso_8601": "2024-12-19T01:43:05.829416Z",
"url": "https://files.pythonhosted.org/packages/ae/51/27a42a28aae6500fe7dcd549a6fa6690738e994726bd41e1b62a3cffa19b/pyrage-1.2.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "22de365c16ada85816f191ecc4cedd8123fae920fecdb8f8b7783238fea50456",
"md5": "260e19cc437adfb52cc5d6c2b41b1e0e",
"sha256": "2e174a903c9ba715c9cca401e75497154c9533c6a19e5fa3fa4ee21b47961a83"
},
"downloads": -1,
"filename": "pyrage-1.2.3-cp39-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "260e19cc437adfb52cc5d6c2b41b1e0e",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 733335,
"upload_time": "2024-12-19T01:43:07",
"upload_time_iso_8601": "2024-12-19T01:43:07.612845Z",
"url": "https://files.pythonhosted.org/packages/22/de/365c16ada85816f191ecc4cedd8123fae920fecdb8f8b7783238fea50456/pyrage-1.2.3-cp39-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6bd65f40ede2378758bb9746cb40089008a447e08bfb4b19079b9dbae3ff44f7",
"md5": "e675c8d20b5012b29a4a03a78a864ade",
"sha256": "a8a1267edb962d13a1db1e0f8e03249568c6eab1d109a4d83b2d5a1c8613c98b"
},
"downloads": -1,
"filename": "pyrage-1.2.3.tar.gz",
"has_sig": false,
"md5_digest": "e675c8d20b5012b29a4a03a78a864ade",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 28715,
"upload_time": "2024-12-19T01:43:11",
"upload_time_iso_8601": "2024-12-19T01:43:11.447038Z",
"url": "https://files.pythonhosted.org/packages/6b/d6/5f40ede2378758bb9746cb40089008a447e08bfb4b19079b9dbae3ff44f7/pyrage-1.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-19 01:43:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "woodruffw",
"github_project": "pyrage",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyrage"
}