//! Example of creating a new did:plc identity use atproto_plc::{DidBuilder, ServiceEndpoint, SigningKey}; fn main() -> Result<(), Box> { println!("Creating a new did:plc identity...\n"); // Create rotation keys (1-5 required) println!("Generating rotation key (P-256)..."); let rotation_key = SigningKey::generate_p256(); let rotation_did_key = rotation_key.to_did_key(); println!(" Rotation key: {}\n", rotation_did_key); // Create verification method for AT Protocol println!("Generating verification method key (secp256k1)..."); let signing_key = SigningKey::generate_k256(); let signing_did_key = signing_key.to_did_key(); println!(" Signing key: {}\n", signing_did_key); // Build the DID println!("Building DID..."); let builder = DidBuilder::new() .add_rotation_key(rotation_key) .add_verification_method("atproto".into(), signing_key) .add_also_known_as("at://alice.example.com".into()) .add_service( "atproto_pds".into(), ServiceEndpoint::new( "AtprotoPersonalDataServer".into(), "https://pds.example.com".into(), ), ); let (did, operation, keys) = builder.build()?; println!("\n✅ Success! Created DID: {}", did); println!("\nGenesis Operation:"); println!("{}", serde_json::to_string_pretty(&operation)?); println!("\n📝 Keys Summary:"); println!(" - Rotation keys: {}", keys.rotation_keys.len()); println!( " - Verification methods: {}", keys.verification_methods.len() ); println!("\n⚠️ Important: Store these keys securely!"); println!(" The private keys are needed to update or recover this DID."); Ok(()) }