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

Throw a more descriptive error if no message is provided when validating an ed25519 condition/fulfillment #52

Open
emschwartz opened this issue Aug 8, 2016 · 1 comment
Assignees

Comments

@emschwartz
Copy link
Member

Found by @inacali in #51

If you run the following and leave out the message from the second to last line you'll see a ValidationError: Invalid ed25519 signature error. It should instead tell you that you need to pass in a message.

const cc = require('five-bells-condition')
const ed25519 = require('ed25519')

const seed =  Buffer.from('833fe62409237b9d62ec77587520911e9a759cec1d19755b7da901b96dca3d42', 'hex')
const keypair = ed25519.MakeKeypair(seed)
const edff = new cc.Ed25519()
edff.setPublicKey(keypair.publicKey)
const condition = edff.getConditionUri()
const message = new Buffer('Hello World! Conditions are here!')
edff.sign(message, seed)
const fulfillment = edff.serializeUri()
const valid = cc.validateFulfillment(fulfillment, condition, message)
console.log('valid', valid)
@emschwartz
Copy link
Member Author

I just realized that it's throwing this error because it's validating against the empty buffer. For something like a signature condition type I think it should probably require that you pass a proper message. It seems likely that it would be a bug causing the user to request validating a signature on no message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants