1
0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2024-11-09 20:42:36 +01:00

rename send key -> akey

This commit is contained in:
Daniel García 2021-03-15 16:42:20 +01:00
parent 7436b454db
commit 95e24ffc51
No known key found for this signature in database
GPG Key ID: FC8A7D14C3CD543A
10 changed files with 11 additions and 9 deletions

View File

@ -8,7 +8,7 @@ CREATE TABLE sends (
atype INTEGER NOT NULL, atype INTEGER NOT NULL,
data TEXT NOT NULL, data TEXT NOT NULL,
key TEXT NOT NULL, akey TEXT NOT NULL,
password_hash BLOB, password_hash BLOB,
password_salt BLOB, password_salt BLOB,
password_iter INTEGER, password_iter INTEGER,

View File

@ -0,0 +1 @@
ALTER TABLE sends RENAME COLUMN key TO akey;

View File

@ -0,0 +1 @@
ALTER TABLE sends RENAME COLUMN key TO akey;

View File

@ -325,7 +325,7 @@ fn put_send(id: String, data: JsonUpcase<SendData>, headers: Headers, conn: DbCo
} }
send.data = data_str; send.data = data_str;
send.name = data.Name; send.name = data.Name;
send.key = data.Key; send.akey = data.Key;
send.deletion_date = data.DeletionDate.naive_utc(); send.deletion_date = data.DeletionDate.naive_utc();
send.notes = data.Notes; send.notes = data.Notes;
send.max_access_count = data.MaxAccessCount; send.max_access_count = data.MaxAccessCount;

View File

@ -22,7 +22,7 @@ db_object! {
pub atype: i32, pub atype: i32,
pub data: String, pub data: String,
pub key: String, pub akey: String,
pub password_hash: Option<Vec<u8>>, pub password_hash: Option<Vec<u8>>,
password_salt: Option<Vec<u8>>, password_salt: Option<Vec<u8>>,
password_iter: Option<i32>, password_iter: Option<i32>,
@ -46,7 +46,7 @@ pub enum SendType {
} }
impl Send { impl Send {
pub fn new(atype: i32, name: String, data: String, key: String, deletion_date: NaiveDateTime) -> Self { pub fn new(atype: i32, name: String, data: String, akey: String, deletion_date: NaiveDateTime) -> Self {
let now = Utc::now().naive_utc(); let now = Utc::now().naive_utc();
Self { Self {
@ -59,7 +59,7 @@ impl Send {
atype, atype,
data, data,
key, akey,
password_hash: None, password_hash: None,
password_salt: None, password_salt: None,
password_iter: None, password_iter: None,
@ -118,7 +118,7 @@ impl Send {
"Text": if self.atype == SendType::Text as i32 { Some(&data) } else { None }, "Text": if self.atype == SendType::Text as i32 { Some(&data) } else { None },
"File": if self.atype == SendType::File as i32 { Some(&data) } else { None }, "File": if self.atype == SendType::File as i32 { Some(&data) } else { None },
"Key": self.key, "Key": self.akey,
"MaxAccessCount": self.max_access_count, "MaxAccessCount": self.max_access_count,
"AccessCount": self.access_count, "AccessCount": self.access_count,
"Password": self.password_hash.as_deref().map(|h| BASE64URL_NOPAD.encode(h)), "Password": self.password_hash.as_deref().map(|h| BASE64URL_NOPAD.encode(h)),

View File

@ -111,7 +111,7 @@ table! {
notes -> Nullable<Text>, notes -> Nullable<Text>,
atype -> Integer, atype -> Integer,
data -> Text, data -> Text,
key -> Text, akey -> Text,
password_hash -> Nullable<Binary>, password_hash -> Nullable<Binary>,
password_salt -> Nullable<Binary>, password_salt -> Nullable<Binary>,
password_iter -> Nullable<Integer>, password_iter -> Nullable<Integer>,

View File

@ -111,7 +111,7 @@ table! {
notes -> Nullable<Text>, notes -> Nullable<Text>,
atype -> Integer, atype -> Integer,
data -> Text, data -> Text,
key -> Text, akey -> Text,
password_hash -> Nullable<Binary>, password_hash -> Nullable<Binary>,
password_salt -> Nullable<Binary>, password_salt -> Nullable<Binary>,
password_iter -> Nullable<Integer>, password_iter -> Nullable<Integer>,

View File

@ -111,7 +111,7 @@ table! {
notes -> Nullable<Text>, notes -> Nullable<Text>,
atype -> Integer, atype -> Integer,
data -> Text, data -> Text,
key -> Text, akey -> Text,
password_hash -> Nullable<Binary>, password_hash -> Nullable<Binary>,
password_salt -> Nullable<Binary>, password_salt -> Nullable<Binary>,
password_iter -> Nullable<Integer>, password_iter -> Nullable<Integer>,