Skip to main content

macOS Keychain access from Python — powered by Swift & ApplePy

Project description

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.

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

swiftkeychain-0.2.0.tar.gz (82.1 kB view details)

Uploaded Source

File details

Details for the file swiftkeychain-0.2.0.tar.gz.

File metadata

  • Download URL: swiftkeychain-0.2.0.tar.gz
  • Upload date:
  • Size: 82.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for swiftkeychain-0.2.0.tar.gz
Algorithm Hash digest
SHA256 00a1ca8d22600900a68c4d21c845a3a5a2f24b1e08d784d3acdf30386bc0863e
MD5 b27ba6300f3b97e99e33e89a054e34e8
BLAKE2b-256 3ab78ee729e632c4e52f41d3038eefffae77e86096c46dd34eebcea221e8e762

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