Commit Graph

3 Commits

Author SHA1 Message Date
Alex Akselrod
55e693aa09 zpay32: fix decoding when payment request is too short
This commit fixes a panic that can result when a zpay32 payment request
that is too short (and possibly invalid) is attempted to be decoded.

To fix this bug, we now simply ensure that that after we decode the
zbase32 encoding, the resulting set of bytes is _exactly_ the length we
expect. A new error has been introduced to handle this case, and a
simple test has been added which ensures proper handling of short
payment requests.

Fixes #127.
2017-02-16 19:30:28 +08:00
Olaoluwa Osuntokun
d94777acf6
zpay32: ensure argument to Decode is not an empty string
This commit fixes a possible panic which can arise within the library
due to poor user-data. We now explicitly check for an empty string,
exiting early if found within the Decode method.
2017-01-29 14:58:15 -08:00
Olaoluwa Osuntokun
bd0cf51581
zpay32: create new package for encoding/decoding payment requests
This commit adds a new package “zpay32”: which is used within the
daemon to encode/decode payment requests. A payment request currently
consists of: the public key of the payee, the payment hash to use, and
finally the amount to send over the network. The encoded payment
request consists of the mentioned fields concatenated to each other, a
cc32 checksum is added, then the blob is finally encoded using zbas32.
I call the resulting scheme “zpay32”.

A number of extensions may be explored in future commits including
adding a version byte, adding “hint” routing information,
cryptographically signed receipts and more,
2017-01-02 15:17:58 -08:00