We have a user who reported a failure reading data from Blockstack. In the console, we see the following error:

Maybe the API could retry in that case?
@kantai any idea what this could be?
Thanks for raising this issue @timsu --
I'm not sure what's causing this error -- we use the same elliptic curve across the whole system, so any private key generated by browser should be usable in blockstack.js, so there's probably an input or output parsing error somewhere.
@timsu -- Can you provide a little more context around this user? Are they using the latest version of blockstack-browser? What version of blockstack.js is the application using? Would it be possible to obtain a non-minified stack-trace?
Sorry, it doesn't seem reproducible, so I don't have any more information. Feel free to close if there's nothing that can be done.
Thanks @timsu - please re-open it if it happens again!
This bug throws on loading https://www.chat.hihermes.co (as of 1/30/2018 at 8PM EST). The app is trying to save both private and public information on first log in.
@dhealy05 I'm seeing this issue as well:

The app is trying to save both private and public information on first log in.
@dhealy05 Which version of blockstack.js is the app using? Which function is throwing the error? Can you create a reduced test case that causes the error to happen?
@larrysalibra 0.15. I think it's just a private save to Gaia that's throwing the error. I'll try to reduce things. For context, this error started happening when we pushed to Heroku; it doesn't happen locally.
The issue experienced by @dhealy05 was related to the transit private key. The transit private key changed between when the authRequest was generated and when the application tried to validate and log the user in. This happened because the application code called redirectUserToSignIn before trying to validate the authResponse. This needs better error-handling in blockstack.js --- this _should_ have failed in the login.
If the encryption routine fails
> authMessage.decryptPrivateKey(transitKey, skEncrypted)
Error: Decryption failed: failure in MAC check
at decryptECIES (/home/aaron/devel/blockstack.js/lib/encryption.js:129:11)
at Object.decryptPrivateKey (/home/aaron/devel/blockstack.js/lib/auth/authMessages.js:83:39)
That should "fail hard" -- and stop the login. Instead, we try to continue the login process, by assuming that we tried to decrypt a key which wasn't encrypted (see: https://github.com/blockstack/blockstack.js/blob/master/src/auth/authApp.js#L164)
Furthermore, we should document the use of the transit private key better, which will help app developers ensure that this key isn't generated multiple times for the same user.
I began work on a branch which enables better error-handling behavior in the above case:
https://github.com/blockstack/blockstack.js/tree/feature/improved-error-handling
This makes it so that a login will _reject_ if the app transit key is wrong or missing.
That branch needs to undergo some serious testing before it can be merged (which is why I haven't opened a PR for it yet), just because authentication requires a lot of different edge cases (old browser -> new app, new browser -> old app, new browser -> new app).
I'm seeing this error with Blockstack Browser in NoteRiot. Reported to me by StackCafe, and I was able to replicate with local installs of both the Linux and Mac versions of Browser 0.30.1, as well as identity set up via browser.blockstack.org.
NoteRiot is built with:
"blockstack": "^0.17.2",
vue.esm.js:1717 Error: Private key must be less than the curve order
at new ECPair (ecpair.js:27)
at getPublicKeyFromPrivate (keys.js:40)
at Object.putFile (index.js:147)
at VueComponent.mounted (app.691a892dbac93dc77e4b.js:402)
at callHook (vue.esm.js:2895)
at Object.insert (vue.esm.js:4090)
at invokeInsertHook (vue.esm.js:5864)
at Vue$3.patch [as __patch__] (vue.esm.js:6083)
at Vue$3.Vue._update (vue.esm.js:2637)
at Vue$3.updateComponent (vue.esm.js:2765)
This is how i'm using putFile:
mounted () {
const blockstack = this.blockstack
if (blockstack.isUserSignedIn()) {
this.userData = blockstack.loadUserData()
this.user = new blockstack.Person(this.userData.profile)
this.username = this.user.name()
this.avatarURL = this.user.avatarUrl()
console.log(this.files)
this.blockstack.putFile(MANIFEST_FILE, JSON.stringify(this.files), {encrypt: true})
this.signedIn = true
this.optionsData()
this.fetchData()
} else if (blockstack.isSignInPending()) {
blockstack.handlePendingSignIn().then((userData) => {
window.location = window.location.origin
})
}
}
watch: {
notes: {
handler: function (notes) {
const blockstack = this.blockstack
blockstack.putFile(STORAGE_FILE, JSON.stringify(notes), {encrypt: true})
.then(function () {
console.log('save success')
})
.catch(function () {
console.log('save fail')
})
},
deep: true
}
Thanks for reporting this @dantrevino --
Does this occur in later versions of blockstack.js when you build NoteRiot with them?
@kantai I do not get the error anymore when i use the npm package [email protected].
However... I'm still not able to log in when using the blockstack browser local install on my desktop. The "browser-based" install on my laptop does work though. ?????
I've tried clearing local storage, but that did not help.
https://www.useloom.com/share/4f8920734c8a4b958d4521d3b35b670d
Most helpful comment
@kantai I do not get the error anymore when i use the npm package
[email protected].However... I'm still not able to log in when using the blockstack browser local install on my desktop. The "browser-based" install on my laptop does work though. ?????
I've tried clearing local storage, but that did not help.
https://www.useloom.com/share/4f8920734c8a4b958d4521d3b35b670d