pub struct RegistryClient { /* private fields */ }Expand description
HTTP client for the Open Agent ID registry API.
Implementations§
Source§impl RegistryClient
impl RegistryClient
Sourcepub fn new(base_url: Option<&str>) -> Self
pub fn new(base_url: Option<&str>) -> Self
Create a new client. If base_url is None, the default
(https://api.openagentid.org) is used.
The base URL should not include /v1; endpoint methods add it.
Sourcepub async fn challenge(&self, wallet_address: &str) -> Result<Challenge, Error>
pub async fn challenge(&self, wallet_address: &str) -> Result<Challenge, Error>
Request a wallet authentication challenge.
POST /v1/auth/challenge
Sourcepub async fn wallet_auth(
&self,
req: &WalletAuthRequest,
) -> Result<WalletAuthResponse, Error>
pub async fn wallet_auth( &self, req: &WalletAuthRequest, ) -> Result<WalletAuthResponse, Error>
Authenticate with a wallet signature and receive a bearer token.
POST /v1/auth/wallet
Sourcepub async fn register(
&self,
token: &str,
req: &RegistrationRequest,
) -> Result<RegistrationResponse, Error>
pub async fn register( &self, token: &str, req: &RegistrationRequest, ) -> Result<RegistrationResponse, Error>
Register a new agent.
POST /v1/agents — requires wallet auth (Authorization: Bearer oaid_...).
Sourcepub async fn lookup(&self, did: &str) -> Result<AgentInfo, Error>
pub async fn lookup(&self, did: &str) -> Result<AgentInfo, Error>
Look up an agent by DID.
GET /v1/agents/{did} — no auth required.
Sourcepub async fn list_my_agents(
&self,
token: &str,
cursor: Option<&str>,
limit: Option<u32>,
) -> Result<ListAgentsResponse, Error>
pub async fn list_my_agents( &self, token: &str, cursor: Option<&str>, limit: Option<u32>, ) -> Result<ListAgentsResponse, Error>
List agents owned by the authenticated wallet.
GET /v1/agents — requires wallet auth (Authorization: Bearer oaid_...).
Sourcepub async fn update_agent(
&self,
token: &str,
did: &str,
req: &UpdateAgentRequest,
) -> Result<AgentInfo, Error>
pub async fn update_agent( &self, token: &str, did: &str, req: &UpdateAgentRequest, ) -> Result<AgentInfo, Error>
Update an agent’s metadata.
PATCH /v1/agents/{did} — requires wallet auth (Authorization: Bearer oaid_...).
Sourcepub async fn revoke(&self, token: &str, did: &str) -> Result<(), Error>
pub async fn revoke(&self, token: &str, did: &str) -> Result<(), Error>
Delete (revoke) an agent.
DELETE /v1/agents/{did} — requires wallet auth.
Sourcepub async fn rotate_key(
&self,
token: &str,
did: &str,
req: &RotateKeyRequest,
) -> Result<(), Error>
pub async fn rotate_key( &self, token: &str, did: &str, req: &RotateKeyRequest, ) -> Result<(), Error>
Rotate an agent’s Ed25519 public key.
PUT /v1/agents/{did}/key — requires wallet auth.
Sourcepub async fn get_credit(&self, did: &str) -> Result<CreditInfo, Error>
pub async fn get_credit(&self, did: &str) -> Result<CreditInfo, Error>
Get an agent’s credit score.
GET /v1/credit/{did} — no auth required.
Sourcepub async fn verify(&self, req: &VerifyRequest) -> Result<VerifyResponse, Error>
pub async fn verify(&self, req: &VerifyRequest) -> Result<VerifyResponse, Error>
Ask the registry to verify a signature.
POST /v1/verify — no auth required.