MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / signer_test_store

Function signer_test_store

atomic-agent/src/identity.rs:911–943  ·  view source on GitHub ↗

Test fixture: a store holding a human default identity (with key) and a delegated agent identity (with key).

(
        dir: &Path,
    )

Source from the content-addressed store, hash-verified

909 /// Test fixture: a store holding a human default identity (with key)
910 /// and a delegated agent identity (with key).
911 fn signer_test_store(
912 dir: &Path,
913 ) -> (
914 atomic_identity::KeyPair,
915 atomic_identity::Identity,
916 atomic_identity::KeyPair,
917 atomic_identity::Identity,
918 ) {
919 use atomic_identity::{Identity, IdentityStore, IdentityType, KeyPair};
920
921 let mut store = IdentityStore::open(dir).unwrap();
922
923 let human_key = KeyPair::generate();
924 let human = Identity::builder("alice")
925 .email("alice@example.com")
926 .public_key(human_key.public.clone())
927 .build()
928 .unwrap();
929 store.save_with_keypair(&human, &human_key, None).unwrap();
930 store.set_default(&human.id).unwrap();
931
932 let agent_key = KeyPair::generate();
933 let agent = Identity::builder("alice+claude")
934 .identity_type(IdentityType::Agent)
935 .email("alice+claude@example.com")
936 .public_key(agent_key.public.clone())
937 .delegated_by(human.id)
938 .build()
939 .unwrap();
940 store.save_with_keypair(&agent, &agent_key, None).unwrap();
941
942 (human_key, human, agent_key, agent)
943 }
944
945 /// The whole point of the feature: a selected agent identity signs with
946 /// its OWN key, so the signature proves the header's key claim. The

Calls 10

openFunction · 0.85
emailMethod · 0.80
save_with_keypairMethod · 0.80
delegated_byMethod · 0.80
unwrapMethod · 0.45
buildMethod · 0.45
public_keyMethod · 0.45
cloneMethod · 0.45
set_defaultMethod · 0.45
identity_typeMethod · 0.45