-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3bf65cc
commit 2c4c96b
Showing
5 changed files
with
301 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<a name="localstorage" id="localstorage"></a> | ||
|
||
# window.localStorage | ||
Provides a local key-value store useful for setting preferences and other kinds of data. | ||
This data is technically persistent, but can be cleared in a variety of ways, so you should not | ||
store data using `localStorage` that you cannot otherwise reconstruct. | ||
|
||
<InlineAlert variant="warning" slots="text"/> | ||
|
||
Do not store passwords or other secure forms of data using `localStorage`. Instead, use [secureStorage](./secureStorage.md). | ||
|
||
|
||
|
||
<a name="localstorage-length" id="localstorage-length"></a> | ||
|
||
## length ⇒ `int` | ||
**Read only** | ||
Returns number of items stored in the local storage. | ||
|
||
**Returns**: `int` - returns the number of items | ||
|
||
|
||
<a name="localstorage-key" id="localstorage-key"></a> | ||
|
||
## key() | ||
Returns key which is stored at the given index | ||
|
||
**Returns**: `int` - Returns key which is stored at the given index. | ||
|
||
| Param | Type | | ||
| --- | --- | | ||
| index. | `number` | | ||
|
||
|
||
|
||
<a name="localstorage-getitem" id="localstorage-getitem"></a> | ||
|
||
## getItem(key) | ||
Get value from the local storage for the key. | ||
|
||
**Returns**: `string` - returns value corresponding to the key as string. If key doesn't exist, this function returns null. | ||
|
||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| key | `string` | A key to get value. | | ||
|
||
|
||
|
||
<a name="localstorage-setitem" id="localstorage-setitem"></a> | ||
|
||
## setItem(key, value) | ||
Set key and value to the local storage. | ||
If the key is newly set or value is different from old value, an update event will be fired later. | ||
|
||
|
||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| key | `string` | A key to set value | | ||
| value | `string` | A value for the key | | ||
|
||
|
||
|
||
<a name="localstorage-removeitem" id="localstorage-removeitem"></a> | ||
|
||
## removeItem(key) | ||
Remove a key/value pair from the local storage. | ||
If the key exists in the local storage, an update event will be fired later. | ||
|
||
|
||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| key | `string` | A key to set value | | ||
|
||
|
||
|
||
<a name="localstorage-clear" id="localstorage-clear"></a> | ||
|
||
## clear() | ||
Remove all key/value pairs from the local storage. | ||
An update event will be fired later. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<a name="securestorage" id="securestorage"></a> | ||
|
||
# require('uxp').storage.secureStorage | ||
SecureStorage provides a protected storage which can be used to store sensitive data | ||
per plugin. SecureStorage takes a key-value pair and encrypts the value before being | ||
stored. After encryption, it stores the key and the encrypted value pair. When the value | ||
is requested with an associated key, it's retrieved after being decrypted. Please note | ||
that the key is not encrypted thus it's not protected by the cryptographic operation. | ||
|
||
Caveats for SecureStorage are as follows: | ||
1. SecureStorage is not an appropriate storage for sensitive data which wants to keep | ||
secret from the current user. SecureStorage is protected under the current user's | ||
account credential. It means the encrypted data can be at risk of being decrypted | ||
with the current user's privilege. | ||
2. Data in SecureStorage can be lost for various reasons. For an example, the user | ||
could uninstall the host application and delete the secure storage. Or, the cryptographic | ||
information used by the secure storage could be damaged by the user accidentally, and | ||
it will result in loss of data without the secure storage being removed. SecureStorage | ||
should be regarded as a cache rather than a persistent storage. Data in SecureStorage | ||
should be able to be regenerated from plugins after the time of loss. | ||
|
||
|
||
|
||
<a name="securestorage-length" id="securestorage-length"></a> | ||
|
||
## length ⇒ `int` | ||
**Read only** | ||
Returns number of items stored in the secure storage. | ||
|
||
**Returns**: `int` - returns the number of items | ||
|
||
|
||
<a name="securestorage-setitem" id="securestorage-setitem"></a> | ||
|
||
## setItem(key, value) | ||
Store a key and value pair after the value is encrypted in a secure storage | ||
|
||
**Returns**: `Promise` - : resolved when the value is stored. rejected when the value is empty or not stored. | ||
**Throws**: | ||
|
||
- `TypeError` : thrown when either key or value doesn't have one of acceptable types. | ||
|
||
|
||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| key | `string` | : a key to set value | | ||
| value | `string` \| `ArrayBuffer` \| `TypedArray` | : a value for a key. | | ||
|
||
|
||
|
||
<a name="securestorage-getitem" id="securestorage-getitem"></a> | ||
|
||
## getItem(key) | ||
Retrieve a value associated with a provided key after the value is being decrypted from a secure storage. | ||
|
||
**Returns**: `Promise.<Uint8Array>` - : a value as buffer | ||
**Throws**: | ||
|
||
- `TypeError` : thrown when a key doesn't have an acceptable type. | ||
|
||
|
||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| key | `string` | : a key to get value | | ||
|
||
|
||
|
||
<a name="securestorage-removeitem" id="securestorage-removeitem"></a> | ||
|
||
## removeItem(key) | ||
Remove a value associated with a provided key | ||
|
||
**Returns**: `Promise` - : resolved when the value associated with the key is removed. rejected when the value is neither removed nor found. | ||
**Throws**: | ||
|
||
- `TypeError` : thrown when a key doesn't have an acceptable type. | ||
|
||
|
||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| key | `string` | : a key to remove value | | ||
|
||
|
||
|
||
<a name="securestorage-key" id="securestorage-key"></a> | ||
|
||
## key() | ||
Returns a key which is stored at the given index | ||
|
||
**Returns**: `int` - Returns the key which is stored at the given index. | ||
|
||
| Param | Type | | ||
| --- | --- | | ||
| index. | `number` | | ||
|
||
|
||
|
||
<a name="securestorage-clear" id="securestorage-clear"></a> | ||
|
||
## clear() | ||
Clear all values in a secure storage. | ||
|
||
**Returns**: `Promise` - : resolved when all the items are cleared. rejected when there is no item to clear or clear failed. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# window.sessionStorage | ||
|
||
Provides a local key/value store useful for storing data that persists only for the plugin's current session. | ||
|
||
For more information about the API itself, see the [localStorage](./localStorage.md) API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters