Skip to content

Commit

Permalink
Switch to checkpwn-lib (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
brycx authored Nov 11, 2020
1 parent 3dba629 commit c8f316e
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 424 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[package]
name = "checkpwn"
version = "0.4.1"
version = "0.5.0"
authors = ["brycx <[email protected]>"]
description = "Check Have I Been Pwned and see if it's time for you to change passwords."
keywords = [ "cli", "password", "security", "HIBP" ]
categories = [ "command-line-utilities" ]
readme = "README.md"
edition = "2018"
repository = "https://github.com/brycx/checkpwn"
license = "MIT"

[dependencies]
colored = "2.0"
sha-1 = { version = "0.9.1", default-features = false }
hex = "0.4.2"
ureq = { version = "1.4.1", default-features = false, features = ["tls"] }
rpassword = "5.0.0"
zeroize = "1.1.0"
dirs-next = "2.0.0"
serde = { version = "1.0.106", features = ["derive"] }
serde_yaml = "0.8.11"
checkpwn_lib = "0.1.0"
anyhow = "1.0.33"

[dev-dependencies]
assert_cmd = "1.0.1"
333 changes: 0 additions & 333 deletions src/api/mod.rs

This file was deleted.

8 changes: 2 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
extern crate dirs_next;
extern crate serde;
extern crate serde_yaml;

use self::dirs_next::config_dir;
use self::serde::{Deserialize, Serialize};
use dirs_next::config_dir;
use serde::{Deserialize, Serialize};
use std::{fs, io::Write, path::PathBuf};

const CHECKPWN_CONFIG_FILE_NAME: &str = "checkpwn.yml";
Expand Down
9 changes: 0 additions & 9 deletions src/api/errors.rs → src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,9 @@
/// Errors that are meant to be internal or or unreachable print this.
pub const USAGE_ERROR: &str =
"Usage: checkpwn { pass | acc (<username> | <email> | <filename>.ls) | register <apikey> }";
pub const STATUSCODE_ERROR: &str = "Unrecognized status code received";
pub const PASSWORD_ERROR: &str = "Error retrieving password from stdin";
pub const READ_FILE_ERROR: &str = "Error reading local file";
pub const NETWORK_ERROR: &str = "Failed to send request to HIBP";
pub const DECODING_ERROR: &str = "Failed to decode response from HIBP";
pub const API_ARG_ERROR: &str =
"SHOULD_BE_UNREACHABLE: Invalid argument in API route construction detected";
pub const BAD_RESPONSE_ERROR: &str =
"Received a bad response from HIBP - make sure the account is valid";
pub const BUFREADER_ERROR: &str = "Failed to read file in to BufReader";
pub const READLINE_ERROR: &str = "Failed to read line from file";
pub const INVALID_API_KEY: &str = "HIBP deemed the current API key invalid";
pub const MISSING_API_KEY: &str = "Failed to read or parse the configuration file 'checkpwn.yml'. You need to register an API key to be able to check accounts";

/// Set panic hook, to have .unwrap(), etc, return the custom panic message.
Expand Down
Loading

0 comments on commit c8f316e

Please sign in to comment.