Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you get the currently unlocked Wallet's public key? #14

Open
woniesong92 opened this issue May 14, 2018 · 7 comments
Open

How do you get the currently unlocked Wallet's public key? #14

woniesong92 opened this issue May 14, 2018 · 7 comments
Assignees

Comments

@woniesong92
Copy link

Also, is there a way to detect whether the user has unlocked a wallet?

@yupnano
Copy link
Contributor

yupnano commented May 14, 2018

Do you mean that you want to get an notification when an wallet is unlocked, or just to get the wallet address that has been unlocked?

@woniesong92
Copy link
Author

Both would be nice. In Metamask, you can check the accounts array and see if it's empty to know if the user has unlocked their wallet. Using this, people can show the warning sign "Please unlock your wallet in Metamask before using our dapp."

@zoowii
Copy link
Contributor

zoowii commented May 14, 2018

What I want is user's pubkey who call some contract api, or pubkey of any address. I wrote a dapp, which stored encrypted data in that smart contract. I want to use user's pubkey to encrypt the data, and let user decrypt it by privatekey. Could you add caller's pubkey to smartcontract's Blockchain.transaction object?

@zoowii
Copy link
Contributor

zoowii commented May 14, 2018

I think if you add this feature, dapp developers can do more things by smart-contract

@yupnano
Copy link
Contributor

yupnano commented May 14, 2018

Thanks for your advice! I will discuss about this with my colleagues later.

@yupnano yupnano self-assigned this May 15, 2018
@hostgame
Copy link

@zoowii wallet address is your public key #6
You can get it by such js code

window.postMessage({
"target": "contentscript",
"data":{},
"method": "getAccount",
}, "*");

window.addEventListener('message', function(e) {
try{
var user_account = e.data.data.account;
console.log(user_account);
}catch (e) {
}
});

@zoowii
Copy link
Contributor

zoowii commented May 24, 2018

@hostgame nebulas's address is not same with public key, event decode them to integers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants