fn insert_password_context(
    store_handle: &mut dyn ManageKeyIDs,
    key_triple: KeyTriple,
    password_context: PasswordContext,
    key_attributes: KeyAttributes,
) -> Result<()> {
    let error_storing = |e| Err(key_id_managers::to_response_status(e));

    let key_info = KeyInfo {
        id: bincode::serialize(&password_context)?,
        attributes: key_attributes,
    };

    if store_handle
        .insert(key_triple, key_info)
        .or_else(error_storing)?
        .is_some()
    {
        error!("Inserting a mapping in the Key ID Manager that would overwrite an existing one.");
        Err(ResponseStatus::PsaErrorAlreadyExists)
    } else {
        Ok(())
    }
}
// Inserts a new mapping in the Key ID manager that stores the PasswordContext.
Inserts a new mapping in the Key ID manager that stores the PasswordContext.
Inserts a new mapping in the Key ID manager that stores the PasswordContext .
fn insert_password_context(
    store_handle: &mut dyn ManageKeyIDs,
    key_triple: KeyTriple,
    password_context: PasswordContext,
    key_attributes: KeyAttributes,
) -> Result<()> {
    let error_storing = |e| Err(key_id_managers::to_response_status(e));
    let key_info = KeyInfo {
        id: bincode::serialize(&password_context)?,
        attributes: key_attributes,
    };
    if store_handle
        .insert(key_triple, key_info)
        .or_else(error_storing)?
        .is_some()
    {
        error!("Inserting a mapping in the Key ID Manager that would overwrite an existing one.");
        Err(ResponseStatus::PsaErrorAlreadyExists)
    } else {
        Ok(())
    }
}
fn insert_password_context ( store_handle : & mut dyn ManageKeyIDs , key_triple : KeyTriple , password_context : PasswordContext , key_attributes : KeyAttributes , ) -> Result < ( ) > { let error_storing = | e | Err ( key_id_managers :: to_response_status ( e ) ) ; let key_info = KeyInfo { id : bincode :: serialize ( & password_context ) ? , attributes : key_attributes , } ; if store_handle . insert ( key_triple , key_info ) . or_else ( error_storing ) ? . is_some ( ) { error ! ( " " ) ; Err ( ResponseStatus :: PsaErrorAlreadyExists ) } else { Ok ( ( ) ) } }
Inserts a new mapping in the Key ID manager that stores the PasswordContext.
Inserts a new mapping in the Key ID manager that stores the PasswordContext .
store_handle
&mut dyn ManageKeyIDs
key_triple
KeyTriple
password_context
PasswordContext
key_attributes
KeyAttributes
store_handle
&mut dyn ManageKeyIDs
key_triple
KeyTriple
password_context
PasswordContext
key_attributes
KeyAttributes