altaire-siren 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +77 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/altaire-siren.gemspec +32 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/docs/commands/crypto.md +25 -0
- data/docs/docs/commands/song.md +59 -0
- data/docs/docs/index.md +0 -0
- data/docs/mkdocs.yml +20 -0
- data/docs/serve.sh +1 -0
- data/docs/site/404.html +313 -0
- data/docs/site/assets/fonts/font-awesome.css +4 -0
- data/docs/site/assets/fonts/material-icons.css +13 -0
- data/docs/site/assets/fonts/specimen/FontAwesome.ttf +0 -0
- data/docs/site/assets/fonts/specimen/FontAwesome.woff +0 -0
- data/docs/site/assets/fonts/specimen/FontAwesome.woff2 +0 -0
- data/docs/site/assets/fonts/specimen/MaterialIcons-Regular.ttf +0 -0
- data/docs/site/assets/fonts/specimen/MaterialIcons-Regular.woff +0 -0
- data/docs/site/assets/fonts/specimen/MaterialIcons-Regular.woff2 +0 -0
- data/docs/site/assets/images/favicon.png +0 -0
- data/docs/site/assets/images/icons/bitbucket.1b09e088.svg +1 -0
- data/docs/site/assets/images/icons/github.f0b8504a.svg +1 -0
- data/docs/site/assets/images/icons/gitlab.6dd19c00.svg +1 -0
- data/docs/site/assets/javascripts/application.c648116f.js +6 -0
- data/docs/site/assets/javascripts/lunr/lunr.da.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.de.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.du.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.es.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.fi.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.fr.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.hu.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.it.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.ja.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.jp.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.multi.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.nl.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.no.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.pt.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.ro.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.ru.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.stemmer.support.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.sv.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.th.js +1 -0
- data/docs/site/assets/javascripts/lunr/lunr.tr.js +1 -0
- data/docs/site/assets/javascripts/lunr/tinyseg.js +1 -0
- data/docs/site/assets/javascripts/lunr/wordcut.js +1 -0
- data/docs/site/assets/javascripts/modernizr.74668098.js +1 -0
- data/docs/site/assets/stylesheets/application-palette.a8b3c06d.css +1 -0
- data/docs/site/assets/stylesheets/application.30686662.css +1 -0
- data/docs/site/commands/crypto/index.html +470 -0
- data/docs/site/commands/song/index.html +474 -0
- data/docs/site/index.html +348 -0
- data/docs/site/search/search_index.json +1 -0
- data/docs/site/sitemap.xml +18 -0
- data/docs/site/sitemap.xml.gz +0 -0
- data/exe/siren +5 -0
- data/lib/siren.rb +9 -0
- data/lib/siren/cli.rb +83 -0
- data/lib/siren/crypto.rb +17 -0
- data/lib/siren/song.rb +214 -0
- data/lib/siren/stack.rb +25 -0
- data/lib/siren/version.rb +3 -0
- data/public.jwk +1 -0
- metadata +210 -0
@@ -0,0 +1,348 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
<!doctype html>
|
6
|
+
<html lang="en" class="no-js">
|
7
|
+
<head>
|
8
|
+
|
9
|
+
<meta charset="utf-8">
|
10
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
11
|
+
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
<meta name="lang:clipboard.copy" content="Copy to clipboard">
|
17
|
+
|
18
|
+
<meta name="lang:clipboard.copied" content="Copied to clipboard">
|
19
|
+
|
20
|
+
<meta name="lang:search.language" content="en">
|
21
|
+
|
22
|
+
<meta name="lang:search.pipeline.stopwords" content="True">
|
23
|
+
|
24
|
+
<meta name="lang:search.pipeline.trimmer" content="True">
|
25
|
+
|
26
|
+
<meta name="lang:search.result.none" content="No matching documents">
|
27
|
+
|
28
|
+
<meta name="lang:search.result.one" content="1 matching document">
|
29
|
+
|
30
|
+
<meta name="lang:search.result.other" content="# matching documents">
|
31
|
+
|
32
|
+
<meta name="lang:search.tokenizer" content="[\s\-]+">
|
33
|
+
|
34
|
+
<link rel="shortcut icon" href="assets/images/favicon.png">
|
35
|
+
<meta name="generator" content="mkdocs-1.0.4, mkdocs-material-4.4.2">
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
<title>Siren</title>
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
<link rel="stylesheet" href="assets/stylesheets/application.30686662.css">
|
44
|
+
|
45
|
+
<link rel="stylesheet" href="assets/stylesheets/application-palette.a8b3c06d.css">
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
<meta name="theme-color" content="#ef5350">
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
<script src="assets/javascripts/modernizr.74668098.js"></script>
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
|
59
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono&display=fallback">
|
60
|
+
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
|
61
|
+
|
62
|
+
|
63
|
+
<link rel="stylesheet" href="assets/fonts/material-icons.css">
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</head>
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
<body dir="ltr" data-md-color-primary="red" data-md-color-accent="black">
|
75
|
+
|
76
|
+
<svg class="md-svg">
|
77
|
+
<defs>
|
78
|
+
|
79
|
+
|
80
|
+
</defs>
|
81
|
+
</svg>
|
82
|
+
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
|
83
|
+
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
|
84
|
+
<label class="md-overlay" data-md-component="overlay" for="__drawer"></label>
|
85
|
+
|
86
|
+
|
87
|
+
<header class="md-header" data-md-component="header">
|
88
|
+
<nav class="md-header-nav md-grid">
|
89
|
+
<div class="md-flex">
|
90
|
+
<div class="md-flex__cell md-flex__cell--shrink">
|
91
|
+
<a href="." title="Siren" class="md-header-nav__button md-logo">
|
92
|
+
|
93
|
+
<i class="md-icon"></i>
|
94
|
+
|
95
|
+
</a>
|
96
|
+
</div>
|
97
|
+
<div class="md-flex__cell md-flex__cell--shrink">
|
98
|
+
<label class="md-icon md-icon--menu md-header-nav__button" for="__drawer"></label>
|
99
|
+
</div>
|
100
|
+
<div class="md-flex__cell md-flex__cell--stretch">
|
101
|
+
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
|
102
|
+
|
103
|
+
<span class="md-header-nav__topic">
|
104
|
+
Siren
|
105
|
+
</span>
|
106
|
+
<span class="md-header-nav__topic">
|
107
|
+
|
108
|
+
Home
|
109
|
+
|
110
|
+
</span>
|
111
|
+
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
<div class="md-flex__cell md-flex__cell--shrink">
|
115
|
+
|
116
|
+
<label class="md-icon md-icon--search md-header-nav__button" for="__search"></label>
|
117
|
+
|
118
|
+
<div class="md-search" data-md-component="search" role="dialog">
|
119
|
+
<label class="md-search__overlay" for="__search"></label>
|
120
|
+
<div class="md-search__inner" role="search">
|
121
|
+
<form class="md-search__form" name="search">
|
122
|
+
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
|
123
|
+
<label class="md-icon md-search__icon" for="__search"></label>
|
124
|
+
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
|
125
|
+

