Skip to content
Snippets Groups Projects
Commit e832bc49 authored by Jonah Husson's avatar Jonah Husson
Browse files

Merge branch 'xx-4687/ekv-js-storage' into 'project/base32768'

Use base32768

See merge request !1
parents a43b2c14 2656556d
No related branches found
No related tags found
3 merge requests!3Release,!2Project/base32768,!1Use base32768
...@@ -10,12 +10,11 @@ ...@@ -10,12 +10,11 @@
package storage package storage
import ( import (
"encoding/base64"
"os" "os"
"strings" "strings"
"syscall/js" "syscall/js"
// "github.com/Max-Sum/base32768" "github.com/Max-Sum/base32768"
"gitlab.com/elixxir/wasm-utils/exception" "gitlab.com/elixxir/wasm-utils/exception"
"gitlab.com/elixxir/wasm-utils/utils" "gitlab.com/elixxir/wasm-utils/utils"
...@@ -69,15 +68,13 @@ func (ls *LocalStorage) Get(keyName string) ([]byte, error) { ...@@ -69,15 +68,13 @@ func (ls *LocalStorage) Get(keyName string) ([]byte, error) {
return nil, err return nil, err
} }
// return base32768.SafeEncoding.DecodeString(value) return base32768.SafeEncoding.DecodeString(value)
return base64.StdEncoding.DecodeString(value)
} }
// Set encodes the bytes to a string and adds them to local storage at the // Set encodes the bytes to a string and adds them to local storage at the
// given key name. Returns an error if local storage quota has been reached. // given key name. Returns an error if local storage quota has been reached.
func (ls *LocalStorage) Set(keyName string, keyValue []byte) error { func (ls *LocalStorage) Set(keyName string, keyValue []byte) error {
// encoded := base32768.SafeEncoding.EncodeToString(keyValue) encoded := base32768.SafeEncoding.EncodeToString(keyValue)
encoded := base64.StdEncoding.EncodeToString(keyValue)
return ls.v.SetItem(ls.prefix+keyName, encoded) return ls.v.SetItem(ls.prefix+keyName, encoded)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment