store old private keys for checking tickets

This commit is contained in:
Anton Dyudin 2016-05-04 11:48:16 -07:00
parent c616cd68ed
commit 6f91c91236
3 changed files with 34 additions and 9 deletions

View File

@ -43,7 +43,7 @@
$% {$drum $1 drum-pith-1} ::
{$helm $0 helm-pith} ::
{$kiln $0 kiln-pith} ::
{$womb $0 pith:womb} ::
{$womb $1 pith:womb} ::
{$write $0 pith:write} ::
== ::
-- ::
@ -167,6 +167,7 @@
++ poke-womb-rekey (wrap poke-rekey):from-womb
++ poke-womb-report (wrap poke-report):from-womb
++ poke-womb-manage (wrap poke-manage):from-womb
++ poke-womb-manage-old-key (wrap poke-manage-old-key):from-womb
++ poke-womb-release (wrap poke-release):from-womb
++ poke-womb-reinvite (wrap poke-reinvite):from-womb
++ poke-womb-replay-log (wrap poke-replay-log):from-womb

View File

@ -0,0 +1,13 @@
::
:::: /hoon/manage-old-key/hood/gen
::
/? 310
::
::::
!:
:- %say
|= $: {now/@da eny/@uvI bec/beak}
{{who/@p key/@ $~} $~}
==
:- %womb-manage-old-key
[who key]

View File

@ -95,12 +95,13 @@
:::: :: ::
:: :: ::
|%
++ part {$womb $0 pith} :: womb state
++ part {$womb $1 pith} :: womb state
++ pith :: womb content
$: boss/(unit ship) :: outside master
bureau/(map passcode balance) :: active invitations
office/property :: properties managed
hotel/(map (each ship mail) client) :: everyone we know
recycling/(map ship @) :: old ticket keys
== ::
-- ::
:: :: ::
@ -499,17 +500,21 @@
|= {a/knot b/knot} ^- {him/@ tik/@}
[him=(rash a old-phon) tik=(rash b old-phon)]
::
++ check-ticket
|= {a/@ b/@} ^- ?
=(b `@p`!!)
++ check-old-ticket
|= {a/ship b/@pG} ^- (unit ?)
%+ bind (~(get by recycling) (sein a))
|= key/@ ^- ?
=(b `@p`(end 6 1 (shaf %tick (mix a (shax key)))))
::
++ peek-x-ticket
|= tyl/path
^- (unit (unit {$womb-tick-info ?($fail $good $used)}))
?. ?=({@ @ $~} tyl) ~|(bad-path+tyl !!)
=+ [him tik]=(parse-ticket i.tyl i.t.tyl)
:^ ~ ~ %womb-tick-info
?. (check-ticket i.tyl i.t.tyl) %fail
%+ bind (check-old-ticket him tik)
|= gud/?
:+ ~ %womb-tick-info
?. gud %fail
?. (~(has by bureau) (shas %tick tik))
%good
%used
@ -542,6 +547,12 @@
$ticket (peek-x-ticket +.tyl)
==
::
++ poke-manage-old-key :: add to recyclable tickets
|= {a/ship b/@}
=< abet
?> |(=(our src) =([~ src] boss)) :: privileged
.(recycling (~(put by recycling) a b))
::
++ poke-manage :: add to property
|= a/(list ship)
=< abet
@ -696,7 +707,7 @@
=. log-transaction (log-transaction %claim-old +<)
?> =(src src)
=+ [him tik]=(parse-ticket him-t tik-t)
?> (check-ticket him tik)
?> (need (check-old-ticket him tik))
=+ pas=(shas %tick tik)
?: (~(has by bureau) pas)
~|(already-claimed+[him-t tik-t] !!)
@ -711,7 +722,7 @@
?> =(src src)
(claim-any aut her)
::
++ claim-any
++ claim-any :: register
|= {aut/passcode her/@p}
=; claimed
:: =. claimed (emit.claimed %wait $~) :: XX delay ack