Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 9 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,17 @@
# ncs-door-lock-app
NCS manifest repo for the door lock reference application.
# nRF Door Lock and Access Control Add-on

## Getting started

Before getting started, set up the nRF Connect SDK development environment.

Follow the official [Installing the nRF Connect SDK](https://docs.nordicsemi.com/bundle/ncs-3.2.0/page/nrf/installation/install_ncs.html) guide and complete the following steps:

- [Update operating system](https://docs.nordicsemi.com/bundle/ncs-3.2.0/page/nrf/installation/install_ncs.html#update_operating_system)
- [Install prerequisites](https://docs.nordicsemi.com/bundle/ncs-3.2.0/page/nrf/installation/install_ncs.html#install_prerequisites)
- [Install the nRF Connect SDK toolchain](https://docs.nordicsemi.com/bundle/ncs-3.2.0/page/nrf/installation/install_ncs.html#install_the_nrf_connect_sdk_toolchain)

### Initialization

First, initialize the workspace folder (``door-lock-workspace``) where
the ``ncs-door-lock-app`` and all nRF Connect SDK modules will be cloned.
In combination with the nRF Connect SDK, the nRF Door Lock and Access Control Add-on provides a complete reference for building Aliro- and Matter-compatible locks and access control readers for both residential and commercial applications. The reference integrates multiple wireless technologies - including Bluetooth Low Energy (BLE), Ultra-Wideband (UWB), NFC, Thread, and Wi-Fi - allowing developers to choose the appropriate technology for their specific use case.

Run the following commands:
Aliro standardizes the interaction that lets a phone or wearable act as a digital key at an opening. Matter specifies how connected products communicate for command-and-control use cases like remotely locking or unlocking a door, checking lock status, user provisioning or integrating with home automation systems. The reference can support Aliro alone, Matter alone, or both protocols, depending on the specific use case and product requirements.

```shell
# launch nRF Connect toolchain for v3.2.0 release
nrfutil sdk-manager toolchain launch --ncs-version v3.2.0 --shell
```

```shell
# initialize workspace for the ncs-door-lock-app (v0.6.0 release)
west init -m https://github.com/nrfconnect/ncs-door-lock-app --mr v0.6.0 door-lock-workspace
```

```shell
# update nRF Connect SDK modules
cd door-lock-workspace
west update
```

For detailed instructions on building and testing the `ncs-door-lock-app` application, see the technical documentation in the `docs` directory.
To build this documentation locally, follow the steps in the section below.

## Building local documentation

To build the documentation locally, you must complete a minimal setup.
## Getting started

Navigate to the ``docs`` folder, and install Sphinx and other documentation dependencies by running the following command:
To get started with the nRF Door Lock and Access Control Add-on, follow the [documentation](https://docs.nordicsemi.com/bundle/aliro_1.0.0/page/index.html).

```shell
pip install -r requirements.txt
```
## License

Once successfully installed, you can build the Sphinx documentation from the ``docs`` folder:
Source code included within this repository is licensed under the [LicenseRef-Nordic-5-Clause](LICENSE).

```shell
make html
```
## Support

The documentation will be generated in the ``build`` folder.
To view the built documentation, open ``docs/build/html/index.html`` in your web browser.
To ask questions about the reference or to get technical support, please refer to [Nordic DevZone](https://devzone.nordicsemi.com).
4 changes: 2 additions & 2 deletions app/VERSION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_MAJOR = 0
VERSION_MINOR = 6
VERSION_MAJOR = 1
VERSION_MINOR = 0
PATCHLEVEL = 0
VERSION_TWEAK = 0
EXTRAVERSION =
8 changes: 3 additions & 5 deletions app/src/aliro/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
menu "Aliro features"

config DOOR_LOCK_BLE_UWB
bool "Aliro Bluetooth LE (BLE) transport together with ultra wideband (UWB)"
bool "Integration with Aliro BLE and UWB [EXPERIMENTAL]"
select NCS_ALIRO_BLE_UWB
select EXPERIMENTAL
help
Enable the Aliro BLE transport protocol (TP). This is the transport layer
used by the Reader to communicate with the User Device. It is used to send and
receive packets over BLE. Additionally the UWB is enabled in order to manage the
ranging between the Reader and the User Device.
Enable the door lock application integration with Aliro Bluetooth LE (BLE) and ultra wideband (UWB).

if DOOR_LOCK_BLE_UWB

Expand Down
10 changes: 7 additions & 3 deletions app/src/aliro/access_manager/access_manager_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1055,9 +1055,13 @@ AliroError AccessManagerImpl::ProcessAccessDocument(const CryptoTypes::PublicKey
#if CONFIG_DOOR_LOCK_STORAGE_MAX_STORED_ACCESS_DOCUMENTS > 0
MutexGuard lock{ sMutex };

// Check if there is a free index in the Access Document container to store the Access Document.
size_t keyIndex = 0;
error = GetFirstFreeIndex(mAdKeys, keyIndex);
const bool adKeyStored = IsPublicKeyStored(mAdKeys, userPublicKey, &keyIndex);

if (!adKeyStored) {
// Check if there is a free index in the Access Document container to store the Access Document.
error = GetFirstFreeIndex(mAdKeys, keyIndex);
}

if (error == ALIRO_NO_MEMORY) {
LOG_DBG("No free index in the Access Document container, removing oldest credential");
Expand All @@ -1072,7 +1076,7 @@ AliroError AccessManagerImpl::ProcessAccessDocument(const CryptoTypes::PublicKey

if (credentialIssuerKeyStored) {
error = StoreAccessDocument(keyIndex, credentialIssuerKeyIndex, ad);
if (error == ALIRO_NO_ERROR) {
if (error == ALIRO_NO_ERROR && !adKeyStored) {
AddKeyToContainer(mAdKeys, userPublicKey, keyIndex);
}
}
Expand Down
16 changes: 2 additions & 14 deletions app/src/aliro/aliro_state_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

#include "aliro_state_control.h"

#include "aliro/crypto_key_ids.h"
#include "aliro/init.h"
#include "crypto/utils.h"
#include "reader_cache.h"
#include "reader.h"

#include <aliro/aliro.h>
#include <aliro/utils.h>
Expand All @@ -21,19 +19,9 @@ LOG_MODULE_DECLARE(aliro);

namespace {

bool IsReaderIdentifierProvisioned()
{
return Aliro::ReaderCache::Instance().IsIdentifierSet();
}

bool IsReaderPrivateKeyProvisioned()
{
return DoorLock::Crypto::IsKeyAvailable(Aliro::kPrivateKeyId) == ALIRO_NO_ERROR;
}

bool IsProvisioningComplete()
{
return IsReaderPrivateKeyProvisioned() && IsReaderIdentifierProvisioned();
return DoorLock::Storage::Reader::IsIdentifierSet() && DoorLock::Storage::Reader::IsPrivateKeySet();
}

} // anonymous namespace
Expand Down
2 changes: 1 addition & 1 deletion app/src/aliro/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ zephyr_library_sources_ifdef(CONFIG_BT btaddr.cpp)
zephyr_library_sources_ifdef(CONFIG_DOOR_LOCK_EXPEDITED_FAST_PHASE kpersistent.cpp)
zephyr_library_sources_ifndef(CONFIG_CHIP
factory_reset.cpp
install.cpp
provisioning.cpp
reader.cpp
)

zephyr_include_directories(.)
4 changes: 2 additions & 2 deletions app/src/aliro/cli/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#

config SHELL_CMD_BUFF_SIZE
# Shell buffer must fit: "dl provisioning reader_cert set " (28 chars) + hex string (2 * cert size)
# For 512 byte cert: 28 + 1024 = 1052
# Shell buffer must fit: "dl reader certificate set " (26 chars) + hex string (2 * cert size)
# For 512 byte cert: 26 + 1024 = 1050
default 1052 if (SHELL && DOOR_LOCK_READER_CERTIFICATE)
103 changes: 0 additions & 103 deletions app/src/aliro/cli/install.cpp

This file was deleted.

5 changes: 3 additions & 2 deletions app/src/aliro/cli/kpersistent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

#include "shell_private.h"

#include <aliro/crypto_key_ids.h>
#include <aliro/memory.h>
#include <aliro/utils.h>
#include <psa_key_ids.h>

#include "aliro/utils/hex_string.h"

Expand Down Expand Up @@ -37,7 +37,8 @@ int PrintKpersistentKeys(const struct shell *shell, Aliro::CryptoTypes::KeyId *k
shell_print(shell, "--------------------------------");
for (size_t i = 0; i < kpersistentCount; i++) {
const Aliro::CryptoTypes::KeyId kpersistentKeyId = kpersistentKeyIds[i];
const size_t kpersistentKeyIndex = kpersistentKeyId - Aliro::kKpersistentRangeBegin;
const size_t kpersistentKeyIndex =
kpersistentKeyId - DoorLock::Storage::PsaKeyIds::kKpersistentRangeBegin;

Aliro::CryptoTypes::PublicKey publicKey{};
auto *kpersistentManager = GetShellKpersistentManager();
Expand Down
Loading