Begin transition to multihash lipmaalinks (34 examples, 18 failures).

This commit is contained in:
Netscape Navigator 2020-05-10 16:57:58 -05:00
parent 54498e5996
commit bb084345f6
3 changed files with 15 additions and 5 deletions

View File

@ -109,7 +109,12 @@ module Pigeon
po3 = m
end
end
return n - po3
result = n - po3
if result == n - 1
return nil
else
return result
end
end
# http://www.crockford.com/wrmg/base32.html
@ -163,7 +168,12 @@ module Pigeon
draft.author = author
draft.depth = depth
draft.prev = db.get_message_by_depth(mhash, depth - 1)
draft.lipmaa = Helpers.lipmaa(depth)
lipmaa = Helpers.lipmaa(depth)
if lipmaa && draft.prev
draft.lipmaa = db.get_message_by_depth(mhash, lipmaa)
else
draft.lipmaa = NOTHING
end
unsigned = template.render_without_signature
draft.signature = author.sign(unsigned)
@ -199,7 +209,7 @@ module Pigeon
# TODO: Re-visit this. Our current verification method
# is probably too strict and won't allow for partial
# verification of feeds.
assert("lipmaa", Helpers.lipmaa(msg.depth), msg.lipmaa)
assert("lipmaa", msg.lipmaa, Helpers.lipmaa(msg.depth))
assert("prev", msg.prev, expected_prev)
tpl = msg.template.render_without_signature
Helpers.verify_string(author, signature, tpl)

View File

@ -64,7 +64,7 @@ module Pigeon
SEPERATOR = /\n/
AUTHOR = /author #{FEED_VALUE}\n/
DEPTH = /depth #{NUMERIC}\n/
LIPMAA = /lipmaa #{NUMERIC}\n/
LIPMAA = /prev (#{MESG_VALUE}|#{NULL_VALUE})\n/
PREV = /prev (#{MESG_VALUE}|#{NULL_VALUE})\n/
KIND = /kind #{ALPHANUMERICISH}\n/
BODY_ENTRY = /#{ALPHANUMERICISH}:#{ANY_VALUE}\n/

View File

@ -26,7 +26,7 @@ module Pigeon
depth = message.depth
kind = message.kind
prev = message.prev || NOTHING
lipmaa = message.lipmaa
lipmaa = message.lipmaa || NOTHING
signature = message.signature
ERB.new(template).result(binding)