Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xxdk-wasm
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
xxdk-wasm
Commits
575ac9dc
Commit
575ac9dc
authored
1 year ago
by
Jono Wenger
Committed by
Jonah Husson
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix purge for wasm-utils localstorage
parent
f725f95d
No related branches found
No related tags found
3 merge requests
!128
Project/base32768
,
!125
Fix purge for wasm-utils localstorage
,
!109
Project/haven beta
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
storage/purge.go
+4
-26
4 additions, 26 deletions
storage/purge.go
with
4 additions
and
26 deletions
storage/purge.go
+
4
−
26
View file @
575ac9dc
...
...
@@ -16,7 +16,6 @@ import (
"github.com/hack-pad/go-indexeddb/idb"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/v4/storage/utility"
"gitlab.com/elixxir/wasm-utils/exception"
"gitlab.com/elixxir/wasm-utils/storage"
)
...
...
@@ -45,17 +44,14 @@ func DecrementNumClientsRunning() {
// password is required.
//
// Parameters:
// - args[0] - Storage directory path (string). This is the same directory
// path passed into [wasm.NewCmix].
// - args[1] - The user-supplied password (string). This is the same password
// - args[0] - The user-supplied password (string). This is the same password
// passed into [wasm.NewCmix].
//
// Returns:
// - Throws an error if the password is incorrect or if not all cMix
//
followers
have been stopped.
// - Throws an error if the password is incorrect or if not all cMix
followers
// have been stopped.
func
Purge
(
_
js
.
Value
,
args
[]
js
.
Value
)
any
{
storageDirectory
:=
args
[
0
]
.
String
()
userPassword
:=
args
[
1
]
.
String
()
userPassword
:=
args
[
0
]
.
String
()
// Check the password
if
!
verifyPassword
(
userPassword
)
{
...
...
@@ -96,23 +92,5 @@ func Purge(_ js.Value, args []js.Value) any {
n
:=
ls
.
Clear
()
jww
.
DEBUG
.
Printf
(
"[PURGE] Cleared %d WASM keys in local storage"
,
n
)
// Clear all EKV from local storage
keys
:=
ls
.
LocalStorageUNSAFE
()
.
KeysPrefix
(
storageDirectory
)
n
=
len
(
keys
)
for
_
,
keyName
:=
range
keys
{
ls
.
LocalStorageUNSAFE
()
.
RemoveItem
(
keyName
)
}
jww
.
DEBUG
.
Printf
(
"[PURGE] Cleared %d keys with the prefix %q (for EKV)"
,
n
,
storageDirectory
)
// Clear all NDFs saved to local storage
keys
=
ls
.
LocalStorageUNSAFE
()
.
KeysPrefix
(
utility
.
NdfStorageKeyNamePrefix
)
n
=
len
(
keys
)
for
_
,
keyName
:=
range
keys
{
ls
.
LocalStorageUNSAFE
()
.
RemoveItem
(
keyName
)
}
jww
.
DEBUG
.
Printf
(
"[PURGE] Cleared %d keys with the prefix %q (for NDF)"
,
n
,
utility
.
NdfStorageKeyNamePrefix
)
return
nil
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment