Skip to content

Commit

Permalink
Merge pull request #7 from castedo/pr/package_allowed_signers
Browse files Browse the repository at this point in the history
move allowed_signers from compat into package
  • Loading branch information
castedo authored Jan 7, 2025
2 parents 5f92001 + 1c88e9f commit 3997ad1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
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

0 comments on commit 3997ad1

Please sign in to comment.