Skip to content

Commit 5329d07

Browse files
authored
add comms module from nrfcloud-utils (#21)
Integrate comms and command_interface modules from nrfcloud-utils. After this, they will be removed from nrfcloud-utils and nrfcredstore is used as a dependency. New test suites are provided to make imported modules more robust. Some changes were made to the modules to integrate them. This adds the following features: * AT Shell support * RTT Shell support * Automatic Nordic Device detection * Interactive device selection * Reading IMEI * Reading Attestation Token --------- Signed-off-by: Maximilian Deubel <[email protected]>
1 parent 0f88507 commit 5329d07

File tree

15 files changed

+1888
-471
lines changed

15 files changed

+1888
-471
lines changed

.editorconfig

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# EditorConfig: https://editorconfig.org/
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# All (Defaults)
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
max_line_length = 100
13+
14+
# Assembly
15+
[*.S]
16+
indent_style = tab
17+
indent_size = 8
18+
19+
# C
20+
[*.{c,h}]
21+
indent_style = tab
22+
indent_size = 8
23+
24+
# C++
25+
[*.{cpp,hpp}]
26+
indent_style = tab
27+
indent_size = 8
28+
29+
# Linker Script
30+
[*.ld]
31+
indent_style = tab
32+
indent_size = 8
33+
34+
# Python
35+
[*.py]
36+
indent_style = space
37+
indent_size = 4
38+
39+
# Perl
40+
[*.pl]
41+
indent_style = tab
42+
indent_size = 8
43+
44+
# reStructuredText
45+
[*.rst]
46+
indent_style = space
47+
indent_size = 3
48+
49+
# YAML
50+
[*.{yml,yaml}]
51+
indent_style = space
52+
indent_size = 2
53+
54+
# Shell Script
55+
[*.sh]
56+
indent_style = space
57+
indent_size = 4
58+
59+
# Windows Command Script
60+
[*.cmd]
61+
end_of_line = crlf
62+
indent_style = tab
63+
indent_size = 8
64+
65+
# Valgrind Suppression File
66+
[*.supp]
67+
indent_style = space
68+
indent_size = 3
69+
70+
# CMake
71+
[{CMakeLists.txt,*.cmake}]
72+
indent_style = space
73+
indent_size = 2
74+
75+
# Makefile
76+
[Makefile]
77+
indent_style = tab
78+
indent_size = 8
79+
80+
# Device tree
81+
[*.{dts,dtsi,overlay}]
82+
indent_style = tab
83+
indent_size = 8
84+
85+
# Git commit messages
86+
[COMMIT_EDITMSG]
87+
max_line_length = 75
88+
89+
# Kconfig
90+
[Kconfig*]
91+
indent_style = tab
92+
indent_size = 8

.github/workflows/python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
matrix:
21-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
21+
python-version: ['3.10', '3.11', '3.12', '3.13']
2222

2323
steps:
2424
- uses: actions/checkout@v4

README.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,32 @@ For the device to respond to AT commands, the firmware on the device must have a
1515
## Command Line Interface
1616

1717
```
18-
usage: nrfcredstore [-h] [--baudrate BAUDRATE] [--timeout TIMEOUT] dev {list,write,delete,generate} ...
18+
usage: nrfcredstore [-h] [--baudrate BAUDRATE] [--timeout TIMEOUT] [--debug] [--cmd-type {at,shell,auto}]
19+
dev {list,write,delete,deleteall,imei,attoken,generate} ...
1920
2021
Manage certificates stored in a cellular modem.
2122
2223
positional arguments:
23-
dev Serial device used to communicate with the modem.
24+
dev Device used to communicate with the modem. For interactive selection of serial port, use "auto". For RTT, use "rtt". If given a SEGGER
25+
serial number, it is assumed to be an RTT device.
2426
2527
options:
2628
-h, --help show this help message and exit
2729
--baudrate BAUDRATE Serial baudrate
2830
--timeout TIMEOUT Serial communication timeout in seconds
31+
--debug Enable debug logging
32+
--cmd-type {at,shell,auto}
33+
Command type to use. "at" for AT commands, "shell" for shell commands, "auto" to detect automatically.
2934
3035
subcommands:
31-
{list,write,delete,generate}
36+
{list,write,delete,deleteall,imei,attoken,generate}
3237
Certificate related commands
3338
list List all keys stored in the modem
3439
write Write key/cert to a secure tag
3540
delete Delete value from a secure tag
41+
deleteall Delete all keys in a secure tag
42+
imei Get IMEI from the modem
43+
attoken Get attestation token of the modem
3644
generate Generate private key
3745
```
3846

@@ -56,7 +64,7 @@ Secure tag Key type SHA
5664

5765
### write subcommand
5866

59-
Write key/cert to a secure tag. KEY_TYPE must be either ROOT_CA_CERT, CLIENT_CERT, CLIENT_KEY, or PSK.
67+
Write key/cert to a security tag. KEY_TYPE must be either ROOT_CA_CERT, CLIENT_CERT, CLIENT_KEY, or PSK.
6068

6169
```
6270
usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev write SECURE_TAG KEY_TYPE FILENAME
@@ -68,7 +76,7 @@ usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev write SECURE_T
6876

6977
### delete subcommand
7078

71-
Delete value from a secure tag.
79+
Delete value from a security tag.
7280

7381
```
7482
usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev delete SECURE_TAG KEY_TYPE
@@ -78,6 +86,31 @@ usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev delete SECURE_
7886

7987
$ nrfcredstore /dev/tty.usbmodem0009600000001 delete 123 ROOT_CA_CERT
8088

89+
### deletall subcommand
90+
91+
Delete all writable security tags.
92+
93+
```
94+
usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev deleteall
95+
```
96+
97+
### imei subcommand
98+
99+
Read IMEI from modem.
100+
101+
```
102+
usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev imei
103+
```
104+
105+
### attoken subcommand
106+
107+
Read Attestation Token from modem.
108+
109+
```
110+
usage: nrfcredstore [--baudrate BAUDRATE] [--timeout TIMEOUT] dev attoken
111+
```
112+
113+
81114
### generate subcommand
82115

83116
> [!IMPORTANT]
@@ -114,4 +147,4 @@ Running the tests depends on a [development installation](#development-installat
114147

115148
Check coverage
116149

117-
poetry run pytest --cov=. tests
150+
poetry run pytest --cov=src tests --cov-report=html

0 commit comments

Comments
 (0)