storage

package
v0.3.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: BSD-2-Clause Imports: 19 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

View Source
const SEMVER = "0.3.18"

SEMVER is the current semantic version of xxDK WASM.

Variables

This section is empty.

Functions

func ChangeExternalPassword

func ChangeExternalPassword(_ js.Value, args []js.Value) any

ChangeExternalPassword allows a user to change their external password.

Parameters:

  • args[0] - The user's old password (string).
  • args[1] - The user's new password (string).

Returns:

  • Throws TypeError on failure.

func CheckAndStoreVersions

func CheckAndStoreVersions() error

CheckAndStoreVersions checks that the stored xxDK WASM version matches the current version and if not, upgrades it. It also stored the current xxDK client to storage.

On first load, only the xxDK WASM and xxDK client versions are stored.

func DecrementNumClientsRunning

func DecrementNumClientsRunning()

DecrementNumClientsRunning decrements the number client tracker. This should be called when stopping the network follower.

func GetIndexedDbList

func GetIndexedDbList() (map[string]struct{}, error)

GetIndexedDbList returns the list of stored indexedDb databases.

func GetOldClientSemVersion added in v0.3.0

func GetOldClientSemVersion() string

GetOldClientSemVersion returns the old version of xxdk client before being updated.

func GetOldWasmSemVersion added in v0.3.0

func GetOldWasmSemVersion() string

GetOldWasmSemVersion returns the old version of xxdk WASM before being updated.

func GetOrInitPassword

func GetOrInitPassword(_ js.Value, args []js.Value) any

GetOrInitPassword takes a user-provided password and returns its associated 256-bit internal password.

If the internal password has not previously been created, then it is generated, saved to local storage, and returned. If the internal password has been previously generated, it is retrieved from local storage and returned.

Any password saved to local storage is encrypted using the user-provided password.

Parameters:

  • args[0] - The user supplied password (string).

Returns a promise:

  • Internal password (Uint8Array).
  • Throws TypeError on failure.

func IncrementNumClientsRunning

func IncrementNumClientsRunning()

IncrementNumClientsRunning increments the number client tracker. This should be called when starting the network follower.

func Purge

func Purge(_ js.Value, args []js.Value) any

Purge clears all local storage and indexedDb databases saved by this WASM binary. This can only occur when no cMix followers are running. The user's password is required.

Parameters:

  • 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.

func StoreIndexedDb

func StoreIndexedDb(databaseName string) error

StoreIndexedDb saved the indexedDb database name to storage.

func StoreIndexedDbEncryptionStatus

func StoreIndexedDbEncryptionStatus(
	databaseName string, encryptionStatus bool) (
	loadedEncryptionStatus bool, err error)

StoreIndexedDbEncryptionStatus stores the encryption status if it has not been previously saved. If it has, then it returns its value.

func VerifyPassword

func VerifyPassword(_ js.Value, args []js.Value) any

VerifyPassword determines if the user-provided password is correct.

Parameters:

  • args[0] - The user supplied password (string).

Returns:

  • True if the password is correct and false if it is incorrect (boolean).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL