pub struct TapAgent {
pub config: AgentConfig,
/* private fields */
}Expand description
TapAgent implementation using the AgentKeyManager for cryptographic operations.
Fields§
§config: AgentConfigConfiguration for the agent
Implementations§
Source§impl TapAgent
impl TapAgent
Sourcepub fn new(config: AgentConfig, key_manager: Arc<AgentKeyManager>) -> Self
pub fn new(config: AgentConfig, key_manager: Arc<AgentKeyManager>) -> Self
Creates a new TapAgent with the given configuration and AgentKeyManager
Sourcepub async fn from_ephemeral_key() -> Result<(Self, String)>
pub async fn from_ephemeral_key() -> Result<(Self, String)>
Creates a new TapAgent with an ephemeral key
This function generates a new DID key for temporary use. The key is not persisted to storage and will be lost when the agent is dropped.
§Returns
A tuple containing the TapAgent and the DID that was generated
Sourcepub async fn from_stored_keys(did: Option<String>, debug: bool) -> Result<Self>
pub async fn from_stored_keys(did: Option<String>, debug: bool) -> Result<Self>
Creates a new TapAgent from stored keys
This function uses the AgentKeyManagerBuilder to load keys from storage
§Arguments
did- Optional DID to use. If None, the default DID from storage is used.debug- Whether to enable debug mode
§Returns
A Result containing either the created agent or an error if no keys are available
Sourcepub async fn from_private_key(
private_key: &[u8],
key_type: KeyType,
debug: bool,
) -> Result<(Self, String)>
pub async fn from_private_key( private_key: &[u8], key_type: KeyType, debug: bool, ) -> Result<(Self, String)>
Creates a new TapAgent from an existing private key
This function creates a new TapAgent using a provided private key, which can be useful for integrating with external key management systems or when keys are generated outside the TAP agent.
§Arguments
private_key- The private key byteskey_type- The type of key (Ed25519, P256, or Secp256k1)debug- Whether to enable debug mode
§Returns
A Result containing either the created agent or an error