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.

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
swiftkeychain-0.4.0.tar.gz 8.8 kB Details

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

Release history Release notifications | RSS feed

This release

0.4.0 This release

1 release file

0.3.0

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

2 release files

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