2026-06-15 15:23:41 +02:00
|
|
|
pub const Implementation = struct {
|
2026-06-26 16:22:01 +02:00
|
|
|
|
2026-06-15 15:23:41 +02:00
|
|
|
pub const KEY_SIZE = 32;
|
|
|
|
|
pub const SIGNATURE_SIZE = 64;
|
2026-06-26 16:22:01 +02:00
|
|
|
|
|
|
|
|
generateKey: *const fn (privkey_buffer: *[KEY_SIZE]u8) void,
|
2026-06-15 15:23:41 +02:00
|
|
|
sign: *const fn (key: *const [KEY_SIZE]u8, data: *const []const u8, signature_out: *const [SIGNATURE_SIZE]u8) void,
|
|
|
|
|
verify: *const fn (key: *const [KEY_SIZE]u8, data: *const []const u8, signature: *const [SIGNATURE_SIZE]u8) void,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// TODO
|
2026-07-03 21:56:17 +02:00
|
|
|
pub fn defaultImplementation() type {
|
2026-06-26 16:22:01 +02:00
|
|
|
|
2026-07-03 21:56:17 +02:00
|
|
|
const Ed25519 = @import("std").crypto.sign.Ed25519;
|
|
|
|
|
_ = Ed25519;
|
|
|
|
|
|
|
|
|
|
// Again, some Ed25519 functions seem to rely on the io module that is not necessarily available on embedded systems
|
|
|
|
|
// It may need some custom implementation or other library
|
|
|
|
|
|
|
|
|
|
return struct {
|
|
|
|
|
|
|
|
|
|
pub fn generateKeys(pubkey_buffer: *[32]u8, privkey_buffer: *[32]u8) !void {
|
|
|
|
|
_ = pubkey_buffer;
|
|
|
|
|
_ = privkey_buffer;
|
|
|
|
|
return error.NotImplemented;
|
|
|
|
|
|
|
|
|
|
}
|
2026-06-15 15:23:41 +02:00
|
|
|
|
2026-07-03 21:56:17 +02:00
|
|
|
pub fn sign(key: *const [32]u8, data: *const []const u8, signature_out: *const [64]u8) !void {
|
|
|
|
|
_ = key;
|
|
|
|
|
_ = data;
|
|
|
|
|
_ = signature_out;
|
|
|
|
|
return error.NotImplemented;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn verify(signature: *const [64]u8, data: *const []const u8) !void {
|
|
|
|
|
_ = signature;
|
|
|
|
|
_ = data;
|
|
|
|
|
return error.NotImplemented;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|