use std::fmt::Display;
use super::*;
#[derive(Copy, Clone, Debug, Default)]
pub struct Plaintext;
#[derive(Clone, Debug)]
pub struct PlaintextSign(String);
impl SignatureMethod for Plaintext {
type Sign = PlaintextSign;
fn sign_with(
self,
consumer_secret: impl Display,
token_secret: Option<impl Display>,
) -> PlaintextSign {
let mut key = String::with_capacity(128);
write_signing_key(&mut key, consumer_secret, token_secret);
PlaintextSign(key)
}
}
impl Sign for PlaintextSign {
type Signature = String;
fn get_signature_method_name(&self) -> &'static str {
"PLAINTEXT"
}
fn request_method(&mut self, _method: &str) {}
fn uri(&mut self, _uri: impl Display) {}
fn parameter(&mut self, _key: &str, _value: impl Display) {}
fn delimiter(&mut self) {}
fn finish(self) -> String {
self.0
}
}