├── .github ├── CODEOWNERS ├── dependabot.yml └── workflows │ ├── ci.yml │ └── publish.yml ├── .gitignore ├── provider-authpro ├── import │ ├── backup.authpro │ └── backup.json ├── Cargo.toml └── src │ ├── de.rs │ └── lib.rs ├── provider-andotp ├── import │ ├── otp_accounts.json.aes │ └── otp_accounts.json ├── Cargo.toml └── src │ └── lib.rs ├── .editorconfig ├── rustfmt.toml ├── src ├── widgets │ ├── mod.rs │ ├── scrollbar.rs │ ├── code_dialog.rs │ ├── help_dialog.rs │ └── list.rs ├── terminal.rs ├── cli.rs └── main.rs ├── otti-gen ├── Cargo.toml └── src │ └── lib.rs ├── deny.toml ├── otti-store ├── Cargo.toml └── src │ ├── aead.rs │ ├── kdf.rs │ └── lib.rs ├── otti-core ├── Cargo.toml └── src │ ├── de.rs │ ├── key.rs │ ├── lib.rs │ └── url.rs ├── provider-aegis ├── Cargo.toml ├── import │ ├── aegis-export-plain.json │ └── aegis-export.json └── src │ ├── de.rs │ └── lib.rs ├── Cargo.toml ├── README.md ├── LICENSE └── Cargo.lock /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @dnaka91 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | 3 | *.otpman 4 | -------------------------------------------------------------------------------- /provider-authpro/import/backup.authpro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dnaka91/otti/HEAD/provider-authpro/import/backup.authpro -------------------------------------------------------------------------------- /provider-andotp/import/otp_accounts.json.aes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dnaka91/otti/HEAD/provider-andotp/import/otp_accounts.json.aes -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | indent_size = 4 6 | indent_style = space 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | 10 | [*.{json,yml}] 11 | indent_size = 2 12 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | comment_width = 100 2 | format_code_in_doc_comments = true 3 | format_strings = true 4 | group_imports = "StdExternalCrate" 5 | imports_granularity = "Crate" 6 | reorder_impl_items = true 7 | use_field_init_shorthand = true 8 | wrap_comments = true 9 | -------------------------------------------------------------------------------- /src/widgets/mod.rs: -------------------------------------------------------------------------------- 1 | #![allow(clippy::cast_possible_truncation)] 2 | 3 | pub use self::{ 4 | code_dialog::CodeDialog, 5 | help_dialog::HelpDialog, 6 | list::{List, State as ListState}, 7 | scrollbar::ScrollBar, 8 | }; 9 | 10 | mod code_dialog; 11 | mod help_dialog; 12 | mod list; 13 | mod scrollbar; 14 | -------------------------------------------------------------------------------- /otti-gen/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "otti-gen" 3 | publish = false 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | hmac = { version = "0.12.1", features = ["std"] } 11 | otti-core = { path = "../otti-core" } 12 | sha1 = "0.10.6" 13 | sha2 = "0.10.8" 14 | thiserror = "1.0.56" 15 | -------------------------------------------------------------------------------- /deny.toml: -------------------------------------------------------------------------------- 1 | [licenses] 2 | allow-osi-fsf-free = "both" 3 | exceptions = [ 4 | { allow = ["MPL-2.0"], name = "option-ext" }, 5 | { allow = ["Unicode-DFS-2016"], name = "unicode-ident" }, 6 | ] 7 | 8 | [licenses.private] 9 | ignore = true 10 | 11 | [bans] 12 | skip = [ 13 | { name = "bitflags", version = "1" }, 14 | { name = "syn", version = "1" }, 15 | ] 16 | 17 | skip-tree = [ 18 | { name = "windows-sys", version = "0.48", depth = 3 }, 19 | ] 20 | -------------------------------------------------------------------------------- /otti-store/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "otti-store" 3 | publish = false 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | argon2 = { version = "0.5.3", features = ["std", "zeroize"] } 11 | chacha20poly1305 = { version = "0.10.1", features = ["std"] } 12 | directories = "5.0.1" 13 | flate2 = "1.0.28" 14 | otti-core = { path = "../otti-core" } 15 | rmp-serde = "1.1.2" 16 | secrecy = "0.8.0" 17 | serde = { version = "1.0.196", features = ["derive"] } 18 | thiserror = "1.0.56" 19 | typenum = "1.17.0" 20 | -------------------------------------------------------------------------------- /provider-andotp/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "provider-andotp" 3 | publish = false 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | aes-gcm = { version = "0.10.3", features = ["std"] } 11 | bytes = "1.5.0" 12 | hmac = "0.12.1" 13 | otti-core = { path = "../otti-core" } 14 | pbkdf2 = { version = "0.12.2", default-features = false } 15 | rand = "0.8.5" 16 | serde = { version = "1.0.196", features = ["derive"] } 17 | serde_json = "1.0.113" 18 | sha1 = "0.10.6" 19 | thiserror = "1.0.56" 20 | 21 | [dev-dependencies] 22 | pretty_assertions = "1.4.0" 23 | -------------------------------------------------------------------------------- /otti-core/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "otti-core" 3 | publish = false 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | data-encoding = "2.5.0" 11 | percent-encoding = { version = "2.3.1", optional = true } 12 | secrecy = { version = "0.8.0", features = ["serde"] } 13 | serde = { version = "1.0.196", features = ["derive"] } 14 | serde_qs = { version = "0.12.0", optional = true } 15 | thiserror = "1.0.56" 16 | url = { version = "2.5.0", optional = true } 17 | 18 | [features] 19 | default = ["otpurl"] 20 | otpurl = ["percent-encoding", "serde_qs", "url"] 21 | -------------------------------------------------------------------------------- /provider-aegis/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "provider-aegis" 3 | publish = false 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | aes-gcm = { version = "0.10.3", features = ["std"] } 11 | base64 = "0.21.7" 12 | bytes = "1.5.0" 13 | hex = "0.4.3" 14 | otti-core = { path = "../otti-core" } 15 | rand = "0.8.5" 16 | scrypt = { version = "0.11.0", default-features = false, features = ["std"] } 17 | serde = { version = "1.0.196", features = ["derive"] } 18 | serde_json = "1.0.113" 19 | serde_repr = "0.1.18" 20 | thiserror = "1.0.56" 21 | uuid = { version = "1.7.0", features = ["v4"] } 22 | 23 | [dev-dependencies] 24 | maplit = "1.0.2" 25 | pretty_assertions = "1.4.0" 26 | -------------------------------------------------------------------------------- /provider-authpro/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "provider-authpro" 3 | publish = false 4 | version.workspace = true 5 | authors.workspace = true 6 | edition.workspace = true 7 | license.workspace = true 8 | 9 | [dependencies] 10 | aes = "0.8.3" 11 | base64 = "0.21.7" 12 | block-padding = { version = "0.3.3", features = ["std"] } 13 | bytes = "1.5.0" 14 | cbc = { version = "0.1.2", features = ["std"] } 15 | hmac = "0.12.1" 16 | otti-core = { path = "../otti-core" } 17 | pbkdf2 = { version = "0.12.2", default-features = false } 18 | rand = "0.8.5" 19 | serde = { version = "1.0.196", features = ["derive"] } 20 | serde_json = "1.0.113" 21 | serde_repr = "0.1.18" 22 | sha1 = "0.10.6" 23 | thiserror = "1.0.56" 24 | 25 | [dev-dependencies] 26 | maplit = "1.0.2" 27 | pretty_assertions = "1.4.0" 28 | -------------------------------------------------------------------------------- /provider-andotp/import/otp_accounts.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "secret": "GEZDGNBVGY3TQOJQ", 4 | "issuer": "", 5 | "label": "Sample HOTP", 6 | "digits": 6, 7 | "type": "HOTP", 8 | "algorithm": "SHA1", 9 | "thumbnail": "Default", 10 | "last_used": 1610867673144, 11 | "used_frequency": 0, 12 | "counter": 5, 13 | "tags": [] 14 | }, 15 | { 16 | "secret": "GEZDGNBVGY3TQOJQ", 17 | "issuer": "Sample Issuer", 18 | "label": "Sample TOTP", 19 | "digits": 6, 20 | "type": "TOTP", 21 | "algorithm": "SHA1", 22 | "thumbnail": "Default", 23 | "last_used": 1610867697155, 24 | "used_frequency": 0, 25 | "period": 30, 26 | "tags": [ 27 | "Sample Tag" 28 | ] 29 | }, 30 | { 31 | "secret": "GEZDGNBVGY3TQOJQ", 32 | "issuer": "", 33 | "label": "Sample Steam", 34 | "digits": 5, 35 | "type": "STEAM", 36 | "algorithm": "SHA1", 37 | "thumbnail": "Default", 38 | "last_used": 1610867715636, 39 | "used_frequency": 0, 40 | "tags": [] 41 | } 42 | ] 43 | -------------------------------------------------------------------------------- /src/widgets/scrollbar.rs: -------------------------------------------------------------------------------- 1 | use ratatui::{buffer::Buffer, layout::Rect, style::Color, widgets::Widget}; 2 | 3 | pub struct ScrollBar { 4 | value: usize, 5 | max: usize, 6 | } 7 | 8 | impl Default for ScrollBar { 9 | fn default() -> Self { 10 | Self { value: 0, max: 1 } 11 | } 12 | } 13 | 14 | impl ScrollBar { 15 | pub fn data(mut self, value: usize, max: usize) -> Self { 16 | self.value = value; 17 | self.max = max; 18 | self 19 | } 20 | } 21 | 22 | impl Widget for ScrollBar { 23 | fn render(self, area: Rect, buf: &mut Buffer) { 24 | let bar_height = 2.max(area.height / 8).min(area.height); 25 | let start = area.y + self.value as u16 * (area.height - bar_height) / self.max as u16; 26 | let end = start + bar_height; 27 | 28 | for x in area.left()..area.right() { 29 | for y in area.top()..area.bottom() { 30 | buf.get_mut(x, y).set_bg(if (start..end).contains(&y) { 31 | Color::White 32 | } else { 33 | Color::DarkGray 34 | }); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/widgets/code_dialog.rs: -------------------------------------------------------------------------------- 1 | use ratatui::{ 2 | buffer::Buffer, 3 | layout::{Alignment, Rect}, 4 | widgets::{Block, Borders, Clear, Paragraph, Widget}, 5 | }; 6 | 7 | pub struct CodeDialog<'a> { 8 | code: &'a str, 9 | } 10 | 11 | impl<'a> CodeDialog<'a> { 12 | pub fn new(code: &'a str) -> Self { 13 | Self { code } 14 | } 15 | } 16 | 17 | impl<'a> Widget for CodeDialog<'a> { 18 | fn render(self, area: Rect, buf: &mut Buffer) { 19 | let area = { 20 | let mut draw_area = area; 21 | draw_area.width = 20.min(area.width); 22 | draw_area.height = 5.min(area.height); 23 | draw_area.y = area.y + (area.height - draw_area.height) / 2; 24 | draw_area.x = area.x + (area.width - draw_area.width) / 2; 25 | draw_area 26 | }; 27 | 28 | Clear.render(area, buf); 29 | 30 | let b = Block::default().borders(Borders::ALL); 31 | let mut text_area = b.inner(area); 32 | b.render(area, buf); 33 | 34 | text_area.y += 1; 35 | text_area.height = 1; 36 | 37 | Paragraph::new(self.code) 38 | .alignment(Alignment::Center) 39 | .render(text_area, buf); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "otti-core", 4 | "otti-gen", 5 | "otti-store", 6 | "provider-aegis", 7 | "provider-andotp", 8 | "provider-authpro", 9 | ] 10 | resolver = "2" 11 | 12 | [workspace.package] 13 | version = "0.2.7" 14 | authors = ["Dominik Nakamura "] 15 | edition = "2021" 16 | license = "AGPL-3.0-only" 17 | 18 | [package] 19 | name = "otti" 20 | publish = false 21 | version.workspace = true 22 | authors.workspace = true 23 | edition.workspace = true 24 | license.workspace = true 25 | 26 | [dependencies] 27 | anyhow = "1.0.79" 28 | arboard = { version = "3.3.0", default-features = false } 29 | clap = { version = "4.4.18", features = ["derive"] } 30 | clap_complete = "4.4.10" 31 | clap_mangen = "0.2.19" 32 | crossbeam-channel = "0.5.11" 33 | crossterm = "0.27.0" 34 | indoc = "2.0.4" 35 | otti-core = { path = "./otti-core" } 36 | otti-gen = { path = "./otti-gen" } 37 | otti-store = { path = "./otti-store" } 38 | provider-aegis = { path = "./provider-aegis" } 39 | provider-andotp = { path = "./provider-andotp" } 40 | provider-authpro = { path = "./provider-authpro" } 41 | ratatui = "0.26.0" 42 | rpassword = "7.3.1" 43 | rprompt = "2.1.1" 44 | secrecy = "0.8.0" 45 | 46 | [profile.release] 47 | lto = true 48 | strip = true 49 | -------------------------------------------------------------------------------- /otti-store/src/aead.rs: -------------------------------------------------------------------------------- 1 | use chacha20poly1305::{ 2 | aead::{Aead, OsRng}, 3 | AeadCore, AeadInPlace, KeyInit, XChaCha20Poly1305, XNonce, 4 | }; 5 | use typenum::Unsigned; 6 | 7 | const NONCE_SIZE: usize = ::NonceSize::USIZE; 8 | const TAG_SIZE: usize = ::TagSize::USIZE; 9 | 10 | pub fn seal(key: &[u8], data: &[u8]) -> Result, super::Error> { 11 | let cipher = XChaCha20Poly1305::new_from_slice(key).map_err(|_e| super::Error::Crypto)?; 12 | let nonce = XChaCha20Poly1305::generate_nonce(&mut OsRng); 13 | 14 | let mut buf = vec![0; data.len() + NONCE_SIZE + TAG_SIZE]; 15 | 16 | let tag = cipher 17 | .encrypt_in_place_detached(&nonce, &[], &mut buf[NONCE_SIZE..]) 18 | .map_err(|_e| super::Error::Crypto)?; 19 | buf[..NONCE_SIZE].copy_from_slice(&nonce); 20 | buf[NONCE_SIZE + data.len()..].copy_from_slice(&tag); 21 | 22 | Ok(buf) 23 | } 24 | 25 | pub fn open(key: &[u8], data: &[u8]) -> Result, super::Error> { 26 | let cipher = XChaCha20Poly1305::new_from_slice(key).map_err(|_e| super::Error::Crypto)?; 27 | let nonce = XNonce::from_slice(&data[..NONCE_SIZE]); 28 | 29 | cipher 30 | .decrypt(nonce, &data[NONCE_SIZE..]) 31 | .map_err(|_e| super::Error::Crypto) 32 | } 33 | -------------------------------------------------------------------------------- /src/widgets/help_dialog.rs: -------------------------------------------------------------------------------- 1 | use indoc::indoc; 2 | use ratatui::{ 3 | buffer::Buffer, 4 | layout::{Margin, Rect}, 5 | widgets::{Block, Borders, Clear, Paragraph, Widget, Wrap}, 6 | }; 7 | 8 | pub struct HelpDialog; 9 | 10 | impl Widget for HelpDialog { 11 | fn render(self, area: Rect, buf: &mut Buffer) { 12 | let area = { 13 | let mut draw_area = area; 14 | draw_area.width = 70.min(area.width); 15 | draw_area.height = 10.min(area.height); 16 | draw_area.y = area.y + (area.height - draw_area.height) / 2; 17 | draw_area.x = area.x + (area.width - draw_area.width) / 2; 18 | draw_area 19 | }; 20 | 21 | Clear.render(area, buf); 22 | 23 | let b = Block::default().borders(Borders::ALL).title("Help"); 24 | let text_area = b.inner(area).inner(&Margin { 25 | vertical: 1, 26 | horizontal: 1, 27 | }); 28 | b.render(area, buf); 29 | 30 | Paragraph::new(indoc! {" 31 | h - Show/hide this help dialog. 32 | s - Show/hide the current OTP code of the selected account. 33 | c - Copy the current OTP code to the clipboard. 34 | "}) 35 | .wrap(Wrap { trim: false }) 36 | .render(text_area, buf); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /provider-authpro/src/de.rs: -------------------------------------------------------------------------------- 1 | use std::fmt; 2 | 3 | use serde::{ 4 | de::{self, Deserializer, Visitor}, 5 | ser::Serializer, 6 | }; 7 | 8 | pub mod base64_string { 9 | use base64::engine::{general_purpose, Engine}; 10 | 11 | use super::*; 12 | 13 | pub fn serialize(value: &[u8], serializer: S) -> Result 14 | where 15 | S: Serializer, 16 | { 17 | serializer.serialize_str(&general_purpose::STANDARD.encode(value)) 18 | } 19 | 20 | pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> 21 | where 22 | D: Deserializer<'de>, 23 | { 24 | deserializer.deserialize_str(Base64StringVisitor) 25 | } 26 | 27 | struct Base64StringVisitor; 28 | 29 | impl<'de> Visitor<'de> for Base64StringVisitor { 30 | type Value = Vec; 31 | 32 | fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { 33 | formatter.write_str("bytes encoded as Base64 string") 34 | } 35 | 36 | fn visit_str(self, v: &str) -> Result 37 | where 38 | E: de::Error, 39 | { 40 | general_purpose::STANDARD 41 | .decode(v) 42 | .map_err(|e| de::Error::custom(e.to_string())) 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /provider-aegis/import/aegis-export-plain.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "header": { 4 | "slots": null, 5 | "params": null 6 | }, 7 | "db": { 8 | "version": 2, 9 | "entries": [ 10 | { 11 | "type": "hotp", 12 | "uuid": "98fba859-bd1e-4a77-a3a1-d77845c46a9a", 13 | "name": "Sample HOTP", 14 | "issuer": "", 15 | "note": "", 16 | "icon": null, 17 | "info": { 18 | "secret": "GEZDGNBVGY3TQOJQ", 19 | "algo": "SHA1", 20 | "digits": 6, 21 | "counter": 5 22 | } 23 | }, 24 | { 25 | "type": "totp", 26 | "uuid": "9ce07804-8fde-4e4e-999d-b5e6c828c552", 27 | "name": "Sample TOTP", 28 | "issuer": "Sample Issuer", 29 | "group": "Sample Group", 30 | "note": "", 31 | "icon": null, 32 | "info": { 33 | "secret": "GEZDGNBVGY3TQOJQ", 34 | "algo": "SHA1", 35 | "digits": 6, 36 | "period": 30 37 | } 38 | }, 39 | { 40 | "type": "steam", 41 | "uuid": "cea85ca4-0a04-4c24-bcee-f1b244f1a7a7", 42 | "name": "Sample Steam", 43 | "issuer": "", 44 | "note": "", 45 | "icon": null, 46 | "info": { 47 | "secret": "GEZDGNBVGY3TQOJQ", 48 | "algo": "SHA1", 49 | "digits": 6, 50 | "period": 30 51 | } 52 | } 53 | ] 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /otti-core/src/de.rs: -------------------------------------------------------------------------------- 1 | //! Custom (de-)serialization implementations for [`serde`]. 2 | 3 | pub mod base32_string { 4 | //! (De-)serialization support for raw byte data as Base32 string. 5 | 6 | use std::fmt; 7 | 8 | use serde::{ 9 | de::{self, Deserializer, Visitor}, 10 | ser::Serializer, 11 | }; 12 | 13 | /// Serialize a byte slice as Base32 string. 14 | pub fn serialize(value: &[u8], serializer: S) -> Result 15 | where 16 | S: Serializer, 17 | { 18 | serializer.serialize_str(&data_encoding::BASE32_NOPAD.encode(value)) 19 | } 20 | 21 | /// Deserialize a Base32 string back into a byte slice. 22 | pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> 23 | where 24 | D: Deserializer<'de>, 25 | { 26 | deserializer.deserialize_str(Base32StringVisitor) 27 | } 28 | 29 | struct Base32StringVisitor; 30 | 31 | impl<'de> Visitor<'de> for Base32StringVisitor { 32 | type Value = Vec; 33 | 34 | fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { 35 | formatter.write_str("bytes encoded as Base32 string") 36 | } 37 | 38 | fn visit_str(self, v: &str) -> Result 39 | where 40 | E: de::Error, 41 | { 42 | data_encoding::BASE32_NOPAD 43 | .decode(v.as_bytes()) 44 | .map_err(|e| de::Error::custom(format!("failed decoding `{v}`: {e}"))) 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /otti-store/src/kdf.rs: -------------------------------------------------------------------------------- 1 | use argon2::{password_hash::rand_core::RngCore, Argon2}; 2 | use chacha20poly1305::aead::OsRng; 3 | 4 | pub struct Password<'a>(&'a [u8]); 5 | 6 | impl<'a> Password<'a> { 7 | pub fn from_slice(value: &'a [u8]) -> Self { 8 | Self(value) 9 | } 10 | } 11 | 12 | pub struct Salt([u8; argon2::RECOMMENDED_SALT_LEN]); 13 | 14 | impl Salt { 15 | pub fn from_slice(value: &[u8]) -> Result { 16 | if value.len() != argon2::RECOMMENDED_SALT_LEN { 17 | return Err(super::Error::Crypto); 18 | } 19 | 20 | let mut salt = [0; argon2::RECOMMENDED_SALT_LEN]; 21 | salt.copy_from_slice(value); 22 | 23 | Ok(Self(salt)) 24 | } 25 | } 26 | 27 | impl Default for Salt { 28 | fn default() -> Self { 29 | let mut salt = [0; argon2::RECOMMENDED_SALT_LEN]; 30 | OsRng.fill_bytes(&mut salt); 31 | 32 | Self(salt) 33 | } 34 | } 35 | 36 | impl AsRef<[u8]> for Salt { 37 | fn as_ref(&self) -> &[u8] { 38 | &self.0 39 | } 40 | } 41 | 42 | pub fn derive_key( 43 | password: &Password<'_>, 44 | salt: &Salt, 45 | iterations: u32, 46 | memory: u32, 47 | size: usize, 48 | ) -> Result, super::Error> { 49 | let mut key = vec![0; size]; 50 | 51 | Argon2::new( 52 | argon2::Algorithm::Argon2i, 53 | argon2::Version::V0x13, 54 | argon2::Params::new(memory, iterations, 1, Some(size)) 55 | .map_err(|_e| super::Error::Crypto)?, 56 | ) 57 | .hash_password_into(password.0, &salt.0, &mut key) 58 | .map_err(|_e| super::Error::Crypto)?; 59 | 60 | Ok(key) 61 | } 62 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [pull_request, push] 3 | env: 4 | CARGO_INCREMENTAL: 0 5 | CARGO_TERM_COLOR: always 6 | RUSTFLAGS: "-C debuginfo=0 -D warnings" 7 | jobs: 8 | test: 9 | name: Test 10 | runs-on: ${{ matrix.os }} 11 | strategy: 12 | matrix: 13 | os: [macos-latest, ubuntu-latest, windows-latest] 14 | steps: 15 | - name: Checkout repository 16 | uses: actions/checkout@v4 17 | - name: Setup Rust 18 | uses: dtolnay/rust-toolchain@stable 19 | - name: Configure cache 20 | uses: Swatinem/rust-cache@v2 21 | - name: Test 22 | run: cargo test --workspace 23 | lint: 24 | name: Lint 25 | runs-on: ubuntu-latest 26 | steps: 27 | - name: Checkout repository 28 | uses: actions/checkout@v4 29 | - name: Setup Rust (nightly) 30 | uses: dtolnay/rust-toolchain@nightly 31 | with: 32 | components: rustfmt 33 | - name: Run rustfmt 34 | run: cargo fmt --check --all 35 | - name: Setup Rust (stable) 36 | uses: dtolnay/rust-toolchain@stable 37 | with: 38 | components: clippy 39 | - name: Configure cache 40 | uses: Swatinem/rust-cache@v2 41 | - name: Run clippy 42 | run: cargo clippy -- -D warnings 43 | cargo-deny: 44 | name: Cargo Deny 45 | runs-on: ubuntu-latest 46 | strategy: 47 | matrix: 48 | checks: 49 | - advisories 50 | - bans licenses sources 51 | continue-on-error: ${{ matrix.checks == 'advisories' }} 52 | steps: 53 | - name: Checkout repository 54 | uses: actions/checkout@v4 55 | - name: Check ${{ matrix.checks }} 56 | uses: EmbarkStudios/cargo-deny-action@v1 57 | with: 58 | command: check ${{ matrix.checks }} 59 | -------------------------------------------------------------------------------- /otti-core/src/key.rs: -------------------------------------------------------------------------------- 1 | use std::fmt; 2 | 3 | use secrecy::{ExposeSecret, Zeroize}; 4 | use serde::{ 5 | de::{self, Visitor}, 6 | Deserialize, Deserializer, Serialize, 7 | }; 8 | 9 | /// The key/secret of an **Otti** account that should be kept private as much as possible. 10 | #[cfg_attr(test, derive(Debug, Eq, PartialEq))] 11 | pub struct Key(Vec); 12 | 13 | impl Key { 14 | #[must_use] 15 | pub fn new(content: Vec) -> Self { 16 | Self(content) 17 | } 18 | } 19 | 20 | impl Drop for Key { 21 | fn drop(&mut self) { 22 | self.zeroize(); 23 | } 24 | } 25 | 26 | impl Zeroize for Key { 27 | fn zeroize(&mut self) { 28 | self.0.zeroize(); 29 | } 30 | } 31 | 32 | impl ExposeSecret> for Key { 33 | fn expose_secret(&self) -> &Vec { 34 | &self.0 35 | } 36 | } 37 | 38 | #[cfg(test)] 39 | impl secrecy::DebugSecret for Key {} 40 | 41 | impl Serialize for Key { 42 | fn serialize(&self, serializer: S) -> Result 43 | where 44 | S: serde::Serializer, 45 | { 46 | serializer.serialize_bytes(self.expose_secret()) 47 | } 48 | } 49 | 50 | impl<'de> Deserialize<'de> for Key { 51 | fn deserialize(deserializer: D) -> Result 52 | where 53 | D: Deserializer<'de>, 54 | { 55 | deserializer.deserialize_byte_buf(KeyVisitor) 56 | } 57 | } 58 | 59 | struct KeyVisitor; 60 | 61 | impl<'de> Visitor<'de> for KeyVisitor { 62 | type Value = Key; 63 | 64 | fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { 65 | formatter.write_str("protected key represented as raw bytes") 66 | } 67 | 68 | fn visit_bytes(self, v: &[u8]) -> Result 69 | where 70 | E: de::Error, 71 | { 72 | Ok(Key(Vec::from(v))) 73 | } 74 | 75 | fn visit_byte_buf(self, v: Vec) -> Result 76 | where 77 | E: de::Error, 78 | { 79 | Ok(Key(v)) 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | permissions: 3 | contents: write 4 | on: 5 | push: 6 | tags: 7 | - v[0-9]+.* 8 | env: 9 | CARGO_INCREMENTAL: 0 10 | CARGO_TERM_COLOR: always 11 | RUSTFLAGS: -C debuginfo=0 -D warnings 12 | jobs: 13 | create-release: 14 | name: Create release 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Checkout repository 18 | uses: actions/checkout@v4 19 | - uses: taiki-e/create-gh-release-action@v1 20 | with: 21 | branch: main 22 | env: 23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | build-assets: 25 | name: Build assets (${{ matrix.target }}) 26 | needs: create-release 27 | strategy: 28 | matrix: 29 | include: 30 | - { os: macos-latest, target: aarch64-apple-darwin } 31 | - { os: macos-latest, target: x86_64-apple-darwin } 32 | - { os: ubuntu-latest, target: aarch64-unknown-linux-gnu } 33 | - { os: ubuntu-latest, target: aarch64-unknown-linux-musl } 34 | - { os: ubuntu-latest, target: armv7-unknown-linux-gnueabihf } 35 | - { os: ubuntu-latest, target: armv7-unknown-linux-musleabihf } 36 | - { os: ubuntu-latest, target: x86_64-unknown-linux-gnu } 37 | - { os: ubuntu-latest, target: x86_64-unknown-linux-musl } 38 | - { os: windows-latest, target: aarch64-pc-windows-msvc } 39 | - { os: windows-latest, target: x86_64-pc-windows-gnu } 40 | - { os: windows-latest, target: x86_64-pc-windows-msvc } 41 | runs-on: ${{ matrix.os }} 42 | steps: 43 | - name: Checkout repository 44 | uses: actions/checkout@v4 45 | - uses: dnaka91/actions/build-assets@main 46 | with: 47 | token: ${{ secrets.GITHUB_TOKEN }} 48 | target: ${{ matrix.target }} 49 | bin: otti 50 | hash-assets: 51 | name: Hash assets 52 | needs: build-assets 53 | runs-on: ubuntu-latest 54 | steps: 55 | - uses: dnaka91/actions/hash-assets@main 56 | with: 57 | token: ${{ secrets.GITHUB_TOKEN }} 58 | -------------------------------------------------------------------------------- /provider-aegis/import/aegis-export.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "header": { 4 | "slots": [ 5 | { 6 | "type": 1, 7 | "uuid": "202449eb-671e-44b8-af52-faeda864c8e8", 8 | "key": "ced13b983006641bfd9846e37adb620b75ba86fe91ebb3a7d190bbf2e5f1e370", 9 | "key_params": { 10 | "nonce": "7daf47da11282b0152ff4988", 11 | "tag": "788702a8ea830df6492a42d9b12a474b" 12 | }, 13 | "n": 32768, 14 | "r": 8, 15 | "p": 1, 16 | "salt": "7145573b316223487723debb6f143d9fa33cd572bc9dbb3bb92f7c0cc40c87fe", 17 | "repaired": true 18 | } 19 | ], 20 | "params": { 21 | "nonce": "def98ce03336abf9b4499b9a", 22 | "tag": "ab639b20bb468b64ef5bffc59423fd20" 23 | } 24 | }, 25 | "db": "JirVsJFoz6Obrl0i0DVBSyrNVsowhtiVQn+A+fA8ILGkDTs4J9Ub12mdbx2+CLKGxHZCHNFeVtegiHLd7sdYCnkaoaVw3T4i9HA7I\/2T3zfG\/gSDwnKbqHwxhLpAd0EZWAy+CG\/TPkZFtncTy6PYBlvNm85JnEJzWSoDZu7ix2N8grSxgYBNXgT3mQZ\/TuQkzI9JHV5Cv5lQc8c77HSLzvl\/1Os92wvUC0UBptVxAuIPhPLzaZ3o8ybmnofaZbz4kgWIbn3mcamli65SuMJpRbz5t2SphpDSzdzdB2s9s1tGgkY4vFp6vlihNnypA+qZvYz7Lo5ryLfqIdd9DvpfedDlxs+ZZoqzKLKgwEwfm066nLZ\/3YWPBX2BzBCUU3g6w87GajuSXQNv66biwkJsCF3cjJW8e0GoUkKGqbweXY9a5aRSw9jFDTlHH\/HjnMe6tRuR5EZh\/99Wgz+6bR98xIHwAZk6Aso+M0cJLS+NHrfNNuhIxLC5zJTIAMJ5IauvzVBL+czX6yFOhg3T7T0\/fMIjqFlB33q2jazJwfiubWLPrGgZ48Kv23oF42LIsuSazh0qoDgYhRceiaJmhW9Dz0jzrw1xiytsfA22ie10hubL+q9mKGUQv04txk2CoATFfcJKwLUpkYCpD9ZKqHfodv50QK3\/bE5u\/QcJld7\/SCzo2psMfkpm1GqqI+F7vvg3jFTBffmG6vFGIKf5Cbzikys7bsEiucJ4bK57yN66IoMTCgVWuVvIXaqjvqeVdqvHiQiotVvpSZVTtHjhio0kAKUfpTLf7CyXZ\/1Bi\/AL3al4H5XLiqqrTFqisEWncGmUXB1Ef3Qq4MsuHCEDH\/UDPgu3t95X2uc3MUvXq3u+NhEtq++NsoWgtn4rB8r+yMOnf0K1J8D+lBVIr73xivuUcp4iqTuqWSWabYgPA3vhDTIPxpFXyws\/IOxSybwjB6c7r1ABlr8V\/ASxYSNrF\/EAmEZ\/ayGh+wCHjjYftKg34SWLNS+vkNWMPMyAHaP4QBOKRwsQD7ud57J4VJ6sASbHW8ZEv\/jA+vYw4pjLMwxQcfJoozma5hZsNfn1fKf2V9Y2YMIgY46b+AHef8GyGMNLL57pLrVbOI1nvp2jKM10FJiuRStOVFu\/FisJIOTHkUmqwQ+0sS6cJIge8uxiXE9Yfooay3gJtL1YFh0sNY+GwHptSKfcB4SccqfOmwH16BwmKjBQuJJCm9jeVh2s2+UeXzUh6Xqjx2lMVOvFq157xD8VrcK6RSPz870+mwPvFpdl8Kn3gltlWmMCFi8nPCz1HE17NPlydKI0t5Y5gEuDw6mYMXV9tiqgzx5EqEIR8A6wOvBqg8m6XRJS+uETapKx9xsiAh0Q6i50o\/eIk5NbmiZfItwBYZJTo6vrgS0XFzpNbbQ6LYLHiWhQn3+ksOOslFuaCuUTO4hfUDoXddXYXt5\/fK3QrM2xH9rKHZ2LII1ep7Q5\/29nr2qXhUGfKn9kAI2sWdhzt24EKgll3nXgd6D2DFw0Q2GbbHE9y2rilETLsCwWyb5wnl7utQBUH9qL1tIRQq735+V4yurYQKtfwTH8O7ANKrowa8K2DH0Ikd6uaIFHUgFhxzGy88Pt913ZOBo6jWu4TCBFT051Ve+F6MQ7EGPALOm+U0ooZwSWs5+nh0bqtAd7a0bQa8pD8n0DmnzXlzYRVz0=" 26 | } 27 | -------------------------------------------------------------------------------- /src/terminal.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | io::{self, Write}, 3 | thread, 4 | }; 5 | 6 | use anyhow::Result; 7 | use crossbeam_channel::Receiver; 8 | use crossterm::{ 9 | event::{Event, KeyEvent}, 10 | execute, 11 | terminal::{EnterAlternateScreen, LeaveAlternateScreen, SetTitle}, 12 | }; 13 | use ratatui::{ 14 | backend::{Backend, CrosstermBackend}, 15 | Terminal, 16 | }; 17 | 18 | pub fn create() -> Result> { 19 | let stdout = RawTerminal::new(io::stdout())?; 20 | let stdout = AlternateScreen::new(stdout)?; 21 | let mut backend = CrosstermBackend::new(stdout); 22 | 23 | execute!(&mut backend, SetTitle("Otti"))?; 24 | 25 | Terminal::new(backend).map_err(Into::into) 26 | } 27 | 28 | struct RawTerminal { 29 | output: W, 30 | } 31 | 32 | impl RawTerminal { 33 | fn new(output: W) -> Result { 34 | crossterm::terminal::enable_raw_mode()?; 35 | Ok(Self { output }) 36 | } 37 | } 38 | 39 | impl Drop for RawTerminal { 40 | fn drop(&mut self) { 41 | crossterm::terminal::disable_raw_mode().expect("disable raw mode"); 42 | } 43 | } 44 | 45 | impl Write for RawTerminal { 46 | fn write(&mut self, buf: &[u8]) -> io::Result { 47 | self.output.write(buf) 48 | } 49 | 50 | fn flush(&mut self) -> io::Result<()> { 51 | self.output.flush() 52 | } 53 | } 54 | 55 | struct AlternateScreen { 56 | output: W, 57 | } 58 | 59 | impl AlternateScreen { 60 | fn new(mut output: W) -> Result { 61 | execute!(output, EnterAlternateScreen)?; 62 | Ok(Self { output }) 63 | } 64 | } 65 | 66 | impl Drop for AlternateScreen { 67 | fn drop(&mut self) { 68 | execute!(self.output, LeaveAlternateScreen).expect("switch to main screen"); 69 | } 70 | } 71 | 72 | impl Write for AlternateScreen { 73 | fn write(&mut self, buf: &[u8]) -> io::Result { 74 | self.output.write(buf) 75 | } 76 | 77 | fn flush(&mut self) -> io::Result<()> { 78 | self.output.flush() 79 | } 80 | } 81 | 82 | pub fn create_event_listener() -> Receiver { 83 | let (tx, rx) = crossbeam_channel::bounded(0); 84 | 85 | thread::spawn(move || { 86 | while let Ok(event) = crossterm::event::read() { 87 | if let Event::Key(k) = event { 88 | if tx.send(k).is_err() { 89 | break; 90 | } 91 | } 92 | } 93 | }); 94 | 95 | rx 96 | } 97 | -------------------------------------------------------------------------------- /provider-authpro/import/backup.json: -------------------------------------------------------------------------------- 1 | { 2 | "Authenticators": [ 3 | { 4 | "Type": 2, 5 | "Icon": null, 6 | "Issuer": "Test TOTP", 7 | "Username": "", 8 | "Secret": "UTJYSPLDXEWZVDQ2", 9 | "Algorithm": 0, 10 | "Digits": 6, 11 | "Period": 30, 12 | "Counter": 0, 13 | "Ranking": 0 14 | }, 15 | { 16 | "Type": 2, 17 | "Icon": null, 18 | "Issuer": "Test TOTP 2", 19 | "Username": "test", 20 | "Secret": "X3FBH2IGPIKACZ5H", 21 | "Algorithm": 1, 22 | "Digits": 9, 23 | "Period": 45, 24 | "Counter": 0, 25 | "Ranking": 0 26 | }, 27 | { 28 | "Type": 1, 29 | "Icon": "1password", 30 | "Issuer": "Test HOTP", 31 | "Username": "", 32 | "Secret": "PGO7UI6HJZLK3AKY", 33 | "Algorithm": 0, 34 | "Digits": 6, 35 | "Period": 30, 36 | "Counter": 1, 37 | "Ranking": 0 38 | }, 39 | { 40 | "Type": 1, 41 | "Icon": "@c633dfec", 42 | "Issuer": "Test HOTP 2", 43 | "Username": "test", 44 | "Secret": "LZNXAOMJBEUAM5CO", 45 | "Algorithm": 2, 46 | "Digits": 8, 47 | "Period": 30, 48 | "Counter": 1, 49 | "Ranking": 0 50 | }, 51 | { 52 | "Type": 4, 53 | "Icon": null, 54 | "Issuer": "Test Steam", 55 | "Username": "", 56 | "Secret": "2US2K4PRQDHAG5NH", 57 | "Algorithm": 0, 58 | "Digits": 5, 59 | "Period": 30, 60 | "Counter": 0, 61 | "Ranking": 0 62 | }, 63 | { 64 | "Type": 4, 65 | "Icon": null, 66 | "Issuer": "Test Steam 2", 67 | "Username": "test", 68 | "Secret": "USPW47FIMJRTECVN", 69 | "Algorithm": 0, 70 | "Digits": 5, 71 | "Period": 30, 72 | "Counter": 0, 73 | "Ranking": 0 74 | } 75 | ], 76 | "Categories": [ 77 | { 78 | "Id": "49c8d71d", 79 | "Name": "TOTPs", 80 | "Ranking": 0 81 | }, 82 | { 83 | "Id": "614ab186", 84 | "Name": "Not TOTP", 85 | "Ranking": 0 86 | }, 87 | { 88 | "Id": "201a6b30", 89 | "Name": "Foo", 90 | "Ranking": 0 91 | } 92 | ], 93 | "AuthenticatorCategories": [ 94 | { 95 | "CategoryId": "49c8d71d", 96 | "AuthenticatorSecret": "UTJYSPLDXEWZVDQ2", 97 | "Ranking": 0 98 | }, 99 | { 100 | "CategoryId": "49c8d71d", 101 | "AuthenticatorSecret": "X3FBH2IGPIKACZ5H", 102 | "Ranking": 0 103 | }, 104 | { 105 | "CategoryId": "614ab186", 106 | "AuthenticatorSecret": "2US2K4PRQDHAG5NH", 107 | "Ranking": 0 108 | }, 109 | { 110 | "CategoryId": "201a6b30", 111 | "AuthenticatorSecret": "2US2K4PRQDHAG5NH", 112 | "Ranking": 0 113 | } 114 | ], 115 | "CustomIcons": [ 116 | { 117 | "Id": "c633dfec", 118 | "Data": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAAXNSR0IArs4c6QAAAANzQklUCAgI2+FP4AAAAAxJREFUCJljkJJVBAAArQBZWmGyhAAAAABJRU5ErkJggg==" 119 | } 120 | ] 121 | } 122 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🦦 Otti 2 | 3 | The one-time password (OTP for short) manager for the terminal, with interactive and fancy TUI. 4 | 5 | 6 |

7 | 8 |

9 | 10 | 11 | ## What's an OTP? 12 | 13 | An OTP is the abbreviation for **O**ne-**T**ime **P**assword and is usually part of a two-factor 14 | authentication setup. That is, when a second password is required for a login to some service as 15 | extra security measure. 16 | 17 | It usually involves scanning a QR-Code from the service's website or inputting it into an 18 | authenticator manually. 19 | 20 | For more information check out [this Wikipedia article](https://en.wikipedia.org/wiki/One-time_password). 21 | 22 | ## Yet another OTP account manager? 23 | 24 | I wanted an OTP manager app for the terminal that behaves similar as mobile managers but couldn't 25 | find any that work in that way. Most CLI-based existing managers use single commands to manage the 26 | OTP accounts, which are non-interactive. 27 | 28 | Therefore, this is a different approach by using the awesome [tui-rs] crate to build a TUI variant 29 | that is as similar to the mobile apps as possible but still simplistic. 30 | 31 | Additionally, I felt the way some OTP managers save the account information is to simple and weak in 32 | regards to security. **Otti** uses the [orion] crate for the credential storage which is very 33 | similar to **libsodium**, but fully implemented in Rust. 34 | 35 | [tui-rs]: https://github.com/fdehau/tui-rs 36 | [orion]: https://github.com/orion-rs/orion 37 | 38 | ## Installation 39 | 40 | ### Pre-built binaries 41 | 42 | Grab the binary for your OS from the [releases](https://github.com/dnaka91/otti/releases), extract 43 | it and put it in a folder that's on your `$PATH` like `/usr/local/bin`. 44 | 45 | ### From source 46 | 47 | Make sure to have the latest Rust compiler and Cargo installed and run: 48 | 49 | ```sh 50 | cargo install --git https://github.com/dnaka91/otti.git --tag v0.1.0 51 | ``` 52 | 53 | You can omit the `--tag` flag to install the latest development version, but make backups of your 54 | store file just in case. 55 | 56 | 57 | ### From AUR 58 | 59 | Arch Linux users can install **Otti** from the [AUR](https://aur.archlinux.org/) using an [AUR helper](https://wiki.archlinux.org/title/AUR_helpers). For example: 60 | 61 | ```sh 62 | paru -S otti 63 | ``` 64 | 65 | ## Usage 66 | 67 | Currently **Otti** is read-only, that means you can not add any new accounts to its database. 68 | Instead you have to import from an external OTP manager until editing features are implemented. 69 | 70 | To do so, first export your OTP accounts from one of the supported external apps (currently 71 | **Aegis** and **andOTP**), then run `otti import ` and optionally give a password with the `--password` argument if the import file is protected. 72 | 73 | After the import completed successfully simply run `otti`, enter your password and use the TUI. For 74 | further help inside the TUI hit the `h` hotkey. 75 | 76 | ## License 77 | 78 | This project is licensed under [AGPL-3.0 License](LICENSE) (or 79 | ). 80 | -------------------------------------------------------------------------------- /provider-aegis/src/de.rs: -------------------------------------------------------------------------------- 1 | use std::fmt; 2 | 3 | use serde::{ 4 | de::{self, Deserializer, Visitor}, 5 | ser::Serializer, 6 | }; 7 | 8 | pub mod base64_string { 9 | use base64::engine::{general_purpose, Engine}; 10 | 11 | use super::*; 12 | 13 | pub fn serialize(value: &[u8], serializer: S) -> Result 14 | where 15 | S: Serializer, 16 | { 17 | serializer.serialize_str(&general_purpose::STANDARD.encode(value)) 18 | } 19 | 20 | pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> 21 | where 22 | D: Deserializer<'de>, 23 | { 24 | deserializer.deserialize_str(Base64StringVisitor) 25 | } 26 | 27 | struct Base64StringVisitor; 28 | 29 | impl<'de> Visitor<'de> for Base64StringVisitor { 30 | type Value = Vec; 31 | 32 | fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { 33 | formatter.write_str("bytes encoded as Base64 string") 34 | } 35 | 36 | fn visit_str(self, v: &str) -> Result 37 | where 38 | E: de::Error, 39 | { 40 | general_purpose::STANDARD 41 | .decode(v) 42 | .map_err(|e| de::Error::custom(e.to_string())) 43 | } 44 | } 45 | 46 | pub mod option { 47 | use super::*; 48 | 49 | pub fn serialize(value: &Option>, serializer: S) -> Result 50 | where 51 | S: Serializer, 52 | { 53 | match value { 54 | Some(v) => serializer.serialize_some(&general_purpose::STANDARD.encode(v)), 55 | None => serializer.serialize_none(), 56 | } 57 | } 58 | 59 | pub fn deserialize<'de, D>(deserializer: D) -> Result>, D::Error> 60 | where 61 | D: Deserializer<'de>, 62 | { 63 | deserializer.deserialize_option(OptionVisitor) 64 | } 65 | 66 | struct OptionVisitor; 67 | 68 | impl<'de> Visitor<'de> for OptionVisitor { 69 | type Value = Option>; 70 | 71 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { 72 | formatter.write_str("optional bytes encoded as Base64 string") 73 | } 74 | 75 | fn visit_some(self, deserializer: D) -> Result 76 | where 77 | D: Deserializer<'de>, 78 | { 79 | super::deserialize(deserializer).map(Some) 80 | } 81 | 82 | fn visit_none(self) -> Result 83 | where 84 | E: de::Error, 85 | { 86 | Ok(None) 87 | } 88 | } 89 | } 90 | } 91 | 92 | pub mod hex_string { 93 | use super::*; 94 | 95 | pub fn serialize(value: &[u8], serializer: S) -> Result 96 | where 97 | S: Serializer, 98 | { 99 | serializer.serialize_str(&hex::encode(value)) 100 | } 101 | 102 | pub fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> 103 | where 104 | D: Deserializer<'de>, 105 | { 106 | deserializer.deserialize_str(HexStringVisitor) 107 | } 108 | 109 | struct HexStringVisitor; 110 | 111 | impl<'de> Visitor<'de> for HexStringVisitor { 112 | type Value = Vec; 113 | 114 | fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { 115 | formatter.write_str("bytes encoded as hexadecimal string") 116 | } 117 | 118 | fn visit_str(self, v: &str) -> Result 119 | where 120 | E: de::Error, 121 | { 122 | hex::decode(v).map_err(|e| de::Error::custom(e.to_string())) 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /otti-core/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! # Otti Core 2 | //! 3 | //! Core component of **Otti** that is shared between all other components and serves as building 4 | //! block. The main piece of interest is the [`Account`] and its related data. They describe a 5 | //! single entry in the database and contain all information needed to create new OTPs. 6 | 7 | #![deny(rust_2018_idioms, clippy::all, clippy::pedantic)] 8 | #![allow(clippy::inline_always, clippy::missing_errors_doc)] 9 | 10 | use std::{collections::BTreeMap, str::FromStr}; 11 | 12 | pub use key::Key; 13 | pub use secrecy::ExposeSecret; 14 | use serde::{Deserialize, Serialize}; 15 | 16 | #[cfg(feature = "otpurl")] 17 | pub use self::url::ParseError; 18 | 19 | pub mod de; 20 | mod key; 21 | #[cfg(feature = "otpurl")] 22 | mod url; 23 | 24 | /// Otti account that contains the information to create OTPs for a single service. 25 | #[derive(Serialize, Deserialize)] 26 | #[cfg_attr(test, derive(Debug, Eq, PartialEq))] 27 | pub struct Account { 28 | /// Free form label to describe this account. 29 | pub label: String, 30 | /// The secret key to generate correct OTPs. 31 | pub secret: Key, 32 | /// Amount of digits to produce as OTP. 33 | pub digits: u8, 34 | /// The variation of OTP to use. 35 | pub otp: Otp, 36 | /// Algorithm that is used to generate OTPs. 37 | pub algorithm: Algorithm, 38 | /// Optional issuer of the OTP account. 39 | pub issuer: Option, 40 | /// Additional metadata for Otti. 41 | pub meta: Metadata, 42 | /// Additional free-form values, mostly used to carry unsupported import data. 43 | /// 44 | /// This allows to keep extra data that would otherwise be lost during import. When exporting 45 | /// again, all information can be restored. 46 | #[serde(default)] 47 | pub extras: BTreeMap>, 48 | } 49 | 50 | #[cfg(feature = "otpurl")] 51 | impl FromStr for Account { 52 | type Err = crate::url::ParseError; 53 | 54 | fn from_str(s: &str) -> Result { 55 | crate::url::parse(s) 56 | } 57 | } 58 | 59 | /// Base information about the OTP used. The most common are HOTP and TOTP but there are many 60 | /// platform specific variations in the wild, like for Steam. 61 | #[derive(Clone, Debug, Serialize, Deserialize)] 62 | #[cfg_attr(test, derive(Eq, PartialEq, PartialOrd))] 63 | pub enum Otp { 64 | /// Counter based, using a counter as base of the OTP generation. 65 | /// 66 | /// Generally not recommended, as the counter must be kept in sync between different clients. 67 | Hotp { 68 | /// Atomic counter that serves as calculation base for new OTPs. Incremented by `1` after 69 | /// each use. 70 | counter: u64, 71 | }, 72 | /// Time based, using the current time with a maximum delay (the `window`). 73 | /// 74 | /// Generated OTPs are considered valid from the point of generation until the window, which 75 | /// describes seconds, has passed. As there can be timing differences between client and 76 | /// server, it is common that the server accepts at least 1-2 old OTPs. Otherwise the input 77 | /// could fail due to being generated at the end of the window, giving no time for the user 78 | /// to copy in and send the OTP. 79 | Totp { 80 | /// Seconds that an OTP is considered valid. 81 | window: u64, 82 | }, 83 | /// Steam specific OTP, very similar to [`Self::Totp`] but uses a different alphabet to 84 | /// generate codes. 85 | Steam { 86 | /// Same as the `window` in a TOTP, describing the amount of time in seconds an OTP is 87 | /// considered valid. 88 | period: u64, 89 | }, 90 | } 91 | 92 | /// Algorithm used in the OTP generation to create the final code. 93 | #[derive(Clone, Copy, Debug, Serialize, Deserialize)] 94 | #[cfg_attr(test, derive(Eq, PartialEq, PartialOrd))] 95 | pub enum Algorithm { 96 | /// SHA-1 algorithm, most common. 97 | Sha1, 98 | /// SHA(2)-256 algorithm. 99 | Sha256, 100 | /// SHA(2)-512 algorithm. 101 | Sha512, 102 | } 103 | 104 | /// Additional metadata that is specific to **Otti** and mostly user provided. 105 | #[derive(Clone, Debug, Default, Serialize, Deserialize)] 106 | #[cfg_attr(test, derive(Eq, PartialEq, PartialOrd))] 107 | pub struct Metadata { 108 | /// Free list of tags to classify or group accounts. 109 | pub tags: Vec, 110 | } 111 | -------------------------------------------------------------------------------- /src/widgets/list.rs: -------------------------------------------------------------------------------- 1 | use otti_core::Account; 2 | use ratatui::{ 3 | buffer::Buffer, 4 | layout::Rect, 5 | style::Color, 6 | widgets::{Block, Paragraph, StatefulWidget, Widget}, 7 | }; 8 | 9 | use super::ScrollBar; 10 | 11 | const LIST_ITEM_HEIGHT: usize = 4; 12 | 13 | pub struct List<'a> { 14 | block: Option>, 15 | scrollbar: Option<(ScrollBar, u16)>, 16 | items: &'a [Account], 17 | } 18 | 19 | impl<'a> List<'a> { 20 | pub fn new(items: &'a [Account]) -> Self { 21 | Self { 22 | block: None, 23 | scrollbar: None, 24 | items, 25 | } 26 | } 27 | 28 | pub fn block(mut self, block: Block<'a>) -> Self { 29 | self.block = Some(block); 30 | self 31 | } 32 | 33 | pub fn scrollbar(mut self, scrollbar: ScrollBar, width: u16) -> Self { 34 | self.scrollbar = Some((scrollbar, width)); 35 | self 36 | } 37 | } 38 | 39 | impl<'a> StatefulWidget for List<'a> { 40 | type State = State; 41 | 42 | fn render(mut self, area: Rect, buf: &mut Buffer, state: &mut Self::State) { 43 | let list_area = match self.block.take() { 44 | Some(b) => { 45 | let inner_area = b.inner(area); 46 | b.render(area, buf); 47 | inner_area 48 | } 49 | None => area, 50 | }; 51 | 52 | let (scrollbar, scrollbar_width) = match self.scrollbar { 53 | Some((scrollbar, width)) => (Some(scrollbar), width), 54 | None => (None, 0), 55 | }; 56 | 57 | state.update_scroll_pos(list_area); 58 | 59 | for (i, item) in self.items.iter().skip(state.scroll_pos).enumerate() { 60 | let mut area = list_area; 61 | area.y += (i * LIST_ITEM_HEIGHT) as u16; 62 | area.height = 1; 63 | area.width -= scrollbar_width; 64 | 65 | // Draw current selection indicator 66 | if state.position() == i { 67 | for y in area.y..list_area.bottom().min(area.y + 3) { 68 | buf.get_mut(area.x, y).set_bg(Color::Blue); 69 | } 70 | } 71 | 72 | area.x += 2; 73 | area.width -= 2; 74 | 75 | // Draw the item label 76 | area.y += 1; 77 | if area.y >= list_area.bottom() { 78 | break; 79 | } 80 | Paragraph::new(item.label.as_str()).render(area, buf); 81 | 82 | // Draw the item issuer 83 | area.y += 1; 84 | if area.y >= list_area.bottom() { 85 | break; 86 | } 87 | if let Some(issuer) = &item.issuer { 88 | Paragraph::new(issuer.as_str()).render(area, buf); 89 | } 90 | 91 | // Draw the separator 92 | area.y += 1; 93 | if area.y >= list_area.bottom() { 94 | break; 95 | } 96 | 97 | area.x -= 2; 98 | area.width += 2; 99 | 100 | (area.x..area.width).for_each(|x| { 101 | buf.get_mut(x, area.y).set_char('─'); 102 | }); 103 | } 104 | 105 | // Draw scroll bar, if set 106 | if let Some(scrollbar) = scrollbar { 107 | let mut area = list_area; 108 | area.x += area.width - scrollbar_width; 109 | area.width = scrollbar_width; 110 | 111 | scrollbar 112 | .data(state.selection, self.items.len() - 1) 113 | .render(area, buf); 114 | } 115 | } 116 | } 117 | 118 | #[derive(Default)] 119 | pub struct State { 120 | selection: usize, 121 | scroll_pos: usize, 122 | } 123 | 124 | impl State { 125 | pub fn up(&mut self, _items: &[Account]) { 126 | if self.selection > 0 { 127 | self.selection -= 1; 128 | } 129 | } 130 | 131 | pub fn down(&mut self, items: &[Account]) { 132 | if self.selection < items.len() - 1 { 133 | self.selection += 1; 134 | } 135 | } 136 | 137 | pub fn selection(&self) -> usize { 138 | self.selection 139 | } 140 | 141 | fn update_scroll_pos(&mut self, area: Rect) { 142 | while (self.selection + 1).saturating_sub(self.scroll_pos) * LIST_ITEM_HEIGHT 143 | > usize::from(area.height) 144 | { 145 | self.scroll_pos += 1; 146 | } 147 | 148 | while self.selection < self.scroll_pos { 149 | self.scroll_pos -= 1; 150 | } 151 | } 152 | 153 | fn position(&self) -> usize { 154 | self.selection - self.scroll_pos 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /src/cli.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | fs::OpenOptions, 3 | io::{self, Write}, 4 | path::{Path, PathBuf}, 5 | }; 6 | 7 | use anyhow::{ensure, Context, Result}; 8 | use clap::{CommandFactory, Parser, Subcommand, ValueEnum, ValueHint}; 9 | use clap_complete::Shell; 10 | 11 | /// The one-time password (OTP for short) manager for the terminal, with interactive and fancy 12 | /// terminal user interface (TUI for short). 13 | /// 14 | /// Use any of the available commands to manage OTP accounts, like import/export. Or pass no 15 | /// command, to start up the interactive TUI. 16 | #[derive(Parser)] 17 | #[command(author, version, propagate_version = true)] 18 | pub struct Opt { 19 | #[command(subcommand)] 20 | pub cmd: Option, 21 | } 22 | 23 | impl Opt { 24 | pub fn parse() -> Self { 25 | ::parse() 26 | } 27 | } 28 | 29 | #[derive(Subcommand)] 30 | pub enum Command { 31 | /// Import OTP accounts from another application. 32 | Import { 33 | /// Optional password if the file is protected. 34 | #[arg(short, long)] 35 | password: Option, 36 | /// Provider/application that this file came from. 37 | #[arg(value_enum)] 38 | provider: Provider, 39 | /// The file to import. 40 | #[arg(value_hint = ValueHint::FilePath)] 41 | file: PathBuf, 42 | }, 43 | /// Export OTP accounts to another application. 44 | Export { 45 | /// Optional password to protect the file. 46 | #[arg(short, long)] 47 | password: Option, 48 | /// Provider/application that this file will be imported into. 49 | #[arg(value_enum)] 50 | provider: Provider, 51 | /// Target location of the file. Defaults to `-export.` in the current 52 | /// folder, where the extension depends on the provider's format. 53 | #[arg(value_hint = ValueHint::FilePath)] 54 | file: Option, 55 | }, 56 | /// Search for a single account and print the current OTP. 57 | Show { 58 | /// Name of the issuer to search by. 59 | issuer: String, 60 | /// Optional label to further restrict the search to a single entry. 61 | label: Option, 62 | }, 63 | /// Generate auto-completion scripts for various shells. 64 | Completions { 65 | /// Shell to generate an auto-completion script for. 66 | #[arg(value_enum)] 67 | shell: Shell, 68 | }, 69 | /// Generate man pages into the given directory. 70 | Manpages { 71 | /// Target directory, that must already exist and be empty. If the any file with the same 72 | /// name as any of the man pages already exist, it'll not be overwritten, but instead an 73 | /// error be returned. 74 | #[arg(value_hint = ValueHint::DirPath)] 75 | dir: PathBuf, 76 | }, 77 | } 78 | 79 | /// Possible supported providers for data import/export. 80 | #[derive(Clone, Copy, ValueEnum)] 81 | pub enum Provider { 82 | /// Aegis authenticator. 83 | Aegis, 84 | /// Android OTP Authenticator. 85 | AndOtp, 86 | /// Authenticator Pro. 87 | AuthPro, 88 | } 89 | 90 | impl Provider { 91 | /// Select the default export file name for a provider. This is used when the user doesn't 92 | /// define a file name on their own. 93 | pub fn export_name(self, with_password: bool) -> &'static str { 94 | match self { 95 | Self::Aegis => { 96 | if with_password { 97 | "aegis-export.json" 98 | } else { 99 | "aegis-export-plain.json" 100 | } 101 | } 102 | Self::AndOtp => { 103 | if with_password { 104 | "and-otp-export.json.aes" 105 | } else { 106 | "and-otp-export.json" 107 | } 108 | } 109 | Self::AuthPro => { 110 | if with_password { 111 | "auth-pro-export.authpro" 112 | } else { 113 | "auth-pro-export.json" 114 | } 115 | } 116 | } 117 | } 118 | } 119 | 120 | /// Generate shell completions, written to the standard output. 121 | #[allow(clippy::unnecessary_wraps)] 122 | pub fn completions(shell: Shell) -> Result<()> { 123 | clap_complete::generate( 124 | shell, 125 | &mut Opt::command(), 126 | env!("CARGO_PKG_NAME"), 127 | &mut io::stdout().lock(), 128 | ); 129 | Ok(()) 130 | } 131 | 132 | /// Generate man pages in the target directory. The directory must already exist and none of the 133 | /// files exist, or an error is returned. 134 | pub fn manpages(dir: &Path) -> Result<()> { 135 | fn print(dir: &Path, app: &clap::Command) -> Result<()> { 136 | let name = app.get_display_name().unwrap_or_else(|| app.get_name()); 137 | let out = dir.join(format!("{name}.1")); 138 | let mut out = OpenOptions::new() 139 | .write(true) 140 | .create_new(true) 141 | .open(&out) 142 | .with_context(|| format!("the file `{}` already exists", out.display()))?; 143 | 144 | clap_mangen::Man::new(app.clone()).render(&mut out)?; 145 | out.flush()?; 146 | 147 | for sub in app.get_subcommands() { 148 | print(dir, sub)?; 149 | } 150 | 151 | Ok(()) 152 | } 153 | 154 | ensure!(dir.try_exists()?, "target directory doesn't exist"); 155 | 156 | let mut app = Opt::command(); 157 | app.build(); 158 | 159 | print(dir, &app) 160 | } 161 | -------------------------------------------------------------------------------- /otti-core/src/url.rs: -------------------------------------------------------------------------------- 1 | use std::{collections::BTreeMap, convert::TryFrom, str::FromStr}; 2 | 3 | use serde::Deserialize; 4 | 5 | use crate::{Account, Algorithm, Key, Metadata, Otp}; 6 | 7 | /// Any error that can happen when parsing an [`Account`](crate::Account) from an URL. 8 | #[derive(Debug, thiserror::Error)] 9 | pub enum ParseError { 10 | /// The input didn't form a valid URL. 11 | #[error("the URL is not valid")] 12 | InvalidUrl(#[from] url::ParseError), 13 | /// An unknown scheme was used in the URL. 14 | #[error("the scheme `{0}` is not supported, only `otpauth`")] 15 | InvalidScheme(String), 16 | /// The host part of the URL was missing. 17 | #[error("host is missing")] 18 | MissingHost, 19 | /// The host part of the URL was unsupported. 20 | #[error("host (otp type) is `{0}` but only `hotp`, `totp` or `steam` are supported")] 21 | InvalidHost(String), 22 | /// Parameters of the URL failed to deserialize. 23 | #[error("parameters failed to deserialize")] 24 | Deserialize(#[from] serde_qs::Error), 25 | /// The input was no proper UTF-8. 26 | #[error("string is not valid UTF-8")] 27 | InvalidUtf8(#[from] std::str::Utf8Error), 28 | } 29 | 30 | #[derive(Debug, Deserialize)] 31 | struct Params { 32 | #[serde(with = "super::de::base32_string")] 33 | secret: Vec, 34 | issuer: Option, 35 | #[serde(default = "default_algorithm")] 36 | algorithm: ParamsAlgorithm, 37 | digits: Option, 38 | #[serde(default = "default_period")] 39 | period: u64, 40 | counter: Option, 41 | } 42 | 43 | #[derive(Debug, Deserialize)] 44 | #[serde(try_from = "&str")] 45 | struct ParamsAlgorithm(Algorithm); 46 | 47 | impl TryFrom<&str> for ParamsAlgorithm { 48 | type Error = String; 49 | 50 | fn try_from(s: &str) -> Result { 51 | Ok(Self(if s.eq_ignore_ascii_case("sha1") { 52 | Algorithm::Sha1 53 | } else if s.eq_ignore_ascii_case("sha256") { 54 | Algorithm::Sha256 55 | } else if s.eq_ignore_ascii_case("sha512") { 56 | Algorithm::Sha512 57 | } else { 58 | return Err(format!("unsupported algorithm `{s}`")); 59 | })) 60 | } 61 | } 62 | 63 | #[derive(Clone, Copy, Debug, Deserialize)] 64 | enum OtpType { 65 | Hotp, 66 | Totp, 67 | Steam, 68 | } 69 | 70 | impl OtpType { 71 | fn default_digits(self) -> u8 { 72 | match self { 73 | Self::Hotp | Self::Totp => 6, 74 | Self::Steam => 5, 75 | } 76 | } 77 | } 78 | 79 | impl FromStr for OtpType { 80 | type Err = ParseError; 81 | 82 | fn from_str(s: &str) -> Result { 83 | Ok(if s.eq_ignore_ascii_case("hotp") { 84 | Self::Hotp 85 | } else if s.eq_ignore_ascii_case("totp") { 86 | Self::Totp 87 | } else if s.eq_ignore_ascii_case("steam") { 88 | Self::Steam 89 | } else { 90 | return Err(ParseError::InvalidHost(s.to_owned())); 91 | }) 92 | } 93 | } 94 | 95 | #[inline(always)] 96 | fn default_algorithm() -> ParamsAlgorithm { 97 | ParamsAlgorithm(Algorithm::Sha1) 98 | } 99 | 100 | #[inline(always)] 101 | fn default_period() -> u64 { 102 | 30 103 | } 104 | 105 | pub fn parse(value: &str) -> Result { 106 | let url = url::Url::parse(value)?; 107 | 108 | if url.scheme() != "otpauth" { 109 | return Err(ParseError::InvalidScheme(url.scheme().to_owned())); 110 | } 111 | 112 | let otp_type = url 113 | .host_str() 114 | .ok_or(ParseError::MissingHost)? 115 | .parse::()?; 116 | 117 | let query = url.query().unwrap_or_default(); 118 | let params = serde_qs::from_str::(query)?; 119 | 120 | let path = url.path(); 121 | let label = path.strip_prefix('/').unwrap_or(path); 122 | let label = percent_encoding::percent_decode_str(label).decode_utf8()?; 123 | 124 | let mut parts = label.splitn(2, ':'); 125 | let (label, issuer) = if let (Some(issuer), Some(label)) = (parts.next(), parts.next()) { 126 | (label, Some(issuer)) 127 | } else { 128 | (label.as_ref(), None) 129 | }; 130 | 131 | Ok(Account { 132 | label: label.to_owned(), 133 | secret: Key::new(params.secret), 134 | digits: params.digits.unwrap_or_else(|| otp_type.default_digits()), 135 | otp: match otp_type { 136 | OtpType::Hotp => Otp::Hotp { 137 | counter: params.counter.unwrap_or_default(), 138 | }, 139 | OtpType::Totp => Otp::Totp { 140 | window: params.period, 141 | }, 142 | OtpType::Steam => Otp::Steam { 143 | period: params.period, 144 | }, 145 | }, 146 | algorithm: params.algorithm.0, 147 | issuer: params.issuer.or_else(|| issuer.map(ToOwned::to_owned)), 148 | meta: Metadata::default(), 149 | extras: BTreeMap::default(), 150 | }) 151 | } 152 | 153 | #[cfg(test)] 154 | mod tests { 155 | use super::*; 156 | use crate::Key; 157 | 158 | #[test] 159 | fn account_from_string() { 160 | let account = parse( 161 | "otpauth://totp/Test%20This:me?secret=JBSWY3DPEHPK3PXP&algorithm=sha256&digits=8&\ 162 | period=60", 163 | ) 164 | .unwrap(); 165 | let expect = Account { 166 | label: "me".to_owned(), 167 | secret: Key::new(vec![72, 101, 108, 108, 111, 33, 222, 173, 190, 239]), 168 | digits: 8, 169 | otp: Otp::Totp { window: 60 }, 170 | algorithm: Algorithm::Sha256, 171 | issuer: Some("Test This".to_owned()), 172 | meta: Metadata::default(), 173 | extras: BTreeMap::default(), 174 | }; 175 | 176 | assert_eq!(expect, account); 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /otti-gen/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! # Otti Gen(erator) 2 | //! 3 | //! Generator component of the **Otti** OTP manager. It allows to create new OTPs for any account 4 | //! from the [`otti_core`] component. 5 | 6 | #![deny(rust_2018_idioms, clippy::all, clippy::pedantic)] 7 | #![allow(clippy::missing_errors_doc, clippy::cast_possible_truncation)] 8 | 9 | use std::{ 10 | fmt::{self, Display}, 11 | time::{SystemTimeError, UNIX_EPOCH}, 12 | }; 13 | 14 | use hmac::{ 15 | digest::{core_api::BlockSizeUser, Digest, InvalidLength}, 16 | Mac, SimpleHmac, 17 | }; 18 | use otti_core::ExposeSecret; 19 | pub use otti_core::{Key, Otp}; 20 | pub use sha1::Sha1; 21 | pub use sha2::{Sha256, Sha512}; 22 | 23 | /// Most common amount of digits for OTPs. 24 | const DEFAULT_DIGITS: u8 = 6; 25 | /// Default amount of "digits" for the [`Otp::Steam`] variant. The name digits is misleading as this 26 | /// variant uses a mixture of alphanumeric characters. 27 | const DEFAULT_STEAM_DIGITS: u8 = 5; 28 | 29 | /// Alphabet for the [`Otp::Steam`] variant. 30 | const STEAM_CHARS: &[char] = &[ 31 | '2', '3', '4', '5', '6', '7', '8', '9', 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'P', 32 | 'Q', 'R', 'T', 'V', 'W', 'X', 'Y', 33 | ]; 34 | 35 | /// Errors that can occur when generating an OTP. 36 | #[derive(Debug, thiserror::Error)] 37 | pub enum Error { 38 | /// Failed to get a timestamp from the system. 39 | #[error("failed to get time since unix epoch")] 40 | Time(#[from] SystemTimeError), 41 | /// The provided key was too short. 42 | #[error("the given key is too short")] 43 | KeyLength(#[from] InvalidLength), 44 | } 45 | 46 | /// Create a new OTP from the given `key`, `otp` variant and optional amount of `digits`. 47 | /// 48 | /// This operation may fail if the key is too short or the system wasn't able to provide the current 49 | /// time (depending on the OTP variant used). 50 | pub fn generate(key: &Key, otp: &Otp, digits: Option) -> Result 51 | where 52 | D: Digest + BlockSizeUser, 53 | { 54 | let digits = digits.unwrap_or(match otp { 55 | Otp::Hotp { .. } | Otp::Totp { .. } => DEFAULT_DIGITS, 56 | Otp::Steam { .. } => DEFAULT_STEAM_DIGITS, 57 | }); 58 | 59 | let code = match otp { 60 | Otp::Hotp { counter } => { 61 | generate_hotp::(key.expose_secret(), *counter, digits)?.to_string() 62 | } 63 | Otp::Totp { window } => { 64 | generate_totp::(key.expose_secret(), *window, digits)?.to_string() 65 | } 66 | Otp::Steam { period } => generate_steam::(key.expose_secret(), *period, digits)?, 67 | }; 68 | 69 | Ok(OtpCode { code, digits }) 70 | } 71 | 72 | fn generate_hotp(key: &[u8], counter: u64, digits: u8) -> Result 73 | where 74 | D: Digest + BlockSizeUser, 75 | { 76 | let digest = mac::(key, counter)?; 77 | let code = digit(&digest, digits); 78 | 79 | Ok(code) 80 | } 81 | 82 | fn generate_totp(key: &[u8], window: u64, digits: u8) -> Result 83 | where 84 | D: Digest + BlockSizeUser, 85 | { 86 | let time = UNIX_EPOCH.elapsed()?.as_secs(); 87 | generate_hotp::(key, time / window, digits) 88 | } 89 | 90 | fn generate_steam(key: &[u8], period: u64, digits: u8) -> Result 91 | where 92 | D: Digest + BlockSizeUser, 93 | { 94 | let mut code = generate_totp::(key, period, digits)?; 95 | let mut steam = String::with_capacity(digits as usize); 96 | 97 | for _ in 0..digits { 98 | steam.push(STEAM_CHARS[code as usize % STEAM_CHARS.len()]); 99 | code /= STEAM_CHARS.len() as u32; 100 | } 101 | 102 | Ok(steam) 103 | } 104 | 105 | fn mac(key: &[u8], counter: u64) -> Result<[u8; 20], Error> 106 | where 107 | D: Digest + BlockSizeUser, 108 | { 109 | let mut digest = [0_u8; 20]; 110 | 111 | let mut mac = >::new_from_slice(key)?; 112 | mac.update(&counter.to_be_bytes()); 113 | digest.copy_from_slice(&mac.finalize().into_bytes()[..20]); 114 | 115 | Ok(digest) 116 | } 117 | 118 | fn digit(bytes: &[u8; 20], digits: u8) -> u32 { 119 | let offset = (bytes[19] & 0xf) as usize; 120 | let bin_code = (u32::from(bytes[offset]) & 0x7f) << 24 121 | | u32::from(bytes[offset + 1]) << 16 122 | | u32::from(bytes[offset + 2]) << 8 123 | | u32::from(bytes[offset + 3]); 124 | 125 | bin_code % 10_u32.pow(u32::from(digits)) 126 | } 127 | 128 | /// A generated OTP code that can be used to verify identity against a service. 129 | /// 130 | /// It contains the code as well as the amount of digits as the generated code might be shorter than 131 | /// the needed amount of digits and must be shifted with zeroes to fullfill the length. 132 | /// 133 | /// Call `to_string()` on an instance to get the final code. 134 | pub struct OtpCode { 135 | /// Generated code as string. Some variants use characters instead of just numbers. Therefore, 136 | /// the code is kept as string to allow more flexibility. 137 | pub code: String, 138 | /// The desired amount of digits of the OTP. The `code` may be shorter in case it's directly 139 | /// converted from an integer and must be shifted with `0`es in the final representation. 140 | pub digits: u8, 141 | } 142 | 143 | impl Display for OtpCode { 144 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 145 | write!(f, "{:0>1$}", self.code, self.digits as usize) 146 | } 147 | } 148 | 149 | #[cfg(test)] 150 | mod tests { 151 | use super::DEFAULT_DIGITS; 152 | 153 | #[test] 154 | fn digit() { 155 | let bytes = [ 156 | 0x1f, 0x86, 0x98, 0x69, 0x0e, 0x02, 0xca, 0x16, 0x61, 0x85, 0x50, 0xef, 0x7f, 0x19, 157 | 0xda, 0x8e, 0x94, 0x5b, 0x55, 0x5a, 158 | ]; 159 | 160 | assert_eq!(872_921, super::digit(&bytes, DEFAULT_DIGITS)); 161 | } 162 | 163 | #[test] 164 | fn code_display() { 165 | let code = super::OtpCode { 166 | code: "123".to_owned(), 167 | digits: 6, 168 | }; 169 | assert_eq!("000123", code.to_string()); 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /otti-store/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! # Otti Store 2 | //! 3 | //! The storage component for **Otti** manages saving of accounts in a secure manner so that they 4 | //! may only be accessed with the user defined password. 5 | 6 | #![deny(rust_2018_idioms, clippy::all, clippy::pedantic)] 7 | #![allow(clippy::missing_errors_doc)] 8 | 9 | mod aead; 10 | mod kdf; 11 | 12 | use std::{ 13 | convert::TryFrom, 14 | fmt::{self, Display}, 15 | fs::{self, File}, 16 | io::{prelude::*, BufReader, BufWriter}, 17 | path::PathBuf, 18 | }; 19 | 20 | use directories::ProjectDirs; 21 | use flate2::{ 22 | write::{ZlibDecoder, ZlibEncoder}, 23 | Compression, 24 | }; 25 | use otti_core::{Account, ExposeSecret}; 26 | pub use secrecy::{Secret, SecretString}; 27 | use serde::{Deserialize, Serialize}; 28 | 29 | use self::kdf::{Password, Salt}; 30 | 31 | /// Errors that can occur when sealing or opening an otti store. 32 | #[derive(Debug, thiserror::Error)] 33 | pub enum Error { 34 | /// Unrecognized version of the store. This can usually only happen if the store was manually 35 | /// modified by the user. 36 | #[error("unknown store version {0}")] 37 | UnknownVersion(u16), 38 | /// The version of the store is too old and not supported anymore. 39 | #[error("unsupported store version {0}")] 40 | UnsupportedVersion(Version), 41 | /// Failed to find the home directory of the executing user. 42 | #[error("failed to find the home folder")] 43 | HomefolderNotFound, 44 | /// An I/O related error happened. 45 | #[error("I/O bound error")] 46 | Io(#[from] std::io::Error), 47 | /// Encoding of the store data failed. 48 | #[error("failed to encode content")] 49 | Encode(#[from] rmp_serde::encode::Error), 50 | /// Decoding of the store data failed. 51 | #[error("failed to decode content")] 52 | Decode(#[from] rmp_serde::decode::Error), 53 | /// A cryptographic error occurred. 54 | #[error("cryptographic error")] 55 | Crypto, 56 | /// The given password to open a store was invalid. 57 | #[error("password is invalid")] 58 | InvalidPassword, 59 | } 60 | 61 | /// Different versions of the otti store. This enum must be extended and according conversion 62 | /// implemented, whenever the store format has been changed in a breaking manner. 63 | #[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize)] 64 | pub enum Version { 65 | /// The current and only format version of the otti store. 66 | V1, 67 | } 68 | 69 | impl Display for Version { 70 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 71 | f.write_str(match self { 72 | Self::V1 => "v1", 73 | }) 74 | } 75 | } 76 | 77 | impl From for u16 { 78 | fn from(v: Version) -> Self { 79 | match v { 80 | Version::V1 => 1, 81 | } 82 | } 83 | } 84 | 85 | impl TryFrom for Version { 86 | type Error = Error; 87 | 88 | fn try_from(value: u16) -> Result { 89 | match value { 90 | 1 => Ok(Self::V1), 91 | _ => Err(Error::UnknownVersion(value)), 92 | } 93 | } 94 | } 95 | 96 | #[derive(Serialize, Deserialize)] 97 | struct EncryptedFile { 98 | salt: Vec, 99 | iterations: u32, 100 | memory: u32, 101 | data: Vec, 102 | } 103 | 104 | /// Try to open the Otti store with the given password. 105 | pub fn open(password: &SecretString) -> Result, Error> { 106 | let file = File::open(filepath()?)?; 107 | let mut file = BufReader::new(file); 108 | 109 | let version = read_version(&mut file)?; 110 | if version != Version::V1 { 111 | return Err(Error::UnsupportedVersion(version)); 112 | } 113 | 114 | let encrypted = rmp_serde::from_read::<_, EncryptedFile>(&mut file)?; 115 | let data = decrypt(&encrypted, password)?; 116 | let data = decompress(&data)?; 117 | 118 | rmp_serde::from_slice(&data).map_err(Into::into) 119 | } 120 | 121 | /// Seal the given list of accounts with the provided password. 122 | pub fn seal(accounts: &[Account], password: &SecretString) -> Result<(), Error> { 123 | let data = rmp_serde::to_vec(accounts)?; 124 | let data = compress(&data)?; 125 | let encrypted = encrypt(&data, password)?; 126 | let path = filepath()?; 127 | 128 | if let Some(parent) = path.parent() { 129 | fs::create_dir_all(parent)?; 130 | } 131 | 132 | let file = File::create(path)?; 133 | let mut file = BufWriter::new(file); 134 | 135 | write_version(&mut file, Version::V1)?; 136 | rmp_serde::encode::write(&mut file, &encrypted)?; 137 | 138 | Ok(()) 139 | } 140 | 141 | /// Test whether an otti datastore already exists in the current system. 142 | pub fn exists() -> Result { 143 | filepath().map(|fp| fp.exists()) 144 | } 145 | 146 | fn filepath() -> Result { 147 | Ok(ProjectDirs::from("rocks", "dnaka91", "otti") 148 | .ok_or(Error::HomefolderNotFound)? 149 | .data_dir() 150 | .join("store.otti")) 151 | } 152 | 153 | fn decompress(data: &[u8]) -> Result, Error> { 154 | let mut wr = ZlibDecoder::new(Vec::new()); 155 | wr.write_all(data)?; 156 | 157 | wr.finish().map_err(Into::into) 158 | } 159 | 160 | fn compress(data: &[u8]) -> Result, Error> { 161 | let mut wr = ZlibEncoder::new(Vec::new(), Compression::best()); 162 | wr.write_all(data)?; 163 | 164 | wr.finish().map_err(Into::into) 165 | } 166 | 167 | fn decrypt(encrypted: &EncryptedFile, password: &SecretString) -> Result, Error> { 168 | let password = Password::from_slice(password.expose_secret().as_bytes()); 169 | let salt = Salt::from_slice(&encrypted.salt)?; 170 | let key = kdf::derive_key(&password, &salt, encrypted.iterations, encrypted.memory, 32)?; 171 | 172 | aead::open(&key, &encrypted.data).map_err(|_e| Error::InvalidPassword) 173 | } 174 | 175 | fn encrypt(data: &[u8], password: &SecretString) -> Result { 176 | let password = Password::from_slice(password.expose_secret().as_bytes()); 177 | let salt = Salt::default(); 178 | let key = kdf::derive_key(&password, &salt, 3, 1 << 16, 32)?; 179 | 180 | let data = aead::seal(&key, data)?; 181 | 182 | Ok(EncryptedFile { 183 | salt: salt.as_ref().to_owned(), 184 | iterations: 3, 185 | memory: 1 << 16, 186 | data, 187 | }) 188 | } 189 | 190 | fn read_version(rd: &mut impl Read) -> Result { 191 | let mut buf = [0_u8; 2]; 192 | rd.read_exact(&mut buf)?; 193 | 194 | Version::try_from(u16::from_le_bytes(buf)) 195 | } 196 | 197 | fn write_version(wr: &mut impl Write, version: Version) -> Result<(), Error> { 198 | wr.write_all(&u16::from(version).to_le_bytes()) 199 | .map_err(Into::into) 200 | } 201 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | #![deny(rust_2018_idioms, clippy::all, clippy::pedantic)] 2 | #![allow( 3 | clippy::too_many_lines, 4 | clippy::cast_possible_truncation, 5 | clippy::single_match_else 6 | )] 7 | 8 | use std::{ 9 | fs, 10 | path::PathBuf, 11 | time::{Duration, UNIX_EPOCH}, 12 | }; 13 | 14 | use anyhow::Result; 15 | use arboard::Clipboard; 16 | use crossbeam_channel::select; 17 | use crossterm::event::KeyCode; 18 | use ratatui::{ 19 | layout::{Constraint, Direction, Layout}, 20 | style::{Color, Style}, 21 | widgets::{Block, Borders, Gauge}, 22 | }; 23 | use secrecy::SecretString; 24 | use widgets::CodeDialog; 25 | 26 | use crate::{ 27 | cli::{Command, Opt, Provider}, 28 | widgets::{HelpDialog, List, ListState, ScrollBar}, 29 | }; 30 | 31 | mod cli; 32 | mod terminal; 33 | mod widgets; 34 | 35 | fn main() -> Result<()> { 36 | let opt = Opt::parse(); 37 | 38 | opt.cmd.map_or_else(run, |cmd| match cmd { 39 | Command::Import { 40 | password, 41 | provider, 42 | file, 43 | } => import(password, provider, file), 44 | Command::Export { 45 | password, 46 | provider, 47 | file, 48 | } => export(password, provider, file), 49 | Command::Show { issuer, label } => show(&issuer, label.as_deref()), 50 | Command::Completions { shell } => cli::completions(shell), 51 | Command::Manpages { dir } => cli::manpages(&dir), 52 | }) 53 | } 54 | 55 | fn import(password: Option, provider: Provider, file: PathBuf) -> Result<()> { 56 | let file = fs::read(file)?; 57 | 58 | let accounts = match provider { 59 | Provider::Aegis => provider_aegis::load(&mut file.as_slice(), password)?, 60 | Provider::AndOtp => provider_andotp::load(&mut file.as_slice(), password)?, 61 | Provider::AuthPro => provider_authpro::load(&mut file.as_slice(), password)?, 62 | }; 63 | 64 | println!("Opened backup file"); 65 | 66 | if otti_store::exists()? { 67 | println!("An OTP store already exists"); 68 | 69 | let resp = rprompt::prompt_reply("Overwrite? [yN] ")?; 70 | 71 | if !matches!(resp.as_str(), "y" | "Y") { 72 | println!("Import cancelled"); 73 | return Ok(()); 74 | } 75 | } 76 | 77 | println!("Imported {} accounts", accounts.len()); 78 | 79 | let password = SecretString::new(rpassword::prompt_password("Store password:")?); 80 | 81 | otti_store::seal(&accounts, &password)?; 82 | 83 | Ok(()) 84 | } 85 | 86 | fn export(file_password: Option, provider: Provider, file: Option) -> Result<()> { 87 | let password = SecretString::new(rpassword::prompt_password("Store password:")?); 88 | let accounts = otti_store::open(&password)?; 89 | let file = file.unwrap_or_else(|| PathBuf::from(provider.export_name(file_password.is_some()))); 90 | 91 | let mut data = Vec::new(); 92 | 93 | match provider { 94 | Provider::Aegis => provider_aegis::save(&mut data, &accounts, file_password)?, 95 | Provider::AndOtp => provider_andotp::save(&mut data, &accounts, file_password)?, 96 | Provider::AuthPro => provider_authpro::save(&mut data, &accounts, file_password)?, 97 | } 98 | 99 | fs::write(file, data)?; 100 | 101 | Ok(()) 102 | } 103 | 104 | fn show(issuer: &str, label: Option<&str>) -> Result<()> { 105 | let password = SecretString::new(rpassword::prompt_password("Password:")?); 106 | 107 | let accounts = otti_store::open(&password)?; 108 | let issuer = issuer.to_lowercase(); 109 | let label = label.map(str::to_lowercase); 110 | 111 | let acc = accounts.iter().find(|a| { 112 | a.issuer 113 | .as_deref() 114 | .map_or(false, |i| i.to_lowercase().contains(&issuer)) 115 | && label 116 | .as_deref() 117 | .map_or(true, |l| a.label.to_lowercase().contains(l)) 118 | }); 119 | 120 | match acc { 121 | Some(acc) => { 122 | let code = 123 | otti_gen::generate::(&acc.secret, &acc.otp, Some(acc.digits))?; 124 | 125 | println!( 126 | "{} ({})", 127 | acc.issuer.as_deref().unwrap_or_default(), 128 | acc.label 129 | ); 130 | println!("{code}"); 131 | } 132 | None => { 133 | print!("no entry found containing issuer `{issuer}`"); 134 | match label { 135 | Some(label) => println!(" and label `{label}`."), 136 | None => println!("."), 137 | } 138 | } 139 | } 140 | 141 | Ok(()) 142 | } 143 | 144 | #[derive(Copy, Clone, PartialEq, Eq)] 145 | enum CurrentDialog { 146 | None, 147 | Help, 148 | Code, 149 | } 150 | 151 | fn run() -> Result<()> { 152 | let password = SecretString::new(rpassword::prompt_password("Password:")?); 153 | 154 | let accounts = otti_store::open(&password)?; 155 | 156 | let mut terminal = terminal::create()?; 157 | let events = terminal::create_event_listener(); 158 | let ticker = crossbeam_channel::tick(Duration::from_millis(1000)); 159 | let mut clipboard = Clipboard::new()?; 160 | 161 | let mut counter = 30 - (UNIX_EPOCH.elapsed()?.as_secs() % 30) as u16; 162 | let mut list_state = ListState::default(); 163 | 164 | let mut showing = CurrentDialog::None; 165 | 166 | 'draw: loop { 167 | let mut otp_code = String::new(); 168 | if showing == CurrentDialog::Code { 169 | if let Some(acc) = accounts.get(list_state.selection()) { 170 | otp_code = 171 | otti_gen::generate::(&acc.secret, &acc.otp, Some(acc.digits))? 172 | .to_string(); 173 | } 174 | } else if !otp_code.is_empty() { 175 | otp_code.clear(); 176 | } 177 | 178 | terminal.draw(|f| { 179 | let area = f.size(); 180 | let chunks = Layout::default() 181 | .direction(Direction::Vertical) 182 | .constraints([Constraint::Length(5), Constraint::Percentage(100)]) 183 | .split(area); 184 | 185 | let gauge = Gauge::default() 186 | .block(Block::default().borders(Borders::ALL)) 187 | .gauge_style(Style::default().fg(Color::Green).bg(Color::DarkGray)) 188 | .label(format!("{counter}s")) 189 | .percent(counter * 100 / 30); 190 | 191 | let list = List::new(&accounts) 192 | .block(Block::default().borders(Borders::ALL)) 193 | .scrollbar(ScrollBar::default(), 2); 194 | 195 | f.render_widget(gauge, chunks[0]); 196 | f.render_stateful_widget(list, chunks[1], &mut list_state); 197 | 198 | match showing { 199 | CurrentDialog::None => {} 200 | CurrentDialog::Help => f.render_widget(HelpDialog, area), 201 | CurrentDialog::Code => f.render_widget(CodeDialog::new(&otp_code), area), 202 | } 203 | })?; 204 | 205 | let value = select! { 206 | recv(ticker) -> _ => { 207 | counter = 30 - (UNIX_EPOCH.elapsed()?.as_secs() % 30) as u16; 208 | None 209 | }, 210 | recv(events) -> event => event.ok(), 211 | }; 212 | 213 | if let Some(event) = value { 214 | match event.code { 215 | KeyCode::Esc | KeyCode::Char('q') => break 'draw, 216 | KeyCode::Up => list_state.up(&accounts), 217 | KeyCode::Down => list_state.down(&accounts), 218 | KeyCode::Char('h') => toggle_dialog(&mut showing, CurrentDialog::Help), 219 | KeyCode::Char('s') => toggle_dialog(&mut showing, CurrentDialog::Code), 220 | KeyCode::Char('c') => { 221 | if let Some(acc) = accounts.get(list_state.selection()) { 222 | clipboard.set_text( 223 | otti_gen::generate::( 224 | &acc.secret, 225 | &acc.otp, 226 | Some(acc.digits), 227 | )? 228 | .to_string(), 229 | )?; 230 | } 231 | } 232 | _ => {} 233 | } 234 | } 235 | } 236 | 237 | Ok(()) 238 | } 239 | 240 | fn toggle_dialog(showing: &mut CurrentDialog, dialog: CurrentDialog) { 241 | *showing = if *showing == dialog { 242 | CurrentDialog::None 243 | } else { 244 | dialog 245 | }; 246 | } 247 | -------------------------------------------------------------------------------- /provider-andotp/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! # Otti - Provier `andOTP` 2 | //! 3 | //! Import/Export component that allows to transform between the Otti accounts and backups from/to 4 | //! the [`andOTP - Android OTP Authenticator`](https://github.com/andOTP/andOTP). 5 | 6 | #![deny(rust_2018_idioms, clippy::all, clippy::pedantic)] 7 | #![allow(clippy::missing_errors_doc, clippy::single_match_else)] 8 | 9 | use std::collections::BTreeMap; 10 | 11 | use aes_gcm::{ 12 | aead::generic_array::{ArrayLength, GenericArray}, 13 | AeadInPlace, Aes256Gcm, KeyInit, 14 | }; 15 | pub use bytes::{Buf, BufMut}; 16 | use hmac::Hmac; 17 | use otti_core::{ExposeSecret, Key}; 18 | use rand::prelude::*; 19 | use serde::{Deserialize, Serialize}; 20 | use sha1::Sha1; 21 | 22 | #[derive(Debug, thiserror::Error)] 23 | pub enum Error { 24 | #[error("the import data is too short")] 25 | InputTooShort, 26 | #[error("the cryptographic key length didn't match the cipher")] 27 | InvalidLength(#[from] pbkdf2::hmac::digest::InvalidLength), 28 | #[error("data en-/decryption failed")] 29 | AesGcm(#[from] aes_gcm::Error), 30 | #[error("JSON (de-)serialization failed")] 31 | Json(#[from] serde_json::Error), 32 | } 33 | 34 | #[derive(Debug, Serialize, Deserialize)] 35 | struct Account { 36 | #[serde(with = "otti_core::de::base32_string")] 37 | secret: Vec, 38 | issuer: String, 39 | label: String, 40 | #[serde(default)] 41 | digits: u8, 42 | #[serde(default, skip_serializing_if = "is_zero")] 43 | period: u64, 44 | #[serde(default, skip_serializing_if = "is_zero")] 45 | counter: u64, 46 | #[serde(rename = "type")] 47 | ty: OtpType, 48 | algorithm: Algorithm, 49 | #[serde(default, skip_serializing_if = "Vec::is_empty")] 50 | tags: Vec, 51 | } 52 | 53 | #[allow(clippy::trivially_copy_pass_by_ref)] 54 | fn is_zero(value: &u64) -> bool { 55 | *value == 0 56 | } 57 | 58 | impl From for otti_core::Account { 59 | fn from(a: Account) -> Self { 60 | Self { 61 | label: a.label, 62 | secret: Key::new(a.secret), 63 | digits: a.digits, 64 | otp: match a.ty { 65 | OtpType::Hotp => otti_core::Otp::Hotp { counter: a.counter }, 66 | OtpType::Totp => otti_core::Otp::Totp { window: a.period }, 67 | OtpType::Steam => otti_core::Otp::Steam { period: a.period }, 68 | }, 69 | algorithm: a.algorithm.into(), 70 | issuer: Some(a.issuer), 71 | meta: otti_core::Metadata { tags: a.tags }, 72 | extras: BTreeMap::new(), 73 | } 74 | } 75 | } 76 | 77 | impl From<&otti_core::Account> for Account { 78 | fn from(a: &otti_core::Account) -> Self { 79 | Self { 80 | secret: a.secret.expose_secret().clone(), 81 | issuer: a.issuer.clone().unwrap_or_default(), 82 | label: a.label.clone(), 83 | digits: a.digits, 84 | period: match a.otp { 85 | otti_core::Otp::Hotp { .. } => 0, 86 | otti_core::Otp::Totp { window } => window, 87 | otti_core::Otp::Steam { period } => period, 88 | }, 89 | counter: match a.otp { 90 | otti_core::Otp::Hotp { counter } => counter, 91 | otti_core::Otp::Totp { .. } | otti_core::Otp::Steam { .. } => 0, 92 | }, 93 | ty: match a.otp { 94 | otti_core::Otp::Hotp { .. } => OtpType::Hotp, 95 | otti_core::Otp::Totp { .. } => OtpType::Totp, 96 | otti_core::Otp::Steam { .. } => OtpType::Steam, 97 | }, 98 | algorithm: a.algorithm.into(), 99 | tags: a.meta.tags.clone(), 100 | } 101 | } 102 | } 103 | 104 | #[derive(Debug, Serialize, Deserialize)] 105 | #[serde(rename_all = "UPPERCASE")] 106 | enum OtpType { 107 | Totp, 108 | Hotp, 109 | Steam, 110 | } 111 | 112 | #[derive(Debug, Serialize, Deserialize)] 113 | #[serde(rename_all = "UPPERCASE")] 114 | enum Algorithm { 115 | Sha1, 116 | Sha256, 117 | Sha512, 118 | } 119 | 120 | impl From for otti_core::Algorithm { 121 | fn from(a: Algorithm) -> Self { 122 | match a { 123 | Algorithm::Sha1 => Self::Sha1, 124 | Algorithm::Sha256 => Self::Sha256, 125 | Algorithm::Sha512 => Self::Sha512, 126 | } 127 | } 128 | } 129 | 130 | impl From for Algorithm { 131 | fn from(a: otti_core::Algorithm) -> Self { 132 | match a { 133 | otti_core::Algorithm::Sha1 => Self::Sha1, 134 | otti_core::Algorithm::Sha256 => Self::Sha256, 135 | otti_core::Algorithm::Sha512 => Self::Sha512, 136 | } 137 | } 138 | } 139 | 140 | fn decrypt(data: &mut impl Buf, password: impl AsRef<[u8]>) -> Result, Error> { 141 | if data.remaining() <= 28 { 142 | return Err(Error::InputTooShort); 143 | } 144 | 145 | let pbkdf2_iterations = data.get_u32(); 146 | let pbkdf2_salt = data.copy_to_bytes(12); 147 | let aes_iv = data.copy_to_bytes(12); 148 | 149 | let mut key = [0_u8; 32]; 150 | 151 | pbkdf2::pbkdf2::>(password.as_ref(), &pbkdf2_salt, pbkdf2_iterations, &mut key)?; 152 | 153 | let key = GenericArray::from_slice(&key); 154 | let cipher = Aes256Gcm::new(key); 155 | 156 | let aes_iv = GenericArray::from_slice(&aes_iv); 157 | 158 | let mut buf = vec![0_u8; data.remaining()]; 159 | data.copy_to_slice(&mut buf); 160 | 161 | cipher.decrypt_in_place(aes_iv, &[], &mut buf)?; 162 | 163 | Ok(buf) 164 | } 165 | 166 | fn encrypt(wr: &mut impl BufMut, data: &[u8], password: impl AsRef<[u8]>) -> Result<(), Error> { 167 | let pbkdf2_iterations = random_iterations(); 168 | let pbkdf2_salt = random_salt(); 169 | let aes_iv = random_array(); 170 | 171 | let mut key = [0_u8; 32]; 172 | 173 | pbkdf2::pbkdf2::>(password.as_ref(), &pbkdf2_salt, pbkdf2_iterations, &mut key)?; 174 | 175 | let key = GenericArray::from_slice(&key); 176 | let cipher = Aes256Gcm::new(key); 177 | 178 | let mut buf = data.to_owned(); 179 | 180 | cipher.encrypt_in_place(&aes_iv, &[], &mut buf)?; 181 | 182 | wr.put_u32(pbkdf2_iterations); 183 | wr.put(&pbkdf2_salt[..]); 184 | wr.put(&aes_iv[..]); 185 | 186 | wr.put(&buf[..]); 187 | 188 | Ok(()) 189 | } 190 | 191 | fn random_iterations() -> u32 { 192 | if cfg!(test) { 193 | 140_000 194 | } else { 195 | rand::thread_rng().gen_range(140_000..=160_000) 196 | } 197 | } 198 | 199 | fn random_salt() -> [u8; 12] { 200 | if cfg!(test) { 201 | [0; 12] 202 | } else { 203 | rand::thread_rng().gen() 204 | } 205 | } 206 | 207 | fn random_array>() -> GenericArray { 208 | let mut array = GenericArray::default(); 209 | if cfg!(not(test)) { 210 | rand::thread_rng().fill_bytes(&mut array); 211 | } 212 | 213 | array 214 | } 215 | 216 | pub fn load( 217 | data: &mut impl Buf, 218 | password: Option>, 219 | ) -> Result, Error> { 220 | let json = match password { 221 | Some(pw) => decrypt(data, pw)?, 222 | None => { 223 | let mut buf = vec![0_u8; data.remaining()]; 224 | data.copy_to_slice(&mut buf); 225 | buf 226 | } 227 | }; 228 | 229 | Ok(serde_json::from_slice::>(&json)? 230 | .into_iter() 231 | .map(Into::into) 232 | .collect()) 233 | } 234 | 235 | pub fn save( 236 | buf: &mut impl BufMut, 237 | data: &[otti_core::Account], 238 | password: Option>, 239 | ) -> Result<(), Error> { 240 | let json = serde_json::to_vec(&data.iter().map(Into::into).collect::>())?; 241 | 242 | match password { 243 | Some(pw) => encrypt(buf, &json, pw), 244 | None => { 245 | buf.put(json.as_ref()); 246 | Ok(()) 247 | } 248 | } 249 | } 250 | 251 | #[cfg(test)] 252 | mod tests { 253 | use std::collections::BTreeMap; 254 | 255 | use pretty_assertions::assert_eq; 256 | use serde_json::json; 257 | 258 | use super::*; 259 | 260 | #[test] 261 | fn roundtrip_plain() { 262 | let file = include_bytes!("../import/otp_accounts.json"); 263 | let accounts = load(&mut &file[..], None::<&str>).unwrap(); 264 | 265 | let mut file = Vec::new(); 266 | save(&mut file, &accounts, None::<&str>).unwrap(); 267 | 268 | load(&mut file.as_slice(), None::<&str>).unwrap(); 269 | } 270 | 271 | #[test] 272 | fn roundtrip_encrypted() { 273 | let file = include_bytes!("../import/otp_accounts.json.aes"); 274 | let accounts = load(&mut &file[..], Some("123")).unwrap(); 275 | 276 | let mut file = Vec::new(); 277 | save(&mut file, &accounts, Some("abc")).unwrap(); 278 | 279 | load(&mut file.as_slice(), Some("abc")).unwrap(); 280 | } 281 | 282 | #[test] 283 | fn export_plain() { 284 | let mut export = Vec::new(); 285 | let data = [otti_core::Account { 286 | label: "Entry 1".to_owned(), 287 | secret: Key::new(vec![0; 10]), 288 | digits: 6, 289 | otp: otti_core::Otp::Totp { window: 30 }, 290 | algorithm: otti_core::Algorithm::Sha1, 291 | issuer: Some("Provider 1".to_owned()), 292 | meta: otti_core::Metadata { 293 | tags: vec!["Tag 1".to_owned()], 294 | }, 295 | extras: BTreeMap::new(), 296 | }]; 297 | 298 | save(&mut export, &data, None::<&str>).unwrap(); 299 | 300 | let output = serde_json::from_slice::(&export).unwrap(); 301 | let expected = json! {[{ 302 | "secret": "AAAAAAAAAAAAAAAA", 303 | "issuer": "Provider 1", 304 | "label": "Entry 1", 305 | "digits": 6, 306 | "type": "TOTP", 307 | "algorithm": "SHA1", 308 | "period": 30, 309 | "tags": ["Tag 1"] 310 | }]}; 311 | 312 | assert_eq!(expected, output); 313 | } 314 | 315 | #[test] 316 | fn export_encrypted() { 317 | let mut export = Vec::new(); 318 | let data = [otti_core::Account { 319 | label: "Entry 1".to_owned(), 320 | secret: Key::new(vec![0; 10]), 321 | digits: 6, 322 | otp: otti_core::Otp::Totp { window: 30 }, 323 | algorithm: otti_core::Algorithm::Sha1, 324 | issuer: Some("Provider 1".to_owned()), 325 | meta: otti_core::Metadata { 326 | tags: vec!["Tag 1".to_owned()], 327 | }, 328 | extras: BTreeMap::new(), 329 | }]; 330 | 331 | save(&mut export, &data, Some("123")).unwrap(); 332 | 333 | let expected = &[ 334 | 0, 2, 34, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 335 | 250, 20, 76, 80, 153, 125, 227, 57, 156, 218, 81, 56, 116, 107, 180, 59, 171, 211, 105, 336 | 7, 144, 171, 56, 249, 230, 250, 195, 65, 45, 142, 78, 42, 254, 64, 123, 17, 126, 126, 337 | 172, 61, 188, 31, 229, 97, 172, 244, 91, 119, 78, 12, 156, 108, 204, 188, 109, 27, 203, 338 | 190, 160, 111, 246, 16, 124, 80, 164, 210, 141, 104, 251, 69, 155, 139, 119, 25, 40, 339 | 136, 216, 55, 120, 104, 135, 150, 145, 142, 226, 155, 40, 188, 11, 160, 129, 25, 136, 340 | 172, 155, 95, 137, 12, 2, 176, 208, 72, 49, 192, 113, 117, 143, 66, 184, 184, 182, 208, 341 | 235, 170, 14, 12, 134, 226, 73, 86, 164, 96, 152, 96, 219, 19, 6, 154, 252, 205, 47, 342 | 180, 208, 91, 57, 116, 223, 213, 49, 87, 46, 188, 231, 235, 3, 163, 169, 236, 88, 228, 343 | 119, 186, 100, 147, 97, 57, 252, 112, 245, 228, 344 | ]; 345 | 346 | assert_eq!(expected, export.as_slice()); 347 | } 348 | } 349 | -------------------------------------------------------------------------------- /provider-authpro/src/lib.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | collections::BTreeMap, 3 | convert::{TryFrom, TryInto}, 4 | }; 5 | 6 | use aes::{ 7 | cipher::{ 8 | block_padding::Pkcs7, 9 | generic_array::{ArrayLength, GenericArray}, 10 | BlockDecryptMut, BlockEncryptMut, KeyIvInit, 11 | }, 12 | Aes256, 13 | }; 14 | use bytes::{Buf, BufMut}; 15 | use hmac::Hmac; 16 | use otti_core::{ExposeSecret, Key}; 17 | use rand::{Rng, RngCore}; 18 | use serde::{Deserialize, Serialize}; 19 | use serde_repr::{Deserialize_repr, Serialize_repr}; 20 | use sha1::Sha1; 21 | 22 | mod de; 23 | 24 | #[derive(Debug, thiserror::Error)] 25 | pub enum Error { 26 | #[error("the import data is too short")] 27 | InputTooShort, 28 | #[error("the data header was invalid")] 29 | InvalidHeader, 30 | #[error("the cryptographic key length doesn't match the cipher")] 31 | InvalidLength(#[from] pbkdf2::hmac::digest::InvalidLength), 32 | #[error("data decryption failed")] 33 | Aes(#[from] block_padding::UnpadError), 34 | #[error("JSON (de-)serialization failed")] 35 | Json(#[from] serde_json::Error), 36 | #[error("the OTP type `{0:?}` is not supported yet")] 37 | UnsupportedOtpType(OtpType), 38 | } 39 | 40 | #[derive(Serialize, Deserialize)] 41 | #[serde(rename_all = "PascalCase")] 42 | struct Backup { 43 | authenticators: Vec, 44 | categories: Vec, 45 | authenticator_categories: Vec, 46 | custom_icons: Vec, 47 | } 48 | 49 | #[derive(Serialize, Deserialize)] 50 | #[serde(rename_all = "PascalCase")] 51 | struct Authenticator { 52 | #[serde(rename = "Type")] 53 | ty: OtpType, 54 | icon: Option, 55 | issuer: String, 56 | username: String, 57 | #[serde(with = "otti_core::de::base32_string")] 58 | secret: Vec, 59 | algorithm: Algorithm, 60 | digits: u8, 61 | period: u64, 62 | counter: u64, 63 | ranking: u64, 64 | } 65 | 66 | const EXTRA_RANKING: &str = "authpro/ranking"; 67 | 68 | struct AuthenticatorWithCategories<'a>(Authenticator, Vec<&'a Category>); 69 | 70 | impl<'a> TryFrom> for otti_core::Account { 71 | type Error = Error; 72 | 73 | fn try_from(ac: AuthenticatorWithCategories<'a>) -> Result { 74 | let (a, c) = (ac.0, ac.1); 75 | 76 | let mut extras = BTreeMap::new(); 77 | if a.ranking > 0 { 78 | extras.insert(EXTRA_RANKING.to_owned(), a.ranking.to_be_bytes().to_vec()); 79 | } 80 | 81 | Ok(Self { 82 | label: a.username, 83 | secret: Key::new(a.secret), 84 | digits: a.digits, 85 | otp: match a.ty { 86 | OtpType::Hotp => otti_core::Otp::Hotp { counter: a.counter }, 87 | OtpType::Totp => otti_core::Otp::Totp { window: a.period }, 88 | OtpType::Steam => otti_core::Otp::Steam { period: a.period }, 89 | OtpType::Motp => return Err(Error::UnsupportedOtpType(a.ty)), 90 | }, 91 | algorithm: a.algorithm.into(), 92 | issuer: Some(a.issuer), 93 | meta: otti_core::Metadata { 94 | tags: c.iter().map(|c| c.name.clone()).collect(), 95 | }, 96 | extras, 97 | }) 98 | } 99 | } 100 | 101 | impl From<&otti_core::Account> for Authenticator { 102 | fn from(a: &otti_core::Account) -> Self { 103 | Self { 104 | ty: match a.otp { 105 | otti_core::Otp::Hotp { .. } => OtpType::Hotp, 106 | otti_core::Otp::Totp { .. } => OtpType::Totp, 107 | otti_core::Otp::Steam { .. } => OtpType::Steam, 108 | }, 109 | icon: None, 110 | issuer: a.issuer.clone().unwrap_or_default(), 111 | username: a.label.clone(), 112 | secret: a.secret.expose_secret().clone(), 113 | algorithm: a.algorithm.into(), 114 | digits: a.digits, 115 | period: match a.otp { 116 | otti_core::Otp::Hotp { .. } => 0, 117 | otti_core::Otp::Totp { window } => window, 118 | otti_core::Otp::Steam { period } => period, 119 | }, 120 | counter: match a.otp { 121 | otti_core::Otp::Hotp { counter } => counter, 122 | otti_core::Otp::Totp { .. } | otti_core::Otp::Steam { .. } => 0, 123 | }, 124 | ranking: a 125 | .extras 126 | .get(EXTRA_RANKING) 127 | .and_then(|v| v.as_slice().try_into().ok().map(u64::from_be_bytes)) 128 | .unwrap_or_default(), 129 | } 130 | } 131 | } 132 | 133 | #[derive(Clone, Copy, Debug, Serialize_repr, Deserialize_repr)] 134 | #[repr(u8)] 135 | pub enum OtpType { 136 | Hotp = 1, 137 | Totp = 2, 138 | Motp = 3, 139 | Steam = 4, 140 | } 141 | 142 | #[derive(Clone, Copy, Serialize_repr, Deserialize_repr)] 143 | #[repr(u8)] 144 | enum Algorithm { 145 | Sha1 = 0, 146 | Sha256 = 1, 147 | Sha512 = 2, 148 | } 149 | 150 | impl From for otti_core::Algorithm { 151 | fn from(a: Algorithm) -> Self { 152 | match a { 153 | Algorithm::Sha1 => Self::Sha1, 154 | Algorithm::Sha256 => Self::Sha256, 155 | Algorithm::Sha512 => Self::Sha512, 156 | } 157 | } 158 | } 159 | 160 | impl From for Algorithm { 161 | fn from(a: otti_core::Algorithm) -> Self { 162 | match a { 163 | otti_core::Algorithm::Sha1 => Self::Sha1, 164 | otti_core::Algorithm::Sha256 => Self::Sha256, 165 | otti_core::Algorithm::Sha512 => Self::Sha512, 166 | } 167 | } 168 | } 169 | 170 | #[derive(Serialize, Deserialize)] 171 | #[serde(rename_all = "PascalCase")] 172 | struct Category { 173 | id: String, 174 | name: String, 175 | ranking: u64, 176 | } 177 | 178 | #[derive(Serialize, Deserialize)] 179 | #[serde(rename_all = "PascalCase")] 180 | struct AuthenticatorCategory { 181 | category_id: String, 182 | #[serde(with = "otti_core::de::base32_string")] 183 | authenticator_secret: Vec, 184 | ranking: u64, 185 | } 186 | 187 | #[derive(Serialize, Deserialize)] 188 | #[serde(rename_all = "PascalCase")] 189 | struct CustomIcon { 190 | id: String, 191 | #[serde(with = "de::base64_string")] 192 | data: Vec, 193 | } 194 | 195 | /// Fixed header present at the start of an encrypted backup. 196 | const HEADER: &str = "AuthenticatorPro"; 197 | /// Amount of rounds for [`pbkdf2`] key derivation. 198 | const PBKDF2_ROUNDS: u32 = 64000; 199 | /// Size of the key for AES en-/decryption. 200 | const KEY_SIZE: usize = 32; 201 | /// Size of the salt used in the key derivation. 202 | const SALT_SIZE: usize = 20; 203 | /// Size of the initialization vector for AES en-/decryption. 204 | const BLOCK_SIZE: usize = 16; 205 | 206 | fn decrypt(data: &mut impl Buf, password: impl AsRef<[u8]>) -> Result, Error> { 207 | if data.remaining() <= HEADER.len() + SALT_SIZE + BLOCK_SIZE { 208 | return Err(Error::InputTooShort); 209 | } 210 | 211 | let header = data.copy_to_bytes(HEADER.len()); 212 | if header != HEADER.as_bytes() { 213 | return Err(Error::InvalidHeader); 214 | } 215 | 216 | let pbkdf2_salt = data.copy_to_bytes(SALT_SIZE); 217 | let aes_iv = data.copy_to_bytes(BLOCK_SIZE); 218 | 219 | let mut key = [0_u8; KEY_SIZE]; 220 | 221 | pbkdf2::pbkdf2::>(password.as_ref(), &pbkdf2_salt, PBKDF2_ROUNDS, &mut key)?; 222 | 223 | let key = GenericArray::from_slice(&key); 224 | let aes_iv = GenericArray::from_slice(&aes_iv); 225 | 226 | let cipher = >::new(key, aes_iv); 227 | 228 | cipher 229 | .decrypt_padded_vec_mut::(data.chunk()) 230 | .map_err(Into::into) 231 | } 232 | 233 | fn encrypt(wr: &mut impl BufMut, data: &[u8], password: impl AsRef<[u8]>) -> Result<(), Error> { 234 | let pbkdf2_salt = random_salt(); 235 | let aes_iv = random_array(); 236 | 237 | let mut key = [0_u8; KEY_SIZE]; 238 | 239 | pbkdf2::pbkdf2::>(password.as_ref(), &pbkdf2_salt, PBKDF2_ROUNDS, &mut key)?; 240 | 241 | let key = GenericArray::from_slice(&key); 242 | let cipher = >::new(key, &aes_iv); 243 | 244 | let buf = cipher.encrypt_padded_vec_mut::(data); 245 | 246 | wr.put(HEADER.as_bytes()); 247 | wr.put(&pbkdf2_salt[..]); 248 | wr.put(&aes_iv[..]); 249 | wr.put(&buf[..]); 250 | 251 | Ok(()) 252 | } 253 | 254 | fn random_salt() -> [u8; SALT_SIZE] { 255 | if cfg!(test) { 256 | [0; SALT_SIZE] 257 | } else { 258 | rand::thread_rng().gen() 259 | } 260 | } 261 | 262 | fn random_array>() -> GenericArray { 263 | let mut array = GenericArray::default(); 264 | if cfg!(not(test)) { 265 | rand::thread_rng().fill_bytes(&mut array); 266 | } 267 | 268 | array 269 | } 270 | 271 | pub fn load( 272 | data: &mut impl Buf, 273 | password: Option>, 274 | ) -> Result, Error> { 275 | let Backup { 276 | authenticators, 277 | categories, 278 | authenticator_categories, 279 | .. 280 | } = match password { 281 | Some(pw) => { 282 | let buf = decrypt(data, pw)?; 283 | serde_json::from_slice::(&buf)? 284 | } 285 | None => serde_json::from_reader::<_, Backup>(data.reader())?, 286 | }; 287 | 288 | authenticators 289 | .into_iter() 290 | .map(|auth| { 291 | let categories = authenticator_categories 292 | .iter() 293 | .filter(|ac| ac.authenticator_secret == auth.secret) 294 | .filter_map(|ac| categories.iter().find(|cat| cat.id == ac.category_id)) 295 | .collect(); 296 | 297 | AuthenticatorWithCategories(auth, categories).try_into() 298 | }) 299 | .collect() 300 | } 301 | 302 | pub fn save( 303 | buf: &mut impl BufMut, 304 | data: &[otti_core::Account], 305 | password: Option>, 306 | ) -> Result<(), Error> { 307 | let json = serde_json::to_vec(&Backup { 308 | authenticators: data.iter().map(Into::into).collect(), 309 | categories: vec![], 310 | authenticator_categories: vec![], 311 | custom_icons: vec![], 312 | })?; 313 | 314 | match password { 315 | Some(pw) => encrypt(buf, &json, pw), 316 | None => { 317 | buf.put(json.as_ref()); 318 | Ok(()) 319 | } 320 | } 321 | } 322 | 323 | #[cfg(test)] 324 | mod tests { 325 | use maplit::btreemap; 326 | use pretty_assertions::assert_eq; 327 | use serde_json::json; 328 | 329 | use super::*; 330 | 331 | #[test] 332 | fn roundtrip_plain() { 333 | let file = include_bytes!("../import/backup.json"); 334 | let accounts = load(&mut &file[..], None::<&str>).unwrap(); 335 | 336 | let mut file = Vec::new(); 337 | save(&mut file, &accounts, None::<&str>).unwrap(); 338 | 339 | load(&mut file.as_slice(), None::<&str>).unwrap(); 340 | } 341 | 342 | #[test] 343 | fn roundtrip_encrypted() { 344 | let file = include_bytes!("../import/backup.authpro"); 345 | let accounts = load(&mut &file[..], Some("123")).unwrap(); 346 | 347 | let mut file = Vec::new(); 348 | save(&mut file, &accounts, Some("abc")).unwrap(); 349 | 350 | load(&mut file.as_slice(), Some("abc")).unwrap(); 351 | } 352 | 353 | #[test] 354 | fn export_plain() { 355 | let mut export = Vec::new(); 356 | let data = [otti_core::Account { 357 | label: "Entry 1".to_owned(), 358 | secret: Key::new(vec![0; 10]), 359 | digits: 6, 360 | otp: otti_core::Otp::Totp { window: 30 }, 361 | algorithm: otti_core::Algorithm::Sha1, 362 | issuer: Some("Provider 1".to_owned()), 363 | meta: otti_core::Metadata { 364 | tags: vec!["Tag 1".to_owned()], 365 | }, 366 | extras: btreemap! { 367 | "authpro/ranking".to_owned() => vec![0, 0, 0, 0, 0, 0, 0, 5], 368 | }, 369 | }]; 370 | 371 | save(&mut export, &data, None::<&str>).unwrap(); 372 | 373 | let output = serde_json::from_slice::(&export).unwrap(); 374 | let expected = json! {{ 375 | "Authenticators": [{ 376 | "Type": 2, 377 | "Icon": null, 378 | "Issuer": "Provider 1", 379 | "Username": "Entry 1", 380 | "Secret": "AAAAAAAAAAAAAAAA", 381 | "Algorithm": 0, 382 | "Digits": 6, 383 | "Period": 30, 384 | "Counter": 0, 385 | "Ranking": 5 386 | }], 387 | "Categories": [], 388 | "AuthenticatorCategories": [], 389 | "CustomIcons": [] 390 | }}; 391 | 392 | assert_eq!(expected, output); 393 | } 394 | 395 | #[test] 396 | fn export_encrypted() { 397 | let mut export = Vec::new(); 398 | let data = [otti_core::Account { 399 | label: "Entry 1".to_owned(), 400 | secret: Key::new(vec![0; 10]), 401 | digits: 6, 402 | otp: otti_core::Otp::Totp { window: 30 }, 403 | algorithm: otti_core::Algorithm::Sha1, 404 | issuer: Some("Provider 1".to_owned()), 405 | meta: otti_core::Metadata { 406 | tags: vec!["Tag 1".to_owned()], 407 | }, 408 | extras: btreemap! { 409 | "authpro/ranking".to_owned() => vec![0, 0, 0, 0, 0, 0, 0, 5], 410 | }, 411 | }]; 412 | 413 | save(&mut export, &data, Some("123")).unwrap(); 414 | 415 | let expected = &[ 416 | 65, 117, 116, 104, 101, 110, 116, 105, 99, 97, 116, 111, 114, 80, 114, 111, 0, 0, 0, 0, 417 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 418 | 0, 0, 0, 155, 189, 28, 124, 174, 147, 211, 183, 46, 183, 109, 25, 58, 172, 146, 42, 419 | 126, 81, 228, 60, 142, 32, 122, 183, 102, 21, 231, 171, 49, 153, 226, 5, 150, 184, 135, 420 | 140, 210, 53, 152, 15, 35, 182, 39, 86, 245, 150, 218, 245, 195, 91, 1, 124, 75, 206, 421 | 163, 81, 207, 108, 39, 84, 41, 9, 106, 59, 247, 42, 220, 229, 72, 172, 81, 162, 227, 422 | 24, 249, 196, 54, 28, 193, 29, 107, 221, 186, 66, 194, 111, 218, 210, 179, 192, 143, 423 | 162, 210, 77, 84, 93, 224, 151, 163, 240, 181, 31, 82, 247, 20, 118, 28, 165, 247, 100, 424 | 168, 180, 111, 123, 111, 151, 72, 175, 109, 165, 5, 151, 6, 44, 126, 207, 36, 251, 227, 425 | 95, 158, 29, 237, 99, 65, 21, 237, 162, 97, 185, 110, 154, 40, 214, 61, 104, 206, 48, 426 | 181, 130, 240, 222, 195, 16, 85, 46, 61, 83, 102, 14, 161, 206, 206, 228, 18, 251, 230, 427 | 133, 115, 21, 39, 90, 113, 100, 156, 238, 47, 17, 97, 131, 32, 88, 10, 128, 195, 122, 428 | 224, 1, 210, 110, 168, 68, 140, 220, 194, 86, 29, 121, 132, 249, 71, 135, 177, 122, 429 | 222, 49, 0, 226, 81, 165, 32, 247, 66, 9, 54, 61, 124, 95, 215, 23, 110, 32, 16, 122, 430 | 153, 31, 102, 31, 65, 90, 162, 135, 241, 9, 231, 149, 187, 140, 10, 35, 431 | ]; 432 | 433 | assert_eq!(expected, export.as_slice()); 434 | } 435 | } 436 | -------------------------------------------------------------------------------- /provider-aegis/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! # Otti - Provier `Aegis` 2 | //! 3 | //! Import/Export component that allows to transform between the Otti accounts and backups from/to 4 | //! the [`Aegis Authenticator`](https://github.com/beemdevelopment/Aegis). 5 | 6 | use std::collections::BTreeMap; 7 | 8 | use aes_gcm::{ 9 | aead::generic_array::{ArrayLength, GenericArray}, 10 | AeadInPlace, Aes256Gcm, KeyInit, 11 | }; 12 | pub use bytes::{Buf, BufMut}; 13 | use otti_core::{ExposeSecret, Key}; 14 | #[cfg(not(test))] 15 | use rand::prelude::*; 16 | use scrypt::Params as ScryptParams; 17 | use serde::{Deserialize, Serialize}; 18 | use serde_repr::{Deserialize_repr, Serialize_repr}; 19 | use uuid::Uuid; 20 | 21 | mod de; 22 | 23 | #[derive(Debug, thiserror::Error)] 24 | pub enum Error { 25 | #[error("JSON (de-)serialization failed")] 26 | Json(#[from] serde_json::Error), 27 | #[error("data en-/decryption failed")] 28 | Aead(#[from] aes_gcm::Error), 29 | #[error("the backup file can't be opened with a password")] 30 | NoPasswordEntry, 31 | #[error("scrypt output length invalid")] 32 | ScryptLength(#[from] scrypt::errors::InvalidOutputLen), 33 | #[error("invalid scrypt parameters")] 34 | ScryptParams(#[from] scrypt::errors::InvalidParams), 35 | } 36 | 37 | #[derive(Debug, Serialize, Deserialize)] 38 | struct Export { 39 | version: ExportVersion, 40 | header: Header, 41 | #[serde(with = "de::base64_string")] 42 | db: Vec, 43 | } 44 | 45 | #[derive(Clone, Copy, Debug, Serialize_repr, Deserialize_repr)] 46 | #[repr(u8)] 47 | enum ExportVersion { 48 | V1 = 1, 49 | } 50 | 51 | #[derive(Debug, Serialize, Deserialize)] 52 | struct Header { 53 | slots: Vec, 54 | params: KeyParams, 55 | } 56 | 57 | #[derive(Debug, Serialize, Deserialize)] 58 | struct Slot { 59 | #[serde(rename = "type")] 60 | ty: u8, 61 | uuid: String, 62 | #[serde(with = "de::hex_string")] 63 | key: Vec, 64 | key_params: KeyParams, 65 | #[serde(flatten)] 66 | password_slot: Option, 67 | } 68 | 69 | const SLOT_TYPE_PASSWORD: u8 = 1; 70 | 71 | #[derive(Debug, Serialize, Deserialize)] 72 | struct PasswordSlot { 73 | n: u32, 74 | r: u32, 75 | p: u32, 76 | #[serde(with = "de::hex_string")] 77 | salt: Vec, 78 | repaired: bool, 79 | } 80 | 81 | #[derive(Debug, Serialize, Deserialize)] 82 | struct KeyParams { 83 | #[serde(with = "de::hex_string")] 84 | nonce: Vec, 85 | #[serde(with = "de::hex_string")] 86 | tag: Vec, 87 | } 88 | 89 | #[derive(Debug, Serialize, Deserialize)] 90 | struct Vault { 91 | version: VaultVersion, 92 | entries: Vec, 93 | } 94 | 95 | #[derive(Clone, Copy, Debug, Serialize_repr, Deserialize_repr)] 96 | #[repr(u8)] 97 | enum VaultVersion { 98 | V1 = 1, 99 | V2 = 2, 100 | } 101 | 102 | #[derive(Debug, Serialize, Deserialize)] 103 | struct Entry { 104 | #[serde(flatten, rename = "type")] 105 | ty: EntryType, 106 | uuid: String, 107 | name: String, 108 | issuer: String, 109 | #[serde(skip_serializing_if = "Option::is_none")] 110 | group: Option, 111 | #[serde(with = "de::base64_string::option")] 112 | icon: Option>, 113 | #[serde(skip_serializing_if = "Option::is_none")] 114 | icon_mime: Option, 115 | note: String, 116 | } 117 | 118 | const EXTRA_ICON: &str = "aegis/icon"; 119 | const EXTRA_ICON_MIME: &str = "aegis/icon_mime"; 120 | const EXTRA_NOTE: &str = "aegis/note"; 121 | 122 | impl From for otti_core::Account { 123 | fn from(e: Entry) -> Self { 124 | let (info, otp) = match e.ty { 125 | EntryType::Hotp { info, counter } => (info, otti_core::Otp::Hotp { counter }), 126 | EntryType::Totp { info, period } => (info, otti_core::Otp::Totp { window: period }), 127 | EntryType::Steam { info, period } => (info, otti_core::Otp::Steam { period }), 128 | }; 129 | 130 | let mut extras = BTreeMap::new(); 131 | if let Some(icon) = e.icon { 132 | extras.insert(EXTRA_ICON.to_owned(), icon); 133 | } 134 | if let Some(icon_mime) = e.icon_mime { 135 | extras.insert(EXTRA_ICON_MIME.to_owned(), icon_mime.into_bytes()); 136 | } 137 | if !e.note.is_empty() { 138 | extras.insert(EXTRA_NOTE.to_owned(), e.note.into_bytes()); 139 | } 140 | 141 | Self { 142 | label: e.name, 143 | secret: Key::new(info.secret), 144 | digits: info.digits, 145 | otp, 146 | algorithm: info.algo.into(), 147 | issuer: Some(e.issuer), 148 | meta: otti_core::Metadata { 149 | tags: match e.group { 150 | Some(g) => vec![g], 151 | None => vec![], 152 | }, 153 | }, 154 | extras, 155 | } 156 | } 157 | } 158 | 159 | impl From<&otti_core::Account> for Entry { 160 | fn from(a: &otti_core::Account) -> Self { 161 | let info = OtpInfo { 162 | secret: a.secret.expose_secret().clone(), 163 | algo: a.algorithm.into(), 164 | digits: a.digits, 165 | }; 166 | 167 | Self { 168 | ty: match a.otp { 169 | otti_core::Otp::Hotp { counter } => EntryType::Hotp { info, counter }, 170 | otti_core::Otp::Totp { window } => EntryType::Totp { 171 | info, 172 | period: window, 173 | }, 174 | otti_core::Otp::Steam { period } => EntryType::Steam { info, period }, 175 | }, 176 | uuid: random_uuid(), 177 | name: a.label.clone(), 178 | issuer: a.issuer.clone().unwrap_or_default(), 179 | group: a.meta.tags.first().cloned(), 180 | icon: a.extras.get(EXTRA_ICON).cloned(), 181 | icon_mime: a 182 | .extras 183 | .get(EXTRA_ICON_MIME) 184 | .cloned() 185 | .and_then(|v| String::from_utf8(v).ok()), 186 | note: a 187 | .extras 188 | .get(EXTRA_NOTE) 189 | .cloned() 190 | .and_then(|v| String::from_utf8(v).ok()) 191 | .unwrap_or_default(), 192 | } 193 | } 194 | } 195 | 196 | #[derive(Debug, Serialize, Deserialize)] 197 | #[serde(rename_all = "lowercase")] 198 | #[serde(tag = "type", content = "info")] 199 | enum EntryType { 200 | Hotp { 201 | #[serde(flatten)] 202 | info: OtpInfo, 203 | counter: u64, 204 | }, 205 | Totp { 206 | #[serde(flatten)] 207 | info: OtpInfo, 208 | period: u64, 209 | }, 210 | Steam { 211 | #[serde(flatten)] 212 | info: OtpInfo, 213 | period: u64, 214 | }, 215 | } 216 | 217 | #[derive(Debug, Serialize, Deserialize)] 218 | struct OtpInfo { 219 | #[serde(with = "otti_core::de::base32_string")] 220 | secret: Vec, 221 | algo: Algorithm, 222 | digits: u8, 223 | } 224 | 225 | #[derive(Debug, Serialize, Deserialize)] 226 | #[serde(rename_all = "UPPERCASE")] 227 | enum Algorithm { 228 | Sha1, 229 | Sha256, 230 | Sha512, 231 | } 232 | 233 | impl From for otti_core::Algorithm { 234 | fn from(a: Algorithm) -> Self { 235 | match a { 236 | Algorithm::Sha1 => Self::Sha1, 237 | Algorithm::Sha256 => Self::Sha256, 238 | Algorithm::Sha512 => Self::Sha512, 239 | } 240 | } 241 | } 242 | 243 | impl From for Algorithm { 244 | fn from(a: otti_core::Algorithm) -> Self { 245 | match a { 246 | otti_core::Algorithm::Sha1 => Self::Sha1, 247 | otti_core::Algorithm::Sha256 => Self::Sha256, 248 | otti_core::Algorithm::Sha512 => Self::Sha512, 249 | } 250 | } 251 | } 252 | 253 | #[derive(Debug, Serialize, Deserialize)] 254 | struct ExportPlain { 255 | version: u8, 256 | header: EmptyHeader, 257 | db: Vault, 258 | } 259 | 260 | #[derive(Default, Debug, Serialize, Deserialize)] 261 | struct EmptyHeader { 262 | slots: Option<()>, 263 | params: Option<()>, 264 | } 265 | 266 | fn decrypt(data: &mut impl Buf, password: impl AsRef<[u8]>) -> Result, Error> { 267 | let mut export = serde_json::from_reader::<_, Export>(data.reader())?; 268 | let mut slot = export 269 | .header 270 | .slots 271 | .into_iter() 272 | .find(|s| s.ty == SLOT_TYPE_PASSWORD) 273 | .ok_or(Error::NoPasswordEntry)?; 274 | 275 | let PasswordSlot { n, r, p, salt, .. } = slot.password_slot.ok_or(Error::NoPasswordEntry)?; 276 | 277 | let mut key = [0u8; 32]; 278 | 279 | scrypt::scrypt( 280 | password.as_ref(), 281 | &salt, 282 | &ScryptParams::new( 283 | f64::from(n).log2() as u8, 284 | r, 285 | p, 286 | ScryptParams::RECOMMENDED_LEN, 287 | )?, 288 | &mut key, 289 | )?; 290 | 291 | let key = GenericArray::from_slice(&key); 292 | let cipher = Aes256Gcm::new(key); 293 | 294 | let nonce = GenericArray::from_slice(&slot.key_params.nonce); 295 | let tag = GenericArray::from_slice(&slot.key_params.tag); 296 | 297 | cipher.decrypt_in_place_detached(nonce, &[], &mut slot.key, tag)?; 298 | 299 | let key = GenericArray::from_slice(&slot.key); 300 | let cipher = Aes256Gcm::new(key); 301 | 302 | let nonce = GenericArray::from_slice(&export.header.params.nonce); 303 | let tag = GenericArray::from_slice(&export.header.params.tag); 304 | 305 | cipher.decrypt_in_place_detached(nonce, &[], &mut export.db, tag)?; 306 | 307 | Ok(export.db) 308 | } 309 | 310 | fn encrypt(wr: &mut impl BufMut, data: &[u8], password: impl AsRef<[u8]>) -> Result<(), Error> { 311 | let mut data = data.to_owned(); 312 | 313 | let salt = random_salt(); 314 | let (log_n, r, p) = (15, 8, 1); 315 | 316 | let mut key = [0u8; 32]; 317 | 318 | scrypt::scrypt( 319 | password.as_ref(), 320 | &salt, 321 | &ScryptParams::new(log_n, r, p, ScryptParams::RECOMMENDED_LEN)?, 322 | &mut key, 323 | )?; 324 | 325 | let mut data_key = random_array(); 326 | 327 | let data_cipher = Aes256Gcm::new(&data_key); 328 | let data_nonce = random_array(); 329 | 330 | let data_tag = data_cipher.encrypt_in_place_detached(&data_nonce, &[], &mut data)?; 331 | 332 | let slot_key = GenericArray::from_slice(&key); 333 | let slot_cipher = Aes256Gcm::new(slot_key); 334 | let slot_nonce = random_array(); 335 | 336 | let slot_tag = slot_cipher.encrypt_in_place_detached(&slot_nonce, &[], &mut data_key)?; 337 | 338 | let export = Export { 339 | version: ExportVersion::V1, 340 | header: Header { 341 | slots: vec![Slot { 342 | ty: SLOT_TYPE_PASSWORD, 343 | uuid: random_uuid(), 344 | key: data_key.to_vec(), 345 | key_params: KeyParams { 346 | nonce: slot_nonce.to_vec(), 347 | tag: slot_tag.to_vec(), 348 | }, 349 | password_slot: Some(PasswordSlot { 350 | n: 2_u32.pow(log_n as u32), 351 | r, 352 | p, 353 | salt: salt.to_vec(), 354 | repaired: true, 355 | }), 356 | }], 357 | params: KeyParams { 358 | nonce: data_nonce.to_vec(), 359 | tag: data_tag.to_vec(), 360 | }, 361 | }, 362 | db: data, 363 | }; 364 | 365 | serde_json::to_writer(wr.writer(), &export).map_err(Into::into) 366 | } 367 | 368 | #[cfg(not(test))] 369 | fn random_uuid() -> String { 370 | Uuid::new_v4().hyphenated().to_string() 371 | } 372 | 373 | #[cfg(test)] 374 | fn random_uuid() -> String { 375 | Uuid::default().hyphenated().to_string() 376 | } 377 | 378 | #[cfg(not(test))] 379 | fn random_salt() -> [u8; 32] { 380 | rand::thread_rng().gen::<[u8; 32]>() 381 | } 382 | 383 | #[cfg(test)] 384 | fn random_salt() -> [u8; 32] { 385 | [0; 32] 386 | } 387 | 388 | #[cfg(not(test))] 389 | fn random_array>() -> GenericArray { 390 | let mut array = GenericArray::default(); 391 | rand::thread_rng().fill_bytes(&mut array); 392 | array 393 | } 394 | 395 | #[cfg(test)] 396 | fn random_array>() -> GenericArray { 397 | GenericArray::default() 398 | } 399 | 400 | pub fn load( 401 | data: &mut impl Buf, 402 | password: Option>, 403 | ) -> Result, Error> { 404 | let vault = match password { 405 | Some(pw) => { 406 | let buf = decrypt(data, pw)?; 407 | serde_json::from_slice::(&buf)? 408 | } 409 | None => serde_json::from_reader::<_, ExportPlain>(data.reader()).map(|e| e.db)?, 410 | }; 411 | 412 | Ok(vault.entries.into_iter().map(Into::into).collect()) 413 | } 414 | 415 | pub fn save( 416 | buf: &mut impl BufMut, 417 | data: &[otti_core::Account], 418 | password: Option>, 419 | ) -> Result<(), Error> { 420 | let vault = Vault { 421 | version: VaultVersion::V2, 422 | entries: data.iter().map(Into::into).collect::>(), 423 | }; 424 | 425 | match password { 426 | Some(pw) => { 427 | let json = serde_json::to_vec(&vault)?; 428 | encrypt(buf, &json, pw) 429 | } 430 | None => { 431 | let json = serde_json::to_vec(&ExportPlain { 432 | version: 1, 433 | header: EmptyHeader::default(), 434 | db: vault, 435 | })?; 436 | 437 | buf.put(json.as_ref()); 438 | Ok(()) 439 | } 440 | } 441 | } 442 | 443 | #[cfg(test)] 444 | mod tests { 445 | use maplit::btreemap; 446 | use pretty_assertions::assert_eq; 447 | use serde_json::json; 448 | 449 | use super::*; 450 | 451 | #[test] 452 | fn roundtrip_plain() { 453 | let file = include_bytes!("../import/aegis-export-plain.json"); 454 | let accounts = load(&mut &file[..], None::<&str>).unwrap(); 455 | 456 | let mut file = Vec::new(); 457 | save(&mut file, &accounts, None::<&str>).unwrap(); 458 | 459 | load(&mut file.as_slice(), None::<&str>).unwrap(); 460 | } 461 | 462 | #[test] 463 | fn roundtrip_encrypted() { 464 | let file = include_bytes!("../import/aegis-export.json"); 465 | let accounts = load(&mut &file[..], Some("123")).unwrap(); 466 | 467 | let mut file = Vec::new(); 468 | save(&mut file, &accounts, Some("abc")).unwrap(); 469 | 470 | load(&mut file.as_slice(), Some("abc")).unwrap(); 471 | } 472 | 473 | #[test] 474 | fn export_plain() { 475 | let mut export = Vec::new(); 476 | let data = [otti_core::Account { 477 | label: "Entry 1".to_owned(), 478 | secret: Key::new(vec![0; 10]), 479 | digits: 6, 480 | otp: otti_core::Otp::Totp { window: 30 }, 481 | algorithm: otti_core::Algorithm::Sha1, 482 | issuer: Some("Provider 1".to_owned()), 483 | meta: otti_core::Metadata { 484 | tags: vec!["Tag 1".to_owned()], 485 | }, 486 | extras: btreemap! { 487 | "aegis/icon".to_owned() => vec![1, 2, 3, 4], 488 | "aegis/icon_mime".to_owned() => b"image/png".to_vec(), 489 | "aegis/note".to_owned() => b"test".to_vec(), 490 | }, 491 | }]; 492 | 493 | save(&mut export, &data, None::<&str>).unwrap(); 494 | 495 | let output = serde_json::from_slice::(&export).unwrap(); 496 | let expected = json! {{ 497 | "version": 1, 498 | "header": { 499 | "slots": null, 500 | "params": null 501 | }, 502 | "db": { 503 | "version": 2, 504 | "entries": [{ 505 | "type": "totp", 506 | "uuid": "00000000-0000-0000-0000-000000000000", 507 | "name": "Entry 1", 508 | "issuer": "Provider 1", 509 | "group": "Tag 1", 510 | "note": "test", 511 | "icon": "AQIDBA==", 512 | "icon_mime": "image/png", 513 | "info": { 514 | "secret": "AAAAAAAAAAAAAAAA", 515 | "algo": "SHA1", 516 | "digits": 6, 517 | "period": 30 518 | } 519 | }] 520 | } 521 | }}; 522 | 523 | assert_eq!(expected, output); 524 | } 525 | 526 | #[test] 527 | fn export_encrypted() { 528 | let mut export = Vec::new(); 529 | let data = [otti_core::Account { 530 | label: "Entry 1".to_owned(), 531 | secret: Key::new(vec![0; 10]), 532 | digits: 6, 533 | otp: otti_core::Otp::Totp { window: 30 }, 534 | algorithm: otti_core::Algorithm::Sha1, 535 | issuer: Some("Provider 1".to_owned()), 536 | meta: otti_core::Metadata { 537 | tags: vec!["Tag 1".to_owned()], 538 | }, 539 | extras: btreemap! { 540 | "aegis/icon".to_owned() => vec![1, 2, 3, 4], 541 | "aegis/icon_mime".to_owned() => b"image/png".to_vec(), 542 | "aegis/note".to_owned() => b"test".to_vec(), 543 | }, 544 | }]; 545 | 546 | save(&mut export, &data, Some("123")).unwrap(); 547 | 548 | let output = serde_json::from_slice::(&export).unwrap(); 549 | let expected = json! {{ 550 | "version": 1, 551 | "header": { 552 | "slots": [{ 553 | "type": 1, 554 | "uuid": "00000000-0000-0000-0000-000000000000", 555 | "key": "81b1e678128bb925b48d97aa17184fea69dbcef894265623fa796822d229098f", 556 | "key_params": { 557 | "nonce": "000000000000000000000000", 558 | "tag": "4349fe4a53e9bb0a4e1f601fef84be10" 559 | }, 560 | "n": 32768, 561 | "r": 8, 562 | "p": 1, 563 | "salt": "0000000000000000000000000000000000000000000000000000000000000000", 564 | "repaired": true 565 | }], 566 | "params": { 567 | "nonce": "000000000000000000000000", 568 | "tag": "9ea0591d234316df9f29325afa94fedf" 569 | } 570 | }, 571 | "db": "tYU2WD8TAgFpbP/hltH4dgYSaq9EhBAvqoCB9wVjF7T/Pt5cPWjNWSiGP0tlNk3VNCSok+TPXQpDPVyi6k17XpGFzjJg6Wx2IbeAwiD9AM+elWvjiI+XD8qeeA8zN2neicBB4Uz1v1Y239nn3x/MVJYolN5BU8LJQbeHPqMnUCJzT/KLVujZgQfM2BkcrOO2jCRyptJCWJjVPcUHmCf5W9VAhtjRbc9x0SzH+lFh/+bRC1EtF28SUpZ8pVuUJE0CE/lY8Wl4x3mHlXKVJJl9ktHQMBW+qgSIygW7WhL1/39d1OIbQdNhkcviNYxng2xPI7P9VKCo0qZNPIIjx6fGGF8CPQw1W3qFqpPJ58rL8mM=" 572 | }}; 573 | 574 | assert_eq!(expected, output); 575 | } 576 | } 577 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published by 637 | the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "adler" 7 | version = "1.0.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 10 | 11 | [[package]] 12 | name = "aead" 13 | version = "0.5.2" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" 16 | dependencies = [ 17 | "crypto-common", 18 | "generic-array", 19 | ] 20 | 21 | [[package]] 22 | name = "aes" 23 | version = "0.8.3" 24 | source = "registry+https://github.com/rust-lang/crates.io-index" 25 | checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" 26 | dependencies = [ 27 | "cfg-if", 28 | "cipher", 29 | "cpufeatures", 30 | ] 31 | 32 | [[package]] 33 | name = "aes-gcm" 34 | version = "0.10.3" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" 37 | dependencies = [ 38 | "aead", 39 | "aes", 40 | "cipher", 41 | "ctr", 42 | "ghash", 43 | "subtle", 44 | ] 45 | 46 | [[package]] 47 | name = "ahash" 48 | version = "0.8.7" 49 | source = "registry+https://github.com/rust-lang/crates.io-index" 50 | checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" 51 | dependencies = [ 52 | "cfg-if", 53 | "once_cell", 54 | "version_check", 55 | "zerocopy", 56 | ] 57 | 58 | [[package]] 59 | name = "allocator-api2" 60 | version = "0.2.16" 61 | source = "registry+https://github.com/rust-lang/crates.io-index" 62 | checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" 63 | 64 | [[package]] 65 | name = "anstream" 66 | version = "0.6.11" 67 | source = "registry+https://github.com/rust-lang/crates.io-index" 68 | checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" 69 | dependencies = [ 70 | "anstyle", 71 | "anstyle-parse", 72 | "anstyle-query", 73 | "anstyle-wincon", 74 | "colorchoice", 75 | "utf8parse", 76 | ] 77 | 78 | [[package]] 79 | name = "anstyle" 80 | version = "1.0.6" 81 | source = "registry+https://github.com/rust-lang/crates.io-index" 82 | checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" 83 | 84 | [[package]] 85 | name = "anstyle-parse" 86 | version = "0.2.3" 87 | source = "registry+https://github.com/rust-lang/crates.io-index" 88 | checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" 89 | dependencies = [ 90 | "utf8parse", 91 | ] 92 | 93 | [[package]] 94 | name = "anstyle-query" 95 | version = "1.0.2" 96 | source = "registry+https://github.com/rust-lang/crates.io-index" 97 | checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" 98 | dependencies = [ 99 | "windows-sys 0.52.0", 100 | ] 101 | 102 | [[package]] 103 | name = "anstyle-wincon" 104 | version = "3.0.2" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" 107 | dependencies = [ 108 | "anstyle", 109 | "windows-sys 0.52.0", 110 | ] 111 | 112 | [[package]] 113 | name = "anyhow" 114 | version = "1.0.79" 115 | source = "registry+https://github.com/rust-lang/crates.io-index" 116 | checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" 117 | 118 | [[package]] 119 | name = "arboard" 120 | version = "3.3.0" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "aafb29b107435aa276664c1db8954ac27a6e105cdad3c88287a199eb0e313c08" 123 | dependencies = [ 124 | "clipboard-win", 125 | "log", 126 | "objc", 127 | "objc-foundation", 128 | "objc_id", 129 | "parking_lot", 130 | "thiserror", 131 | "winapi", 132 | "x11rb", 133 | ] 134 | 135 | [[package]] 136 | name = "argon2" 137 | version = "0.5.3" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | checksum = "3c3610892ee6e0cbce8ae2700349fcf8f98adb0dbfbee85aec3c9179d29cc072" 140 | dependencies = [ 141 | "base64ct", 142 | "blake2", 143 | "cpufeatures", 144 | "password-hash", 145 | "zeroize", 146 | ] 147 | 148 | [[package]] 149 | name = "autocfg" 150 | version = "1.1.0" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 153 | 154 | [[package]] 155 | name = "base64" 156 | version = "0.21.7" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" 159 | 160 | [[package]] 161 | name = "base64ct" 162 | version = "1.6.0" 163 | source = "registry+https://github.com/rust-lang/crates.io-index" 164 | checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" 165 | 166 | [[package]] 167 | name = "bitflags" 168 | version = "1.3.2" 169 | source = "registry+https://github.com/rust-lang/crates.io-index" 170 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 171 | 172 | [[package]] 173 | name = "bitflags" 174 | version = "2.4.2" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" 177 | 178 | [[package]] 179 | name = "blake2" 180 | version = "0.10.6" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" 183 | dependencies = [ 184 | "digest", 185 | ] 186 | 187 | [[package]] 188 | name = "block" 189 | version = "0.1.6" 190 | source = "registry+https://github.com/rust-lang/crates.io-index" 191 | checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" 192 | 193 | [[package]] 194 | name = "block-buffer" 195 | version = "0.10.4" 196 | source = "registry+https://github.com/rust-lang/crates.io-index" 197 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 198 | dependencies = [ 199 | "generic-array", 200 | ] 201 | 202 | [[package]] 203 | name = "block-padding" 204 | version = "0.3.3" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" 207 | dependencies = [ 208 | "generic-array", 209 | ] 210 | 211 | [[package]] 212 | name = "byteorder" 213 | version = "1.5.0" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 216 | 217 | [[package]] 218 | name = "bytes" 219 | version = "1.5.0" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" 222 | 223 | [[package]] 224 | name = "cassowary" 225 | version = "0.3.0" 226 | source = "registry+https://github.com/rust-lang/crates.io-index" 227 | checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" 228 | 229 | [[package]] 230 | name = "castaway" 231 | version = "0.2.2" 232 | source = "registry+https://github.com/rust-lang/crates.io-index" 233 | checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc" 234 | dependencies = [ 235 | "rustversion", 236 | ] 237 | 238 | [[package]] 239 | name = "cbc" 240 | version = "0.1.2" 241 | source = "registry+https://github.com/rust-lang/crates.io-index" 242 | checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" 243 | dependencies = [ 244 | "cipher", 245 | ] 246 | 247 | [[package]] 248 | name = "cfg-if" 249 | version = "1.0.0" 250 | source = "registry+https://github.com/rust-lang/crates.io-index" 251 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 252 | 253 | [[package]] 254 | name = "chacha20" 255 | version = "0.9.1" 256 | source = "registry+https://github.com/rust-lang/crates.io-index" 257 | checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" 258 | dependencies = [ 259 | "cfg-if", 260 | "cipher", 261 | "cpufeatures", 262 | ] 263 | 264 | [[package]] 265 | name = "chacha20poly1305" 266 | version = "0.10.1" 267 | source = "registry+https://github.com/rust-lang/crates.io-index" 268 | checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" 269 | dependencies = [ 270 | "aead", 271 | "chacha20", 272 | "cipher", 273 | "poly1305", 274 | "zeroize", 275 | ] 276 | 277 | [[package]] 278 | name = "cipher" 279 | version = "0.4.4" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" 282 | dependencies = [ 283 | "crypto-common", 284 | "inout", 285 | "zeroize", 286 | ] 287 | 288 | [[package]] 289 | name = "clap" 290 | version = "4.4.18" 291 | source = "registry+https://github.com/rust-lang/crates.io-index" 292 | checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" 293 | dependencies = [ 294 | "clap_builder", 295 | "clap_derive", 296 | ] 297 | 298 | [[package]] 299 | name = "clap_builder" 300 | version = "4.4.18" 301 | source = "registry+https://github.com/rust-lang/crates.io-index" 302 | checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" 303 | dependencies = [ 304 | "anstream", 305 | "anstyle", 306 | "clap_lex", 307 | "strsim", 308 | ] 309 | 310 | [[package]] 311 | name = "clap_complete" 312 | version = "4.4.10" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "abb745187d7f4d76267b37485a65e0149edd0e91a4cfcdd3f27524ad86cee9f3" 315 | dependencies = [ 316 | "clap", 317 | ] 318 | 319 | [[package]] 320 | name = "clap_derive" 321 | version = "4.4.7" 322 | source = "registry+https://github.com/rust-lang/crates.io-index" 323 | checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" 324 | dependencies = [ 325 | "heck", 326 | "proc-macro2", 327 | "quote", 328 | "syn 2.0.48", 329 | ] 330 | 331 | [[package]] 332 | name = "clap_lex" 333 | version = "0.6.0" 334 | source = "registry+https://github.com/rust-lang/crates.io-index" 335 | checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" 336 | 337 | [[package]] 338 | name = "clap_mangen" 339 | version = "0.2.19" 340 | source = "registry+https://github.com/rust-lang/crates.io-index" 341 | checksum = "8e35a078f3aae828c9b7ad58e1631dab87e9dac40da19418f2219bbf3198aa5c" 342 | dependencies = [ 343 | "clap", 344 | "roff", 345 | ] 346 | 347 | [[package]] 348 | name = "clipboard-win" 349 | version = "4.5.0" 350 | source = "registry+https://github.com/rust-lang/crates.io-index" 351 | checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" 352 | dependencies = [ 353 | "error-code", 354 | "str-buf", 355 | "winapi", 356 | ] 357 | 358 | [[package]] 359 | name = "colorchoice" 360 | version = "1.0.0" 361 | source = "registry+https://github.com/rust-lang/crates.io-index" 362 | checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" 363 | 364 | [[package]] 365 | name = "compact_str" 366 | version = "0.7.1" 367 | source = "registry+https://github.com/rust-lang/crates.io-index" 368 | checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f" 369 | dependencies = [ 370 | "castaway", 371 | "cfg-if", 372 | "itoa", 373 | "ryu", 374 | "static_assertions", 375 | ] 376 | 377 | [[package]] 378 | name = "cpufeatures" 379 | version = "0.2.12" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" 382 | dependencies = [ 383 | "libc", 384 | ] 385 | 386 | [[package]] 387 | name = "crc32fast" 388 | version = "1.3.2" 389 | source = "registry+https://github.com/rust-lang/crates.io-index" 390 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 391 | dependencies = [ 392 | "cfg-if", 393 | ] 394 | 395 | [[package]] 396 | name = "crossbeam-channel" 397 | version = "0.5.11" 398 | source = "registry+https://github.com/rust-lang/crates.io-index" 399 | checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" 400 | dependencies = [ 401 | "crossbeam-utils", 402 | ] 403 | 404 | [[package]] 405 | name = "crossbeam-utils" 406 | version = "0.8.19" 407 | source = "registry+https://github.com/rust-lang/crates.io-index" 408 | checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" 409 | 410 | [[package]] 411 | name = "crossterm" 412 | version = "0.27.0" 413 | source = "registry+https://github.com/rust-lang/crates.io-index" 414 | checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" 415 | dependencies = [ 416 | "bitflags 2.4.2", 417 | "crossterm_winapi", 418 | "libc", 419 | "mio", 420 | "parking_lot", 421 | "signal-hook", 422 | "signal-hook-mio", 423 | "winapi", 424 | ] 425 | 426 | [[package]] 427 | name = "crossterm_winapi" 428 | version = "0.9.1" 429 | source = "registry+https://github.com/rust-lang/crates.io-index" 430 | checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" 431 | dependencies = [ 432 | "winapi", 433 | ] 434 | 435 | [[package]] 436 | name = "crypto-common" 437 | version = "0.1.6" 438 | source = "registry+https://github.com/rust-lang/crates.io-index" 439 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 440 | dependencies = [ 441 | "generic-array", 442 | "rand_core", 443 | "typenum", 444 | ] 445 | 446 | [[package]] 447 | name = "ctr" 448 | version = "0.9.2" 449 | source = "registry+https://github.com/rust-lang/crates.io-index" 450 | checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" 451 | dependencies = [ 452 | "cipher", 453 | ] 454 | 455 | [[package]] 456 | name = "data-encoding" 457 | version = "2.5.0" 458 | source = "registry+https://github.com/rust-lang/crates.io-index" 459 | checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" 460 | 461 | [[package]] 462 | name = "diff" 463 | version = "0.1.13" 464 | source = "registry+https://github.com/rust-lang/crates.io-index" 465 | checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" 466 | 467 | [[package]] 468 | name = "digest" 469 | version = "0.10.7" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 472 | dependencies = [ 473 | "block-buffer", 474 | "crypto-common", 475 | "subtle", 476 | ] 477 | 478 | [[package]] 479 | name = "directories" 480 | version = "5.0.1" 481 | source = "registry+https://github.com/rust-lang/crates.io-index" 482 | checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" 483 | dependencies = [ 484 | "dirs-sys", 485 | ] 486 | 487 | [[package]] 488 | name = "dirs-sys" 489 | version = "0.4.1" 490 | source = "registry+https://github.com/rust-lang/crates.io-index" 491 | checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" 492 | dependencies = [ 493 | "libc", 494 | "option-ext", 495 | "redox_users", 496 | "windows-sys 0.48.0", 497 | ] 498 | 499 | [[package]] 500 | name = "either" 501 | version = "1.9.0" 502 | source = "registry+https://github.com/rust-lang/crates.io-index" 503 | checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" 504 | 505 | [[package]] 506 | name = "error-code" 507 | version = "2.3.1" 508 | source = "registry+https://github.com/rust-lang/crates.io-index" 509 | checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" 510 | dependencies = [ 511 | "libc", 512 | "str-buf", 513 | ] 514 | 515 | [[package]] 516 | name = "flate2" 517 | version = "1.0.28" 518 | source = "registry+https://github.com/rust-lang/crates.io-index" 519 | checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" 520 | dependencies = [ 521 | "crc32fast", 522 | "miniz_oxide", 523 | ] 524 | 525 | [[package]] 526 | name = "form_urlencoded" 527 | version = "1.2.1" 528 | source = "registry+https://github.com/rust-lang/crates.io-index" 529 | checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" 530 | dependencies = [ 531 | "percent-encoding", 532 | ] 533 | 534 | [[package]] 535 | name = "generic-array" 536 | version = "0.14.7" 537 | source = "registry+https://github.com/rust-lang/crates.io-index" 538 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 539 | dependencies = [ 540 | "typenum", 541 | "version_check", 542 | ] 543 | 544 | [[package]] 545 | name = "gethostname" 546 | version = "0.3.0" 547 | source = "registry+https://github.com/rust-lang/crates.io-index" 548 | checksum = "bb65d4ba3173c56a500b555b532f72c42e8d1fe64962b518897f8959fae2c177" 549 | dependencies = [ 550 | "libc", 551 | "winapi", 552 | ] 553 | 554 | [[package]] 555 | name = "getrandom" 556 | version = "0.2.12" 557 | source = "registry+https://github.com/rust-lang/crates.io-index" 558 | checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" 559 | dependencies = [ 560 | "cfg-if", 561 | "libc", 562 | "wasi", 563 | ] 564 | 565 | [[package]] 566 | name = "ghash" 567 | version = "0.5.0" 568 | source = "registry+https://github.com/rust-lang/crates.io-index" 569 | checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" 570 | dependencies = [ 571 | "opaque-debug", 572 | "polyval", 573 | ] 574 | 575 | [[package]] 576 | name = "hashbrown" 577 | version = "0.14.3" 578 | source = "registry+https://github.com/rust-lang/crates.io-index" 579 | checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" 580 | dependencies = [ 581 | "ahash", 582 | "allocator-api2", 583 | ] 584 | 585 | [[package]] 586 | name = "heck" 587 | version = "0.4.1" 588 | source = "registry+https://github.com/rust-lang/crates.io-index" 589 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 590 | 591 | [[package]] 592 | name = "hex" 593 | version = "0.4.3" 594 | source = "registry+https://github.com/rust-lang/crates.io-index" 595 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 596 | 597 | [[package]] 598 | name = "hmac" 599 | version = "0.12.1" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" 602 | dependencies = [ 603 | "digest", 604 | ] 605 | 606 | [[package]] 607 | name = "idna" 608 | version = "0.5.0" 609 | source = "registry+https://github.com/rust-lang/crates.io-index" 610 | checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" 611 | dependencies = [ 612 | "unicode-bidi", 613 | "unicode-normalization", 614 | ] 615 | 616 | [[package]] 617 | name = "indoc" 618 | version = "2.0.4" 619 | source = "registry+https://github.com/rust-lang/crates.io-index" 620 | checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" 621 | 622 | [[package]] 623 | name = "inout" 624 | version = "0.1.3" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" 627 | dependencies = [ 628 | "block-padding", 629 | "generic-array", 630 | ] 631 | 632 | [[package]] 633 | name = "itertools" 634 | version = "0.12.1" 635 | source = "registry+https://github.com/rust-lang/crates.io-index" 636 | checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" 637 | dependencies = [ 638 | "either", 639 | ] 640 | 641 | [[package]] 642 | name = "itoa" 643 | version = "1.0.10" 644 | source = "registry+https://github.com/rust-lang/crates.io-index" 645 | checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" 646 | 647 | [[package]] 648 | name = "libc" 649 | version = "0.2.153" 650 | source = "registry+https://github.com/rust-lang/crates.io-index" 651 | checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" 652 | 653 | [[package]] 654 | name = "libredox" 655 | version = "0.0.1" 656 | source = "registry+https://github.com/rust-lang/crates.io-index" 657 | checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" 658 | dependencies = [ 659 | "bitflags 2.4.2", 660 | "libc", 661 | "redox_syscall", 662 | ] 663 | 664 | [[package]] 665 | name = "lock_api" 666 | version = "0.4.11" 667 | source = "registry+https://github.com/rust-lang/crates.io-index" 668 | checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" 669 | dependencies = [ 670 | "autocfg", 671 | "scopeguard", 672 | ] 673 | 674 | [[package]] 675 | name = "log" 676 | version = "0.4.20" 677 | source = "registry+https://github.com/rust-lang/crates.io-index" 678 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" 679 | 680 | [[package]] 681 | name = "lru" 682 | version = "0.12.2" 683 | source = "registry+https://github.com/rust-lang/crates.io-index" 684 | checksum = "db2c024b41519440580066ba82aab04092b333e09066a5eb86c7c4890df31f22" 685 | dependencies = [ 686 | "hashbrown", 687 | ] 688 | 689 | [[package]] 690 | name = "malloc_buf" 691 | version = "0.0.6" 692 | source = "registry+https://github.com/rust-lang/crates.io-index" 693 | checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" 694 | dependencies = [ 695 | "libc", 696 | ] 697 | 698 | [[package]] 699 | name = "maplit" 700 | version = "1.0.2" 701 | source = "registry+https://github.com/rust-lang/crates.io-index" 702 | checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" 703 | 704 | [[package]] 705 | name = "memoffset" 706 | version = "0.7.1" 707 | source = "registry+https://github.com/rust-lang/crates.io-index" 708 | checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" 709 | dependencies = [ 710 | "autocfg", 711 | ] 712 | 713 | [[package]] 714 | name = "miniz_oxide" 715 | version = "0.7.2" 716 | source = "registry+https://github.com/rust-lang/crates.io-index" 717 | checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" 718 | dependencies = [ 719 | "adler", 720 | ] 721 | 722 | [[package]] 723 | name = "mio" 724 | version = "0.8.10" 725 | source = "registry+https://github.com/rust-lang/crates.io-index" 726 | checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" 727 | dependencies = [ 728 | "libc", 729 | "log", 730 | "wasi", 731 | "windows-sys 0.48.0", 732 | ] 733 | 734 | [[package]] 735 | name = "nix" 736 | version = "0.26.4" 737 | source = "registry+https://github.com/rust-lang/crates.io-index" 738 | checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" 739 | dependencies = [ 740 | "bitflags 1.3.2", 741 | "cfg-if", 742 | "libc", 743 | "memoffset", 744 | ] 745 | 746 | [[package]] 747 | name = "num-traits" 748 | version = "0.2.17" 749 | source = "registry+https://github.com/rust-lang/crates.io-index" 750 | checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" 751 | dependencies = [ 752 | "autocfg", 753 | ] 754 | 755 | [[package]] 756 | name = "objc" 757 | version = "0.2.7" 758 | source = "registry+https://github.com/rust-lang/crates.io-index" 759 | checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" 760 | dependencies = [ 761 | "malloc_buf", 762 | ] 763 | 764 | [[package]] 765 | name = "objc-foundation" 766 | version = "0.1.1" 767 | source = "registry+https://github.com/rust-lang/crates.io-index" 768 | checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" 769 | dependencies = [ 770 | "block", 771 | "objc", 772 | "objc_id", 773 | ] 774 | 775 | [[package]] 776 | name = "objc_id" 777 | version = "0.1.1" 778 | source = "registry+https://github.com/rust-lang/crates.io-index" 779 | checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" 780 | dependencies = [ 781 | "objc", 782 | ] 783 | 784 | [[package]] 785 | name = "once_cell" 786 | version = "1.19.0" 787 | source = "registry+https://github.com/rust-lang/crates.io-index" 788 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" 789 | 790 | [[package]] 791 | name = "opaque-debug" 792 | version = "0.3.0" 793 | source = "registry+https://github.com/rust-lang/crates.io-index" 794 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 795 | 796 | [[package]] 797 | name = "option-ext" 798 | version = "0.2.0" 799 | source = "registry+https://github.com/rust-lang/crates.io-index" 800 | checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" 801 | 802 | [[package]] 803 | name = "otti" 804 | version = "0.2.7" 805 | dependencies = [ 806 | "anyhow", 807 | "arboard", 808 | "clap", 809 | "clap_complete", 810 | "clap_mangen", 811 | "crossbeam-channel", 812 | "crossterm", 813 | "indoc", 814 | "otti-core", 815 | "otti-gen", 816 | "otti-store", 817 | "provider-aegis", 818 | "provider-andotp", 819 | "provider-authpro", 820 | "ratatui", 821 | "rpassword", 822 | "rprompt", 823 | "secrecy", 824 | ] 825 | 826 | [[package]] 827 | name = "otti-core" 828 | version = "0.2.7" 829 | dependencies = [ 830 | "data-encoding", 831 | "percent-encoding", 832 | "secrecy", 833 | "serde", 834 | "serde_qs", 835 | "thiserror", 836 | "url", 837 | ] 838 | 839 | [[package]] 840 | name = "otti-gen" 841 | version = "0.2.7" 842 | dependencies = [ 843 | "hmac", 844 | "otti-core", 845 | "sha1", 846 | "sha2", 847 | "thiserror", 848 | ] 849 | 850 | [[package]] 851 | name = "otti-store" 852 | version = "0.2.7" 853 | dependencies = [ 854 | "argon2", 855 | "chacha20poly1305", 856 | "directories", 857 | "flate2", 858 | "otti-core", 859 | "rmp-serde", 860 | "secrecy", 861 | "serde", 862 | "thiserror", 863 | "typenum", 864 | ] 865 | 866 | [[package]] 867 | name = "parking_lot" 868 | version = "0.12.1" 869 | source = "registry+https://github.com/rust-lang/crates.io-index" 870 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" 871 | dependencies = [ 872 | "lock_api", 873 | "parking_lot_core", 874 | ] 875 | 876 | [[package]] 877 | name = "parking_lot_core" 878 | version = "0.9.9" 879 | source = "registry+https://github.com/rust-lang/crates.io-index" 880 | checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" 881 | dependencies = [ 882 | "cfg-if", 883 | "libc", 884 | "redox_syscall", 885 | "smallvec", 886 | "windows-targets 0.48.5", 887 | ] 888 | 889 | [[package]] 890 | name = "password-hash" 891 | version = "0.5.0" 892 | source = "registry+https://github.com/rust-lang/crates.io-index" 893 | checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" 894 | dependencies = [ 895 | "base64ct", 896 | "rand_core", 897 | "subtle", 898 | ] 899 | 900 | [[package]] 901 | name = "paste" 902 | version = "1.0.14" 903 | source = "registry+https://github.com/rust-lang/crates.io-index" 904 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" 905 | 906 | [[package]] 907 | name = "pbkdf2" 908 | version = "0.12.2" 909 | source = "registry+https://github.com/rust-lang/crates.io-index" 910 | checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" 911 | dependencies = [ 912 | "digest", 913 | "hmac", 914 | ] 915 | 916 | [[package]] 917 | name = "percent-encoding" 918 | version = "2.3.1" 919 | source = "registry+https://github.com/rust-lang/crates.io-index" 920 | checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" 921 | 922 | [[package]] 923 | name = "poly1305" 924 | version = "0.8.0" 925 | source = "registry+https://github.com/rust-lang/crates.io-index" 926 | checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" 927 | dependencies = [ 928 | "cpufeatures", 929 | "opaque-debug", 930 | "universal-hash", 931 | ] 932 | 933 | [[package]] 934 | name = "polyval" 935 | version = "0.6.1" 936 | source = "registry+https://github.com/rust-lang/crates.io-index" 937 | checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" 938 | dependencies = [ 939 | "cfg-if", 940 | "cpufeatures", 941 | "opaque-debug", 942 | "universal-hash", 943 | ] 944 | 945 | [[package]] 946 | name = "ppv-lite86" 947 | version = "0.2.17" 948 | source = "registry+https://github.com/rust-lang/crates.io-index" 949 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 950 | 951 | [[package]] 952 | name = "pretty_assertions" 953 | version = "1.4.0" 954 | source = "registry+https://github.com/rust-lang/crates.io-index" 955 | checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" 956 | dependencies = [ 957 | "diff", 958 | "yansi", 959 | ] 960 | 961 | [[package]] 962 | name = "proc-macro2" 963 | version = "1.0.78" 964 | source = "registry+https://github.com/rust-lang/crates.io-index" 965 | checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" 966 | dependencies = [ 967 | "unicode-ident", 968 | ] 969 | 970 | [[package]] 971 | name = "provider-aegis" 972 | version = "0.2.7" 973 | dependencies = [ 974 | "aes-gcm", 975 | "base64", 976 | "bytes", 977 | "hex", 978 | "maplit", 979 | "otti-core", 980 | "pretty_assertions", 981 | "rand", 982 | "scrypt", 983 | "serde", 984 | "serde_json", 985 | "serde_repr", 986 | "thiserror", 987 | "uuid", 988 | ] 989 | 990 | [[package]] 991 | name = "provider-andotp" 992 | version = "0.2.7" 993 | dependencies = [ 994 | "aes-gcm", 995 | "bytes", 996 | "hmac", 997 | "otti-core", 998 | "pbkdf2", 999 | "pretty_assertions", 1000 | "rand", 1001 | "serde", 1002 | "serde_json", 1003 | "sha1", 1004 | "thiserror", 1005 | ] 1006 | 1007 | [[package]] 1008 | name = "provider-authpro" 1009 | version = "0.2.7" 1010 | dependencies = [ 1011 | "aes", 1012 | "base64", 1013 | "block-padding", 1014 | "bytes", 1015 | "cbc", 1016 | "hmac", 1017 | "maplit", 1018 | "otti-core", 1019 | "pbkdf2", 1020 | "pretty_assertions", 1021 | "rand", 1022 | "serde", 1023 | "serde_json", 1024 | "serde_repr", 1025 | "sha1", 1026 | "thiserror", 1027 | ] 1028 | 1029 | [[package]] 1030 | name = "quote" 1031 | version = "1.0.35" 1032 | source = "registry+https://github.com/rust-lang/crates.io-index" 1033 | checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" 1034 | dependencies = [ 1035 | "proc-macro2", 1036 | ] 1037 | 1038 | [[package]] 1039 | name = "rand" 1040 | version = "0.8.5" 1041 | source = "registry+https://github.com/rust-lang/crates.io-index" 1042 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 1043 | dependencies = [ 1044 | "libc", 1045 | "rand_chacha", 1046 | "rand_core", 1047 | ] 1048 | 1049 | [[package]] 1050 | name = "rand_chacha" 1051 | version = "0.3.1" 1052 | source = "registry+https://github.com/rust-lang/crates.io-index" 1053 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1054 | dependencies = [ 1055 | "ppv-lite86", 1056 | "rand_core", 1057 | ] 1058 | 1059 | [[package]] 1060 | name = "rand_core" 1061 | version = "0.6.4" 1062 | source = "registry+https://github.com/rust-lang/crates.io-index" 1063 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1064 | dependencies = [ 1065 | "getrandom", 1066 | ] 1067 | 1068 | [[package]] 1069 | name = "ratatui" 1070 | version = "0.26.0" 1071 | source = "registry+https://github.com/rust-lang/crates.io-index" 1072 | checksum = "154b85ef15a5d1719bcaa193c3c81fe645cd120c156874cd660fe49fd21d1373" 1073 | dependencies = [ 1074 | "bitflags 2.4.2", 1075 | "cassowary", 1076 | "compact_str", 1077 | "crossterm", 1078 | "indoc", 1079 | "itertools", 1080 | "lru", 1081 | "paste", 1082 | "stability", 1083 | "strum", 1084 | "unicode-segmentation", 1085 | "unicode-width", 1086 | ] 1087 | 1088 | [[package]] 1089 | name = "redox_syscall" 1090 | version = "0.4.1" 1091 | source = "registry+https://github.com/rust-lang/crates.io-index" 1092 | checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" 1093 | dependencies = [ 1094 | "bitflags 1.3.2", 1095 | ] 1096 | 1097 | [[package]] 1098 | name = "redox_users" 1099 | version = "0.4.4" 1100 | source = "registry+https://github.com/rust-lang/crates.io-index" 1101 | checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" 1102 | dependencies = [ 1103 | "getrandom", 1104 | "libredox", 1105 | "thiserror", 1106 | ] 1107 | 1108 | [[package]] 1109 | name = "rmp" 1110 | version = "0.8.12" 1111 | source = "registry+https://github.com/rust-lang/crates.io-index" 1112 | checksum = "7f9860a6cc38ed1da53456442089b4dfa35e7cedaa326df63017af88385e6b20" 1113 | dependencies = [ 1114 | "byteorder", 1115 | "num-traits", 1116 | "paste", 1117 | ] 1118 | 1119 | [[package]] 1120 | name = "rmp-serde" 1121 | version = "1.1.2" 1122 | source = "registry+https://github.com/rust-lang/crates.io-index" 1123 | checksum = "bffea85eea980d8a74453e5d02a8d93028f3c34725de143085a844ebe953258a" 1124 | dependencies = [ 1125 | "byteorder", 1126 | "rmp", 1127 | "serde", 1128 | ] 1129 | 1130 | [[package]] 1131 | name = "roff" 1132 | version = "0.2.1" 1133 | source = "registry+https://github.com/rust-lang/crates.io-index" 1134 | checksum = "b833d8d034ea094b1ea68aa6d5c740e0d04bad9d16568d08ba6f76823a114316" 1135 | 1136 | [[package]] 1137 | name = "rpassword" 1138 | version = "7.3.1" 1139 | source = "registry+https://github.com/rust-lang/crates.io-index" 1140 | checksum = "80472be3c897911d0137b2d2b9055faf6eeac5b14e324073d83bc17b191d7e3f" 1141 | dependencies = [ 1142 | "libc", 1143 | "rtoolbox", 1144 | "windows-sys 0.48.0", 1145 | ] 1146 | 1147 | [[package]] 1148 | name = "rprompt" 1149 | version = "2.1.1" 1150 | source = "registry+https://github.com/rust-lang/crates.io-index" 1151 | checksum = "0d24bc146fc6baf226b8bca973d5e7655bd2077a8d94d9809a060c185108e611" 1152 | dependencies = [ 1153 | "rtoolbox", 1154 | "windows-sys 0.48.0", 1155 | ] 1156 | 1157 | [[package]] 1158 | name = "rtoolbox" 1159 | version = "0.0.2" 1160 | source = "registry+https://github.com/rust-lang/crates.io-index" 1161 | checksum = "c247d24e63230cdb56463ae328478bd5eac8b8faa8c69461a77e8e323afac90e" 1162 | dependencies = [ 1163 | "libc", 1164 | "windows-sys 0.48.0", 1165 | ] 1166 | 1167 | [[package]] 1168 | name = "rustversion" 1169 | version = "1.0.14" 1170 | source = "registry+https://github.com/rust-lang/crates.io-index" 1171 | checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" 1172 | 1173 | [[package]] 1174 | name = "ryu" 1175 | version = "1.0.16" 1176 | source = "registry+https://github.com/rust-lang/crates.io-index" 1177 | checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" 1178 | 1179 | [[package]] 1180 | name = "salsa20" 1181 | version = "0.10.2" 1182 | source = "registry+https://github.com/rust-lang/crates.io-index" 1183 | checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" 1184 | dependencies = [ 1185 | "cipher", 1186 | ] 1187 | 1188 | [[package]] 1189 | name = "scopeguard" 1190 | version = "1.2.0" 1191 | source = "registry+https://github.com/rust-lang/crates.io-index" 1192 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 1193 | 1194 | [[package]] 1195 | name = "scrypt" 1196 | version = "0.11.0" 1197 | source = "registry+https://github.com/rust-lang/crates.io-index" 1198 | checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" 1199 | dependencies = [ 1200 | "password-hash", 1201 | "pbkdf2", 1202 | "salsa20", 1203 | "sha2", 1204 | ] 1205 | 1206 | [[package]] 1207 | name = "secrecy" 1208 | version = "0.8.0" 1209 | source = "registry+https://github.com/rust-lang/crates.io-index" 1210 | checksum = "9bd1c54ea06cfd2f6b63219704de0b9b4f72dcc2b8fdef820be6cd799780e91e" 1211 | dependencies = [ 1212 | "serde", 1213 | "zeroize", 1214 | ] 1215 | 1216 | [[package]] 1217 | name = "serde" 1218 | version = "1.0.196" 1219 | source = "registry+https://github.com/rust-lang/crates.io-index" 1220 | checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" 1221 | dependencies = [ 1222 | "serde_derive", 1223 | ] 1224 | 1225 | [[package]] 1226 | name = "serde_derive" 1227 | version = "1.0.196" 1228 | source = "registry+https://github.com/rust-lang/crates.io-index" 1229 | checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" 1230 | dependencies = [ 1231 | "proc-macro2", 1232 | "quote", 1233 | "syn 2.0.48", 1234 | ] 1235 | 1236 | [[package]] 1237 | name = "serde_json" 1238 | version = "1.0.113" 1239 | source = "registry+https://github.com/rust-lang/crates.io-index" 1240 | checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" 1241 | dependencies = [ 1242 | "itoa", 1243 | "ryu", 1244 | "serde", 1245 | ] 1246 | 1247 | [[package]] 1248 | name = "serde_qs" 1249 | version = "0.12.0" 1250 | source = "registry+https://github.com/rust-lang/crates.io-index" 1251 | checksum = "0431a35568651e363364210c91983c1da5eb29404d9f0928b67d4ebcfa7d330c" 1252 | dependencies = [ 1253 | "percent-encoding", 1254 | "serde", 1255 | "thiserror", 1256 | ] 1257 | 1258 | [[package]] 1259 | name = "serde_repr" 1260 | version = "0.1.18" 1261 | source = "registry+https://github.com/rust-lang/crates.io-index" 1262 | checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" 1263 | dependencies = [ 1264 | "proc-macro2", 1265 | "quote", 1266 | "syn 2.0.48", 1267 | ] 1268 | 1269 | [[package]] 1270 | name = "sha1" 1271 | version = "0.10.6" 1272 | source = "registry+https://github.com/rust-lang/crates.io-index" 1273 | checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" 1274 | dependencies = [ 1275 | "cfg-if", 1276 | "cpufeatures", 1277 | "digest", 1278 | ] 1279 | 1280 | [[package]] 1281 | name = "sha2" 1282 | version = "0.10.8" 1283 | source = "registry+https://github.com/rust-lang/crates.io-index" 1284 | checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" 1285 | dependencies = [ 1286 | "cfg-if", 1287 | "cpufeatures", 1288 | "digest", 1289 | ] 1290 | 1291 | [[package]] 1292 | name = "signal-hook" 1293 | version = "0.3.17" 1294 | source = "registry+https://github.com/rust-lang/crates.io-index" 1295 | checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" 1296 | dependencies = [ 1297 | "libc", 1298 | "signal-hook-registry", 1299 | ] 1300 | 1301 | [[package]] 1302 | name = "signal-hook-mio" 1303 | version = "0.2.3" 1304 | source = "registry+https://github.com/rust-lang/crates.io-index" 1305 | checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" 1306 | dependencies = [ 1307 | "libc", 1308 | "mio", 1309 | "signal-hook", 1310 | ] 1311 | 1312 | [[package]] 1313 | name = "signal-hook-registry" 1314 | version = "1.4.1" 1315 | source = "registry+https://github.com/rust-lang/crates.io-index" 1316 | checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" 1317 | dependencies = [ 1318 | "libc", 1319 | ] 1320 | 1321 | [[package]] 1322 | name = "smallvec" 1323 | version = "1.13.1" 1324 | source = "registry+https://github.com/rust-lang/crates.io-index" 1325 | checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" 1326 | 1327 | [[package]] 1328 | name = "stability" 1329 | version = "0.1.1" 1330 | source = "registry+https://github.com/rust-lang/crates.io-index" 1331 | checksum = "ebd1b177894da2a2d9120208c3386066af06a488255caabc5de8ddca22dbc3ce" 1332 | dependencies = [ 1333 | "quote", 1334 | "syn 1.0.109", 1335 | ] 1336 | 1337 | [[package]] 1338 | name = "static_assertions" 1339 | version = "1.1.0" 1340 | source = "registry+https://github.com/rust-lang/crates.io-index" 1341 | checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" 1342 | 1343 | [[package]] 1344 | name = "str-buf" 1345 | version = "1.0.6" 1346 | source = "registry+https://github.com/rust-lang/crates.io-index" 1347 | checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" 1348 | 1349 | [[package]] 1350 | name = "strsim" 1351 | version = "0.10.0" 1352 | source = "registry+https://github.com/rust-lang/crates.io-index" 1353 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 1354 | 1355 | [[package]] 1356 | name = "strum" 1357 | version = "0.26.1" 1358 | source = "registry+https://github.com/rust-lang/crates.io-index" 1359 | checksum = "723b93e8addf9aa965ebe2d11da6d7540fa2283fcea14b3371ff055f7ba13f5f" 1360 | dependencies = [ 1361 | "strum_macros", 1362 | ] 1363 | 1364 | [[package]] 1365 | name = "strum_macros" 1366 | version = "0.26.1" 1367 | source = "registry+https://github.com/rust-lang/crates.io-index" 1368 | checksum = "7a3417fc93d76740d974a01654a09777cb500428cc874ca9f45edfe0c4d4cd18" 1369 | dependencies = [ 1370 | "heck", 1371 | "proc-macro2", 1372 | "quote", 1373 | "rustversion", 1374 | "syn 2.0.48", 1375 | ] 1376 | 1377 | [[package]] 1378 | name = "subtle" 1379 | version = "2.5.0" 1380 | source = "registry+https://github.com/rust-lang/crates.io-index" 1381 | checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" 1382 | 1383 | [[package]] 1384 | name = "syn" 1385 | version = "1.0.109" 1386 | source = "registry+https://github.com/rust-lang/crates.io-index" 1387 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1388 | dependencies = [ 1389 | "proc-macro2", 1390 | "quote", 1391 | "unicode-ident", 1392 | ] 1393 | 1394 | [[package]] 1395 | name = "syn" 1396 | version = "2.0.48" 1397 | source = "registry+https://github.com/rust-lang/crates.io-index" 1398 | checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" 1399 | dependencies = [ 1400 | "proc-macro2", 1401 | "quote", 1402 | "unicode-ident", 1403 | ] 1404 | 1405 | [[package]] 1406 | name = "thiserror" 1407 | version = "1.0.56" 1408 | source = "registry+https://github.com/rust-lang/crates.io-index" 1409 | checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" 1410 | dependencies = [ 1411 | "thiserror-impl", 1412 | ] 1413 | 1414 | [[package]] 1415 | name = "thiserror-impl" 1416 | version = "1.0.56" 1417 | source = "registry+https://github.com/rust-lang/crates.io-index" 1418 | checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" 1419 | dependencies = [ 1420 | "proc-macro2", 1421 | "quote", 1422 | "syn 2.0.48", 1423 | ] 1424 | 1425 | [[package]] 1426 | name = "tinyvec" 1427 | version = "1.6.0" 1428 | source = "registry+https://github.com/rust-lang/crates.io-index" 1429 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1430 | dependencies = [ 1431 | "tinyvec_macros", 1432 | ] 1433 | 1434 | [[package]] 1435 | name = "tinyvec_macros" 1436 | version = "0.1.1" 1437 | source = "registry+https://github.com/rust-lang/crates.io-index" 1438 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 1439 | 1440 | [[package]] 1441 | name = "typenum" 1442 | version = "1.17.0" 1443 | source = "registry+https://github.com/rust-lang/crates.io-index" 1444 | checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" 1445 | 1446 | [[package]] 1447 | name = "unicode-bidi" 1448 | version = "0.3.15" 1449 | source = "registry+https://github.com/rust-lang/crates.io-index" 1450 | checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" 1451 | 1452 | [[package]] 1453 | name = "unicode-ident" 1454 | version = "1.0.12" 1455 | source = "registry+https://github.com/rust-lang/crates.io-index" 1456 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 1457 | 1458 | [[package]] 1459 | name = "unicode-normalization" 1460 | version = "0.1.22" 1461 | source = "registry+https://github.com/rust-lang/crates.io-index" 1462 | checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" 1463 | dependencies = [ 1464 | "tinyvec", 1465 | ] 1466 | 1467 | [[package]] 1468 | name = "unicode-segmentation" 1469 | version = "1.10.1" 1470 | source = "registry+https://github.com/rust-lang/crates.io-index" 1471 | checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" 1472 | 1473 | [[package]] 1474 | name = "unicode-width" 1475 | version = "0.1.11" 1476 | source = "registry+https://github.com/rust-lang/crates.io-index" 1477 | checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" 1478 | 1479 | [[package]] 1480 | name = "universal-hash" 1481 | version = "0.5.1" 1482 | source = "registry+https://github.com/rust-lang/crates.io-index" 1483 | checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" 1484 | dependencies = [ 1485 | "crypto-common", 1486 | "subtle", 1487 | ] 1488 | 1489 | [[package]] 1490 | name = "url" 1491 | version = "2.5.0" 1492 | source = "registry+https://github.com/rust-lang/crates.io-index" 1493 | checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" 1494 | dependencies = [ 1495 | "form_urlencoded", 1496 | "idna", 1497 | "percent-encoding", 1498 | ] 1499 | 1500 | [[package]] 1501 | name = "utf8parse" 1502 | version = "0.2.1" 1503 | source = "registry+https://github.com/rust-lang/crates.io-index" 1504 | checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" 1505 | 1506 | [[package]] 1507 | name = "uuid" 1508 | version = "1.7.0" 1509 | source = "registry+https://github.com/rust-lang/crates.io-index" 1510 | checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" 1511 | dependencies = [ 1512 | "getrandom", 1513 | ] 1514 | 1515 | [[package]] 1516 | name = "version_check" 1517 | version = "0.9.4" 1518 | source = "registry+https://github.com/rust-lang/crates.io-index" 1519 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1520 | 1521 | [[package]] 1522 | name = "wasi" 1523 | version = "0.11.0+wasi-snapshot-preview1" 1524 | source = "registry+https://github.com/rust-lang/crates.io-index" 1525 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1526 | 1527 | [[package]] 1528 | name = "winapi" 1529 | version = "0.3.9" 1530 | source = "registry+https://github.com/rust-lang/crates.io-index" 1531 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1532 | dependencies = [ 1533 | "winapi-i686-pc-windows-gnu", 1534 | "winapi-x86_64-pc-windows-gnu", 1535 | ] 1536 | 1537 | [[package]] 1538 | name = "winapi-i686-pc-windows-gnu" 1539 | version = "0.4.0" 1540 | source = "registry+https://github.com/rust-lang/crates.io-index" 1541 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1542 | 1543 | [[package]] 1544 | name = "winapi-wsapoll" 1545 | version = "0.1.1" 1546 | source = "registry+https://github.com/rust-lang/crates.io-index" 1547 | checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e" 1548 | dependencies = [ 1549 | "winapi", 1550 | ] 1551 | 1552 | [[package]] 1553 | name = "winapi-x86_64-pc-windows-gnu" 1554 | version = "0.4.0" 1555 | source = "registry+https://github.com/rust-lang/crates.io-index" 1556 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1557 | 1558 | [[package]] 1559 | name = "windows-sys" 1560 | version = "0.48.0" 1561 | source = "registry+https://github.com/rust-lang/crates.io-index" 1562 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1563 | dependencies = [ 1564 | "windows-targets 0.48.5", 1565 | ] 1566 | 1567 | [[package]] 1568 | name = "windows-sys" 1569 | version = "0.52.0" 1570 | source = "registry+https://github.com/rust-lang/crates.io-index" 1571 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 1572 | dependencies = [ 1573 | "windows-targets 0.52.0", 1574 | ] 1575 | 1576 | [[package]] 1577 | name = "windows-targets" 1578 | version = "0.48.5" 1579 | source = "registry+https://github.com/rust-lang/crates.io-index" 1580 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 1581 | dependencies = [ 1582 | "windows_aarch64_gnullvm 0.48.5", 1583 | "windows_aarch64_msvc 0.48.5", 1584 | "windows_i686_gnu 0.48.5", 1585 | "windows_i686_msvc 0.48.5", 1586 | "windows_x86_64_gnu 0.48.5", 1587 | "windows_x86_64_gnullvm 0.48.5", 1588 | "windows_x86_64_msvc 0.48.5", 1589 | ] 1590 | 1591 | [[package]] 1592 | name = "windows-targets" 1593 | version = "0.52.0" 1594 | source = "registry+https://github.com/rust-lang/crates.io-index" 1595 | checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" 1596 | dependencies = [ 1597 | "windows_aarch64_gnullvm 0.52.0", 1598 | "windows_aarch64_msvc 0.52.0", 1599 | "windows_i686_gnu 0.52.0", 1600 | "windows_i686_msvc 0.52.0", 1601 | "windows_x86_64_gnu 0.52.0", 1602 | "windows_x86_64_gnullvm 0.52.0", 1603 | "windows_x86_64_msvc 0.52.0", 1604 | ] 1605 | 1606 | [[package]] 1607 | name = "windows_aarch64_gnullvm" 1608 | version = "0.48.5" 1609 | source = "registry+https://github.com/rust-lang/crates.io-index" 1610 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 1611 | 1612 | [[package]] 1613 | name = "windows_aarch64_gnullvm" 1614 | version = "0.52.0" 1615 | source = "registry+https://github.com/rust-lang/crates.io-index" 1616 | checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" 1617 | 1618 | [[package]] 1619 | name = "windows_aarch64_msvc" 1620 | version = "0.48.5" 1621 | source = "registry+https://github.com/rust-lang/crates.io-index" 1622 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 1623 | 1624 | [[package]] 1625 | name = "windows_aarch64_msvc" 1626 | version = "0.52.0" 1627 | source = "registry+https://github.com/rust-lang/crates.io-index" 1628 | checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" 1629 | 1630 | [[package]] 1631 | name = "windows_i686_gnu" 1632 | version = "0.48.5" 1633 | source = "registry+https://github.com/rust-lang/crates.io-index" 1634 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 1635 | 1636 | [[package]] 1637 | name = "windows_i686_gnu" 1638 | version = "0.52.0" 1639 | source = "registry+https://github.com/rust-lang/crates.io-index" 1640 | checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" 1641 | 1642 | [[package]] 1643 | name = "windows_i686_msvc" 1644 | version = "0.48.5" 1645 | source = "registry+https://github.com/rust-lang/crates.io-index" 1646 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 1647 | 1648 | [[package]] 1649 | name = "windows_i686_msvc" 1650 | version = "0.52.0" 1651 | source = "registry+https://github.com/rust-lang/crates.io-index" 1652 | checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" 1653 | 1654 | [[package]] 1655 | name = "windows_x86_64_gnu" 1656 | version = "0.48.5" 1657 | source = "registry+https://github.com/rust-lang/crates.io-index" 1658 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 1659 | 1660 | [[package]] 1661 | name = "windows_x86_64_gnu" 1662 | version = "0.52.0" 1663 | source = "registry+https://github.com/rust-lang/crates.io-index" 1664 | checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" 1665 | 1666 | [[package]] 1667 | name = "windows_x86_64_gnullvm" 1668 | version = "0.48.5" 1669 | source = "registry+https://github.com/rust-lang/crates.io-index" 1670 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 1671 | 1672 | [[package]] 1673 | name = "windows_x86_64_gnullvm" 1674 | version = "0.52.0" 1675 | source = "registry+https://github.com/rust-lang/crates.io-index" 1676 | checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" 1677 | 1678 | [[package]] 1679 | name = "windows_x86_64_msvc" 1680 | version = "0.48.5" 1681 | source = "registry+https://github.com/rust-lang/crates.io-index" 1682 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 1683 | 1684 | [[package]] 1685 | name = "windows_x86_64_msvc" 1686 | version = "0.52.0" 1687 | source = "registry+https://github.com/rust-lang/crates.io-index" 1688 | checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" 1689 | 1690 | [[package]] 1691 | name = "x11rb" 1692 | version = "0.12.0" 1693 | source = "registry+https://github.com/rust-lang/crates.io-index" 1694 | checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a" 1695 | dependencies = [ 1696 | "gethostname", 1697 | "nix", 1698 | "winapi", 1699 | "winapi-wsapoll", 1700 | "x11rb-protocol", 1701 | ] 1702 | 1703 | [[package]] 1704 | name = "x11rb-protocol" 1705 | version = "0.12.0" 1706 | source = "registry+https://github.com/rust-lang/crates.io-index" 1707 | checksum = "82d6c3f9a0fb6701fab8f6cea9b0c0bd5d6876f1f89f7fada07e558077c344bc" 1708 | dependencies = [ 1709 | "nix", 1710 | ] 1711 | 1712 | [[package]] 1713 | name = "yansi" 1714 | version = "0.5.1" 1715 | source = "registry+https://github.com/rust-lang/crates.io-index" 1716 | checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" 1717 | 1718 | [[package]] 1719 | name = "zerocopy" 1720 | version = "0.7.32" 1721 | source = "registry+https://github.com/rust-lang/crates.io-index" 1722 | checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" 1723 | dependencies = [ 1724 | "zerocopy-derive", 1725 | ] 1726 | 1727 | [[package]] 1728 | name = "zerocopy-derive" 1729 | version = "0.7.32" 1730 | source = "registry+https://github.com/rust-lang/crates.io-index" 1731 | checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" 1732 | dependencies = [ 1733 | "proc-macro2", 1734 | "quote", 1735 | "syn 2.0.48", 1736 | ] 1737 | 1738 | [[package]] 1739 | name = "zeroize" 1740 | version = "1.7.0" 1741 | source = "registry+https://github.com/rust-lang/crates.io-index" 1742 | checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" 1743 | --------------------------------------------------------------------------------