Replies: 1 comment 5 replies
-
Thanks for sharing all this, it helps a lot to understand the current picture! First of all, I fully agree with:
Orchestrating this server-side feels like overengineering the problem with no actual benefit. I would advocate for versioning the schema of the data stored in the
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Recovery sync
In the KERIA/Signify architecture, each agent provisioned in the cloud has it's own set of databases and Signify itself is stateless except for the bran (sometimes referred to as the "passcode"). The bran is our recovery phrase, which we BIP-39 encode to a word list.
We do however have a local SQLite database which is primarily there to:
For the time being, we have been avoiding any local backups of this SQLite database in favour of allowing the user to recover using their recovery phrase and KERIA connect URL, and sync as much data back to the edge as we can. Some things are lost but are not vitally important, and we can improve on that in the future by having additional KERIA APIs for storing more user data. This in general could be a completely different topic of discussion which will no doubt become even more relevant when we consider backup and recovery of cloud databases.
Data
We have SQLite database at the edge, and the LMDB database in the cloud. Both are migrated as you would expect when upgrading either the app or KERIA. The LMDB migrations are of standard KERI data, like how KELs are stored, or OOBIs etc.
The harder thing to consider is due to our current recovery strategy, we have user data stored in the cloud that is non-standard. For example, for each connection, we can store connection notes, and we track big events like credential issuances and store it with the KERIA Contact using the
contacts()
API in Signify.Standard LMDB migrations from keripy or KERIA will not touch this data - it is data that is entirely driven by the edge wallet, and KERIA has no inclination of what a Signify client intends to store there.
Edge initiated migrations
So it becomes tricky to manage when that data should be migrated - to me, there are only two immediate options:
So far, for our
1.2.0
release we have been working on the first option, and it works. The second option feels like a lot of work, but it is worth considering before we release1.2.0
and align on a strategy.Happy to hear other options too. For example, we could become less dependent on the cloud and have better backup mechanisms for SQLite. We could even use KERIA to serve as a backup layer for it, and recognise that the entire onboarding/recovery flow could be done with a separate SQLite database than the one that's used during normal app flow.
On-connect
This means as part of migrations, we will connect to the cloud and fire a bunch of Signify calls to migrate data in the cloud. It is very important that each "area" of migrations in the cloud, like a KERIA Contact, has it's own version number so that migrations are idempotent in case we need to re-run them for completion, as we cannot perform a LMDB transaction from the edge.
However, it is also possible that we are recovering a wallet, so the connection to the cloud does not happen on app launch, but at the edge of the recovery flow. In this case, we must make sure that we create a separation between local SQLite migrations and cloud migrations.
For example, we shouldn't iterate over all local connections in SQLite, and update them in KERIA, since the connection list is not there before recovering. We should iterate over all KERIA Contacts, and update them with only data from Signify.
Additionally, if we a
1.2.0
edge and cloud migration to apply, and a1.3.0
edge migration - both of the edge migrations will happen before we display the UI for the user to enter their recovery phrase and connect URL. So1.3.0
edge should be allowed to happen out of order to1.2.0
cloud.Scheduled updates
Scheduling a migration from the edge on the surface raises a lot of concerns. The coordination of it feels like it would take a lot of effort, given there could be various wallets connected to the same KERIA, with varying Signify versions. But it also introduces the complexity of mapping the intentions of the edge client to the cloud DB - or the edge being dependent on knowing LMDB database structures which breaks a lot of rules.
There is no use case for this data being accessed by anything other than the wallet, so it feels like it brings a lot of complexity to just reduce needing to make (possibly) many API calls to migrate.
Beta Was this translation helpful? Give feedback.
All reactions