Skip to main content

Crate vectorpin

Crate vectorpin 

Source
Expand description

VectorPin — verifiable integrity for AI embedding stores.

This crate implements protocol version 1 of the VectorPin attestation format. It is bit-for-bit compatible with the Python reference implementation: identical canonical bytes, identical signatures. Compatibility is enforced by shared test vectors that both ports consume in CI.

§Quick start

use vectorpin::{Signer, Verifier};

let signer = Signer::generate("demo".to_string());
let vector: Vec<f32> = vec![1.0, 2.0, 3.0];
let pin = signer.pin("hello", "test-model", vector.as_slice()).unwrap();

let mut verifier = Verifier::new();
verifier.add_key(signer.key_id(), signer.public_key_bytes());

let result = verifier.verify_full::<&[f32]>(
    &pin, Some("hello"), Some(vector.as_slice()), None,
);
assert!(result.is_ok());

Re-exports§

pub use attestation::Pin;
pub use attestation::PinHeader;
pub use attestation::PROTOCOL_VERSION;
pub use hash::canonical_vector_bytes;
pub use hash::hash_text;
pub use hash::hash_vector;
pub use hash::VecDtype;
pub use signer::Signer;
pub use signer::SignerError;
pub use verifier::Verifier;
pub use verifier::VerifyError;

Modules§

attestation
Pin attestation format and canonicalization.
hash
Canonical hashing for source text and embedding vectors.
signer
Pin signing.
verifier
Pin verification.