This class is used to store keys in the browsers local storage.
https://docs.near.org/docs/develop/front-end/naj-quick-reference#key-store
import { connect, keyStores } from 'near-api-js';const keyStore = new keyStores.BrowserLocalStorageKeyStore();const config = { keyStore, // instance of BrowserLocalStorageKeyStore networkId: 'testnet', nodeUrl: 'https://rpc.testnet.near.org', walletUrl: 'https://wallet.testnet.near.org', helperUrl: 'https://helper.testnet.near.org', explorerUrl: 'https://explorer.testnet.near.org'};// inside an async functionconst near = await connect(config) Copy
import { connect, keyStores } from 'near-api-js';const keyStore = new keyStores.BrowserLocalStorageKeyStore();const config = { keyStore, // instance of BrowserLocalStorageKeyStore networkId: 'testnet', nodeUrl: 'https://rpc.testnet.near.org', walletUrl: 'https://wallet.testnet.near.org', helperUrl: 'https://helper.testnet.near.org', explorerUrl: 'https://explorer.testnet.near.org'};// inside an async functionconst near = await connect(config)
defaults to window.localStorage
defaults to near-api-js:keystore:
near-api-js:keystore:
Removes all items that start with prefix from local storage
prefix
Gets the account(s) from local storage
The targeted network. (ex. default, betanet, etc…)
Gets a KeyPair from local storage
The NEAR account tied to the key pair
Get the network(s) from local storage
Removes a KeyPair from local storage
Stores a KeyPair in local storage.
The key pair to store in local storage
This class is used to store keys in the browsers local storage.
See
https://docs.near.org/docs/develop/front-end/naj-quick-reference#key-store
Example