|
126
|
+
</button>
|
127
|
+
</form>
|
128
|
+
<div class="md-search__output">
|
129
|
+
<div class="md-search__scrollwrap" data-md-scrollfix>
|
130
|
+
<div class="md-search-result" data-md-component="result">
|
131
|
+
<div class="md-search-result__meta">
|
132
|
+
Type to start searching
|
133
|
+
</div>
|
134
|
+
<ol class="md-search-result__list"></ol>
|
135
|
+
</div>
|
136
|
+
</div>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
</div>
|
142
|
+
|
143
|
+
</div>
|
144
|
+
</nav>
|
145
|
+
</header>
|
146
|
+
|
147
|
+
<div class="md-container">
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<nav class="md-tabs" data-md-component="tabs">
|
155
|
+
<div class="md-tabs__inner md-grid">
|
156
|
+
<ul class="md-tabs__list">
|
157
|
+
|
158
|
+
|
159
|
+
<li class="md-tabs__item">
|
160
|
+
|
161
|
+
<a href="." class="md-tabs__link md-tabs__link--active">
|
162
|
+
Home
|
163
|
+
</a>
|
164
|
+
|
165
|
+
</li>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<li class="md-tabs__item">
|
172
|
+
|
173
|
+
<a href="commands/crypto/" class="md-tabs__link">
|
174
|
+
Commands
|
175
|
+
</a>
|
176
|
+
|
177
|
+
</li>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
</ul>
|
182
|
+
</div>
|
183
|
+
</nav>
|
184
|
+
|
185
|
+
<main class="md-main" role="main">
|
186
|
+
<div class="md-main__inner md-grid" data-md-component="container">
|
187
|
+
|
188
|
+
|
189
|
+
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
|
190
|
+
<div class="md-sidebar__scrollwrap">
|
191
|
+
<div class="md-sidebar__inner">
|
192
|
+
<nav class="md-nav md-nav--primary" data-md-level="0">
|
193
|
+
<label class="md-nav__title md-nav__title--site" for="__drawer">
|
194
|
+
<a href="." title="Siren" class="md-nav__button md-logo">
|
195
|
+
|
196
|
+
<i class="md-icon"></i>
|
197
|
+
|
198
|
+
</a>
|
199
|
+
Siren
|
200
|
+
</label>
|
201
|
+
|
202
|
+
<ul class="md-nav__list" data-md-scrollfix>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
<li class="md-nav__item md-nav__item--active">
|
212
|
+
|
213
|
+
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="__toc">
|
214
|
+
|
215
|
+
|
216
|
+
<a href="." title="Home" class="md-nav__link md-nav__link--active">
|
217
|
+
Home
|
218
|
+
</a>
|
219
|
+
|
220
|
+
</li>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
<li class="md-nav__item md-nav__item--nested">
|
229
|
+
|
230
|
+
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-2" type="checkbox" id="nav-2">
|
231
|
+
|
232
|
+
<label class="md-nav__link" for="nav-2">
|
233
|
+
Commands
|
234
|
+
</label>
|
235
|
+
<nav class="md-nav" data-md-component="collapsible" data-md-level="1">
|
236
|
+
<label class="md-nav__title" for="nav-2">
|
237
|
+
Commands
|
238
|
+
</label>
|
239
|
+
<ul class="md-nav__list" data-md-scrollfix>
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
<li class="md-nav__item">
|
248
|
+
<a href="commands/crypto/" title="Crypto" class="md-nav__link">
|
249
|
+
Crypto
|
250
|
+
</a>
|
251
|
+
</li>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
<li class="md-nav__item">
|
260
|
+
<a href="commands/song/" title="Song" class="md-nav__link">
|
261
|
+
Song
|
262
|
+
</a>
|
263
|
+
</li>
|
264
|
+
|
265
|
+
|
266
|
+
</ul>
|
267
|
+
</nav>
|
268
|
+
</li>
|
269
|
+
|
270
|
+
|
271
|
+
</ul>
|
272
|
+
</nav>
|
273
|
+
</div>
|
274
|
+
</div>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
<div class="md-content">
|
280
|
+
<article class="md-content__inner md-typeset">
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
<h1>Home</h1>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
</article>
|
297
|
+
</div>
|
298
|
+
</div>
|
299
|
+
</main>
|
300
|
+
|
301
|
+
|
302
|
+
<footer class="md-footer">
|
303
|
+
|
304
|
+
<div class="md-footer-nav">
|
305
|
+
<nav class="md-footer-nav__inner md-grid">
|
306
|
+
|
307
|
+
|
308
|
+
<a href="commands/crypto/" title="Crypto" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
|
309
|
+
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
|
310
|
+
<span class="md-flex__ellipsis">
|
311
|
+
<span class="md-footer-nav__direction">
|
312
|
+
Next
|
313
|
+
</span>
|
314
|
+
Crypto
|
315
|
+
</span>
|
316
|
+
</div>
|
317
|
+
<div class="md-flex__cell md-flex__cell--shrink">
|
318
|
+
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
|
319
|
+
</div>
|
320
|
+
</a>
|
321
|
+
|
322
|
+
</nav>
|
323
|
+
</div>
|
324
|
+
|
325
|
+
<div class="md-footer-meta md-typeset">
|
326
|
+
<div class="md-footer-meta__inner md-grid">
|
327
|
+
<div class="md-footer-copyright">
|
328
|
+
|
329
|
+
powered by
|
330
|
+
<a href="https://www.mkdocs.org">MkDocs</a>
|
331
|
+
and
|
332
|
+
<a href="https://squidfunk.github.io/mkdocs-material/">
|
333
|
+
Material for MkDocs</a>
|
334
|
+
</div>
|
335
|
+
|
336
|
+
</div>
|
337
|
+
</div>
|
338
|
+
</footer>
|
339
|
+
|
340
|
+
</div>
|
341
|
+
|
342
|
+
<script src="assets/javascripts/application.c648116f.js"></script>
|
343
|
+
|
344
|
+
<script>app.initialize({version:"1.0.4",url:{base:"."}})</script>
|
345
|
+
|
346
|
+
|
347
|
+
</body>
|
348
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
{"config":{"lang":["en"],"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"","title":"Home"},{"location":"commands/crypto/","text":"Crypto encrypt \u00b6 siren crypto encrypt [ --pubkey = public.jwk ] WORDS... Encrypt the words using the public key. The resulting output can only be decrypted using the corresponding private key. decrypt \u00b6 siren crypto decrypt [ --privkey = private.jwk ] CIPHERTEXT Decrypt the encrypted data using the private key. This can only decrypt data that was encrypted using the corresponding public key. genkeys \u00b6 siren crypto genkeys [ --force ] [ --privkey = private.jwk ] [ --pubkey = public.jwk ] Generates a pair of encryption keys. Usually, you\u2019ll want to use the already-created encryption keys. This command should only need to be used if it\u2019s necessary to replace those keys.","title":"Crypto"},{"location":"commands/crypto/#encrypt","text":"siren crypto encrypt [ --pubkey = public.jwk ] WORDS... Encrypt the words using the public key. The resulting output can only be decrypted using the corresponding private key.","title":"encrypt"},{"location":"commands/crypto/#decrypt","text":"siren crypto decrypt [ --privkey = private.jwk ] CIPHERTEXT Decrypt the encrypted data using the private key. This can only decrypt data that was encrypted using the corresponding public key.","title":"decrypt"},{"location":"commands/crypto/#genkeys","text":"siren crypto genkeys [ --force ] [ --privkey = private.jwk ] [ --pubkey = public.jwk ] Generates a pair of encryption keys. Usually, you\u2019ll want to use the already-created encryption keys. This command should only need to be used if it\u2019s necessary to replace those keys.","title":"genkeys"},{"location":"commands/song/","text":"Song convert \u00b6 siren song convert FILE Convert a song to a set of Kubernetes resource descriptions. Until Kubernetes is fully integrated into the CLI, you could deploy a song on a Kubernetes cluster using the command: siren song convert FILE | kubectl apply -f - and remove it with siren song convert FILE | kubectl delete -f - Or, you can save the resources to a file to edit or inspect them before deployment. File format \u00b6 # Choff for Kubernetes. apiVersion : siren.altaire.xyz/v1 kind : Song metadata : # A name is required. name : builder spec : # Global environmental variables which apply to all services. env : name : value service : - # As you can imagine, the image to run. image : altaire/builder-live # Optionally, the command to run in the image. command : command-name # Optionally, name this service. # If there are multiple services, you _must_ name them. name : service-name # Environmental variables which apply to all services. # These override the global variables, if there are any. env : name : value # Publish the service one or more domains publish : - # The port the service is listening on. port : 8081 # Domain name to use. domain : builder.k9.altaire.xyz # Use built-in Altaire auth. auth : true - ...","title":"Song"},{"location":"commands/song/#convert","text":"siren song convert FILE Convert a song to a set of Kubernetes resource descriptions. Until Kubernetes is fully integrated into the CLI, you could deploy a song on a Kubernetes cluster using the command: siren song convert FILE | kubectl apply -f - and remove it with siren song convert FILE | kubectl delete -f - Or, you can save the resources to a file to edit or inspect them before deployment.","title":"convert"},{"location":"commands/song/#file-format","text":"# Choff for Kubernetes. apiVersion : siren.altaire.xyz/v1 kind : Song metadata : # A name is required. name : builder spec : # Global environmental variables which apply to all services. env : name : value service : - # As you can imagine, the image to run. image : altaire/builder-live # Optionally, the command to run in the image. command : command-name # Optionally, name this service. # If there are multiple services, you _must_ name them. name : service-name # Environmental variables which apply to all services. # These override the global variables, if there are any. env : name : value # Publish the service one or more domains publish : - # The port the service is listening on. port : 8081 # Domain name to use. domain : builder.k9.altaire.xyz # Use built-in Altaire auth. auth : true - ...","title":"File format"}]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
3
|
+
<url>
|
4
|
+
<loc>None</loc>
|
5
|
+
<lastmod>2019-10-28</lastmod>
|
6
|
+
<changefreq>daily</changefreq>
|
7
|
+
</url>
|
8
|
+
<url>
|
9
|
+
<loc>None</loc>
|
10
|
+
<lastmod>2019-10-28</lastmod>
|
11
|
+
<changefreq>daily</changefreq>
|
12
|
+
</url>
|
13
|
+
<url>
|
14
|
+
<loc>None</loc>
|
15
|
+
<lastmod>2019-10-28</lastmod>
|
16
|
+
<changefreq>daily</changefreq>
|
17
|
+
</url>
|
18
|
+
</urlset>
|
Binary file
|
data/exe/siren
ADDED
data/lib/siren.rb
ADDED
data/lib/siren/cli.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'clamp'
|
2
|
+
|
3
|
+
require 'siren'
|
4
|
+
|
5
|
+
module Siren
|
6
|
+
module CLI
|
7
|
+
|
8
|
+
class SongfileCommand < Clamp::Command
|
9
|
+
|
10
|
+
subcommand %w(c conv convert), "Convert songfile to resources" do
|
11
|
+
parameter "SONGFILE", "the Songfile"
|
12
|
+
def execute
|
13
|
+
song = Siren::Song.load(songfile)
|
14
|
+
puts song.to_stack.to_yaml
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
class CryptoCommand < Clamp::Command
|
21
|
+
|
22
|
+
subcommand %w(g gen genkeys), "Generate encryption keys" do
|
23
|
+
option %w(-f --force), :flag, "overwrite keys if they already exist"
|
24
|
+
option %w(-k --privkey), "FILE", "private key file", default: "private.jwk"
|
25
|
+
option %w(-p --pubkey), "FILE", "public key file", default: "public.jwk"
|
26
|
+
def execute
|
27
|
+
if File.exists?(privkey) && !force?
|
28
|
+
STDERR.puts "Won't overwrite #{privkey}. Delete it first if you want to generate a new key."
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
private, public = Siren::Crypto.genkeys
|
32
|
+
public.to_file(privkey)
|
33
|
+
private.to_file(pubkey)
|
34
|
+
puts "Keys generated. Keep #{privkey} secret. Give #{pubkey} to whoever needs it."
|
35
|
+
puts "Thumbprint: #{JOSE::JWK.thumbprint(private)}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
subcommand %w(e enc encrypt), "Encrypt data using public key" do
|
40
|
+
option %w(-k --pubkey), "FILE", "public key file", default: "public.jwk"
|
41
|
+
parameter "WORDS ...", "the data to encrypt", attribute_name: :words
|
42
|
+
def execute
|
43
|
+
require "jose"
|
44
|
+
key = JOSE::JWK.from_file(pubkey)
|
45
|
+
STDERR.puts "multiple arguments will be joined with single spaces" if words.length > 1
|
46
|
+
plain = words.join(" ")
|
47
|
+
cyphertext = key.box_encrypt(plain)[0].compact
|
48
|
+
puts cyphertext
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
subcommand %w(d dec decrypt), "Decrypt data using private key" do
|
53
|
+
option %w(-k --privkey), "FILE", "private key file", default: "private.jwk"
|
54
|
+
parameter "CYPHERTEXT", "the data to decrypt", attribute_name: :cyphertext
|
55
|
+
def execute
|
56
|
+
require "jose"
|
57
|
+
key = JOSE::JWK.from_file(privkey)
|
58
|
+
puts key.block_decrypt(cyphertext)[0]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
class SirenCommand < Clamp::Command
|
65
|
+
|
66
|
+
subcommand %w(ver version), "Show version" do
|
67
|
+
def execute
|
68
|
+
puts "siren #{Siren::VERSION}"
|
69
|
+
exit(0)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
subcommand %w(c crypto cryptography), "Cryptography (JOSE) commands", CryptoCommand
|
74
|
+
subcommand %w(s song songs songfile), "Songfile commands", SongfileCommand
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.start
|
79
|
+
SirenCommand.run
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|