SecureStorage Module
Version 0.6.0
OpenRPC
This document was generated from an OpenRPC JSON-Schema, and is intended to provide a human readable overview and examples of the methods contained in the module.
For the full schema, see the link below.
Schema |
---|
securestorage.json |
Table of Contents
Usage
To use the SecureStorage module, you can import it into your project from the Firebolt SDK:
import { SecureStorage } from '@firebolt-js/sdk'
Overview
A module for storing and retrieving secure data owned by the app.
Events
Methods
get
Get stored value by key.
function get(scope: StorageScope, key: string): Promise<string>
Parameters
Param | Type | Required | Summary |
---|---|---|---|
scope | StorageScope | true | The scope of the key/value. |
key | string | true | Key to get. |
Promise Resolution
Type | Description |
---|---|
string | The retrieved value, if found. |
Examples
Successfully retrieve a refresh token with key 'authRefreshToken'
JavaScript
import { SecureStorage } from '@firebolt-js/sdk'
SecureStorage.get("household", "authRefreshToken")
.then(value => {
console.log(value)
})
Value of value
"VGhpcyBub3QgYSByZWFsIHRva2VuLgo="
JSON-RPC
Attempt to retrieve a a key with no value set.
JavaScript
import { SecureStorage } from '@firebolt-js/sdk'
SecureStorage.get("household", "authRefreshToken")
.then(value => {
console.log(value)
})
Value of value
null
JSON-RPC
set
Set or update a secure data value.
function set(scope: StorageScope, key: string, value: string): Promise<boolean>
Parameters
Param | Type | Required | Summary |
---|---|---|---|
scope | StorageScope | true | The scope of the data key. |
key | string | true | Key to set. |
value | string | true | Value to set. |
Promise Resolution
Type | Description |
---|---|
boolean | whether the call was successful or not |
Examples
Set a refresh token with name 'authRefreshToken'
JavaScript
import { SecureStorage } from '@firebolt-js/sdk'
SecureStorage.set("household", "authRefreshToken", "VGhpcyBub3QgYSByZWFsIHRva2VuLgo=")
.then(success => {
console.log(success)
})
Value of success
true
JSON-RPC
remove
Remove a secure data value.
function remove(scope: StorageScope, key: string): Promise<boolean>
Parameters
Param | Type | Required | Summary |
---|---|---|---|
scope | StorageScope | true | The scope of the data key. |
key | string | true | Key to remove. |
Promise Resolution
Type | Description |
---|---|
boolean | whether the call was successful or not |
Examples
Remove the value with key 'authRefreshToken'
JavaScript
import { SecureStorage } from '@firebolt-js/sdk'
SecureStorage.remove("household", "authRefreshToken")
.then(success => {
console.log(success)
})
Value of success
true
JSON-RPC
Schemas
StorageScope
type StorageScope = 'household'
Details
The scope of the data.