]> git.meshlink.io Git - meshlink/blobdiff - src/meshlink.h
Add unit test cases for encrypted storage key rotation
[meshlink] / src / meshlink.h
index 96f2d183e222e0163a796a38d6056a85d3cf191a..6a1c758a65011666b5f8731dd02c40f079223d72 100644 (file)
@@ -1176,6 +1176,19 @@ extern void meshlink_hint_address(meshlink_handle_t *mesh, meshlink_node_t *node
  */
 extern void meshlink_enable_discovery(meshlink_handle_t *mesh, bool enable);
 
+/// Performs key rotation for an encrypted storage
+
+/** This rotates the (master) key for an encrypted storage and discards the old key
+ *  if the call succeeded. This is an atomic call.
+ *
+ *  @param mesh     A handle which represents an instance of MeshLink.
+ *  @param key      A pointer to the new key used to encrypt storage.
+ *  @param keylen   The length of the new key in bytes.
+ *
+ *  @return         This function returns true if the key rotation for the encrypted storage succeeds, false otherwise.
+ */
+extern bool meshlink_encrypted_key_rotate(meshlink_handle_t *mesh, const void *new_key, size_t new_keylen);
+
 #ifdef __cplusplus
 }
 #endif