vultisig / vultisig-windows

Apache License 2.0
5 stars 1 forks source link

[ADD] When the KeysignPayload become too big , let's upload the keysign payload to relay server #474

Open johnnyluo opened 3 days ago

johnnyluo commented 3 days ago

Recently discovered that in some special cases , the keysign payload will become very big , for example , on UTXO chains , if the user's address has a lot UTXOs, the the keysign payload become very big , and exceeded the 4kb limit of QR code.

We have to do this

  1. First serialize the KeysignMessage to protobuf , 7zip it , and base 64 it
  2. Check whether the total size is larger than 2048
  3. if the total size is less than 2048 , use it to generate the QR code
  4. If the total size is larger than 2048, then remove KeysignPayload , directly serialize KeysignPayload to protobuf bytes , 7zip it , and base64 encoded , and then upload it to relay server.
  5. Set KeysignPayload in KeysignMessage to nil , and set the PayloadID to the hash which we used to upload to relay
  6. Generate QR code with the new KeysignMessage

When Pair with another device , if the KeysignPayload is nil , and PayloadID is not empty, then we need to download the KeysignPayload from relay server.

Relevant IOS implementation is at https://github.com/vultisig/vultisig-ios/pull/1476/files

if you have any questions , feel free to ping me