--- title: "SecureStorage" slug: "100-manage-securestorage" updated: 2025-05-27T18:19:50Z published: 2025-05-27T18:19:50Z canonical: "docs.developer.comcast.com/100-manage-securestorage" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.developer.comcast.com/llms.txt > Use this file to discover all available pages before exploring further. # SecureStorage **SecureStorage Module 1.0.0 | Manage SDK** ## Usage To use the SecureStorage module, you can import it into your project from the Firebolt SDK: ``` import { SecureStorage } from '@firebolt-js/manage-sdk' ``` ## Overview A module for storing and retrieving secure data owned by the app ## Methods ### clearForApp Clears all the secure data values for a specific app ``` function clearForApp(appId: string, scope: StorageScope): Promise ``` Parameters: | Param | Type | Required | Description | | --- | --- | --- | --- | | `appId` | `string` | true | appId for which values are removed | | , | `scope` | [`StorageScope`](/docs/100-manage-securestorage#storagescope) | true | Promise resolution: ``` void ``` Capabilities: | Role | Capability | | --- | --- | | manages | xrn:firebolt:capability:storage:secure | #### Examples Clears all the secure data values for appId foo JavaScript: ``` import { SecureStorage } from '@firebolt-js/manage-sdk' SecureStorage.clearForApp("foo", "account") .then(success => { console.log(success) }) ``` Value of `success`: ``` null ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "SecureStorage.clearForApp", "params": { "appId": "foo", "scope": "account" } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` --- ### removeForApp Removes single data value for a specific app. ``` function removeForApp(appId: string, scope: StorageScope, key: string): Promise ``` Parameters: | Param | Type | Required | Description | | --- | --- | --- | --- | | `appId` | `string` | true | appId for which values are removed | | , | `scope` | [`StorageScope`](/docs/100-manage-securestorage#storagescope) | true | | , | `key` | `string` | true | Promise resolution: ``` void ``` Capabilities: | Role | Capability | | --- | --- | | manages | xrn:firebolt:capability:storage:secure | #### Examples Removes authRefreshToken for appId foo JavaScript: ``` import { SecureStorage } from '@firebolt-js/manage-sdk' SecureStorage.removeForApp("foo", "account", "authRefreshToken") .then(success => { console.log(success) }) ``` Value of `success`: ``` null ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "SecureStorage.removeForApp", "params": { "appId": "foo", "scope": "account", "key": "authRefreshToken" } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` --- ### setForApp Set or update a secure data value for a specific app. ``` function setForApp(appId: string, scope: StorageScope, key: string, value: string, options?: StorageOptions): Promise ``` Parameters: | Param | Type | Required | Description | | --- | --- | --- | --- | | `appId` | `string` | true | appId for which value is being set | | , | `scope` | [`StorageScope`](/docs/100-manage-securestorage#storagescope) | true | | , | `key` | `string` | true | | , | `value` | `string` | true | | , | `options` | [`StorageOptions`](/docs/100-manage-securestorage#storageoptions) | false | Promise resolution: ``` void ``` Capabilities: | Role | Capability | | --- | --- | | manages | xrn:firebolt:capability:storage:secure | #### Examples Set a refresh token with name authRefreshToken with optional parameter for appId foo JavaScript: ``` import { SecureStorage } from '@firebolt-js/manage-sdk' SecureStorage.setForApp("foo", "device", "authRefreshToken", "VGhpcyBub3QgYSByZWFsIHRva2VuLgo=", { "ttl": 600 }) .then(success => { console.log(success) }) ``` Value of `success`: ``` null ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "SecureStorage.setForApp", "params": { "appId": "foo", "scope": "device", "key": "authRefreshToken", "value": "VGhpcyBub3QgYSByZWFsIHRva2VuLgo=", "options": { "ttl": 600 } } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` Set a refresh token with name authRefreshToken without optional parameter for appId foo JavaScript: ``` import { SecureStorage } from '@firebolt-js/manage-sdk' SecureStorage.setForApp("foo", "account", "authRefreshToken", "VGhpcyBub3QgYSByZWFsIHRva2VuLgo=", null) .then(success => { console.log(success) }) ``` Value of `success`: ``` null ``` **JSON-RPC:** Request: ``` { "jsonrpc": "2.0", "id": 1, "method": "SecureStorage.setForApp", "params": { "appId": "foo", "scope": "account", "key": "authRefreshToken", "value": "VGhpcyBub3QgYSByZWFsIHRva2VuLgo=" } } ``` Response: ``` { "jsonrpc": "2.0", "id": 1, "result": null } ``` --- ## Types ### StorageScope The scope of the data ``` enum StorageScope { DEVICE = 'device', ACCOUNT = 'account' } ``` --- ### StorageOptions ``` type StorageOptions = { ttl: number // Seconds from set time before the data expires and is removed } ``` ---