Skip to content

Commit 3adbebb

Browse files
coderbyheartgregersrygg
authored andcommitted
fix: do not prepend credentials with newline
This is not needed and aligns credstore with the way nRF Connect's Cellular Monitor's Device Manager provisions certificates. Signed-off-by: Markus Tacker <[email protected]>
1 parent a2c036e commit 3adbebb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/nrfcredstore/credstore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def write(self, tag: int, type: CredType, file: io.TextIOBase):
7777

7878
if type == CredType.ANY:
7979
raise ValueError
80-
cert = '\n' + file.read().rstrip()
80+
cert = file.read().rstrip()
8181
return is_ok(self.at_client.at_command(f'AT%CMNG=0,{tag},{type.value},"{cert}"'))
8282

8383
def delete(self, tag: int, type: CredType):

tests/test_credstore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test_write_success(self, cred_store, ok_resp):
109109
-----END CERTIFICATE-----'''
110110
fake_file = io.StringIO(cert_text)
111111
assert cred_store.write(567890, CredType.CLIENT_KEY, fake_file)
112-
self.at_client.at_command.assert_called_with(f'AT%CMNG=0,567890,2,"\n{cert_text}"')
112+
self.at_client.at_command.assert_called_with(f'AT%CMNG=0,567890,2,"{cert_text}"')
113113

114114
def test_write_fail(self, cred_store, at_error):
115115
with pytest.raises(ATCommandError):

0 commit comments

Comments
 (0)