diff options
-rw-r--r-- | src/main.zig | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main.zig b/src/main.zig index 23f0e05..3ee70cc 100644 --- a/src/main.zig +++ b/src/main.zig | |||
@@ -173,14 +173,14 @@ pub const SeedKeyPair = struct { | |||
173 | } | 173 | } |
174 | 174 | ||
175 | pub fn intoPublicKey(self: *const Self) PublicKey { | 175 | pub fn intoPublicKey(self: *const Self) PublicKey { |
176 | return PublicKey{ | 176 | return .{ |
177 | .role = self.role, | 177 | .role = self.role, |
178 | .key = self.kp.public_key, | 178 | .key = self.kp.public_key, |
179 | }; | 179 | }; |
180 | } | 180 | } |
181 | 181 | ||
182 | pub fn intoPrivateKey(self: *const Self) PrivateKey { | 182 | pub fn intoPrivateKey(self: *const Self) PrivateKey { |
183 | return PrivateKey{ .kp = self.kp }; | 183 | return .{ .kp = self.kp }; |
184 | } | 184 | } |
185 | 185 | ||
186 | pub fn wipe(self: *Self) void { | 186 | pub fn wipe(self: *Self) void { |
@@ -205,7 +205,7 @@ pub const PublicKey = struct { | |||
205 | } | 205 | } |
206 | 206 | ||
207 | pub fn fromRawPublicKey(role: Role, raw_key: *const [Ed25519.public_length]u8) Self { | 207 | pub fn fromRawPublicKey(role: Role, raw_key: *const [Ed25519.public_length]u8) Self { |
208 | return Self{ .role = role, .key = raw_key.* }; | 208 | return .{ .role = role, .key = raw_key.* }; |
209 | } | 209 | } |
210 | 210 | ||
211 | pub fn publicKeyText(self: *const Self) text_public { | 211 | pub fn publicKeyText(self: *const Self) text_public { |
@@ -232,22 +232,22 @@ pub const PrivateKey = struct { | |||
232 | defer decoded.wipe(); // gets copied | 232 | defer decoded.wipe(); // gets copied |
233 | if (decoded.prefix[0] != prefix_byte_private) | 233 | if (decoded.prefix[0] != prefix_byte_private) |
234 | return error.InvalidPrivateKey; | 234 | return error.InvalidPrivateKey; |
235 | return PrivateKey{ .kp = Ed25519.KeyPair.fromSecretKey(decoded.data) }; | 235 | return Self{ .kp = Ed25519.KeyPair.fromSecretKey(decoded.data) }; |
236 | } | 236 | } |
237 | 237 | ||
238 | pub fn fromRawPrivateKey(raw_key: *const [Ed25519.secret_length]u8) Self { | 238 | pub fn fromRawPrivateKey(raw_key: *const [Ed25519.secret_length]u8) Self { |
239 | return Self{ .kp = Ed25519.KeyPair.fromSecretKey(raw_key.*) }; | 239 | return .{ .kp = Ed25519.KeyPair.fromSecretKey(raw_key.*) }; |
240 | } | 240 | } |
241 | 241 | ||
242 | pub fn intoSeedKeyPair(self: *const Self, role: Role) SeedKeyPair { | 242 | pub fn intoSeedKeyPair(self: *const Self, role: Role) SeedKeyPair { |
243 | return SeedKeyPair{ | 243 | return .{ |
244 | .role = role, | 244 | .role = role, |
245 | .kp = self.kp, | 245 | .kp = self.kp, |
246 | }; | 246 | }; |
247 | } | 247 | } |
248 | 248 | ||
249 | pub fn intoPublicKey(self: *const Self, role: Role) PublicKey { | 249 | pub fn intoPublicKey(self: *const Self, role: Role) PublicKey { |
250 | return PublicKey{ | 250 | return .{ |
251 | .role = role, | 251 | .role = role, |
252 | .key = self.kp.public_key, | 252 | .key = self.kp.public_key, |
253 | }; | 253 | }; |