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

Add command to generate chain link file #572

Closed
dadamu opened this issue Jul 27, 2021 · 2 comments · Fixed by #583
Closed

Add command to generate chain link file #572

dadamu opened this issue Jul 27, 2021 · 2 comments · Fixed by #583
Labels
kind/enhancement Enhance an already existing feature; no "New feature" to add x/profiles Module that allows to create and manage decentralized social profiles
Milestone

Comments

@dadamu
Copy link
Contributor

dadamu commented Jul 27, 2021

Feature description

Currently, the sign cmd returns the hex-ecoded public key. However, The public key in the proof object is required as base64-encoded string when creating a chain link. From my side, the sign cmd should return the public key as base64-encoded.

The chain link required file:

{
   "address":{
      "@type":"/desmos.profiles.v1beta1.Bech32Address",
      "value":"cosmos15uc89vnzufu5kuhhsxdkltt38zfx8vcyggzwfm",
      "prefix":"cosmos"
   },
   "proof":{
      "pub_key":{
         "@type":"/cosmos.crypto.secp256k1.PubKey",
         "key":"A58DXR/lXKVkIjLofXgST/OHi+pkOQbVIiOjnTy7Zoqo"   /*<- It's base64-encoded*/
      },
      "signature":"ecc6175e730917fb289d3a9f4e49a5630a44b42d972f481342f540e09def2ec5169780d85c4e060d52cc3ffb3d677745a4d56cd385760735bc6db0f1816713be",
      "plain_text":"cosmos15uc89vnzufu5kuhhsxdkltt38zfx8vcyggzwfm"
   },
   "chain_config":{
      "name":"cosmos"
   }
}

Implementation proposal

Let the public key of signature data in sign cmd be base64-encoded.

@dadamu dadamu added kind/enhancement Enhance an already existing feature; no "New feature" to add x/profiles Module that allows to create and manage decentralized social profiles labels Jul 27, 2021
@RiccardoM
Copy link
Contributor

@dadamu The sign command returns an hex-encoded signature and public key because it should be used when creating application links. The process should be:

  1. The user signs its application username using the sign command.
  2. The returned output is posted online.
  3. The Band data sources will fetch and validate those data expecting an hex-encoded signature and public key.

Changing this command would break everything.

Also, I don't think it's worth changing it and requiring the user to create the chain-link object by themselves. Instead, what we should do is create a new command that allows the user to create such object easily. However, I think this is not a priority right now since the overall JSON object can be created very easily using Protobuf and the JSON encoding of the Cosmos-provided objects. Indeed, the public key value is simply obtained by creating a cryptotypes.PubKey instance and encoding it with the json package.

@dadamu
Copy link
Contributor Author

dadamu commented Jul 27, 2021

@RiccardoM Okay, I am thinking about the same thing that creating a new command in order to generate object easily.
Currently, to have a chain link, the user should use sign command to generate the signature and get base64-encoded public key, then create the such object manually.
I suppose it should be mentioned in docs before the command is out.

@RiccardoM RiccardoM changed the title Convert the public key to be base64-encoded in sign command Add command to generate chain link file Aug 14, 2021
@RiccardoM RiccardoM added this to the v1.0.0 milestone Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Enhance an already existing feature; no "New feature" to add x/profiles Module that allows to create and manage decentralized social profiles
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants