Compare commits

...

4 Commits

Author SHA1 Message Date
f66186bb7b Bump version to 4.4.2 2023-07-14 10:56:00 +01:00
3f8f746dc5 Fix sending multiple FilterListReq mac-commands. 2023-07-13 12:26:03 +01:00
57ab993a88 Update dependencies. 2023-07-13 11:39:20 +01:00
a975cf3223 Add create-api-key sub-command.
This makes is possible to create a global API key (programmatically)
using the CLI.

Fixes https://github.com/chirpstack/chirpstack-rest-api/issues/12.
2023-07-13 11:10:32 +01:00
17 changed files with 300 additions and 293 deletions

495
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@chirpstack/chirpstack-api-grpc-web",
"version": "4.4.1",
"version": "4.4.2",
"description": "Chirpstack gRPC-web API",
"license": "MIT",
"devDependencies": {

View File

@ -8,7 +8,7 @@ plugins {
}
group = "io.chirpstack"
version = "4.4.1"
version = "4.4.2"
repositories {
mavenCentral()

2
api/js/package.json vendored
View File

@ -1,6 +1,6 @@
{
"name": "@chirpstack/chirpstack-api",
"version": "4.4.1",
"version": "4.4.2",
"description": "Chirpstack JS and TS API",
"license": "MIT",
"devDependencies": {

View File

@ -9,7 +9,7 @@ plugins {
}
group = "io.chirpstack"
version = "4.4.1"
version = "4.4.2"
repositories {
mavenCentral()

View File

@ -18,7 +18,7 @@ CLASSIFIERS = [
setup(
name='chirpstack-api',
version = "4.4.1",
version = "4.4.2",
url='https://github.com/brocaar/chirpstack-api',
author='Orne Brocaar',
author_email='info@brocaar.com',

2
api/rust/Cargo.lock generated vendored
View File

@ -108,7 +108,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chirpstack_api"
version = "4.4.1"
version = "4.4.2"
dependencies = [
"hex",
"pbjson",

2
api/rust/Cargo.toml vendored
View File

@ -1,7 +1,7 @@
[package]
name = "chirpstack_api"
description = "ChirpStack Protobuf / gRPC API definitions."
version = "4.4.1"
version = "4.4.2"
authors = ["Orne Brocaar <info@brocaar.com>"]
license = "MIT"
homepage = "https://www.chirpstack.io"

View File

@ -1,6 +1,6 @@
[package]
name = "backend"
version = "4.4.1"
version = "4.4.2"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2018"
publish = false

View File

@ -3,7 +3,7 @@ name = "chirpstack"
description = "ChirpStack is an open-source LoRaWAN(TM) Network Server"
repository = "https://github.com/chirpstack/chirpstack"
homepage = "https://www.chirpstack.io/"
version = "4.4.1"
version = "4.4.2"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2021"
publish = false
@ -101,7 +101,7 @@ pbkdf2 = { version = "0.12", features = ["simple"] }
rand_core = { version = "0.6", features = ["std"] }
jsonwebtoken = "8.2"
openssl = { version = "0.10" }
openidconnect = { version = "3.1", features = ["accept-rfc3339-timestamps"] }
openidconnect = { version = "3.3", features = ["accept-rfc3339-timestamps"] }
# MQTT
paho-mqtt = { version = "0.12", features = ["ssl"] }
@ -124,7 +124,7 @@ aes = "0.8"
rand = "0.8"
base64 = "0.21"
async-recursion = "1.0"
regex = "1.7"
regex = "1.9"
petgraph = "0.6"
prometheus-client = "0.21"
pin-project = "1.0"

View File

@ -0,0 +1,25 @@
use anyhow::Result;
use crate::api::auth::claims;
use crate::config;
use crate::storage::api_key;
pub async fn run(name: &str) -> Result<()> {
let conf = config::get();
crate::storage::setup().await?;
let key = api_key::create(api_key::ApiKey {
name: name.to_string(),
is_admin: true,
..Default::default()
})
.await?;
let token = claims::AuthClaim::new_for_api_key(&key.id).encode(conf.api.secret.as_ref())?;
println!("id: {}", key.id);
println!("token: {}", token);
Ok(())
}

View File

@ -1,4 +1,5 @@
pub mod configfile;
pub mod create_api_key;
pub mod import_legacy_lorawan_devices_repository;
pub mod print_ds;
pub mod root;

View File

@ -1788,6 +1788,11 @@ impl Data {
dev_eui: device.dev_eui.to_vec(),
provisioned: false,
});
// Return because we can't add multiple sets and if we would combine
// multiple commands as a single set, it might not fit in a single
// downlink.
return Ok(());
}
}

View File

@ -14,7 +14,6 @@ extern crate diesel;
extern crate anyhow;
use std::path::Path;
use std::process;
use std::str::FromStr;
use anyhow::Result;
@ -78,6 +77,13 @@ enum Commands {
#[arg(short, long, value_name = "DIR")]
dir: String,
},
/// Create global API key.
CreateApiKey {
/// Name.
#[arg(short, long, value_name = "NAME")]
name: String,
},
}
#[tokio::main]
@ -104,25 +110,20 @@ async fn main() -> Result<()> {
.init();
}
if let Some(Commands::Configfile {}) = &cli.command {
cmd::configfile::run();
process::exit(0);
match &cli.command {
Some(Commands::Configfile {}) => cmd::configfile::run(),
Some(Commands::PrintDs { dev_eui }) => {
let dev_eui = EUI64::from_str(dev_eui).unwrap();
cmd::print_ds::run(&dev_eui).await.unwrap();
}
Some(Commands::ImportLegacyLorawanDevicesRepository { dir }) => {
cmd::import_legacy_lorawan_devices_repository::run(Path::new(&dir))
.await
.unwrap()
}
Some(Commands::CreateApiKey { name }) => cmd::create_api_key::run(&name).await?,
None => cmd::root::run().await?,
}
if let Some(Commands::PrintDs { dev_eui }) = &cli.command {
let dev_eui = EUI64::from_str(dev_eui).unwrap();
cmd::print_ds::run(&dev_eui).await.unwrap();
process::exit(0);
}
if let Some(Commands::ImportLegacyLorawanDevicesRepository { dir }) = &cli.command {
cmd::import_legacy_lorawan_devices_repository::run(Path::new(&dir))
.await
.unwrap();
process::exit(0);
}
cmd::root::run().await?;
Ok(())
}

View File

@ -3,7 +3,7 @@ name = "lrwn_filters"
description = "Library for filtering LoRaWAN payloads on DevAddr and JoinEUIs prefixes"
homepage = "https://www.chirpstack.io/"
license = "MIT"
version = "4.4.1"
version = "4.4.2"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2021"
repository = "https://github.com/chirpstack/chirpstack"

View File

@ -3,7 +3,7 @@ name = "lrwn"
description = "Library for encoding / decoding LoRaWAN frames."
homepage = "https://www.chirpstack.io"
license = "MIT"
version = "4.4.1"
version = "4.4.2"
authors = ["Orne Brocaar <info@brocaar.com>"]
edition = "2018"
repository = "https://github.com/chirpstack/chirpstack"

View File

@ -1,6 +1,6 @@
{
"name": "chirpstack-ui",
"version": "4.4.1",
"version": "4.4.2",
"private": true,
"dependencies": {
"@ant-design/colors": "^6.0.0",