urbit/gen/moon.hoon
Joe Bryan c8f1b4d5a1 Merge branch 'release-candidate' into ames-eth-keys
* release-candidate: (33 commits)
  update pin-vere-commit.txt
  Bug fix for metal-wrapping runes
  Remove old-zuse (#867)
  Type Analysis (#865)
  remove clam from error sigpam
  Fix compiler error.
  Remove temporary type analysis work.
  Remove ++cook from ++auri parsing
  Remove forced ssl upgrade for localhost http reqs
  moved to new branch with updated arvo
  11. demacrotizes %6, %7, %8, and %9
  10. updates %5 to require two subformulas (4K)
  9. emits %10 (4K)
  8. adds and implements edit (%10) (4K)
  7. removes %13 and %14 (4K)
  6. emits %11 and %12 (4K)
  5. implements hint at %11 and wish at %12 (4K)
  4. removes %10 and %11 (4K)
  3. emits %13 and %14 (4K)
  2. implements %13 and %14 (4K)
  ...
2018-11-01 00:18:54 -04:00

38 lines
1.0 KiB
Plaintext

:: Create a private key-file for a random (or specified) moon
::
:::: /hoon/moon/gen
::
/? 310
/- *sole
/+ *generators
::
::::
::
:- %ask
|= $: [now=@da eny=@uvJ bec=beak]
arg=?(~ [mon=@p ~])
~
==
=* 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))]