File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,21 @@ class FileSecurityDb : public SecurityDb {
116
116
sign_count_t sign_counter
117
117
);
118
118
119
+ /* local csrk and identity */
120
+
121
+ virtual void set_local_csrk (
122
+ const csrk_t &csrk
123
+ );
124
+
125
+ virtual void set_local_identity (
126
+ const irk_t &irk,
127
+ const address_t &identity_address,
128
+ bool public_address
129
+ );
130
+
131
+ /* I am not overriding set_local_sign_counter to avoid constant filesystem writes,
132
+ * instead this is synced by sync (which is called on disconnection) */
133
+
119
134
/* saving and loading from nvm */
120
135
121
136
virtual void restore ();
Original file line number Diff line number Diff line change @@ -425,6 +425,22 @@ class SecurityDb {
425
425
_local_sign_counter = sign_counter;
426
426
}
427
427
428
+ /* local identity */
429
+ /* *
430
+ * Update the local identity.
431
+ *
432
+ * @param[in] csrk new CSRK value
433
+ */
434
+ virtual void set_local_identity (
435
+ const irk_t &irk,
436
+ const address_t &identity_address,
437
+ bool public_address
438
+ ) {
439
+ _local_identity.irk = irk;
440
+ _local_identity.identity_address = identity_address;
441
+ _local_identity.identity_address_is_public = public_address;
442
+ }
443
+
428
444
/* list management */
429
445
430
446
/* *
Original file line number Diff line number Diff line change @@ -265,6 +265,22 @@ void FileSecurityDb::set_entry_peer_sign_counter(
265
265
}
266
266
}
267
267
268
+ void FileSecurityDb::set_local_csrk (
269
+ const csrk_t &csrk
270
+ ) {
271
+ this ->SecurityDb ::set_local_csrk (csrk);
272
+ db_write (&_local_csrk, DB_OFFSET_LOCAL_CSRK);
273
+ }
274
+
275
+ void FileSecurityDb::set_local_identity (
276
+ const irk_t &irk,
277
+ const address_t &identity_address,
278
+ bool public_address
279
+ ) {
280
+ this ->SecurityDb ::set_local_identity (irk, identity_address, public_address);
281
+ db_write (&_local_identity, DB_OFFSET_LOCAL_IDENTITY);
282
+ }
283
+
268
284
/* saving and loading from nvm */
269
285
270
286
void FileSecurityDb::restore () {
@@ -299,6 +315,7 @@ void FileSecurityDb::sync(entry_handle_t db_handle) {
299
315
300
316
db_write (&entry->peer_sign_counter , entry->file_offset + DB_STORE_OFFSET_PEER_SIGNING_COUNT);
301
317
db_write (&entry->flags , entry->file_offset + DB_STORE_OFFSET_FLAGS);
318
+ db_write (&_local_sign_counter, DB_OFFSET_LOCAL_SIGN_COUNT);
302
319
}
303
320
304
321
void FileSecurityDb::set_restore (bool reload) {
You can’t perform that action at this time.
0 commit comments