|
|
@ -30,9 +30,9 @@ impl Paste {
|
|
|
|
Ok(paste)
|
|
|
|
Ok(paste)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn from_text(text: String) -> Result<Self> {
|
|
|
|
pub fn from_text(text: String, salt: String) -> Result<Self> {
|
|
|
|
let dt = Utc::now();
|
|
|
|
let dt = Utc::now();
|
|
|
|
let harsh = HarshBuilder::new().salt("salt and pepper").init()?;
|
|
|
|
let harsh = HarshBuilder::new().salt(salt).init()?;
|
|
|
|
let encoded = harsh.encode(&[dt.timestamp_millis() as u64]);
|
|
|
|
let encoded = harsh.encode(&[dt.timestamp_millis() as u64]);
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(id) = encoded {
|
|
|
|
if let Some(id) = encoded {
|
|
|
@ -48,9 +48,9 @@ impl Paste {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn from_form(form: HashMap<String, String>) -> Result<Self> {
|
|
|
|
pub fn from_form(form: HashMap<String, String>, salt: String) -> Result<Self> {
|
|
|
|
let dt = Utc::now();
|
|
|
|
let dt = Utc::now();
|
|
|
|
let harsh = HarshBuilder::new().salt("salt and pepper").init()?;
|
|
|
|
let harsh = HarshBuilder::new().salt(salt).init()?;
|
|
|
|
let encoded = harsh.encode(&[dt.timestamp_millis() as u64]);
|
|
|
|
let encoded = harsh.encode(&[dt.timestamp_millis() as u64]);
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(id) = encoded {
|
|
|
|
if let Some(id) = encoded {
|
|
|
|