Skip to main content

derivepassphrase-sshagentsocketprovider

PyPI - Version PyPI - Python Version

An interface for SSH agent socket providers, which expose an abstract communication channel for an SSH agent to derivepassphrase.

This package contains only the interface definition and the types involved.


Installation

derivepassphrase-sshagentsocketprovider is a pure Python package, and may be easily installed with any pip-compatible Python package manager such as pip, pipx, or uv. (pip is distributed with Python 3 by default.)

derivepassphrase-sshagentsocketprovider requires Python 3.9 or higher, as well as the typing-extensions package.

pip install derivepassphrase-sshagentsocketprovider

Registering an SSH agent socket provider

The SSHAgentSocket represents the abstract communication channel to an SSH agent. Ensure that the abstract channel behaves like a socket with respect to the sendall and recv operations. The abstract channel must also be a context manager, which closes itself upon leaving the context, causing further sendall and recv operations to raise an error. (By convention, this is OSError, with errno.EBADF.)

The SSHAgentSocketProvider is a callable that returns an SSHAgentSocket when called without arguments.

To then actually register an SSH agent socket provider, build an SSHAgentSocketProviderEntry struct. For example:

# The class is an SSHAgentSocket and has an empty constructor, so the
# constructor is a valid SSHAgentSocketProvider.
class SSHAgentOverStdinStdoutSocket:
    """Forwarding STDIN/STDOUT, as if connected to an SSH agent."""

    FLAGS_ARE_UNSUPPORTED = "flags argument is unsupported"
    """Common error message."""

    def __enter__(self) -> Self:
        """Return self."""
        return self

    def __exit__(self, *args: object) -> bool | None:
        """Close stdin/stdout."""
        sys.stdin.close()
        sys.stdout.close()
        return None

    def send(self, data: Buffer, flags: int = 0, /) -> None:
        """Send data to agent."""
        if flags:
            raise ValueError(self.FLAGS_ARE_UNSUPPORTED)
        sys.stdout.buffer.write(data)

    def recv(self, bufsize: int, flags: int = 0, /) -> bytes:
        """Receive data from agent."""
        if flags:
            raise ValueError(self.FLAGS_ARE_UNSUPPORTED)
        return sys.stdin.buffer.read(bufsize)


ENTRY_POINT = SSHAgentSocketProviderEntry(
    provider=SSHAgentOverStdinStdoutSocket,
    key="stdin_stdout",
    aliases=("stdin", "stdout"),
)

Then add an appropriate entry point definition in your pyproject.toml, using the entry point group name derivepassphrase.ssh_agent_socket_providers:

[project.entry."derivepassphrase.ssh_agent_socket_providers"]
first_provider = "mymodule: ENTRY_POINT"

derivepassphrase will then pick up stdin_stdout as a new SSH agent socket provider, with aliases stdin and stdout.1

(See the tests and the test data for two further examples.)

License

Like derivepassphrase, derivepassphrase-sshagentsocketprovider is distributed under the terms of the zlib/libpng license.

  1. Only the fields in the SSHAgentSocketProviderEntry matter, not what names are used to declare the entry point. By convention, however, you would choose stdin_stdout as the entry point name, not first_provider. ↩

Metadata

Release files for derivepassphrase-sshagentsocketprovider 1.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 derivepassphrase-sshagentsocketprovider 1.0
File Size Uploaded Provenance
derivepassphrase_sshagentsocketprovider-1.0.tar.gz 8.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for derivepassphrase-sshagentsocketprovider 1.0
File Interpreter ABI Platform
derivepassphrase_sshagentsocketprovider-1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.1 kB

Release files / derivepassphrase_sshagentsocketprovider-1.0.tar.gz

Download URL derivepassphrase_sshagentsocketprovider-1.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5bcfb4152e7dee750b204fd49dd417c4e5d73da4268df3359d6958b817db4126
BLAKE2b-256 checksum
How to use checksums
4227513ab8d7a487361f4a9f28b4dd266f3ca8df804a7780edd95d4e71af253f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.0 {"ci":null,"cpu":"x86_64","distro":{"id":"forky","libc":{"lib":"glibc","version":"2.42"},"name":"Debian GNU/Linux","version":"n/a"},"implementation":{"name":"CPython","version":"3.13.12"},"installer":{"name":"hatch","version":"1.18.0"},"openssl_version":"OpenSSL 3.6.2 7 Apr 2026","python":"3.13.12","system":{"name":"Linux","release":"7.0.7+deb14-amd64"}} HTTPX2/2.12.0

Release files / derivepassphrase_sshagentsocketprovider-1.0-py3-none-any.whl

Download URL derivepassphrase_sshagentsocketprovider-1.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70d789725ae696547ab453597827c6346a4fa3d1096af9058f655328371f67cc
BLAKE2b-256 checksum
How to use checksums
42c3357bade2ed359a2e475dc06c5288c0bf20eca105798461fc01a4e07c65e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.0 {"ci":null,"cpu":"x86_64","distro":{"id":"forky","libc":{"lib":"glibc","version":"2.42"},"name":"Debian GNU/Linux","version":"n/a"},"implementation":{"name":"CPython","version":"3.13.12"},"installer":{"name":"hatch","version":"1.18.0"},"openssl_version":"OpenSSL 3.6.2 7 Apr 2026","python":"3.13.12","system":{"name":"Linux","release":"7.0.7+deb14-amd64"}} HTTPX2/2.12.0

Security for derivepassphrase-sshagentsocketprovider 1.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.

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files No provenance

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