Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions crates/agentkeys-core/src/mock_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,14 +424,27 @@ impl CredentialBackend for MockHttpClient {
AuthRequestType::KeyRotate { .. } => "KeyRotate",
};

let mut request_body = json!({
"child_pubkey": pubkey_b64,
"request_type": request_type_str,
"request_details": details_b64,
});

if let AuthRequestType::Recover { agent_identity, .. } = &request_type {
let (identity_type, identity_value) = match agent_identity {
agentkeys_types::AgentIdentity::Alias(s) => ("alias", s.clone()),
agentkeys_types::AgentIdentity::Email(s) => ("email", s.clone()),
agentkeys_types::AgentIdentity::Ens(s) => ("ens", s.clone()),
agentkeys_types::AgentIdentity::WalletAddress(w) => ("wallet", w.0.clone()),
};
request_body["identity_type"] = json!(identity_type);
request_body["identity_value"] = json!(identity_value);
}

let resp = self
.client
.post(self.url("/auth-request/open"))
.json(&json!({
"child_pubkey": pubkey_b64,
"request_type": request_type_str,
"request_details": details_b64,
}))
.json(&request_body)
.send()
.await
.map_err(|e| BackendError::Transport(e.to_string()))?;
Expand Down
4 changes: 3 additions & 1 deletion crates/agentkeys-mock-server/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ pub fn init_schema(conn: &Connection) -> Result<()> {
session_json TEXT,
wallet_address TEXT,
created_at INTEGER NOT NULL,
ttl_seconds INTEGER NOT NULL
ttl_seconds INTEGER NOT NULL,
identity_type TEXT,
identity_value TEXT
);

CREATE TABLE IF NOT EXISTS identity_links (
Expand Down
Loading