Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/plugins #56

Merged
merged 1 commit into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 165 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ crate-type = ["cdylib"]

[dependencies]
age-core = "0.10"
age = { version = "0.10", features = ["ssh"] }
age = { version = "0.10", features = ["ssh", "plugin"] }
pyo3 = { version = "0.21", features = [
"extension-module",
"abi3",
Expand Down
6 changes: 3 additions & 3 deletions pyrage-stubs/pyrage-stubs/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Sequence, Union

from pyrage import ssh, x25519, passphrase
from pyrage import ssh, x25519, passphrase, plugin

Identity = Union[ssh.Identity, x25519.Identity]
Recipient = Union[ssh.Recipient, x25519.Recipient]
Identity = Union[ssh.Identity, x25519.Identity, plugin.IdentityPluginV1]
Recipient = Union[ssh.Recipient, x25519.Recipient, plugin.RecipientPluginV1]


class RecipientError(Exception):
Expand Down
48 changes: 48 additions & 0 deletions pyrage-stubs/pyrage-stubs/plugin.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from __future__ import annotations
from typing import Sequence, Self, Optional, Protocol


class Callbacks(Protocol):
def display_message(self, message: str) -> None:
...

def confirm(self, message: str, yes_string: str, no_string: Optional[str]) -> Optional[bool]:
...

def request_public_string(self, description: str) -> Optional[str]:
...

def request_passphrase(self, description: str) -> Optional[str]:
...


class Recipient:
@classmethod
def from_str(cls, v: str) -> Recipient:
...

def plugin(self) -> str:
...


class RecipientPluginV1:
def __new__(cls, plugin_name: str, recipients: Sequence[Recipient], identities: Sequence[Identity], callbacks: Callbacks) -> Self:
...


class Identity:
@classmethod
def from_str(cls, v: str) -> Identity:
...

@classmethod
def default_for_plugin(cls, plugin: str) -> Identity:
...

def plugin(self) -> str:
...


class IdentityPluginV1:
def __new__(cls, plugin_name: str, identities: Sequence[Identity], callbacks: Callbacks) -> Self:
...
Loading