stellar-expert / albedo

Security-centric, developer-friendly, easy-to-use delegated signer and keystore for Stellar Network
https://albedo.link
MIT License
64 stars 14 forks source link

The 'public_key' example does not work #57

Closed ftppro closed 3 years ago

ftppro commented 3 years ago

This URL has the following example: https://albedo.link/playground?section=public_key

albedo.publicKey({ token: 'vuEiDlijTCLdR8fqDHdfUQUUyVpVenVO2YGBrljh/Iw=' }) .then(res => console.log(res.pubkey, res.signed_message, res.signature))

I preceded that code with this script tag:

It displays the following error: albedo.publicKey is not a function

The following code confirms that a Module named 'albedo' is accessible from albedo.intent.js: console.log(albedo)

Please describe how I can access the publicKey function.

orbitlens commented 3 years ago

If you are using UMD module, then you'll need to access methods via the default module export. For example, albedo.default.publicKey().

With any build system (e.g. WebPack, Browserify, Babel, Parcel, etc.), you can skip loading UMD bundle, and instead use standard JS import somewhere in your code, like

import albedo from '@albedo-link/intent'

...

albedo.publicKey()