Remove old KeyPair type
@@ -280,73 +280,6 @@ impl FromStr for PairType {
////////////////////////////////////////////////////////////////////////
-/// A pair of related keys (public and secret) which have a name and revision.
-///
-/// Depending on the type of keypair, the public key may be empty or not apply, or one or both of
-/// the keys may not be present due to the loading context. For example, the act of verifying a
-/// signed message or artifact only requires the public key to be present, whereas the act of
-/// signing will require the secret key to be present.
-#[deprecated(note = "Please use new key types")]
-#[derive(Clone, PartialEq)]
-pub struct KeyPair<P: PartialEq, S: PartialEq> {
- /// The name of the key, ex: "habitat"
- name: String,
- /// The revision of the key, which is a timestamp, ex: "201604051449"
- // TODO (CM): This needs to be public for Builder (for now)
- #[deprecated(note = "Use KeyPair::rev() function instead")]
- pub rev: String,
- revision: KeyRevision,
- /// The public key component, if relevant
- public: Option<P>,
- /// The private key component, if relevant
- secret: Option<S>,
-}
-
-impl<P: PartialEq, S: PartialEq> KeyPair<P, S> {
- /// Creates a new `KeyPair`.
- pub fn new(name: String,
- rev: KeyRevision,
- public: Option<P>,
- secret: Option<S>)
- -> KeyPair<P, S> {
- #[allow(deprecated)] // for our own internal use of the rev field
- KeyPair { name,
- rev: rev.to_string(),
- revision: rev,
- public,
- secret }
- }
-
- /// Returns a `String` containing the combination of the `name` and `rev` fields.
- pub fn name_with_rev(&self) -> String { format!("{}-{}", self.name, self.revision) }
-
- // TODO (CM): Only polymorphic for Builder right now; eventually,
- // return only KeyRevision from this (if even needed at all; once
- // Builder gets some refactorings, I think we can get rid of this
- // entirely).
- pub fn rev<T>(&self) -> T
- where T: From<KeyRevision>
- {
- self.revision.clone().into()
- }
-
- pub fn public(&self) -> Result<&P> {
- self.public.as_ref().ok_or_else(|| {
- let msg = format!("Public key is required but not present for {}",
- self.name_with_rev());
- Error::CryptoError(msg)
- })
- }
-
- pub fn secret(&self) -> Result<&S> {
- self.secret.as_ref().ok_or_else(|| {
- let msg = format!("Secret key is required but not present for {}",
- self.name_with_rev());
- Error::CryptoError(msg)
- })
- }
-}
-
////////////////////////////////////////////////////////////////////////
/// If a key "belongs" to a filename revision, then add the full stem of the
