about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-08-19T13·24+0300
committerclbot <clbot@tvl.fyi>2024-08-19T14·34+0000
commit70d199ea44ce2b8a4982cde920c691f779c17e2f (patch)
treecd09430d2083a17c049c39e10bad420129cd87d2 /tvix
parented4f68b1d335359000a71be8ba999d221965aff8 (diff)
refactor(nix-compat/narinfo/signature): use ed25519::SignatureBytes r/8536
It's a `[u8; SIGNATURE_LENGTH]` type alias, and conveys what we're
accepting or returning a bit nicer.

Change-Id: I974cd97d56d383e51417eb0f26e1431a05711922
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12252
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Diffstat (limited to 'tvix')
-rw-r--r--tvix/nix-compat/src/narinfo/signature.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/tvix/nix-compat/src/narinfo/signature.rs b/tvix/nix-compat/src/narinfo/signature.rs
index fd197e771d98..e5567f44109a 100644
--- a/tvix/nix-compat/src/narinfo/signature.rs
+++ b/tvix/nix-compat/src/narinfo/signature.rs
@@ -1,17 +1,18 @@
 use std::fmt::{self, Display};
 
 use data_encoding::BASE64;
-use ed25519_dalek::SIGNATURE_LENGTH;
 use serde::{Deserialize, Serialize};
 
+const SIGNATURE_LENGTH: usize = std::mem::size_of::<ed25519::SignatureBytes>();
+
 #[derive(Clone, Debug, Eq, PartialEq)]
 pub struct Signature<'a> {
     name: &'a str,
-    bytes: [u8; SIGNATURE_LENGTH],
+    bytes: ed25519::SignatureBytes,
 }
 
 impl<'a> Signature<'a> {
-    pub fn new(name: &'a str, bytes: [u8; SIGNATURE_LENGTH]) -> Self {
+    pub fn new(name: &'a str, bytes: ed25519::SignatureBytes) -> Self {
         Self { name, bytes }
     }
 
@@ -46,7 +47,7 @@ impl<'a> Signature<'a> {
         self.name
     }
 
-    pub fn bytes(&self) -> &[u8; SIGNATURE_LENGTH] {
+    pub fn bytes(&self) -> &ed25519::SignatureBytes {
         &self.bytes
     }