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

New feature: ?import= allows importing BASE64-encoded Wallet JSON directly #72

Merged
merged 4 commits into from May 11, 2021
Merged

New feature: ?import= allows importing BASE64-encoded Wallet JSON directly #72

merged 4 commits into from May 11, 2021

Conversation

spirilis
Copy link

@spirilis spirilis commented May 5, 2021

This is a new feature to enable the home page to check ?import= query string; contents should be a BASE64-encoded wallet JSON (e.g. base64 encoding a .webd downloaded wallet).

This allows us to stuff wallets into a https://webdollar.io/?import= URL, QR-code it, and have WebDollar Gift Cards!

Gift someone a webdollar account with preloaded balance!

@ibudisteanu
Copy link
Member

Maybe we should sanitize the string as well before we import it.

@spirilis
Copy link
Author

spirilis commented May 5, 2021

Agreed, apologies this was an amateur mistake on my part! I'm writing up some deep validation (validate base64, sanity-check JSON, double check JSON contents for valid keys, etc) now...

@spirilis
Copy link
Author

spirilis commented May 5, 2021

Check out the latest commit. I tested it out with various malformed wallet JSON's and modification of the base64 and it seems to trigger correctly on various kinds of faults.

  1. Valid base64 characters
  2. JSON must start with {"version":
  3. After parsing JSON, if version == "0.1", specific sanity checks of contents occur - validating only the specific keys exist, validating the hex bytestream of publicKey/privateKey, validating the address is correct length, begins with WEBD$ and ends with $

Copy link
Member

@ibudisteanu ibudisteanu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome work!

@ibudisteanu ibudisteanu merged commit 6fce031 into WebDollar:master May 11, 2021
@spirilis spirilis deleted the import-wallet-qry branch May 13, 2021 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants