mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 18:12:47 +03:00
f3ee59561f
user-specified moon, or generated from hashed entropy
38 lines
1009 B
Plaintext
38 lines
1009 B
Plaintext
:: Create a private key-file for a random (or specified) moon
|
|
::
|
|
:::: /hoon/moon/gen
|
|
::
|
|
/? 310
|
|
/- *sole
|
|
::
|
|
::::
|
|
::
|
|
:- %ask
|
|
|= $: [now=@da eny=@uvJ bec=beak]
|
|
arg=?(~ [mon=@p ~])
|
|
~
|
|
==
|
|
=* our p.bec
|
|
=/ ran (clan:title our)
|
|
?: ?=({?($earl $pawn)} ran)
|
|
%- sole-so
|
|
:- %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)
|
|
%- sole-so
|
|
:- %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]
|
|
%+ sole-yo leaf+"moon: {(scow %p mon)}"
|
|
%- sole-so [%atom (scot %uw (jam sed))]
|