Skip to main content

create_api_key

Function create_api_key 

Source
pub fn create_api_key(
    name: &str,
    wallet_ids: &[String],
    policy_ids: &[String],
    passphrase: &str,
    expires_at: Option<&str>,
    vault_path: Option<&Path>,
) -> Result<(String, ApiKeyFile), OwsLibError>
Expand description

Create an API key for agent access to one or more wallets.

  1. Authenticates with the owner’s passphrase
  2. Decrypts the mnemonic for each wallet
  3. Generates a random token (ows_key_...)
  4. Re-encrypts each mnemonic under HKDF(token)
  5. Stores the key file with token hash, policy IDs, and encrypted copies
  6. Returns the raw token (shown once to the user)