MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / reset_nonces

Function reset_nonces

chirpstack/src/storage/device_keys.rs:153–168  ·  view source on GitHub ↗
(dev_eui: &EUI64)

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 4

setMethod · 0.80
to_stringMethod · 0.80
updateFunction · 0.70
get_async_db_connFunction · 0.70

Tested by

no test coverage detected