Workshop 4: Identity and Trust Hands-On
Goal
Practice creating identities, understanding the keystore, and exploring trust graph operations.
Prerequisites
- Completed Module 4 reading
- ICN binaries built (
cargo build --release)
Estimated time
2-3 hours
Part 1: Create and Inspect an Identity
Steps
Create a temporary data directory:
export ICN_DATA=$(mktemp -d) export ICN_PASSPHRASE="workshop-test-passphrase"Initialize a new identity:
./target/release/icnctl --data-dir "$ICN_DATA" id initShow the identity:
./target/release/icnctl --data-dir "$ICN_DATA" id show
Expected output
You should see:
- A DID in the format
did:icn:<base58-public-key> - The public key fingerprint
- Keystore version information
Questions to answer
- What cryptographic algorithm is used for the keypair?
- Where is the encrypted keystore file stored?
- What happens if you run
id showwithout settingICN_PASSPHRASE?
Checkpoint
- You created a new identity successfully
- You can explain the DID format
Part 2: Explore the Keystore Code
Steps
- Open
icn/crates/icn-identity/src/keystore.rs - Find the
KeyStoretrait definition - Locate the encryption implementation
Questions to answer
- What encryption scheme is used for the keystore?
- What is the purpose of the
lock()method? - How does the code handle invalid passphrases?
Code snippet to find
Look for the Age encryption usage:
// The keystore uses Age encryption
let encryptor = age::Encryptor::with_user_passphrase(...);
Checkpoint
- You found the encryption implementation
- You can explain the security boundary the keystore provides
Part 3: Identity Bundle Deep Dive
Steps
- Open
icn/crates/icn-identity/src/bundle.rs - Find the
IdentityBundlestruct - Trace how the TLS binding signature is created
Questions to answer
- What does
tls_binding_sigprove? - Why is the TLS cert bound to the DID key?
- What happens during key rotation?
Checkpoint
- You understand DID-TLS binding
- You can explain why binding is important for transport security
Part 4: Trust Graph Exploration
Steps
- Open
icn/crates/icn-trust/src/types.rs - List all
TrustGraphTypevariants - Open
icn/crates/icn-trust/src/lib.rs - Find the methods for adding/querying trust edges
Expected findings
Trust graph types:
- Social: relationships between members
- EconomicReliability: payment history, creditworthiness
- TechnicalReliability: uptime, network behavior
Questions to answer
- Why are trust dimensions modeled separately?
- How would a "well-known partner" differ from a "new member" in trust scores?
- What is transitive trust and how is it computed?
Checkpoint
- You can list all trust dimensions
- You understand why dimensions are independent
Part 5: Trust-Gated Rate Limiting
Steps
Search for rate limit usage in the codebase:
grep -r "rate_limit" icn/crates/ --include="*.rs" | head -20Find where trust class determines rate limits
Map trust levels to their rate limits:
| Trust Class | Trust Score Range | Rate Limit |
|---|---|---|
| Isolated | < 0.1 | ? msg/sec |
| Known | 0.1 - 0.4 | ? msg/sec |
| Partner | 0.4 - 0.7 | ? msg/sec |
| Federated | > 0.7 | ? msg/sec |
Expected values
From docs/security/production-hardening.md:
- Isolated: 10 msg/sec
- Known: 50 msg/sec
- Partner: 100 msg/sec
- Federated: 200 msg/sec
Checkpoint
- You found the trust-gated rate limiting code
- You understand how trust influences system access
Part 6: Key Rotation Exercise
Steps
Using your test identity from Part 1, rotate the key:
./target/release/icnctl --data-dir "$ICN_DATA" id rotateShow the identity again:
./target/release/icnctl --data-dir "$ICN_DATA" id show
Questions to answer
- Did the DID change after rotation?
- What happens to old signatures after rotation?
- Where is the key history stored?
Checkpoint
- You successfully rotated a key
- You understand the implications of key rotation
Cleanup
Remove the temporary data directory:
rm -rf "$ICN_DATA"
Summary
After completing this workshop you should be able to:
- Create and manage ICN identities via CLI
- Navigate the keystore and bundle code
- Understand trust graph dimensions and their purposes
- Explain how trust influences system behavior
Troubleshooting
"Failed to unlock keystore"
Ensure ICN_PASSPHRASE environment variable is set correctly.
"Keystore not found"
The --data-dir path must match where you initialized the identity.
"Permission denied"
Check file permissions on the data directory.
Next steps
Proceed to Module 5: Network and Gossip