Is it possible to sign an arbitrary message with sdk?

Can we do something like web3’s personal sign to verify the identity of the person? (Using javascript sdk or go sdk)

Yep, Flow has something similar to this.

Here’s an example from the Go SDK: flow-go-sdk/main.go at master · onflow/flow-go-sdk · GitHub

The user can sign an arbitrary message that is then verified on-chain. That same message could also be verified off-chain – the verifier would just need to query the matching account public key.

1 Like

@pete Thanks for the answer! I see. Is this only for the Go SDK?
Can we also have the user sign in using Blocto wallet in the browser?

Not yet :frowning: We’ll need to make this functionality available in FCL in order to enable wallets. But before we can do that, we need to update transaction signatures to use a domain prefix so that they can be distinguished from “personal” signatures.

What’s your use case if you don’t mind me asking?

1 Like

I see.

With Ethereum Dapps, it’s easy to create a login mechanism by signing with MetaMask, so I thought it would be nice if the same thing could be done with Flow Dapps.

I hope on FLOW we find ways to remove this need, systems like meta mask where a user needs to install an extension is cumbersome for the general population. We need to build more UX experiences like top shots.

@pete I was emailing with the dapper team and they mentioned that the Dapper wallet would be available soon. Will login mechanisms be capable, could you provide some more insight into how the dapper wallet works? is it like a traditional integration?

1 Like

This will be a thing in FCL in the future, it is fairly high on our list of things, but we have a blocker we need to work around so it unfortunately wont be a thing particularly soon.

It will be part of the fcl current user system and will probably look something like this:

// this is not a thing yet
await fcl.currentUser().sign("thing to sign")
// similar to the authz functionality it may even make sense to have it as a highlevel alias
await fcl.sign("thing to sign")

// the signature that comes back will most likely be what we already call a composite signature
{
  address: "0x____",
  keyId: 0,
  signature: "_________" // hex representation of binary signature
}

We are working with the node devs to unblock this, and are in the process of working with FCL wallet providers to enable this from their side. It should be fairly straightforward to implement once we are unblocked.

3 Likes

@qvvg Thank you for explaining the exact situation to me.
I understand that the API of the current node needs to be changed, and node operators have to update it :sweat_drops: