# react-native-secured-storage

> Secured AsyncStorage for React Native

Latest version **1.0.1** (published 2020-02-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-native-secured-storage
pnpm add react-native-secured-storage
yarn add react-native-secured-storage
bun add react-native-secured-storage
```

## Health

**Score 5/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: insecure dependencies; abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-02-20 |
| First published | 2020-02-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | SSG |
| Maintainers | ssg-luke |
| Keywords | react, react-native, secure, storage, asyncstorage |

## Links

- npm: https://www.npmjs.com/package/react-native-secured-storage
- npm.io page: https://npm.io/package/react-native-secured-storage

## Dependencies (2)

- [simple-crypto-js](https://npm.io/package/simple-crypto-js.md) ^1.1.1
- [react-native-simple-encryption](https://npm.io/package/react-native-simple-encryption.md) git+https://github.com/kyle-ssg/react-native-simple-encryption.git#master

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-02-20
- 1.0.0 — 2020-02-19

## README

# React Native Secured Storage

## Getting Started

### Install

```
yarn add react-native-secured-storage react-native-keychain https://github.com/SolidStateGroup/react-native-pbkdf2 @react-native-community/async-storage
```

or

```
npm install --save react-native-secured-storage react-native-keychain https://github.com/SolidStateGroup/react-native-pbkdf2 @react-native-community/async-storage
```

### Link

- **React Native 0.60+**


[CLI autolink feature](https://github.com/react-native-community/cli/blob/master/docs/autolinking.md) links the module while building the app. 


- **React Native <= 0.59**


```bash
$ react-native link react-native-keychain react-native-pbkdf2 @react-native-community/async-storage
```


*Note* For `iOS` using `cocoapods`, run:

```bash
$ cd ios/ && pod install
```

See docs for [manual linking guide](docs/Linking.md)

### **Upgrading to React Native *0.60+*** 
 
New React Native comes with `autolinking` feature, which automatically links Native Modules in your project.
In order to get it to work, make sure you `unlink` dependencies first first:

```bash
$ react-native unlink react-native-keychain react-native-pbkdf2 @react-native-community/async-storage
```

## Usage

### Import

```js
import SecuredStorage from 'react-native-secured-storage';
```

### Initialise

```js
await SecuredStorage.init('mypassword');
```

### Unlock storage / Get data

`get()` would be called once on relaunching the app if secured storage has already been initialised.

```js
const storage = await SecuredStorage.get();
const mydata = storage['mydata'];
const mydata2 = SecuredStorage.storage['mydata2'];
```

### Store data

```js
await SecuredStorage.setItem('key', {complex: 'object'});
await SecuredStorage.setItem('key', null, 'or just a string');
```

### Remove data

```js
await SecuredStorage.removeItem('key');
```

---
_Source: https://npm.io/package/react-native-secured-storage · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
