Skip to main content

No project description provided

Project description

keyringrs

A Python binding for keyring-rs.

While keyring is a great tool, it doesn't fully meet our general requirements due to the following reasons:

  • Native Linux Keyutils Support: We need seamless integration with keyutils on Linux.
  • Proper Memory Management on macOS: We perform numerous key queries, and keyring has known memory management issues on macOS (see issue jaraco/keyring #670).

The keyringrs is not plan as the alternative of keyring. For CLI tool and more generic use cases I recommend to go to keyring.

Aside from our specific requirements with macOS and Linux keyutils, this library can serve as a backup solution if there are unresolved issues. While it doesn't guarantee a fix for the problems encountered, it can be a helpful tool to distinguish whether the issue stems from the library itself or from system configuration.

This library aims to maintain API compatibility with keyring-rs as closely as possible. It therefore provide built-in support following platform-specific credential stores inherited from keyring-rs:

  • Linux: The DBus-based Secret Service, the kernel keyutils, and a combo of the two (see below for example on how to control to use only keyutils).
  • FreeBSD, OpenBSD: The DBus-based Secret Service.
  • macOS, iOS: The local keychain.
  • Windows: The Windows Credential Manager.

Installation

To install the package, simply run:

pip install keyringrs

Usage

Here's a quick example of how to use keyringrs:

from keyringrs import Entry

# Create an entry for the given service and username
entry = Entry("my-service", "my-name")

# Set a password
entry.set_password("0Xl$$K6o2bBwDe")

# Retrieve the password
password = entry.get_password()
print(f"My password is '{password}'")

# Delete the credential
entry.delete_credential()

In linux, by default it assume it used in a desktop distro with libdbus installed. For the fallback support to use only keyutils, the key stored will disappear after reboot.

from keyringrs import Entry, CredentialType

# Create an entry use only keyutils in linux
entry = Entry("my-service", "my-name", credential_type=CredentialType.KeyUtils)

This interface follows the same logic as keyring-rs to ensure consistency and ease of use.

tree layout

The repo organized using mixed rust/python layout.

.
├── Cargo.lock
├── Cargo.toml
├── README.md
├── keyringrs
│   └── __init__.py
├── pyproject.toml
├── src
│   └── lib.rs
├── tests
│   └── test_base.py
└── uv.lock

Ack

There was an effort five years ago with pyrust-keyring. However, over the years, keyring-rs has gained more features, become more robust, and slightly diverged from the original keyring library. It would be beneficial to have a proper wrapper for it.

Additionally, pyo3 has significantly improved, making it much easier to create wrappers and distribute the library on PyPI.

Project details


Download files

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

Source Distribution

keyringrs-0.4.0.tar.gz (31.5 kB view details)

Uploaded Source

Built Distributions

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

keyringrs-0.4.0-cp39-abi3-win_amd64.whl (145.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

keyringrs-0.4.0-cp39-abi3-win32.whl (139.5 kB view details)

Uploaded CPython 3.9+Windows x86

keyringrs-0.4.0-cp39-abi3-musllinux_1_2_x86_64.whl (926.0 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

keyringrs-0.4.0-cp39-abi3-musllinux_1_2_i686.whl (951.5 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

keyringrs-0.4.0-cp39-abi3-musllinux_1_2_armv7l.whl (984.6 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARMv7l

keyringrs-0.4.0-cp39-abi3-musllinux_1_2_aarch64.whl (914.5 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

keyringrs-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (755.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

keyringrs-0.4.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (843.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ s390x

keyringrs-0.4.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (809.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ppc64le

keyringrs-0.4.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (722.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARMv7l

keyringrs-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (724.5 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

keyringrs-0.4.0-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl (796.5 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.5+ i686

keyringrs-0.4.0-cp39-abi3-macosx_11_0_arm64.whl (251.5 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

keyringrs-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl (257.5 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file keyringrs-0.4.0.tar.gz.

File metadata

  • Download URL: keyringrs-0.4.0.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.2

File hashes

Hashes for keyringrs-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4474fc294474a9e88746a1e5de3bd7249a9cea8f3668e722c9df7dd2b68cd77b
MD5 733f4079b1bc9124beb29cb750f07c12
BLAKE2b-256 189e6c73d08404518bbe81889dd48ca0494815b9790f031e83ebf382427ba6e0

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: keyringrs-0.4.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 145.8 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.2

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e50fe42a9a12226acd39ff8cd3bbb5b3e5b316f26a3698e9dea445b0a9399fab
MD5 138a1b45ea0fb2bb2b0875e81b1fd9f4
BLAKE2b-256 c6b5ffed5cdc3b6d56d90c84ef97a12569c0f21517c0f59dba4c61b4bd8da737

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-win32.whl.

File metadata

  • Download URL: keyringrs-0.4.0-cp39-abi3-win32.whl
  • Upload date:
  • Size: 139.5 kB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.2

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 531c09db12cb319238a071fd50eaa1f0598de31341a3444a46c385f7f4fe43be
MD5 ae897a21fb75159566e9fd211b7e801a
BLAKE2b-256 2914666630b5a5ff76663ad8e609f44ff02a9cb10b289a5f264af45262082f97

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f4f09bcc1d4fb61cd7c1038150ee9309af3b51f0801c2a8f3a22cc542da0ed77
MD5 c15e4f2bd3fe24b4bbaeaeb1f20efb17
BLAKE2b-256 64f4b4798a08918281d7da3e94295d3e80cbfbc6e66ffbee455252fb58db01e1

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 1fd0f3fca90c4443669966d533a408f211a290e7483b9bf9ac1595cda9bc90dd
MD5 1a7e9094c9b4dc04a25dc81f8042303e
BLAKE2b-256 358f983fb0a4728cb97a8ae418d2da234afcb130ffb8c845d746b802e7ba530e

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 e948c6b3e94ad0ccfe1e7108c20ceb99667b05c1e455733a466fc41be097a02b
MD5 3d05601e065f39d16ed11c0009970662
BLAKE2b-256 f5dfa38e3e63d3755250d9576368d98d4e2a195496f3551c35f9d9a727c53047

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 3be0f3f4e627ce409e233e96dd84dd3564c6eafa2a8b01c7a9b3574a4e0ec7f0
MD5 8b40a8364c061b6eec59fda5184f3e7c
BLAKE2b-256 8603badaed39a93528bb620ee15fc6e4d315b805b8b99af174e45fa5a51caac4

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 75a64e393576310632c9c27bdbfbc75d4d8229453d4323a5255479eb00e300e3
MD5 5fbaabdf2e26f6a19c562673b7d174d5
BLAKE2b-256 33b7b8ae5d763f9902cfb68fe784c8d024b9a265ea4a00fb835448353aa23521

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 067e4df8de97b4958c4c8676a8f53e424889b660fe5968e7360af5265c6c2b0c
MD5 638a2a44f5156f90b87d1ed2cfa535cf
BLAKE2b-256 5c624dc4e976a10bb3619a45ab6f6ae6bc7e3eaa0e4693184b6f7072aaa1e525

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 7d8c86c77fce368e60425313c5993edaa70fec6a51d525834eb663f1fb60e16c
MD5 4d71072c78fa0792d01d71e4dfa8214c
BLAKE2b-256 4c9d49409d37e72c334a6a51d8e5c5ecc5033ac825f1c781836c23f85e29b072

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 07f9fda5c4bf51cadddd4409c2bcfd7db4aa8f42c98e7f1c5125eb7230ba5598
MD5 bb9d372d3635b61d55b99f4a2849a118
BLAKE2b-256 3803fba6a69192bc1054e2785337aedef3798a8c1cc6b7893cadabc8dfcaa3c6

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a50370aac82f10a91365e5ac9be0bb74946ee064741eae9ae235773f9006a7a2
MD5 6e0df73205a8b88542cea51b8121bf48
BLAKE2b-256 77578c16cb0053a5305398161bd8a8b7526a74c652fc2e794504d551b8feb62c

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 ed512b6f344b5550cc9178871f7f94c2b3c931202dce438defcb90b9dff4b289
MD5 a8cb070b51f4c6038e6e140300a04799
BLAKE2b-256 0c84d9c2aca6b1a5ba844d06885bd0611460750514b0e1d75a4cd60c414e4fe4

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ffce9bb7737e83c86b2e0fd3fa868f29a86ad7e275d3853755131d6aadc21a5e
MD5 6f46a4f885d7852391da2264c1b43a55
BLAKE2b-256 a528c49326f4794e3ca839b7e1a4c41f30e6a593131e42560c970195bd639617

See more details on using hashes here.

File details

Details for the file keyringrs-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for keyringrs-0.4.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 942084d562b754eef9ce4f5f84700530059baaa815de1aa9421ee1d9c566484e
MD5 5b7f6d7c5acaa38ad8a3ba1ae28073ed
BLAKE2b-256 1e0719237f4a5886525a1468a71dc860da7ceed6eba11968075db34f5eefd3c6

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