From d8e668916d61c63f2c0aed1b972c5322a3b87de8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolphe=20Br=C3=A9ard?= Date: Mon, 10 Apr 2023 11:11:00 +0200 Subject: [PATCH] Add a published flag to keys --- migrations/20230409141801_initial.sql | 1 + src/key.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/migrations/20230409141801_initial.sql b/migrations/20230409141801_initial.sql index 4c3e77d..a018dc4 100644 --- a/migrations/20230409141801_initial.sql +++ b/migrations/20230409141801_initial.sql @@ -5,6 +5,7 @@ CREATE TABLE key_db ( creation INTEGER, not_after INTEGER, revocation INTEGER, + published BOOLEAN, private_key TEXT, public_key TEXT ); diff --git a/src/key.rs b/src/key.rs index ab3ec1f..651f1a3 100644 --- a/src/key.rs +++ b/src/key.rs @@ -12,6 +12,7 @@ const INSERT_KEY: &str = "INSERT INTO key_db ( creation, not_after, revocation, + published, private_key, public_key ) VALUES ( @@ -21,6 +22,7 @@ const INSERT_KEY: &str = "INSERT INTO key_db ( $4, $5, $6, + FALSE, $7, $8 )"; @@ -29,6 +31,7 @@ FROM key_db WHERE sdid = $1 AND algorithm = $2 + AND published IS FALSE ORDER BY not_after DESC LIMIT 1";