![]() |
|
Uniot Core
|
| 0.8.1 |
Manages device identity and cryptographic credentials for Uniot devices. More...
#include <Credentials.h>
Public Member Functions | |
| Credentials () | |
| Constructor that initializes device credentials. | |
| virtual bool | store () override |
| Stores credentials to persistent storage. | |
| virtual bool | restore () override |
| Restores credentials from persistent storage. | |
| void | setOwnerId (const String &id) |
| Sets the owner ID of the device. | |
| const String & | getOwnerId () const |
| Gets the current owner ID. | |
| bool | isOwnerChanged () const |
| void | resetOwnerChanged () |
| const String & | getCreatorId () const |
| Gets the creator ID. | |
| const String & | getDeviceId () const |
| Gets the unique device ID. | |
| const String & | getPublicKey () const |
| Gets the device's public key as a hexadecimal string. | |
| uint32_t | getShortDeviceId () const |
| Gets a shorter unique identifier for the device. | |
| virtual Bytes | keyId () const override |
| Implements ICOSESigner interface to provide key ID. | |
| virtual Bytes | sign (const Bytes &data) const override |
| Implements ICOSESigner interface to sign data. | |
| virtual COSEAlgorithm | signerAlgorithm () const override |
| Implements ICOSESigner interface to specify the signing algorithm. | |
Public Member Functions inherited from uniot::CBORStorage | |
| CBORStorage (const String &path) | |
| Constructs a new CBORStorage object. | |
| virtual | ~CBORStorage () |
| Virtual destructor. | |
| CBORObject & | object () |
| Get access to the underlying CBORObject. | |
| virtual bool | clean () override |
| Clean the CBOR object and remove the storage file. | |
Public Member Functions inherited from uniot::Storage | |
| Storage (const String &path) | |
| Constructs a Storage object for a specific file. | |
| virtual | ~Storage () |
| Destructor. | |
Public Member Functions inherited from uniot::ICOSESigner | |
| virtual | ~ICOSESigner () |
| Virtual destructor to ensure proper cleanup of derived classes. | |
Additional Inherited Members | |
Static Public Member Functions inherited from uniot::Storage | |
| static void | unmount () |
| Explicitly unmounts the filesystem. | |
Protected Member Functions inherited from uniot::Storage | |
| void | setPath (const String &path) |
| Sets the file path, ensuring it starts with "/". | |
Protected Attributes inherited from uniot::CBORStorage | |
| CBORObject | mCbor |
| The CBOR object used for data serialization/deserialization. | |
Protected Attributes inherited from uniot::Storage | |
| Bytes | mData |
| The byte array containing the data to be stored or the loaded data. | |
| String | mPath |
| The file path where data is stored. | |
Manages device identity and cryptographic credentials for Uniot devices.
The Credentials class is responsible for:
It inherits from CBORStorage for serialization/deserialization and from ICOSESigner to implement COSE signing capabilities.
|
inline |
Constructor that initializes device credentials.
On first instantiation, it generates a new Ed25519 key pair for the device. On subsequent instantiations, it loads existing credentials from persistent storage.
|
inline |
Gets the creator ID.
| creatorId& | The creator ID. |
|
inline |
Gets the unique device ID.
| deviceId& | The device ID. |
|
inline |
Gets the current owner ID.
| ownerId& | The owner ID. |
|
inline |
Gets the device's public key as a hexadecimal string.
| publicKey& | The public key in hexadecimal format. |
|
inline |
Gets a shorter unique identifier for the device.
Uses ESP-specific functions to obtain a chip ID.
| uint32_t | The short device ID. |
|
inline |
|
inlineoverridevirtual |
Implements ICOSESigner interface to provide key ID.
| Bytes | The raw public key bytes. |
Implements uniot::ICOSESigner.
|
inline |
|
inlineoverridevirtual |
Restores credentials from persistent storage.
Loads the owner ID and private key from CBOR storage.
| true | Credentials were successfully restored. |
| false | Credentials could not be restored. |
Reimplemented from uniot::CBORStorage.
|
inline |
Sets the owner ID of the device.
| id | The new owner ID to set. |
Implements ICOSESigner interface to sign data.
Signs the provided data using the device's Ed25519 private key.
| data | The data to sign. |
| Bytes | The signature of the data. |
Implements uniot::ICOSESigner.
|
inlineoverridevirtual |
Implements ICOSESigner interface to specify the signing algorithm.
| COSEAlgorithm::EdDSA | The algorithm used for signing. |
Implements uniot::ICOSESigner.
|
inlineoverridevirtual |
Stores credentials to persistent storage.
Saves the owner ID and private key to the CBOR storage.
Reimplemented from uniot::CBORStorage.