How to get user's public key by address account? #1236
-
Hi guys! I want to do this in order to be able to verify a message signed by a user — without referring to his smart contract. Because, as I understand it, when creating a wallet, the creation of a smart contract occurs only after you have an "enabled account" - and for this you need to make a transaction yourself or receive it (at least, my experiments have shown exactly this) I have found only those APIs that allow you to get a public key over a private one — but this does not suit me, because I cannot take the user's private key in any way |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Afaik it is not possible without referring to his smart contract! Addresses are hashes of the public key + some more params like account class hash, deployer address and callData:
cc @PhilippeR26 correct me if I'm wrong please! |
Beta Was this translation helpful? Give feedback.
-
You have to query Starknet. const publicKey = await contractAccount.getPublicKey() ; |
Beta Was this translation helpful? Give feedback.
You have to query Starknet.
An example : https://github.com/PhilippeR26/starknet.js-workshop-typescript/blob/a7b4fe558022d030a1236e9f9df8f05d157f882c/src/scripts/signature/13.signerV5.ts#L65