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.3.1.tar.gz (31.2 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.3.1-cp39-abi3-win_amd64.whl (145.6 kB view details)

Uploaded CPython 3.9+Windows x86-64

keyringrs-0.3.1-cp39-abi3-win32.whl (139.1 kB view details)

Uploaded CPython 3.9+Windows x86

keyringrs-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl (923.1 kB view details)

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

keyringrs-0.3.1-cp39-abi3-musllinux_1_2_i686.whl (948.6 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

keyringrs-0.3.1-cp39-abi3-musllinux_1_2_armv7l.whl (977.1 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARMv7l

keyringrs-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl (911.7 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

keyringrs-0.3.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (755.3 kB view details)

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

keyringrs-0.3.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (844.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ s390x

keyringrs-0.3.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (809.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ppc64le

keyringrs-0.3.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (722.4 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARMv7l

keyringrs-0.3.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (724.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

keyringrs-0.3.1-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl (796.9 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.5+ i686

keyringrs-0.3.1-cp39-abi3-macosx_11_0_arm64.whl (251.3 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

keyringrs-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl (257.3 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for keyringrs-0.3.1.tar.gz
Algorithm Hash digest
SHA256 69dfac4fa13dfba0669176fee2089dd7b4ee6ec60cbc85664d283d9d09da8007
MD5 eac81a3b1f2425697a5b4a02b460c824
BLAKE2b-256 7b02101d322ed2f72866c420e75d45c60a5c10ae4d096af5b74e6ab9c3c6ff46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: keyringrs-0.3.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 145.6 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.3.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 71e8f11da96f86d2bfe26f935506331d4eaac0c0552f87fe50dbca227bad6dfe
MD5 d7ccccd03bb087a8b3447df4c8751ead
BLAKE2b-256 1c87031dd0749f57d4c8911b7f9b83b39331dc0157270aca225c37bd9232be78

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 c2649f869d70aa934da9251701746f395128413a309ea44d92a12b6888b5b081
MD5 b9b3d5cc1dbf1508281d7ba5c26633e5
BLAKE2b-256 37f12a73822028601d784e64f08ab307f8628ed7a964d36c422c87987ce6c4da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5abe63db3d10783b109af30c62ecc60b2e71d307e4082f328d6eac80ac2ff642
MD5 fed757f325090751dfc07d43078e192d
BLAKE2b-256 55a08443ab6f97a61e5f8bec55bf91e01de274027e2c0d9846a1ddac9f51a443

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 b693215506331d0f7ba8f35e47b9509d90a0378cc3fb2de146a3b38030ca501d
MD5 7f9760b5af75a1de57dd77ce127e872c
BLAKE2b-256 228755354598078a8beec867a71dd90eb096de81932f2df42a519a90e9e84464

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 0d92dc98e9b5dc172186ed254b650a2dd594f4e43fe18e44033e6ec8fc480c51
MD5 8a2dbac39f545ba48f7ad2a6cc329cff
BLAKE2b-256 d225b77b10eba4155e66699ba5a0079aba3175bbf17f7b40bc668d7b0430d163

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 da2a20e72f62386cade15f7aaa95477514deac66908bb159952aea666f4db43b
MD5 b62d24984f87b0199aac71b1c2e82d10
BLAKE2b-256 a4222bd8fec031d3565eeaa86c098f08bbf9474d2496ba796bdbb67bf663aed6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b31ee3c714722e233ba2746ef6eadbea81242deb0ceb206512defe99d39c626
MD5 2f85af2d4a2b2452399ae5302eb84f84
BLAKE2b-256 2e3eb0ceaf0a9e72d83aa409d25620cae97a4f211f0f0c9c8ad0869766a08298

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 f2f28534d0b183db7c7d31ebfc33ede6d88913f39ca58c23f363574fa5ecfad5
MD5 16e490b7fb271493107b542dd64484af
BLAKE2b-256 86b3a3d4ca80cb01c2cd981d7cf5ff7e0b356c72bbfd387da74555d8014ad7df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 55d2ae07a136a97fce3d0bc8d85ca10dd302a382e9dedabf7abae70e8a73df9a
MD5 f7187cdce6df575844c67e1c3b5f6f06
BLAKE2b-256 69392e9ecf9c90f0e0b10862e7dba1f05969600a44f326afec078f0d7c5f4d44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 9a201c00f568ff7fe2fd6f039c3b08e17b22863f2bbae1e83e93746125a42593
MD5 bc4bcb645c0cc08698efa38a4521023d
BLAKE2b-256 fc9f3f9c8f2441741569dfdf17ae0c5a276923459254d47e47bdbd8dba20c093

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 71e704a6f089452febd6e3adb7758193bd7c604d98b5fb7cea64693e0ea82b4d
MD5 cab0aba9b2c8344533dc8c42c940d755
BLAKE2b-256 36d218178e0a151b99e257e5be7611b9e2cb0ee7d84191bed22e5453c5e90432

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 62b32275fa19b9f7ebfda61ff8308204fdccd03789cea1919562b93f99f202f3
MD5 b5eb463b9c931d0c1e1904d9d98bbb5c
BLAKE2b-256 d54442e08e53ef7d3ab219173bf7580ee31e7a7ff93ac8ce7765bb4af01eb0fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4191beecb1b26f068b3a2f6b12d4704935f0756998ef0ad6a4db8cd35f9fcd5f
MD5 57a10792b8d0cf7b7b7dfa5075a9679f
BLAKE2b-256 f4da871cc245cb506da6222b9b097235b701851f79a57fe94d9662072fd0fb34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for keyringrs-0.3.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 537fa8978e8163164fc4ad1a3580e94ee4f291ca51059dafbbdc8e0fca7e9f4e
MD5 c97fd894ea02ce28162ebfad2518d923
BLAKE2b-256 7f0159de08839c466870133b9901dd214f82c9bd2ff74403826724544f1b801c

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