Skip to main content
Version: 6.0

Class: BrowserVault

THIS VAULT DOES NOT IMPLEMENT SECURE STORAGE IN THE BROWSER. It only exists as a way to run browser-compatible code in place of Identity Vault. Browsers do not have a secure storage element same as native devices. This class is intended to be used to enable running your application in the browser while simulating the functions of Identity Vault using sessionStorage.

Represents a vault implementation for browser compatibility.

Implements​

  • VaultInterface

Constructors​

constructor​

• new BrowserVault(config?): BrowserVault

Parameters​

NameType
config?IdentityVaultConfig

Returns​

BrowserVault

Usage


_10
const vault = new Vault({
_10
key: 'com.company.myvaultapp',
_10
type: 'CustomPasscode',
_10
deviceSecurityType: 'Both',
_10
lockAfterBackgrounded: 2000,
_10
});

Methods​

clear​

▸ clear(): Promise<void>

See Vault.clear

Returns​

Promise<void>

Implementation of​

VaultInterface.clear


doesVaultExist​

▸ doesVaultExist(): Promise<boolean>

See Vault.doesVaultExist

Returns​

Promise<boolean>

Implementation of​

VaultInterface.doesVaultExist


exportVault​

▸ exportVault(): Promise<Record<string, string>>

See Vault.exportVault

Returns​

Promise<Record<string, string>>

Implementation of​

VaultInterface.exportVault


getKeys​

▸ getKeys(): Promise<string[]>

See Vault.getKeys

Returns​

Promise<string[]>

Implementation of​

VaultInterface.getKeys


getValue​

▸ getValue<T>(key): Promise<null | T>

See Vault.getValue

Type parameters​

NameType
Tany

Parameters​

NameType
keystring

Returns​

Promise<null | T>

Implementation of​

VaultInterface.getValue


importVault​

▸ importVault(data): Promise<void>

See Vault.importVault

Parameters​

NameType
dataRecord<string, string>

Returns​

Promise<void>

Implementation of​

VaultInterface.importVault


initialize​

▸ initialize(config): Promise<void>

Parameters​

NameType
configIdentityVaultConfig

Returns​

Promise<void>

Usage


_10
vault.initialize({
_10
key: 'com.company.myvaultapp',
_10
type: 'CustomPasscode',
_10
deviceSecurityType: 'Both',
_10
lockAfterBackgrounded: 2000,
_10
});


isEmpty​

▸ isEmpty(): Promise<boolean>

See Vault.isEmpty

Returns​

Promise<boolean>

Implementation of​

VaultInterface.isEmpty


isLocked​

▸ isLocked(): Promise<boolean>

See Vault.isLocked

Returns​

Promise<boolean>

Implementation of​

VaultInterface.isLocked


lock​

▸ lock(): Promise<void>

See Vault.lock

Returns​

Promise<void>

Implementation of​

VaultInterface.lock


onConfigChanged​

▸ onConfigChanged(callback): void

See Vault.onConfigChanged

Parameters​

NameType
callbackCallback<IdentityVaultConfig>

Returns​

void

Implementation of​

VaultInterface.onConfigChanged


onError​

▸ onError(callback): void

See Vault.onError

Parameters​

NameType
callbackCallback<VaultError>

Returns​

void

Implementation of​

VaultInterface.onError


onLock​

▸ onLock(callback): void

See Vault.onLock

Parameters​

NameType
callbackCallback<VaultLockEvent>

Returns​

void

Implementation of​

VaultInterface.onLock


onPasscodeRequested​

▸ onPasscodeRequested(callback): void

See Vault.onPasscodeRequested

Parameters​

NameType
callback(isPasscodeSetRequest: boolean, onComplete: (code: string) => void) => void

Returns​

void

Implementation of​

VaultInterface.onPasscodeRequested

▸ onPasscodeRequested(callback): void

Parameters​

NameType
callback(isPasscodeSetRequest: boolean) => Promise<void>

Returns​

void

Implementation of​

VaultInterface.onPasscodeRequested


onUnlock​

▸ onUnlock(callback): void

See Vault.onUnlock

Parameters​

NameType
callbackEmptyCallback

Returns​

void

Implementation of​

VaultInterface.onUnlock


removeValue​

▸ removeValue(key): Promise<void>

See Vault.removeValue

Parameters​

NameType
keystring

Returns​

Promise<void>

Implementation of​

VaultInterface.removeValue


setCustomPasscode​

▸ setCustomPasscode(passcode): Promise<void>

See Vault.setCustomPasscode

Parameters​

NameType
passcodestring

Returns​

Promise<void>

Implementation of​

VaultInterface.setCustomPasscode


setValue​

▸ setValue<T>(key, value): Promise<void>

See Vault.setValue

Type parameters​

NameType
Tany

Parameters​

NameType
keystring
valueT

Returns​

Promise<void>

Implementation of​

VaultInterface.setValue


unlock​

▸ unlock(): Promise<void>

See Vault.unlock

Returns​

Promise<void>

Implementation of​

VaultInterface.unlock


updateConfig​

▸ updateConfig(config): Promise<void>

See Vault.updateConfig

Parameters​

NameType
configIdentityVaultConfig

Returns​

Promise<void>

Implementation of​

VaultInterface.updateConfig


updateTranslations​

▸ updateTranslations(translations): Promise<void>

See Vault.updateTranslations

Parameters​

NameType
translationsVaultTranslations

Returns​

Promise<void>

Implementation of​

VaultInterface.updateTranslations