Skip to content
Snippets Groups Projects
Commit b1601670 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Merge branch 'release' of git.xx.network:elixxir/xxdk-wasm into release

parents 6a54dcd1 0fabaff1
No related branches found
No related tags found
1 merge request!60Revert "Fail a test to be sure it works"
...@@ -12,6 +12,7 @@ package storage ...@@ -12,6 +12,7 @@ package storage
import ( import (
"github.com/hack-pad/go-indexeddb/idb" "github.com/hack-pad/go-indexeddb/idb"
"github.com/pkg/errors" "github.com/pkg/errors"
"gitlab.com/elixxir/ekv/portableOS"
"gitlab.com/elixxir/xxdk-wasm/utils" "gitlab.com/elixxir/xxdk-wasm/utils"
"sync/atomic" "sync/atomic"
"syscall/js" "syscall/js"
...@@ -32,15 +33,14 @@ var NumClientsRunning uint64 ...@@ -32,15 +33,14 @@ var NumClientsRunning uint64
// Only use if you want to destroy everything. // Only use if you want to destroy everything.
// //
// Parameters: // Parameters:
// - args[0] - Storage directory path (string). // - args[0] - The user-supplied password (string).
// - args[1] - The user-supplied password (string).
// //
// Returns: // Returns:
// - Throws a TypeError if the password is incorrect or if not all Cmix // - Throws a TypeError if the password is incorrect or if not all Cmix
// followers have been stopped. // followers have been stopped.
func Purge(_ js.Value, args []js.Value) interface{} { func Purge(_ js.Value, args []js.Value) interface{} {
// Check the password // Check the password
if !verifyPassword(args[1].String()) { if !verifyPassword(args[0].String()) {
utils.Throw(utils.TypeError, errors.New("invalid password")) utils.Throw(utils.TypeError, errors.New("invalid password"))
return nil return nil
} }
...@@ -61,6 +61,9 @@ func Purge(_ js.Value, args []js.Value) interface{} { ...@@ -61,6 +61,9 @@ func Purge(_ js.Value, args []js.Value) interface{} {
return nil return nil
} }
// Add EKV database to list
databaseList[portableOS.DatabaseName] = struct{}{}
// Delete each database // Delete each database
for dbName := range databaseList { for dbName := range databaseList {
_, err = idb.Global().DeleteDatabase(dbName) _, err = idb.Global().DeleteDatabase(dbName)
...@@ -72,10 +75,9 @@ func Purge(_ js.Value, args []js.Value) interface{} { ...@@ -72,10 +75,9 @@ func Purge(_ js.Value, args []js.Value) interface{} {
} }
} }
// Clear WASM local storage and EKV // Clear WASM local storage
ls := GetLocalStorage() ls := GetLocalStorage()
ls.ClearWASM() ls.ClearWASM()
ls.ClearPrefix(args[0].String())
return nil return nil
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment