Keychain Module
The Keychain module securely stores and retrieves a username/password pair on the device.
import { Keychain } from '@shopgate/native-modules';Example React component
Section titled “Example React component”import { useState } from 'react';import { Keychain } from '@shopgate/native-modules';
export function LoginStorage() { const [username, setUsername] = useState(null); const loadLogin = async () => { const credentials = await Keychain.getLogin(); setUsername(credentials ? credentials.username : null); }; return <button type="button" onClick={loadLogin}>{username ?? 'Load login'}</button>;}setLogin(username, password)
Section titled “setLogin(username, password)”await Keychain.setLogin('user@example.com', 'password');getLogin()
Section titled “getLogin()”const credentials = await Keychain.getLogin();Returns { username, password } or false when no credentials exist.
resetLogin()
Section titled “resetLogin()”await Keychain.resetLogin();setLogin() and resetLogin() resolve when complete.

