-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathidkey_gen.go
656 lines (540 loc) · 20 KB
/
idkey_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
// MIT License
//
// Copyright 2018 Canonical Ledgers, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
// Code generated DO NOT EDIT
package factom
import (
"crypto/ed25519"
"crypto/sha256"
)
// Defines IDKeys ID1Key - ID4Key and corresponding SKKeys SK1Key - SK4Key.
var (
id1PrefixBytes = [...]byte{0x3f, 0xbe, 0xba}
id2PrefixBytes = [...]byte{0x3f, 0xbe, 0xd8}
id3PrefixBytes = [...]byte{0x3f, 0xbe, 0xf6}
id4PrefixBytes = [...]byte{0x3f, 0xbf, 0x14}
sk1PrefixBytes = [...]byte{0x4d, 0xb6, 0xc9}
sk2PrefixBytes = [...]byte{0x4d, 0xb6, 0xe7}
sk3PrefixBytes = [...]byte{0x4d, 0xb7, 0x05}
sk4PrefixBytes = [...]byte{0x4d, 0xb7, 0x23}
)
const (
id1PrefixStr = "id1"
id2PrefixStr = "id2"
id3PrefixStr = "id3"
id4PrefixStr = "id4"
sk1PrefixStr = "sk1"
sk2PrefixStr = "sk2"
sk3PrefixStr = "sk3"
sk4PrefixStr = "sk4"
)
// ID1Key is the id1 public key for an identity.
type ID1Key [sha256.Size]byte
// SK1Key is the sk1 secret key for an identity.
type SK1Key [sha256.Size]byte
// Payload returns key as a byte array.
func (key ID1Key) Payload() [sha256.Size]byte {
return key
}
// Payload returns key as a byte array.
func (key SK1Key) Payload() [sha256.Size]byte {
return key
}
// payload returns adr as *payload. This is syntactic sugar useful in other
// methods that leverage *payload.
func (key *ID1Key) payload() *payload {
return (*payload)(key)
}
func (key *SK1Key) payload() *payload {
return (*payload)(key)
}
// PrefixBytes returns the two byte prefix for the address type as a byte
// array. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns []byte{0x3f, 0xbe, 0xba}.
func (ID1Key) PrefixBytes() []byte {
prefix := id1PrefixBytes
return prefix[:]
}
// PrefixBytes returns the two byte prefix for the address type as a byte
// array. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns []byte{0x4d, 0xb6, 0xc9}.
func (SK1Key) PrefixBytes() []byte {
prefix := sk1PrefixBytes
return prefix[:]
}
// PrefixString returns the two prefix bytes for the address type as an encoded
// string. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns "id1".
func (ID1Key) PrefixString() string {
return id1PrefixStr
}
// PrefixString returns the two prefix bytes for the address type as an encoded
// string. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns "sk1".
func (SK1Key) PrefixString() string {
return sk1PrefixStr
}
// String encodes key into its human readable form: a base58check string with
// key.PrefixBytes().
func (key ID1Key) String() string {
return key.payload().StringWithPrefix(key.PrefixBytes())
}
// String encodes key into its human readable form: a base58check string with
// key.PrefixBytes().
func (key SK1Key) String() string {
return key.payload().StringWithPrefix(key.PrefixBytes())
}
// Type returns PrefixString() satisfies the pflag.Value interface.
func (ID1Key) Type() string {
return id1PrefixStr
}
// Type returns PrefixString() satisfies the pflag.Value interface.
func (SK1Key) Type() string {
return sk1PrefixStr
}
// MarshalText encodes key as a string using key.String().
func (key ID1Key) MarshalText() ([]byte, error) {
return key.payload().MarshalTextWithPrefix(key.PrefixBytes())
}
// MarshalText encodes key as a string using key.String().
func (key SK1Key) MarshalText() ([]byte, error) {
return key.payload().MarshalTextWithPrefix(key.PrefixBytes())
}
// NewID1Key attempts to parse keyStr into a new ID1Key.
func NewID1Key(keyStr string) (key ID1Key, err error) {
err = key.Set(keyStr)
return
}
// NewSK1Key attempts to parse keyStr into a new SK1Key.
func NewSK1Key(keyStr string) (key SK1Key, err error) {
err = key.Set(keyStr)
return
}
// GenerateSK1Key generates a secure random private Entry Credit address using
// crypto/rand.Random as the source of randomness.
func GenerateSK1Key() (SK1Key, error) {
return generatePrivKey()
}
// Set attempts to parse keyStr into key.
func (key *ID1Key) Set(keyStr string) error {
return key.payload().SetWithPrefix(keyStr, key.PrefixString())
}
// Set attempts to parse keyStr into key.
func (key *SK1Key) Set(keyStr string) error {
return key.payload().SetWithPrefix(keyStr, key.PrefixString())
}
// UnmarshalText decodes a string with a human readable id1 key into key.
func (key *ID1Key) UnmarshalText(text []byte) error {
return key.payload().UnmarshalTextWithPrefix(text, key.PrefixString())
}
// UnmarshalText decodes a string with a human readable sk1 key into key.
func (key *SK1Key) UnmarshalText(text []byte) error {
return key.payload().UnmarshalTextWithPrefix(text, key.PrefixString())
}
// ID1Key computes the ID1Key corresponding to key.
func (key SK1Key) ID1Key() ID1Key {
return ID1Key(key.RCD().Hash())
}
// RCD computes the RCD for key.
func (key SK1Key) RCD() RCD {
return append([]byte{byte(RCDType01)}, key.PublicKey()[:]...)
}
// Sign the msg.
func (key SK1Key) Sign(msg []byte) []byte {
return ed25519.Sign(key.PrivateKey(), msg)
}
// PublicKey computes the ed25519.PublicKey for key.
func (key SK1Key) PublicKey() ed25519.PublicKey {
return key.PrivateKey().Public().(ed25519.PublicKey)
}
// PrivateKey returns the ed25519.PrivateKey for key.
func (key SK1Key) PrivateKey() ed25519.PrivateKey {
return ed25519.NewKeyFromSeed(key[:])
}
// ID2Key is the id2 public key for an identity.
type ID2Key [sha256.Size]byte
// SK2Key is the sk2 secret key for an identity.
type SK2Key [sha256.Size]byte
// Payload returns key as a byte array.
func (key ID2Key) Payload() [sha256.Size]byte {
return key
}
// Payload returns key as a byte array.
func (key SK2Key) Payload() [sha256.Size]byte {
return key
}
// payload returns adr as *payload. This is syntactic sugar useful in other
// methods that leverage *payload.
func (key *ID2Key) payload() *payload {
return (*payload)(key)
}
func (key *SK2Key) payload() *payload {
return (*payload)(key)
}
// PrefixBytes returns the two byte prefix for the address type as a byte
// array. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns []byte{0x3f, 0xbe, 0xd8}.
func (ID2Key) PrefixBytes() []byte {
prefix := id2PrefixBytes
return prefix[:]
}
// PrefixBytes returns the two byte prefix for the address type as a byte
// array. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns []byte{0x4d, 0xb6, 0xe7}.
func (SK2Key) PrefixBytes() []byte {
prefix := sk2PrefixBytes
return prefix[:]
}
// PrefixString returns the two prefix bytes for the address type as an encoded
// string. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns "id2".
func (ID2Key) PrefixString() string {
return id2PrefixStr
}
// PrefixString returns the two prefix bytes for the address type as an encoded
// string. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns "sk2".
func (SK2Key) PrefixString() string {
return sk2PrefixStr
}
// String encodes key into its human readable form: a base58check string with
// key.PrefixBytes().
func (key ID2Key) String() string {
return key.payload().StringWithPrefix(key.PrefixBytes())
}
// String encodes key into its human readable form: a base58check string with
// key.PrefixBytes().
func (key SK2Key) String() string {
return key.payload().StringWithPrefix(key.PrefixBytes())
}
// Type returns PrefixString() satisfies the pflag.Value interface.
func (ID2Key) Type() string {
return id2PrefixStr
}
// Type returns PrefixString() satisfies the pflag.Value interface.
func (SK2Key) Type() string {
return sk2PrefixStr
}
// MarshalText encodes key as a string using key.String().
func (key ID2Key) MarshalText() ([]byte, error) {
return key.payload().MarshalTextWithPrefix(key.PrefixBytes())
}
// MarshalText encodes key as a string using key.String().
func (key SK2Key) MarshalText() ([]byte, error) {
return key.payload().MarshalTextWithPrefix(key.PrefixBytes())
}
// NewID2Key attempts to parse keyStr into a new ID2Key.
func NewID2Key(keyStr string) (key ID2Key, err error) {
err = key.Set(keyStr)
return
}
// NewSK2Key attempts to parse keyStr into a new SK2Key.
func NewSK2Key(keyStr string) (key SK2Key, err error) {
err = key.Set(keyStr)
return
}
// GenerateSK2Key generates a secure random private Entry Credit address using
// crypto/rand.Random as the source of randomness.
func GenerateSK2Key() (SK2Key, error) {
return generatePrivKey()
}
// Set attempts to parse keyStr into key.
func (key *ID2Key) Set(keyStr string) error {
return key.payload().SetWithPrefix(keyStr, key.PrefixString())
}
// Set attempts to parse keyStr into key.
func (key *SK2Key) Set(keyStr string) error {
return key.payload().SetWithPrefix(keyStr, key.PrefixString())
}
// UnmarshalText decodes a string with a human readable id2 key into key.
func (key *ID2Key) UnmarshalText(text []byte) error {
return key.payload().UnmarshalTextWithPrefix(text, key.PrefixString())
}
// UnmarshalText decodes a string with a human readable sk2 key into key.
func (key *SK2Key) UnmarshalText(text []byte) error {
return key.payload().UnmarshalTextWithPrefix(text, key.PrefixString())
}
// ID2Key computes the ID2Key corresponding to key.
func (key SK2Key) ID2Key() ID2Key {
return ID2Key(key.RCD().Hash())
}
// RCD computes the RCD for key.
func (key SK2Key) RCD() RCD {
return append([]byte{byte(RCDType01)}, key.PublicKey()[:]...)
}
// Sign the msg.
func (key SK2Key) Sign(msg []byte) []byte {
return ed25519.Sign(key.PrivateKey(), msg)
}
// PublicKey computes the ed25519.PublicKey for key.
func (key SK2Key) PublicKey() ed25519.PublicKey {
return key.PrivateKey().Public().(ed25519.PublicKey)
}
// PrivateKey returns the ed25519.PrivateKey for key.
func (key SK2Key) PrivateKey() ed25519.PrivateKey {
return ed25519.NewKeyFromSeed(key[:])
}
// ID3Key is the id3 public key for an identity.
type ID3Key [sha256.Size]byte
// SK3Key is the sk3 secret key for an identity.
type SK3Key [sha256.Size]byte
// Payload returns key as a byte array.
func (key ID3Key) Payload() [sha256.Size]byte {
return key
}
// Payload returns key as a byte array.
func (key SK3Key) Payload() [sha256.Size]byte {
return key
}
// payload returns adr as *payload. This is syntactic sugar useful in other
// methods that leverage *payload.
func (key *ID3Key) payload() *payload {
return (*payload)(key)
}
func (key *SK3Key) payload() *payload {
return (*payload)(key)
}
// PrefixBytes returns the two byte prefix for the address type as a byte
// array. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns []byte{0x3f, 0xbe, 0xf6}.
func (ID3Key) PrefixBytes() []byte {
prefix := id3PrefixBytes
return prefix[:]
}
// PrefixBytes returns the two byte prefix for the address type as a byte
// array. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns []byte{0x4d, 0xb7, 0x05}.
func (SK3Key) PrefixBytes() []byte {
prefix := sk3PrefixBytes
return prefix[:]
}
// PrefixString returns the two prefix bytes for the address type as an encoded
// string. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns "id3".
func (ID3Key) PrefixString() string {
return id3PrefixStr
}
// PrefixString returns the two prefix bytes for the address type as an encoded
// string. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns "sk3".
func (SK3Key) PrefixString() string {
return sk3PrefixStr
}
// String encodes key into its human readable form: a base58check string with
// key.PrefixBytes().
func (key ID3Key) String() string {
return key.payload().StringWithPrefix(key.PrefixBytes())
}
// String encodes key into its human readable form: a base58check string with
// key.PrefixBytes().
func (key SK3Key) String() string {
return key.payload().StringWithPrefix(key.PrefixBytes())
}
// Type returns PrefixString() satisfies the pflag.Value interface.
func (ID3Key) Type() string {
return id3PrefixStr
}
// Type returns PrefixString() satisfies the pflag.Value interface.
func (SK3Key) Type() string {
return sk3PrefixStr
}
// MarshalText encodes key as a string using key.String().
func (key ID3Key) MarshalText() ([]byte, error) {
return key.payload().MarshalTextWithPrefix(key.PrefixBytes())
}
// MarshalText encodes key as a string using key.String().
func (key SK3Key) MarshalText() ([]byte, error) {
return key.payload().MarshalTextWithPrefix(key.PrefixBytes())
}
// NewID3Key attempts to parse keyStr into a new ID3Key.
func NewID3Key(keyStr string) (key ID3Key, err error) {
err = key.Set(keyStr)
return
}
// NewSK3Key attempts to parse keyStr into a new SK3Key.
func NewSK3Key(keyStr string) (key SK3Key, err error) {
err = key.Set(keyStr)
return
}
// GenerateSK3Key generates a secure random private Entry Credit address using
// crypto/rand.Random as the source of randomness.
func GenerateSK3Key() (SK3Key, error) {
return generatePrivKey()
}
// Set attempts to parse keyStr into key.
func (key *ID3Key) Set(keyStr string) error {
return key.payload().SetWithPrefix(keyStr, key.PrefixString())
}
// Set attempts to parse keyStr into key.
func (key *SK3Key) Set(keyStr string) error {
return key.payload().SetWithPrefix(keyStr, key.PrefixString())
}
// UnmarshalText decodes a string with a human readable id3 key into key.
func (key *ID3Key) UnmarshalText(text []byte) error {
return key.payload().UnmarshalTextWithPrefix(text, key.PrefixString())
}
// UnmarshalText decodes a string with a human readable sk3 key into key.
func (key *SK3Key) UnmarshalText(text []byte) error {
return key.payload().UnmarshalTextWithPrefix(text, key.PrefixString())
}
// ID3Key computes the ID3Key corresponding to key.
func (key SK3Key) ID3Key() ID3Key {
return ID3Key(key.RCD().Hash())
}
// RCD computes the RCD for key.
func (key SK3Key) RCD() RCD {
return append([]byte{byte(RCDType01)}, key.PublicKey()[:]...)
}
// Sign the msg.
func (key SK3Key) Sign(msg []byte) []byte {
return ed25519.Sign(key.PrivateKey(), msg)
}
// PublicKey computes the ed25519.PublicKey for key.
func (key SK3Key) PublicKey() ed25519.PublicKey {
return key.PrivateKey().Public().(ed25519.PublicKey)
}
// PrivateKey returns the ed25519.PrivateKey for key.
func (key SK3Key) PrivateKey() ed25519.PrivateKey {
return ed25519.NewKeyFromSeed(key[:])
}
// ID4Key is the id4 public key for an identity.
type ID4Key [sha256.Size]byte
// SK4Key is the sk4 secret key for an identity.
type SK4Key [sha256.Size]byte
// Payload returns key as a byte array.
func (key ID4Key) Payload() [sha256.Size]byte {
return key
}
// Payload returns key as a byte array.
func (key SK4Key) Payload() [sha256.Size]byte {
return key
}
// payload returns adr as *payload. This is syntactic sugar useful in other
// methods that leverage *payload.
func (key *ID4Key) payload() *payload {
return (*payload)(key)
}
func (key *SK4Key) payload() *payload {
return (*payload)(key)
}
// PrefixBytes returns the two byte prefix for the address type as a byte
// array. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns []byte{0x3f, 0xbf, 0x14}.
func (ID4Key) PrefixBytes() []byte {
prefix := id4PrefixBytes
return prefix[:]
}
// PrefixBytes returns the two byte prefix for the address type as a byte
// array. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns []byte{0x4d, 0xb7, 0x23}.
func (SK4Key) PrefixBytes() []byte {
prefix := sk4PrefixBytes
return prefix[:]
}
// PrefixString returns the two prefix bytes for the address type as an encoded
// string. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns "id4".
func (ID4Key) PrefixString() string {
return id4PrefixStr
}
// PrefixString returns the two prefix bytes for the address type as an encoded
// string. Note that the prefix for a given address type is always the same and
// does not depend on the address value. Returns "sk4".
func (SK4Key) PrefixString() string {
return sk4PrefixStr
}
// String encodes key into its human readable form: a base58check string with
// key.PrefixBytes().
func (key ID4Key) String() string {
return key.payload().StringWithPrefix(key.PrefixBytes())
}
// String encodes key into its human readable form: a base58check string with
// key.PrefixBytes().
func (key SK4Key) String() string {
return key.payload().StringWithPrefix(key.PrefixBytes())
}
// Type returns PrefixString() satisfies the pflag.Value interface.
func (ID4Key) Type() string {
return id4PrefixStr
}
// Type returns PrefixString() satisfies the pflag.Value interface.
func (SK4Key) Type() string {
return sk4PrefixStr
}
// MarshalText encodes key as a string using key.String().
func (key ID4Key) MarshalText() ([]byte, error) {
return key.payload().MarshalTextWithPrefix(key.PrefixBytes())
}
// MarshalText encodes key as a string using key.String().
func (key SK4Key) MarshalText() ([]byte, error) {
return key.payload().MarshalTextWithPrefix(key.PrefixBytes())
}
// NewID4Key attempts to parse keyStr into a new ID4Key.
func NewID4Key(keyStr string) (key ID4Key, err error) {
err = key.Set(keyStr)
return
}
// NewSK4Key attempts to parse keyStr into a new SK4Key.
func NewSK4Key(keyStr string) (key SK4Key, err error) {
err = key.Set(keyStr)
return
}
// GenerateSK4Key generates a secure random private Entry Credit address using
// crypto/rand.Random as the source of randomness.
func GenerateSK4Key() (SK4Key, error) {
return generatePrivKey()
}
// Set attempts to parse keyStr into key.
func (key *ID4Key) Set(keyStr string) error {
return key.payload().SetWithPrefix(keyStr, key.PrefixString())
}
// Set attempts to parse keyStr into key.
func (key *SK4Key) Set(keyStr string) error {
return key.payload().SetWithPrefix(keyStr, key.PrefixString())
}
// UnmarshalText decodes a string with a human readable id4 key into key.
func (key *ID4Key) UnmarshalText(text []byte) error {
return key.payload().UnmarshalTextWithPrefix(text, key.PrefixString())
}
// UnmarshalText decodes a string with a human readable sk4 key into key.
func (key *SK4Key) UnmarshalText(text []byte) error {
return key.payload().UnmarshalTextWithPrefix(text, key.PrefixString())
}
// ID4Key computes the ID4Key corresponding to key.
func (key SK4Key) ID4Key() ID4Key {
return ID4Key(key.RCD().Hash())
}
// RCD computes the RCD for key.
func (key SK4Key) RCD() RCD {
return append([]byte{byte(RCDType01)}, key.PublicKey()[:]...)
}
// Sign the msg.
func (key SK4Key) Sign(msg []byte) []byte {
return ed25519.Sign(key.PrivateKey(), msg)
}
// PublicKey computes the ed25519.PublicKey for key.
func (key SK4Key) PublicKey() ed25519.PublicKey {
return key.PrivateKey().Public().(ed25519.PublicKey)
}
// PrivateKey returns the ed25519.PrivateKey for key.
func (key SK4Key) PrivateKey() ed25519.PrivateKey {
return ed25519.NewKeyFromSeed(key[:])
}