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

Method get_device_keys_or_js_client

chirpstack/src/uplink/join_sns.rs:149–169  ·  view source on GitHub ↗

We need to get either the device-keys or a JS client. In any other case, this must return an error.

(&mut self)

Source from the content-addressed store, hash-verified

147
148 // We need to get either the device-keys or a JS client. In any other case, this must return an error.
149 async fn get_device_keys_or_js_client(&mut self) -> Result<()> {
150 trace!("Getting device keys");
151 let jr = self.join_request.as_ref().unwrap();
152 self.device_keys = match device_keys::get(&jr.dev_eui).await {
153 Ok(v) => Some(v),
154 Err(e) => {
155 if let StorageError::NotFound(_) = e {
156 None
157 } else {
158 return Err(anyhow::Error::new(e));
159 }
160 }
161 };
162
163 if self.device_keys.is_none() {
164 trace!(join_eui = %jr.join_eui, "Getting Join Server client");
165 self.js_client = Some(joinserver::get(jr.join_eui).await?);
166 }
167
168 Ok(())
169 }
170
171 fn set_device_info(&mut self) -> Result<()> {
172 let tenant = self.tenant.as_ref().unwrap();

Callers 1

_start_prMethod · 0.45

Calls 3

unwrapMethod · 0.80
as_refMethod · 0.80
getFunction · 0.50

Tested by

no test coverage detected