mirror of
https://github.com/urbit/shrub.git
synced 2024-12-30 07:35:19 +03:00
Remove more ballet junk and also some minimal testing generators.
This commit is contained in:
parent
59387055f9
commit
5efbb0e6ba
@ -1,40 +0,0 @@
|
|||||||
/- *ballet
|
|
||||||
/+ ring
|
|
||||||
::
|
|
||||||
=/ people=(list @p)
|
|
||||||
[~littel-ponnys ~rovnys-ricfer ~palfun-foslup ~rapfyr-diglyt ~poldec-tonteg ~]
|
|
||||||
:: Creates a
|
|
||||||
::
|
|
||||||
:- %say
|
|
||||||
|= $: {now/@da eny/@uvJ byk/beak}
|
|
||||||
[[=id who=@p vote=@u ~] ~]
|
|
||||||
==
|
|
||||||
:: todo: these are fake keys
|
|
||||||
::
|
|
||||||
=/ keys=(list @udpoint)
|
|
||||||
(turn people public-key-for-ship:ring)
|
|
||||||
=/ electorate-keys=(set @udpoint) (sy keys)
|
|
||||||
:: ballot
|
|
||||||
::
|
|
||||||
=/ vote-to-cast=^vote
|
|
||||||
[id [[%radio vote] ~]]
|
|
||||||
|
|
||||||
:: sign our ballet
|
|
||||||
::
|
|
||||||
=/ signature=ring-signature:ring
|
|
||||||
%- sign:ring :*
|
|
||||||
message=vote-to-cast
|
|
||||||
link-scope=[~ [%election id]]
|
|
||||||
anonymity-set=electorate-keys
|
|
||||||
my-public-key=(public-key-for-ship:ring who)
|
|
||||||
my-private-key=`@udscalar`who
|
|
||||||
eny=eny
|
|
||||||
==
|
|
||||||
::
|
|
||||||
~& [%signature signature]
|
|
||||||
::
|
|
||||||
:* %ballot-cast
|
|
||||||
id
|
|
||||||
signature
|
|
||||||
vote-to-cast
|
|
||||||
==
|
|
@ -1,17 +0,0 @@
|
|||||||
:: Creates a
|
|
||||||
::
|
|
||||||
|
|
||||||
=/ people=(list @p)
|
|
||||||
[~littel-ponnys ~rovnys-ricfer ~palfun-foslup ~rapfyr-diglyt ~poldec-tonteg ~]
|
|
||||||
::
|
|
||||||
:- %say
|
|
||||||
|= $: {now/@da eny/@uvJ byk/beak}
|
|
||||||
[[answers=(list tape) ~] ~]
|
|
||||||
==
|
|
||||||
:* %ballot-create
|
|
||||||
`(set @p)`(sy people)
|
|
||||||
:* "Test"
|
|
||||||
[[%radio "Question" answers] ~]
|
|
||||||
==
|
|
||||||
`@da`(add now ~d1)
|
|
||||||
==
|
|
@ -1,9 +0,0 @@
|
|||||||
/+ ring
|
|
||||||
::
|
|
||||||
:- %say
|
|
||||||
|= [{now/@da eny/@uvJ bec/beak} [invited=(list @p) ~] ~]
|
|
||||||
:- %noun
|
|
||||||
=/ s1 (sign:ring p.bec now eny "Hello Worldd" `[%scope 6] (sy invited))
|
|
||||||
~& [%signature-1 s1]
|
|
||||||
=/ v (verify:ring p.bec now "Hello Worldd" s1)
|
|
||||||
v
|
|
@ -1,49 +0,0 @@
|
|||||||
/+ *ring
|
|
||||||
::
|
|
||||||
::
|
|
||||||
:- %say
|
|
||||||
|= [[now=time eny=@ our=ship ^] ~ ~]
|
|
||||||
:- %noun
|
|
||||||
:: deterministically generate keys with insecure numbers for testing purposes
|
|
||||||
::
|
|
||||||
=/ key-num=@ 2
|
|
||||||
:: create a list of public/private keypairs
|
|
||||||
::
|
|
||||||
=/ keys=(list [pk=@udpoint sk=@udscalar])
|
|
||||||
=| count=@
|
|
||||||
=| keys=(list [pk=@udpoint sk=@udscalar])
|
|
||||||
::
|
|
||||||
|-
|
|
||||||
?: =(count 300)
|
|
||||||
keys
|
|
||||||
:: using key-num as our "secret" key.
|
|
||||||
::
|
|
||||||
=/ pk=@udpoint (scalarmult-base:ed:crypto key-num)
|
|
||||||
::
|
|
||||||
$(keys [[pk key-num] keys], count +(count), key-num +(key-num))
|
|
||||||
:: create the key set the interface expects
|
|
||||||
::
|
|
||||||
=/ key-set=(set @udpoint)
|
|
||||||
(sy (turn keys head))
|
|
||||||
::
|
|
||||||
=/ my-key (snag 13 keys)
|
|
||||||
=/ my-public-key=@udpoint (head my-key)
|
|
||||||
=/ my-private-key=@udscalar (tail my-key)
|
|
||||||
::
|
|
||||||
~& %start----------signing
|
|
||||||
::
|
|
||||||
=/ message "blah"
|
|
||||||
=/ scope [~ [%link-scope 52]]
|
|
||||||
::=/ scope ~
|
|
||||||
::
|
|
||||||
=/ signature=ring-signature
|
|
||||||
(sign message scope key-set my-public-key my-private-key eny)
|
|
||||||
~& [%signature signature]
|
|
||||||
::
|
|
||||||
~& %start----------verification
|
|
||||||
::
|
|
||||||
=/ verified
|
|
||||||
(verify message scope key-set signature)
|
|
||||||
::
|
|
||||||
~& [%verified verified]
|
|
||||||
verified
|
|
Loading…
Reference in New Issue
Block a user