Skip to main content

SwiftKeychain

macOS Keychain access from Python — powered by Swift & ApplePy.

macOS only — requires Swift 6.0+ toolchain

Install

pip install -e .

This compiles the embedded Swift code and installs the Python package.

Usage

import swiftkeychain as kc

# Store & retrieve passwords
kc.set_password("myapp", "user@email.com", "s3cret")
pw = kc.get_password("myapp", "user@email.com")

# List all accounts for a service
accounts = kc.find_passwords("myapp")

# Internet passwords
kc.set_internet_password("api.example.com", "bot", "token", "https", "/v1")
pw = kc.get_internet_password("api.example.com", "bot")

# Delete
kc.delete_password("myapp", "user@email.com")

API

Function Returns Description
set_password(service, account, password) None Store a generic password
get_password(service, account) str | None Retrieve a password
delete_password(service, account) bool Delete a password
find_passwords(service) list[str] List accounts for a service
set_internet_password(server, account, password, protocol, path) None Store an internet password
get_internet_password(server, account) str | None Retrieve an internet password

Examples

See swiftkeychain/examples/demo.py for a full demo.

License

BSD-3-Clause © Jagtesh Chadha — see LICENSE.

Metadata

Release files for swiftkeychain 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for swiftkeychain 0.4.0
File Size Uploaded Provenance Actions
swiftkeychain-0.4.0.tar.gz 8.8 kB Without provenance Details for swiftkeychain-0.4.0.tar.gz

Release files / swiftkeychain-0.4.0.tar.gz

Download URL swiftkeychain-0.4.0.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9e7ad0c0c91824302025c6adb67133d658b450c6f765c833f95a5972631ca438
BLAKE2b-256 checksum
How to use checksums
22b56204c6f2069856670cb8ca625083060d6e3aca516a914bc8c58e011c20ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Security for swiftkeychain 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page