cosmjs icon indicating copy to clipboard operation
cosmjs copied to clipboard

Implement ADR-036

Open webmaster128 opened this issue 4 years ago • 11 comments

ADR-036 was merged as a draft spec for signing arbitrary data using a Cosmos SDK keypair. We should try to implement it.

webmaster128 avatar Jul 20 '21 14:07 webmaster128

There is a draft implementation in #847 but looking at https://github.com/cosmos/cosmos-sdk/pull/7727#issuecomment-884261972 the spec seems to be work in progress. So not much more we can do here at this point.

webmaster128 avatar Jul 21 '21 15:07 webmaster128

It would be cool feature for dApps when it is stabilised, but yeah... seems like we are waiting for a spec here. Since wintertime I believe.

ethanfrey avatar Jul 21 '21 18:07 ethanfrey

Hey guys, how are we looking on this? Possible to implement something now?

JGJP avatar Mar 29 '22 06:03 JGJP

🤔

blake-regalia avatar May 19 '22 06:05 blake-regalia

This would be a nice addition. I don't think a standard will be ratified, but if there is a library that is compatible with ledger and Keplr and gets adopted, it will become the standard.

Such a library could easily be built on top of CosmJS, but I think it doesn't really belong as a part of that. Maybe in some sort of tooling library.

Does anyone commenting here want to implement it with support from Confio? Or rather requesting that we implement it?

If you wish us to implement it, a few concrete use cases would be great to ensure it covers them all.

ethanfrey avatar May 22 '22 17:05 ethanfrey

It's a while since I implemented arbitrary message signing with Keplr, but I was able to use keplr.signAmino. The thinking regarding adding it to cosmjs is that SigningStargateClient is already in the business of requesting signatures, and also has a signAmino but for some reason was not able to request the signature in this instance. Showing my working example with Keplr here for reference, as I think it shows something that's already very close to what Stargate offers (AFAICR):

await window.keplr!.signAmino(chainId, account.address, {
    chain_id: "",
    account_number: "0",
    sequence: "0",
    fee: {
        gas: "0",
        amount: [],
    },
    msgs: [
        {
            type: "sign/MsgSignData",
            value: {
                signer: account.address,
                data: btoa(message.toLowerCase()),
            },
        },
    ],
    memo: "",
})

MsgSignData is also already mentioned in cosmjs-types. If its presence there is warranted then maybe implementation in cosmjs is warranted.

JGJP avatar May 23 '22 05:05 JGJP

Currently freezes the Keplr mobile app currently when using .signAmino with sign/MsgSignData type

ThomasDEVio avatar Feb 20 '23 15:02 ThomasDEVio

This would be a nice addition. I don't think a standard will be ratified, but if there is a library that is compatible with ledger and Keplr and gets adopted, it will become the standard.

Such a library could easily be built on top of CosmJS, but I think it doesn't really belong as a part of that. Maybe in some sort of tooling library.

Does anyone commenting here want to implement it with support from Confio? Or rather requesting that we implement it?

If you wish us to implement it, a few concrete use cases would be great to ensure it covers them all.

A very simple and useful use case would be to authenticate/sign-in with cosmos wallets by signing a challenge, or proving account ownership

williamchong avatar Mar 15 '23 05:03 williamchong

A very simple and useful use case would be to authenticate/sign-in with cosmos wallets by signing a challenge, or proving account ownership

Yes, that's exactly what I was using it for

JGJP avatar Mar 15 '23 11:03 JGJP

How can I do this on keplr mobile?Authentication/signing a messageOn 15 Mar 2023, at 13:51, J Garcia @.***> wrote:

A very simple and useful use case would be to authenticate/sign-in with cosmos wallets by signing a challenge, or proving account ownership

Yes, that's exactly what I was using it for

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

ThomasDEVio avatar Mar 15 '23 17:03 ThomasDEVio

@ThomasDEVio I'm not familiar with the Keplr mobile interface. If my above code snippet doesn't work for you then it may not be doable

JGJP avatar Mar 24 '23 03:03 JGJP