(dev_eui: &EUI64)
| 151 | use crate::test; |
| 152 | |
| 153 | pub async fn reset_nonces(dev_eui: &EUI64) -> Result<DeviceKeys, Error> { |
| 154 | let dk: DeviceKeys = diesel::update(device_keys::dsl::device_keys.find(&dev_eui)) |
| 155 | .set(( |
| 156 | device_keys::dev_nonces.eq(fields::DevNonces::default()), |
| 157 | device_keys::join_nonce.eq(0), |
| 158 | )) |
| 159 | .get_result(&mut get_async_db_conn().await?) |
| 160 | .await |
| 161 | .map_err(|e| Error::from_diesel(e, dev_eui.to_string()))?; |
| 162 | |
| 163 | info!( |
| 164 | dev_eui = %dev_eui, |
| 165 | "Nonces reset" |
| 166 | ); |
| 167 | Ok(dk) |
| 168 | } |
| 169 | |
| 170 | pub async fn create_device_keys(dev_eui: Option<EUI64>) -> DeviceKeys { |
| 171 | let dev_eui = match dev_eui { |
nothing calls this directly
no test coverage detected