Convert `".sig.ed25519"` literals to constants. Update README.

This commit is contained in:
Netscape Navigator 2020-03-13 22:02:45 -05:00
parent ef569d3fb4
commit afa160c2d2
4 changed files with 14 additions and 13 deletions

View File

@ -24,28 +24,28 @@ Eg: `pigeon identity show` becomes `./pigeon-cli show`.
- [X] pigeon peer block
- [X] pigeon peer all
- [X] 100% coverage
- [ ] Convert `".sig.ed25519"` literals to constants
- [ ] Reduce whole darn repo into single module to aide portability
- [ ] Remove all `.current` "singletons" / hacks
- [X] Convert `".sig.ed25519"` literals to constants
- [ ] Rename numerous "pigeon message ..." commands to "pigeon draft ..."
- [ ] pigeon bundle create
- [ ] pigeon bundle consume
- [ ] pigeon draft create
- [ ] pigeon draft append
- [ ] pigeon draft current
- [ ] pigeon draft save
- [ ] Perform message verification at time of disk write
- [ ] Remove all `.current` "singletons" / hacks
- [ ] pigeon message find
- [ ] pigeon message find-all
- [ ] pigeon bundle create
- [ ] pigeon bundle consume
- [ ] 100% documentation
- [ ] add parsers and validators for all CLI inputs
- [ ] Validate inputs for `Draft#[]=`.
- [ ] Perform message verrification at time of disk write?
- [ ] Update spec to look [like this](https://gist.github.com/RickCarlino/3ff4178db4a75fd135832c403cd313d4)
- [ ] Reduce whole darn repo into single module to aide portability
- [ ] Add Lipmaa links like the Bamboo folks do.
- [ ] Publish a RubyGem
- [ ] Performance benchmarks
- [ ] Performance tuning (DO THIS LAST!)
- [ ] Update spec to look [like this](https://gist.github.com/RickCarlino/3ff4178db4a75fd135832c403cd313d4)
- [ ] Publish a RubyGem
# Idea Bin
- [ ] Map/reduce plugin support for custom indices?
- [ ] Add Lipmaa links like the Bamboo folks do.
- [ ] Ability to add a blob in one swoop using File objects and `Message#[]=`, maybe?

1
dist/pigeon.rb vendored
View File

@ -41,6 +41,7 @@ module Pigeon
IDENTITY_SIGIL = "@"
STRING_SIGIL = "\""
BLOB_FOOTER = ".sha256"
SIG_FOOTER = ".sig.ed25519"
# Error messages
PREV_REQUIRES_SAVE = "Can't fetch `prev` on unsaved messages"

View File

@ -37,7 +37,7 @@ module Pigeon
def sign(string)
hex = @signing_key.sign(string)
b64 = Base64.urlsafe_encode64(hex)
return b64 + ".sig.ed25519"
return b64 + SIG_FOOTER
end
def verify(signature, string)

View File

@ -40,7 +40,7 @@ RSpec.describe Pigeon::Message do
expect(message.depth).to eq(0)
expect(message.kind).to eq("unit_test")
expect(message.prev).to eq(nil)
expect(message.signature.include?(".sig.ed25519")).to eq(true)
expect(message.signature.include?(Pigeon::SIG_FOOTER)).to eq(true)
expect(message.signature.length).to be > 99
actual = message.render
expected = [
@ -111,8 +111,8 @@ RSpec.describe Pigeon::Message do
expect(key1.seed).to eq(key2.seed)
expect(sig1).to eq(sig2)
sig1_b64 = Base64.urlsafe_encode64(sig1) + ".sig.ed25519"
sig2_b64 = Base64.urlsafe_encode64(sig2) + ".sig.ed25519"
sig1_b64 = Base64.urlsafe_encode64(sig1) + Pigeon::SIG_FOOTER
sig2_b64 = Base64.urlsafe_encode64(sig2) + Pigeon::SIG_FOOTER
expect(message.signature).to eq(sig1_b64)
expect(message.signature).to eq(sig2_b64)