Skip to content

Commit

Permalink
feat: print identity and provider during signing (#52)
Browse files Browse the repository at this point in the history
* print identity and providr during signing

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* fix linter

Signed-off-by: laurentsimon <laurentsimon@google.com>

---------

Signed-off-by: laurentsimon <laurentsimon@google.com>
  • Loading branch information
laurentsimon authored Oct 25, 2023
1 parent b83aee8 commit ac26cbf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions model_signing/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
)
from sigstore._internal.oidc import (
DEFAULT_AUDIENCE,
Identity
)
from sigstore.oidc import (
Issuer,
Expand All @@ -37,6 +38,7 @@
from typing import Optional
from serialize import Serializer
import psutil
import sys


def chunk_size() -> int:
Expand Down Expand Up @@ -103,6 +105,12 @@ def sign(self, inputfn: Path, signaturefn: Path,
if not token:
raise ValueError("No identity token supplied or detected!")

# Print identity used to sign the model.
oidc_identity = Identity(token)
print(f"identity-provider: {oidc_identity.issuer}",
file=sys. stderr)
print(f"identity: {oidc_identity.proof}", file=sys. stderr)

contentio = io.BytesIO(Serializer.serialize_v1(
inputfn, chunk_size(), signaturefn, ignorepaths))
result = self.signer.sign(input_=contentio, identity_token=token)
Expand Down

0 comments on commit ac26cbf

Please sign in to comment.