Module jose

Module jose 

Source
Expand description

DAG-JOSE codec for encrypted and signed IPLD data

This module provides support for DAG-JOSE, which combines IPLD with:

  • JWS (JSON Web Signature) for signing data
  • JWE (JSON Web Encryption) for encrypting data

§Features

  • Sign IPLD data with Ed25519, RS256, or other algorithms
  • Verify signed IPLD data
  • Create content-addressed signed documents
  • Integration with IPLD DAG structures

§Example - Signing Data

use ipfrs_core::jose::{JoseBuilder, JoseSignature};
use ipfrs_core::Ipld;

// Create some IPLD data
let data = Ipld::String("Hello, IPFS!".to_string());

// Sign the data (using a mock key for this example)
let secret = b"your-secret-key-min-32-bytes-long!!";
let jose = JoseBuilder::new()
    .with_payload(data)
    .sign_hs256(secret)
    .unwrap();

// Verify the signature
let verified = jose.verify_hs256(secret).unwrap();
assert!(verified);

Structs§

JoseBuilder
Builder for creating DAG-JOSE signatures
JoseSignature
DAG-JOSE signature wrapper for IPLD data