[react-native] EncryptedStorage, AsyncStorage

bunny.log·2023년 6월 5일
0

AsyncStorage

보안에 민감하지 않으며 앱을 종료 후 다시 실행하였을 때에도 데이터가 유지되어야 하는 경우에 사용한다. 사용방법은 웹의localStorage와 비슷하다.

💿 설치
https://react-native-async-storage.github.io/async-storage/docs/install

📔 사용 설명

import EncryptedStorage from 'react-native-encrypted-storage';

await AsyncStorage.setItem('키', '값');
await AsyncStorage.removeItem('키');
const 값 = await AsyncStorage.getItem('키');

EncryptedStorage

보안에 민감할때 사용한다. 앱을 종료 후 다시 실행하였을 때에도 데이터가 유지되어야 하는 경우에 사용한다. 사용방법은 AsyncStorage와 비슷하다.

💿 설치
https://www.npmjs.com/package/react-native-encrypted-storage

📔 사용 설명

import EncryptedStorage from 'react-native-encrypted-storage';

await EncryptedStorage.setItem('키', '값');
await EncryptedStorage.removeItem('키');
const 값 = await EncryptedStorage.getItem('키');

promise로 await을 사용한다.

.
.
.
.

참고
https://www.inflearn.com/course/lecture?courseSlug=%EB%B0%B0%EB%8B%AC%EC%95%B1-%EB%A6%AC%EC%95%A1%ED%8A%B8-%EB%84%A4%EC%9D%B4%ED%8B%B0%EB%B8%8C&unitId=104786&tab=curriculum

profile
https://github.com/nam-yeun-hwa

0개의 댓글