shrub/gen/moon.hoon

38 lines
1.0 KiB
Plaintext
Raw Normal View History

:: Create a private key-file for a random (or specified) moon
2015-10-20 21:12:22 +03:00
::
2016-02-05 06:05:37 +03:00
:::: /hoon/moon/gen
2015-10-20 21:12:22 +03:00
::
/? 310
/- *sole
/+ *generators
2015-10-20 21:12:22 +03:00
::
::::
2016-11-17 04:42:58 +03:00
::
:- %ask
|= $: [now=@da eny=@uvJ bec=beak]
arg=?(~ [mon=@p ~])
2018-03-19 07:18:20 +03:00
~
2015-10-20 21:12:22 +03:00
==
=* our p.bec
=/ ran (clan:title our)
?: ?=({?($earl $pawn)} ran)
%- produce
:- %tang :_ ~
leaf+"can't create a moon from a {?:(?=($earl ran) "moon" "comet")}"
=/ mon=ship
?^ arg
mon.arg
(add our (lsh 5 1 (end 5 1 (shaz eny))))
=/ seg=ship (sein:title our now mon)
?. =(our seg)
%- produce
:- %tang :_ ~
leaf+"can't create keys for {(scow %p mon)}, which belongs to {(scow %p seg)}"
=/ cub=acru:ames (pit:nu:crub:crypto 512 eny)
=/ lyf=life .^(@ud j+/(scot %p our)/life/(scot %da now)/(scot %p our))
=/ sig=oath:pki:jael
.^(@ j+/(scot %p our)/earl/(scot %da now)/(scot %p mon)/(scot %ud lyf)/(scot %ux pub:ex:cub))
=/ sed=seed:able:jael
[mon lyf sec:ex:cub `sig]
%+ print leaf+"moon: {(scow %p mon)}"
%- produce [%atom (scot %uw (jam sed))]