Skip to content

StorageApi

API Functions

get

Get value from storage.

Params:

Param NameDescription
keyKey name
defaultValueOptional, default value

Signature:

typescript
get: <T extends BaseType>(key: string, defaultValue?: T) => Promise<T | null>

set

Set value in storage.

Params:

Param NameDescription
keyKey name
valueValue to store, can be BaseType or object

Signature:

typescript
set: (key: string, value: BaseType | object) => Promise<string>

getObject

Get object value from storage.

Params:

Param NameDescription
keyKey name
defaultValueOptional, default value

Signature:

typescript
getObject: <T>(key: string, defaultValue?: T) => Promise<T | undefined>

delete

Delete value from storage.

Params:

Param NameDescription
keyKey name

Signature:

typescript
delete: (key: string) => Promise<void>

encryptString

Encrypt a string with the encryption key generated by DPAPI. According to Windows documentation: "Typically, only a user with the same logon credential as the user who encrypted the data can decrypt the data". Therefore, the content is protected from other users on the same computer, but not from other applications running in the same user space. @see Safe Storage

Params:

Param NameDescription
valueString to encrypt

Signature:

typescript
encryptString: (value: string) => Promise<string>

decryptString

Decrypt the encrypted string.

Params:

Param NameDescription
valueString to decrypt

Signature:

typescript
decryptString: (value: string) => Promise<string>

encryptSet

Encrypt string and store.

Params:

Param NameDescription
keyKey name
valueString to encrypt and store

Signature:

typescript
encryptSet: (key: string, value: string) => Promise<string>

decryptGet

Get string value from encrypted storage.

Params:

Param NameDescription
keyKey name
defaultValueOptional, default value

Signature:

typescript
decryptGet: (key: string, defaultValue?: string) => Promise<string | undefined>

API Events

No events available.

API Constants

No constants available.