pub struct DevSigner { /* private fields */ }Expand description
A persistent ECDSA P-256 / cosign-scheme signer. Holds one key pair; the same key signs
both a filter component and its SBOM, matching a TrustPolicy that trusts exactly that key.
Implementations§
Source§impl DevSigner
impl DevSigner
Sourcepub fn generate() -> Result<(DevSigner, Zeroizing<String>), DevKeyError>
pub fn generate() -> Result<(DevSigner, Zeroizing<String>), DevKeyError>
Generate a fresh key pair. Returns the ready-to-use signer plus the PKCS8 PEM private
key, so the caller decides whether to persist it (load_or_create) or sign once and
drop it (an ephemeral self-signed conformance check, no file ever written).
Sourcepub fn from_private_key_pem(pem: &[u8]) -> Result<DevSigner, DevKeyError>
pub fn from_private_key_pem(pem: &[u8]) -> Result<DevSigner, DevKeyError>
Rebuild from a previously persisted PKCS8 PEM private key. The elliptic curve is detected from the key’s own OID (sigstore-rs), so this works for any dev key this module has ever generated.
Sourcepub fn load_or_create(private_key_path: &Path) -> Result<DevSigner, DevKeyError>
pub fn load_or_create(private_key_path: &Path) -> Result<DevSigner, DevKeyError>
Load the key at private_key_path, generating and persisting a fresh one on first use.
The private key is written 0600 (owner read/write only); the matching public key is
written alongside at <private_key_path>.pub, prefixed with DEV_KEY_MARKER.
Does NOT touch .gitignore — that is the CLI caller’s job (it knows the project root;
this function only knows the one key path it was given).
Sourcepub fn sign(&self, msg: &[u8]) -> Result<Vec<u8>, DevKeyError>
pub fn sign(&self, msg: &[u8]) -> Result<Vec<u8>, DevKeyError>
Raw DER ECDSA signature over msg (the shape SignedArtifact expects).
pub fn public_key_pem(&self) -> &str
Sourcepub fn trust_policy(&self) -> Result<TrustPolicy, DevKeyError>
pub fn trust_policy(&self) -> Result<TrustPolicy, DevKeyError>
A TrustPolicy that trusts exactly this signer’s key.
Auto Trait Implementations§
impl Freeze for DevSigner
impl RefUnwindSafe for DevSigner
impl Send for DevSigner
impl Sync for DevSigner
impl Unpin for DevSigner
impl UnsafeUnpin for DevSigner
impl UnwindSafe for DevSigner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more