aboutsummaryrefslogtreecommitdiffstats
path: root/src/nkeys.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/nkeys.zig')
-rw-r--r--src/nkeys.zig16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/nkeys.zig b/src/nkeys.zig
index ac5ba1b..42a781f 100644
--- a/src/nkeys.zig
+++ b/src/nkeys.zig
@@ -26,10 +26,10 @@ pub const KeyTypePrefixByte = enum(u8) {
26 private = 15 << 3, // P 26 private = 15 << 3, // P
27 27
28 fn char(self: Self) u8 { 28 fn char(self: Self) u8 {
29 switch (self) { 29 return switch (self) {
30 .seed => 'S', 30 .seed => 'S',
31 .private => 'P', 31 .private => 'P',
32 } 32 };
33 } 33 }
34 34
35 fn fromChar(c: u8) InvalidPrefixByteError!Self { 35 fn fromChar(c: u8) InvalidPrefixByteError!Self {
@@ -61,6 +61,16 @@ pub const PublicPrefixByte = enum(u8) {
61 }; 61 };
62 } 62 }
63 63
64 fn char(self: Self) u8 {
65 return switch (self) {
66 .account => 'A',
67 .cluster => 'C',
68 .operator => 'O',
69 .server => 'N',
70 .user => 'U',
71 };
72 }
73
64 fn fromChar(c: u8) InvalidPrefixByteError!Self { 74 fn fromChar(c: u8) InvalidPrefixByteError!Self {
65 return switch (c) { 75 return switch (c) {
66 'A' => .account, 76 'A' => .account,
@@ -464,6 +474,8 @@ pub fn parseDecoratedUserNkey(contents: []const u8) (NoNkeySeedFoundError || NoN
464 474
465test { 475test {
466 testing.refAllDecls(@This()); 476 testing.refAllDecls(@This());
477 testing.refAllDecls(KeyTypePrefixByte);
478 testing.refAllDecls(PublicPrefixByte);
467 testing.refAllDecls(SeedKeyPair); 479 testing.refAllDecls(SeedKeyPair);
468 testing.refAllDecls(PublicKey); 480 testing.refAllDecls(PublicKey);
469 testing.refAllDecls(PrivateKey); 481 testing.refAllDecls(PrivateKey);