This module makes it easy to add Keychain support within the browser. It also includes helpful functions to check whether Keychain was used before.
import {keychain, isKeychainInstalled, hasKeychainBeenUsed} from '@hiveio/keychain'
const {success, msg, cancel, notInstalled, notActive} = await keychain(window, 'requestTransfer', 'test', 'therealwolf', 5, test memo', 'HIVE')
// All good
if(success) {
// do your thing
}
// User didn't cancel, so something must have happened
else if(!cancel) {
if(notActive) {
// alert('Please allow Keychain to access this website')
} else if(notInstalled) {
// alert('Please install Keychain')
} else {
// error happened - check msg
}
}