Get Public Key

by passbird

HTML

<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="utf-8">

    <!-- 
    Import metakeep sdk.
    You can also import npm package if you are using node for building website
    e.g. 
    npm install metakeep@2.2.2
    require(metakeep)
    -->
    <script src="https://cdn.jsdelivr.net/npm/metakeep@2.2.2/lib/index.js" integrity="sha256-XwEVfJ47JrjxB4a8Hyym7/kwX23rmtA1ZW6hbdCW090=" crossorigin="anonymous"></script>
  </head>

</html>

JavaScript

/* Init SDK */
const sdk = new MetaKeep({
  /* App id to configure UI */
  appId: "dd77a047-1855-4fea-aa94-70136ce6b1f3",
});

/* Call SDK. It returns a promise which returns when the operation succeeds.
Otherwise throws an error.
*/
async function getPublicKey() {
  try {
    const getPublicKeyResponse = await sdk.getWallet();
    console.log("getPublicKey successful");
    console.log(getPublicKeyResponse);
  } catch (err) {
    console.log("Error when trying to get the public key");
    console.log(err.message);
  }
}


getPublicKey();