Skip to content

Commit

Permalink
fix: assure that all signers will have an unique id
Browse files Browse the repository at this point in the history
Without an unique ID, when do a delete will delete all that haven't an
unique ID. By this way we assure that all will have an unique id

Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Nov 22, 2024
1 parent ba8b540 commit db26037
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/store/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export const useFilesStore = function(...args) {
})
},
async hydrateFile(nodeId) {
this.addUniqueIdentifierToAllSigners(this.files[nodeId].signers)
if (Object.hasOwn(this.files[nodeId], 'uuid')) {
return
}
Expand All @@ -173,6 +174,9 @@ export const useFilesStore = function(...args) {
signers.map(signer => this.addIdentifierToSigner(signer))
},
addIdentifierToSigner(signer) {
if (signer.identify) {
return
}
// generate unique code to new signer to be possible delete or edit
if ((signer.identify === undefined || signer.identify === '') && signer.signRequestId === undefined) {
signer.identify = btoa(String.fromCharCode(...new TextEncoder().encode(JSON.stringify(signer))))
Expand Down

0 comments on commit db26037

Please sign in to comment.