stratisproject/Breeze

Unable to create and recover wallets (missing model property)

Closed this issue · 1 comments

Our (Solaris Team) tests show that we are unable to create and recover wallets.

The bug is caused by a missing property passphrase on the WalletCreation and WalletRecovery model classes. The API expects the property passphrase to be at least an empty string:

[Required(ErrorMessage = "A passphrase is required.", AllowEmptyStrings = true)]
public string Passphrase { get; set; }

Here is the full HTTP request in HAR/JSON format (I will not be using the mnemonic below) :

{
  "log": {
    "version": "1.2",
    "creator": {
      "name": "WebInspector",
      "version": "537.36"
    },
    "pages": [],
    "entries": [
      {
        "startedDateTime": "2019-06-20T10:33:13.197Z",
        "time": 3.6949999630451202,
        "request": {
          "method": "POST",
          "url": "http://localhost:37220/api/wallet/create/",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Origin",
              "value": "file://"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate"
            },
            {
              "name": "Host",
              "value": "localhost:37220"
            },
            {
              "name": "Accept-Language",
              "value": "nl"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) SnowWallet/1.0.1 Chrome/58.0.3029.110 Electron/1.7.9 Safari/537.36"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Accept",
              "value": "application/json, text/plain, */*"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "X-DevTools-Request-Id",
              "value": "30452.96"
            },
            {
              "name": "Content-Length",
              "value": "138"
            }
          ],
          "queryString": [],
          "cookies": [],
          "headersSize": 444,
          "bodySize": 138,
          "postData": {
            "mimeType": "application/json",
            "text": "{\"name\":\"Kees\",\"mnemonic\":\"cross gadget nut dream congress pool door tired grape limit gasp good\",\"password\":\"xxxxx\",\"folderPath\":null}"
          }
        },
        "response": {
          "status": 400,
          "statusText": "Bad Request",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Date",
              "value": "Thu, 20 Jun 2019 10:33:12 GMT"
            },
            {
              "name": "Server",
              "value": "Kestrel"
            },
            {
              "name": "Transfer-Encoding",
              "value": "chunked"
            },
            {
              "name": "Content-Type",
              "value": "application/json; charset=utf-8"
            }
          ],
          "cookies": [],
          "content": {
            "size": 82,
            "mimeType": "application/json",
            "compression": -11,
            "text": "{\"errors\":[{\"status\":400,\"message\":\"A passphrase is required.\",\"description\":\"\"}]}"
          },
          "redirectURL": "",
          "headersSize": 157,
          "bodySize": 93,
          "_transferSize": 250
        },
        "cache": {},
        "timings": {
          "blocked": 0.288999988697469,
          "dns": 0.18800003454089198,
          "connect": 0.42599998414516405,
          "send": 0.17100002150982496,
          "wait": 2.3579999106004896,
          "receive": 0.2630000235512804,
          "ssl": -1
        },
        "serverIPAddress": "[::1]",
        "connection": "171"
      }
    ]
  }
}

Edit: The property will need a default value:

passphrase: string = "";

After adding this property we were able to create and recover wallets

Thanks for reporting the issue, however this is not a bug, but because Breeze needs an update to work with the current fullnode.
Closing the issue because it's already fixed in a development branch here: https://github.com/BreezeHub/BreezeProject/tree/dev0