StarKey Installation
To determine if a user has StarKey installed, a web application should check for the presence of a starkey
object. StarKey's browser extension automatically inject this object into the window of any web application that meets the following conditions: the site uses https://
, is running on localhost, or is on 127.0.0.1
. Note that StarKey does not inject the provider into iframes or sites using http://
.
If the starkey
object is present, Supra dApps can interact with StarKey through the API available at window.starkey
. However, this Supra provider may experience namespace collisions with other injected wallets.
To confirm StarKey's installation, the application should also verify the presence of an isStarkey
flag.
const isStarkeyInstalled = window?.starkey;
If StarKey is not installed, we suggest redirecting your users to our website. The implementation might look something like this:
const getProvider = () => {
if ('starkey' in window) {
const provider = window.starkey?.supra;
if (provider) {
return provider;
}
}
window.open('https://starkey.app/', '_blank');
};
Last updated