aurowallet / auro-wallet-browser-extension

Mina Protocol browser extension wallet
https://www.aurowallet.com
Apache License 2.0
44 stars 24 forks source link

Add arbitrary data signing API #16

Closed maht0rz closed 1 year ago

maht0rz commented 1 year ago

Would be a great idea to add an arbitrary data signing API to Auro, which would allow to sign data the same way as snarky does. This would mean accepting a Fields[] array as the message to sign, and auro providing the private key to a function like this:

https://gist.github.com/maht0rz/fd9d338be3729c202a29c215fdd20e9c

// auro will actually provide the private key, in case the user is not using a hardware wallet we require additional implementation on ledger
const signer: PrivateKey = PrivateKey.random();
// message/data comes from the dapp as a signature request
const message: Field[] = [
...UInt64.from(0).toFields(),
];
// users want the signature so they can feed it to their zkapp contract methods
const signature = sign(signer, message);
// Auro hands over back to the dapp
return signature;
maht0rz commented 1 year ago

Maybe we need to add support for field signing into mina-signer first. https://www.npmjs.com/package/mina-signer

jasongitmail commented 1 year ago

Maybe we need to add support for field signing into mina-signer first. https://www.npmjs.com/package/mina-signer

@maht0rz O(1) Labs is working on this currently for Mina Signer, which I believe would unblock Auro on this

jasongitmail commented 1 year ago

Mina Signer 2.0 is now available, which can be used toward this feature request

wjdfx commented 1 year ago

Included in v2.1.7.