Skip to content

Commit

Permalink
fix: backup recovery was linking incorrectly dids with private keys
Browse files Browse the repository at this point in the history
Signed-off-by: Cristian G <[email protected]>
  • Loading branch information
cristianIOHK committed Jul 30, 2024
1 parent 6b1e7b9 commit b6f79a2
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ open class PlutoBackupTask(private val pluto: Pluto) {
dids = dids.await(),
didPairs = didPairs.await(),
keys = privateKeys.await(),
linkSecret = linkSecret.await()!!,
linkSecret = linkSecret.await(),
messages = messages.await(),
mediators = mediator.await()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,10 @@ open class PlutoRestoreTask(
val did = (it.third as DID)
val keyId = did.toString()
if (keyId.contains("#")) {
val simpleDid = keyId.split("#").first()
pluto.storePrivateKeys(
it.first as StorableKey,
did,
DID(simpleDid),
(it.first.keySpecification[IndexKey().property])?.toInt(),
keyId
)
Expand Down Expand Up @@ -242,7 +243,9 @@ open class PlutoRestoreTask(
* If the backup object has a link secret, it is decoded from base64 URL encoding and stored using the pluto.storeLinkSecret method.
*/
private fun restoreLinkSecret() {
pluto.storeLinkSecret(this.backup.linkSecret)
if (this.backup.linkSecret != null) {
pluto.storeLinkSecret(this.backup.linkSecret)
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ constructor(
val keys: List<Key>,
val messages: List<String>,
@SerialName("link_secret")
val linkSecret: String,
val linkSecret: String?,
val mediators: List<Mediator>
) {

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit b6f79a2

Please sign in to comment.