pub struct OpenSecretClient { /* private fields */ }Implementations§
Source§impl OpenSecretClient
impl OpenSecretClient
Sourcepub fn new(base_url: impl Into<String>) -> Result<Self>
pub fn new(base_url: impl Into<String>) -> Result<Self>
Construct a client using the official production PCR0 trust roots.
Sourcepub fn new_with_pcr0_environment(
base_url: impl Into<String>,
pcr0_environment: Pcr0Environment,
) -> Result<Self>
pub fn new_with_pcr0_environment( base_url: impl Into<String>, pcr0_environment: Pcr0Environment, ) -> Result<Self>
Construct a client using one explicit official PCR0 environment.
Sourcepub fn new_with_pcr0_trust_policy(
base_url: impl Into<String>,
pcr0_trust_policy: Pcr0TrustPolicy,
) -> Result<Self>
pub fn new_with_pcr0_trust_policy( base_url: impl Into<String>, pcr0_trust_policy: Pcr0TrustPolicy, ) -> Result<Self>
Construct a client with an explicit PCR0 trust policy.
Sourcepub fn new_with_api_key(
base_url: impl Into<String>,
api_key: String,
) -> Result<Self>
pub fn new_with_api_key( base_url: impl Into<String>, api_key: String, ) -> Result<Self>
Construct an API-key client using the official production PCR0 trust roots.
Sourcepub fn new_with_api_key_and_pcr0_environment(
base_url: impl Into<String>,
api_key: String,
pcr0_environment: Pcr0Environment,
) -> Result<Self>
pub fn new_with_api_key_and_pcr0_environment( base_url: impl Into<String>, api_key: String, pcr0_environment: Pcr0Environment, ) -> Result<Self>
Construct an API-key client using one explicit official PCR0 environment.
Sourcepub fn new_with_api_key_and_pcr0_trust_policy(
base_url: impl Into<String>,
api_key: String,
pcr0_trust_policy: Pcr0TrustPolicy,
) -> Result<Self>
pub fn new_with_api_key_and_pcr0_trust_policy( base_url: impl Into<String>, api_key: String, pcr0_trust_policy: Pcr0TrustPolicy, ) -> Result<Self>
Construct an API-key client with an explicit PCR0 trust policy.
pub fn set_api_key(&self, api_key: String) -> Result<()>
pub fn clear_api_key(&self) -> Result<()>
pub async fn perform_attestation_handshake(&self) -> Result<()>
pub fn get_session_id(&self) -> Result<Option<Uuid>>
pub async fn test_connection(&self) -> Result<String>
Sourcepub async fn send_inference_request(
&self,
request: InferenceRequest,
) -> Result<InferenceResponse>
pub async fn send_inference_request( &self, request: InferenceRequest, ) -> Result<InferenceResponse>
Sends a lossless encrypted request to an OpenSecret inference endpoint.
The request URI must be relative and target one of the SDK’s explicitly
allowed inference routes. Its method, query string, headers, and body
bytes are otherwise caller-owned. The SDK does not parse the request as
JSON and never adds or changes inference parameters such as stream.
OpenSecret authentication, attestation sessions, and the encrypted
envelope remain SDK-owned. Caller-provided Host, Authorization,
x-session-id, Content-Length, Content-Type, Content-Encoding,
Accept-Encoding, Content-MD5, Digest, and hop-by-hop headers
(including fields named by Connection) are therefore not forwarded.
Other headers are preserved.
The returned HTTP response preserves the final OpenSecret status and
safe response headers. Its body is decrypted raw bytes. SSE framing is
preserved while encrypted data: fields are decrypted without parsing
their contents as completion JSON. Individual SSE lines are limited to
16 MiB.
pub async fn login( &self, email: String, password: String, client_id: Uuid, ) -> Result<LoginResponse>
pub async fn login_with_id( &self, id: Uuid, password: String, client_id: Uuid, ) -> Result<LoginResponse>
pub async fn register( &self, email: String, password: String, client_id: Uuid, name: Option<String>, ) -> Result<LoginResponse>
pub async fn register_guest( &self, password: String, client_id: Uuid, ) -> Result<LoginResponse>
pub async fn initiate_github_auth( &self, client_id: Uuid, invite_code: Option<String>, ) -> Result<GithubAuthResponse>
pub async fn handle_github_callback( &self, code: String, state: String, invite_code: String, ) -> Result<LoginResponse>
pub async fn initiate_google_auth( &self, client_id: Uuid, invite_code: Option<String>, ) -> Result<GoogleAuthResponse>
pub async fn handle_google_callback( &self, code: String, state: String, invite_code: String, ) -> Result<LoginResponse>
pub async fn initiate_apple_auth( &self, client_id: Uuid, invite_code: Option<String>, ) -> Result<AppleAuthResponse>
pub async fn handle_apple_callback( &self, code: String, state: String, invite_code: String, ) -> Result<LoginResponse>
pub async fn handle_apple_native_sign_in( &self, user_identifier: String, identity_token: String, client_id: Uuid, email: Option<String>, given_name: Option<String>, family_name: Option<String>, nonce: Option<String>, invite_code: Option<String>, ) -> Result<LoginResponse>
pub async fn refresh_token(&self) -> Result<()>
pub async fn logout(&self) -> Result<()>
pub async fn logout_with_push_device_id( &self, push_device_id: Uuid, ) -> Result<()>
pub fn get_access_token(&self) -> Result<Option<String>>
Sourcepub fn get_tokens(&self) -> Result<Option<TokenPair>>
pub fn get_tokens(&self) -> Result<Option<TokenPair>>
Return one coherent snapshot of the current JWT token pair.
Prefer this over separate access- and refresh-token reads when the pair will be persisted or copied into another client: an automatic refresh can replace both values between two independent lock acquisitions.
pub fn get_refresh_token(&self) -> Result<Option<String>>
pub fn set_tokens( &self, access_token: String, refresh_token: Option<String>, ) -> Result<()>
pub async fn get_user(&self) -> Result<UserResponse>
pub async fn register_push_device( &self, request: RegisterPushDeviceRequest, ) -> Result<PushDevice>
pub async fn list_push_devices(&self) -> Result<PushDeviceListResponse>
pub async fn revoke_push_device( &self, id: Uuid, ) -> Result<DeletedPushDeviceResponse>
pub async fn create_api_key(&self, name: String) -> Result<ApiKeyCreateResponse>
pub async fn list_api_keys(&self) -> Result<Vec<ApiKey>>
pub async fn delete_api_key(&self, name: &str) -> Result<()>
pub async fn kv_get(&self, key: &str) -> Result<String>
pub async fn kv_put(&self, key: &str, value: String) -> Result<String>
pub async fn kv_delete(&self, key: &str) -> Result<()>
pub async fn kv_delete_all(&self) -> Result<()>
pub async fn kv_list(&self) -> Result<Vec<KVListItem>>
pub async fn get_private_key( &self, options: Option<KeyOptions>, ) -> Result<PrivateKeyResponse>
pub async fn get_private_key_bytes( &self, options: Option<KeyOptions>, ) -> Result<PrivateKeyBytesResponse>
pub async fn sign_message( &self, message_bytes: &[u8], algorithm: SigningAlgorithm, key_options: Option<KeyOptions>, ) -> Result<SignMessageResponse>
pub async fn get_public_key( &self, algorithm: SigningAlgorithm, key_options: Option<KeyOptions>, ) -> Result<PublicKeyResponse>
pub async fn generate_third_party_token( &self, audience: Option<String>, ) -> Result<ThirdPartyTokenResponse>
pub async fn encrypt_data( &self, data: String, key_options: Option<KeyOptions>, ) -> Result<EncryptDataResponse>
pub async fn decrypt_data( &self, encrypted_data: String, key_options: Option<KeyOptions>, ) -> Result<String>
Sourcepub async fn change_password(
&self,
current_password: String,
new_password: String,
) -> Result<()>
pub async fn change_password( &self, current_password: String, new_password: String, ) -> Result<()>
Changes the password for the currently authenticated user
Sourcepub async fn request_password_reset(
&self,
email: String,
hashed_secret: String,
client_id: Uuid,
) -> Result<()>
pub async fn request_password_reset( &self, email: String, hashed_secret: String, client_id: Uuid, ) -> Result<()>
Requests a password reset for the given email Note: This does not require authentication but still uses encryption
Sourcepub async fn confirm_password_reset(
&self,
email: String,
alphanumeric_code: String,
plaintext_secret: String,
new_password: String,
client_id: Uuid,
) -> Result<()>
pub async fn confirm_password_reset( &self, email: String, alphanumeric_code: String, plaintext_secret: String, new_password: String, client_id: Uuid, ) -> Result<()>
Confirms a password reset with the code from email Note: This does not require authentication but still uses encryption
Sourcepub async fn verify_email(&self, code: String) -> Result<()>
pub async fn verify_email(&self, code: String) -> Result<()>
Verifies an email address with the code from the verification email Note: This does not require authentication but still uses encryption
Sourcepub async fn request_new_verification_code(&self) -> Result<()>
pub async fn request_new_verification_code(&self) -> Result<()>
Requests a new email verification code
Sourcepub async fn request_account_deletion(
&self,
hashed_secret: String,
) -> Result<()>
pub async fn request_account_deletion( &self, hashed_secret: String, ) -> Result<()>
Initiates the account deletion process
Sourcepub async fn confirm_account_deletion(
&self,
confirmation_code: String,
plaintext_secret: String,
) -> Result<()>
pub async fn confirm_account_deletion( &self, confirmation_code: String, plaintext_secret: String, ) -> Result<()>
Confirms account deletion with the code from email
Sourcepub async fn create_conversation(
&self,
request: ConversationCreateRequest,
) -> Result<Conversation>
pub async fn create_conversation( &self, request: ConversationCreateRequest, ) -> Result<Conversation>
Creates a new conversation.
Sourcepub async fn list_conversations(
&self,
params: Option<ConversationsListParams>,
) -> Result<ConversationsListResponse>
pub async fn list_conversations( &self, params: Option<ConversationsListParams>, ) -> Result<ConversationsListResponse>
Lists conversations with optional filters and pagination.
Sourcepub async fn get_conversation(
&self,
conversation_id: Uuid,
) -> Result<Conversation>
pub async fn get_conversation( &self, conversation_id: Uuid, ) -> Result<Conversation>
Fetches a single conversation by UUID.
Sourcepub async fn update_conversation(
&self,
conversation_id: Uuid,
request: ConversationUpdateRequest,
) -> Result<Conversation>
pub async fn update_conversation( &self, conversation_id: Uuid, request: ConversationUpdateRequest, ) -> Result<Conversation>
Partially updates a conversation.
Sourcepub async fn delete_conversation(
&self,
conversation_id: Uuid,
) -> Result<DeletedObjectResponse>
pub async fn delete_conversation( &self, conversation_id: Uuid, ) -> Result<DeletedObjectResponse>
Deletes a single conversation by UUID.
Sourcepub async fn list_conversation_items(
&self,
conversation_id: Uuid,
params: Option<AgentItemsListParams>,
) -> Result<ConversationItemsResponse>
pub async fn list_conversation_items( &self, conversation_id: Uuid, params: Option<AgentItemsListParams>, ) -> Result<ConversationItemsResponse>
Lists items in a conversation.
Sourcepub async fn get_conversation_item(
&self,
conversation_id: Uuid,
item_id: Uuid,
) -> Result<ConversationItem>
pub async fn get_conversation_item( &self, conversation_id: Uuid, item_id: Uuid, ) -> Result<ConversationItem>
Fetches a single item from a conversation.
Sourcepub async fn delete_conversations(&self) -> Result<ConversationsDeleteResponse>
pub async fn delete_conversations(&self) -> Result<ConversationsDeleteResponse>
Deletes all conversations
Sourcepub async fn batch_delete_conversations(
&self,
ids: Vec<String>,
) -> Result<BatchDeleteConversationsResponse>
pub async fn batch_delete_conversations( &self, ids: Vec<String>, ) -> Result<BatchDeleteConversationsResponse>
Batch deletes multiple conversations by their IDs
Sourcepub async fn batch_update_conversation_project(
&self,
ids: Vec<Uuid>,
project_id: Option<Uuid>,
) -> Result<BatchUpdateConversationProjectResponse>
pub async fn batch_update_conversation_project( &self, ids: Vec<Uuid>, project_id: Option<Uuid>, ) -> Result<BatchUpdateConversationProjectResponse>
Batch updates conversation project assignments. Use None to clear the project.
Sourcepub async fn create_conversation_project(
&self,
request: ConversationProjectCreateRequest,
) -> Result<ConversationProject>
pub async fn create_conversation_project( &self, request: ConversationProjectCreateRequest, ) -> Result<ConversationProject>
Creates a new conversation project.
Sourcepub async fn list_conversation_projects(
&self,
params: Option<ConversationProjectListParams>,
) -> Result<ConversationProjectsListResponse>
pub async fn list_conversation_projects( &self, params: Option<ConversationProjectListParams>, ) -> Result<ConversationProjectsListResponse>
Lists conversation projects with pagination.
Sourcepub async fn get_conversation_project(
&self,
project_id: Uuid,
) -> Result<ConversationProject>
pub async fn get_conversation_project( &self, project_id: Uuid, ) -> Result<ConversationProject>
Fetches a single conversation project by UUID.
Sourcepub async fn update_conversation_project(
&self,
project_id: Uuid,
request: ConversationProjectUpdateRequest,
) -> Result<ConversationProject>
pub async fn update_conversation_project( &self, project_id: Uuid, request: ConversationProjectUpdateRequest, ) -> Result<ConversationProject>
Updates a conversation project and/or its project instructions.
Sourcepub async fn delete_conversation_project(
&self,
project_id: Uuid,
) -> Result<DeletedObjectResponse>
pub async fn delete_conversation_project( &self, project_id: Uuid, ) -> Result<DeletedObjectResponse>
Deletes a conversation project by UUID.
Sourcepub async fn get_models(&self) -> Result<ModelsResponse>
pub async fn get_models(&self) -> Result<ModelsResponse>
Fetches available AI models
Sourcepub async fn create_embeddings(
&self,
request: EmbeddingRequest,
) -> Result<EmbeddingResponse>
pub async fn create_embeddings( &self, request: EmbeddingRequest, ) -> Result<EmbeddingResponse>
Sourcepub async fn create_chat_completion(
&self,
request: ChatCompletionRequest,
) -> Result<ChatCompletionResponse>
pub async fn create_chat_completion( &self, request: ChatCompletionRequest, ) -> Result<ChatCompletionResponse>
Creates a chat completion (non-streaming)
Sourcepub async fn create_chat_completion_stream(
&self,
request: ChatCompletionRequest,
) -> Result<Pin<Box<dyn Stream<Item = Result<ChatCompletionChunk>> + Send>>>
pub async fn create_chat_completion_stream( &self, request: ChatCompletionRequest, ) -> Result<Pin<Box<dyn Stream<Item = Result<ChatCompletionChunk>> + Send>>>
Creates a streaming chat completion
Sourcepub async fn web_search(
&self,
request: WebSearchRequest,
) -> Result<WebSearchResponse>
pub async fn web_search( &self, request: WebSearchRequest, ) -> Result<WebSearchResponse>
Searches the public web through OpenSecret’s configured search provider.
Sourcepub async fn web_extract(
&self,
request: WebExtractRequest,
) -> Result<WebExtractResponse>
pub async fn web_extract( &self, request: WebExtractRequest, ) -> Result<WebExtractResponse>
Extracts sanitized Markdown from public URLs through OpenSecret’s configured provider.
Sourcepub async fn get_main_agent(&self) -> Result<MainAgentResponse>
pub async fn get_main_agent(&self) -> Result<MainAgentResponse>
Fetches the current user’s main agent.
Sourcepub async fn init_main_agent(
&self,
request: InitMainAgentRequest,
) -> Result<InitMainAgentResponse>
pub async fn init_main_agent( &self, request: InitMainAgentRequest, ) -> Result<InitMainAgentResponse>
Explicitly initializes the current user’s main agent.
Sourcepub async fn delete_main_agent(&self) -> Result<DeletedObjectResponse>
pub async fn delete_main_agent(&self) -> Result<DeletedObjectResponse>
Deletes the current user’s main agent and resets shared agent state.
Sourcepub async fn list_main_agent_items(
&self,
params: Option<AgentItemsListParams>,
) -> Result<AgentItemsListResponse>
pub async fn list_main_agent_items( &self, params: Option<AgentItemsListParams>, ) -> Result<AgentItemsListResponse>
Lists items in the main agent conversation.
Sourcepub async fn get_main_agent_item(
&self,
item_id: Uuid,
) -> Result<ConversationItem>
pub async fn get_main_agent_item( &self, item_id: Uuid, ) -> Result<ConversationItem>
Fetches a single item from the main agent conversation.
Sourcepub async fn set_main_agent_item_reaction(
&self,
item_id: Uuid,
emoji: impl Into<String>,
) -> Result<ConversationItem>
pub async fn set_main_agent_item_reaction( &self, item_id: Uuid, emoji: impl Into<String>, ) -> Result<ConversationItem>
Sets or replaces the current user’s reaction on a main-agent assistant message item.
Sourcepub async fn clear_main_agent_item_reaction(
&self,
item_id: Uuid,
) -> Result<ConversationItem>
pub async fn clear_main_agent_item_reaction( &self, item_id: Uuid, ) -> Result<ConversationItem>
Clears the current user’s reaction on a main-agent assistant message item.
Sourcepub async fn agent_chat(
&self,
input: &str,
) -> Result<Pin<Box<dyn Stream<Item = Result<AgentSseEvent>> + Send>>>
pub async fn agent_chat( &self, input: &str, ) -> Result<Pin<Box<dyn Stream<Item = Result<AgentSseEvent>> + Send>>>
Sends a message to the main agent and returns a stream of SSE events.
Sourcepub async fn create_subagent(
&self,
request: CreateSubagentRequest,
) -> Result<SubagentResponse>
pub async fn create_subagent( &self, request: CreateSubagentRequest, ) -> Result<SubagentResponse>
Creates a new subagent for the current user.
Sourcepub async fn list_subagents(
&self,
params: Option<ListSubagentsParams>,
) -> Result<SubagentListResponse>
pub async fn list_subagents( &self, params: Option<ListSubagentsParams>, ) -> Result<SubagentListResponse>
Lists subagents for the current user with pagination and filtering.
Sourcepub async fn get_subagent(&self, id: Uuid) -> Result<SubagentResponse>
pub async fn get_subagent(&self, id: Uuid) -> Result<SubagentResponse>
Fetches a single subagent by UUID.
Sourcepub async fn subagent_chat(
&self,
id: Uuid,
input: &str,
) -> Result<Pin<Box<dyn Stream<Item = Result<AgentSseEvent>> + Send>>>
pub async fn subagent_chat( &self, id: Uuid, input: &str, ) -> Result<Pin<Box<dyn Stream<Item = Result<AgentSseEvent>> + Send>>>
Sends a message to a specific subagent and returns a stream of SSE events.
Sourcepub async fn list_subagent_items(
&self,
id: Uuid,
params: Option<AgentItemsListParams>,
) -> Result<AgentItemsListResponse>
pub async fn list_subagent_items( &self, id: Uuid, params: Option<AgentItemsListParams>, ) -> Result<AgentItemsListResponse>
Lists items in a subagent conversation.
Sourcepub async fn get_subagent_item(
&self,
id: Uuid,
item_id: Uuid,
) -> Result<ConversationItem>
pub async fn get_subagent_item( &self, id: Uuid, item_id: Uuid, ) -> Result<ConversationItem>
Fetches a single item from a subagent conversation.
Sourcepub async fn set_subagent_item_reaction(
&self,
id: Uuid,
item_id: Uuid,
emoji: impl Into<String>,
) -> Result<ConversationItem>
pub async fn set_subagent_item_reaction( &self, id: Uuid, item_id: Uuid, emoji: impl Into<String>, ) -> Result<ConversationItem>
Sets or replaces the current user’s reaction on a subagent assistant message item.
Sourcepub async fn clear_subagent_item_reaction(
&self,
id: Uuid,
item_id: Uuid,
) -> Result<ConversationItem>
pub async fn clear_subagent_item_reaction( &self, id: Uuid, item_id: Uuid, ) -> Result<ConversationItem>
Clears the current user’s reaction on a subagent assistant message item.
Sourcepub async fn delete_subagent(&self, id: Uuid) -> Result<DeletedObjectResponse>
pub async fn delete_subagent(&self, id: Uuid) -> Result<DeletedObjectResponse>
Deletes a subagent by UUID.