Stability issues WIP.

What's Next?

 * Update the protocol spec and push to Tildegit
 * Cleanup fix scratchpad.sh (currently crashes because ::Draft.current is unexpectedlyy nil)
 * Fix failing test (going to make ::Draft.current crash maybe)
 * Make blobs URLSafe b64??
This commit is contained in:
Netscape Navigator 2020-03-13 07:48:37 -05:00
parent 3c9b653f7c
commit 56518e55c8
2 changed files with 5 additions and 13 deletions

View File

@ -39,6 +39,7 @@ Eg: `pigeon identity show` becomes `./pigeon-cli show`.
- [ ] 100% documentation
- [ ] add parsers and validators for all CLI inputs
- [ ] Validate inputs for `Draft#[]=`.
- [ ] Perform message verrification at time of disk write?
- [ ] Performance benchmarks
- [ ] Performance tuning (DO THIS LAST!)
- [ ] Update spec to look [like this](https://gist.github.com/RickCarlino/3ff4178db4a75fd135832c403cd313d4)

View File

@ -16,7 +16,7 @@ module Pigeon
end
def render
MessageSerializer.new(self).render.chomp
template.render.chomp
end
def multihash
@ -30,16 +30,7 @@ module Pigeon
@template ||= MessageSerializer.new(self)
end
def template_string
@template_string ||= template.render_without_signature
end
def keypair
puts "I should be using @author here!"
@keypair ||= KeyPair.current
end
def initialize(author:, kind:, body:)
def initialize(author:, kind:, body:, signature: nil)
raise "BODY CANT BE EMPTY" if body.empty?
@author = author
@kind = kind
@ -47,14 +38,14 @@ module Pigeon
# Side effects in a constructor? Hmm...
store = Pigeon::Storage.current
@depth = store.message_count
@signature = calculate_signature
@signature = signature || calculate_signature
@prev = store.get_message_by_depth(@author, @depth - 1)
self.freeze
store.save_message(self)
end
def calculate_signature
keypair.sign(template_string)
@author.sign(template.render_without_signature)
end
end
end