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

move allowed_signers from compat into package #7

Merged
merged 1 commit into from
Jan 7, 2025
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
1 change: 0 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Docs
on:
push:
branches: [main]
pull_request:

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
# and committing generated baseprint snapshot to autobaseprint branch
Expand Down
3 changes: 1 addition & 2 deletions compat/ssh_keygen.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from typing import BinaryIO

from sshsig import InvalidSignature, check_signature, verify

from .allowed_signers import load_for_git_allowed_signers_file
from sshsig.allowed_signers import load_for_git_allowed_signers_file


def cli_subcmd_check_novalidate(
Expand Down
8 changes: 6 additions & 2 deletions compat/allowed_signers.py → sshsig/allowed_signers.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# (c) 2024 E. Castedo Ellerman <[email protected]>
# Released under the MIT License (https://spdx.org/licenses/MIT)

"""Parsing of the ssh-keygen allowed signers format."""

from __future__ import annotations

from collections.abc import Iterable
from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, TextIO

from sshsig import PublicKey
from .ssh_public_key import PublicKey


if TYPE_CHECKING:
Expand Down Expand Up @@ -171,7 +173,9 @@ def load_for_git_allowed_signers_file(file: TextIO | Path) -> Iterable[PublicKey
return for_git_allowed_keys(load_allowed_signers_file(file))


def save_for_git_allowed_signers_file(src: set[PublicKey], out: Path | TextIO) -> None:
def save_for_git_allowed_signers_file(
src: Iterable[PublicKey], out: Path | TextIO
) -> None:
"""Save keys for git to "allowed signers" format per ssh-keygen."""

if isinstance(out, Path):
Expand Down
3 changes: 1 addition & 2 deletions tests/test_allowed_signers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
from unittest import TestCase

from sshsig import PublicKey

from compat.allowed_signers import AllowedSigner, load_allowed_signers_file
from sshsig.allowed_signers import AllowedSigner, load_allowed_signers_file


TESTDATA_DIR = Path(__file__).parent.parent / "testdata"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sshsig.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from unittest import TestCase

from sshsig import sshsig
from sshsig.allowed_signers import load_for_git_allowed_signers_file

from compat import ssh_keygen
from compat.allowed_signers import load_for_git_allowed_signers_file


TESTDATA_DIR = Path(__file__).parent.parent / "testdata"
Expand Down
Loading