Skip to content

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

@emschwartz

Description

@emschwartz

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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions