atproto-record
A Rust library for AT Protocol record signature operations, providing cryptographic signing and verification capabilities for AT Protocol records.
Overview
This crate provides functionality for:
- Record Signing: Create cryptographic signatures for AT Protocol records
- Signature Verification: Verify existing signatures against records and public keys
- Error Handling: Structured error types for signature operations
- Multi-curve Support: Support for P-256 and K-256 elliptic curves via
atproto-identity
Features
- Create signatures for AT Protocol records with proper
$sigobject handling - Required signature object validation (must include
issuerandissued_atfields) - Verify record signatures against issuer public keys
- IPLD DAG-CBOR serialization for consistent signature generation
- Multibase encoding for signature representation
- Integration with
atproto-identityfor cryptographic key operations - Repository and collection context support in signature objects
- Comprehensive error handling with structured error types including creation and verification errors
Usage
Creating Signatures
use signature;
use ;
use json;
use VerificationError;
# async
Verifying Signatures
use signature;
use identify_key;
use VerificationError;
# async
Modules
- [
signature] - Core signature creation and verification functions - [
errors] - Structured error types for signature operations
Error Handling
The crate uses structured error types defined in the errors module:
use VerificationError;
use json;
// Example error handling for signature creation
let signature_object = json!;
match create.await
// Example error handling for signature verification
match verify.await
Dependencies
This crate builds on:
atproto-identity- Cryptographic key operations and DID resolutionserde_ipld_dagcbor- IPLD DAG-CBOR serialization for signature contentmultibase- Base encoding for signature representationserde_json- JSON handling for AT Protocol recordsanyhow- Error handling utilitiesthiserror- Structured error type derivation
License
Licensed under the MIT License.