summaryrefslogtreecommitdiff
path: root/ext/crypto/shared.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/crypto/shared.rs')
-rw-r--r--ext/crypto/shared.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/crypto/shared.rs b/ext/crypto/shared.rs
index 0b70db24e..1a0703b26 100644
--- a/ext/crypto/shared.rs
+++ b/ext/crypto/shared.rs
@@ -90,6 +90,13 @@ impl RawKeyData {
_ => Err(type_error("expected private key")),
}
}
+
+ pub fn as_secret_key(&self) -> Result<&[u8], AnyError> {
+ match self {
+ RawKeyData::Secret(data) => Ok(data),
+ _ => Err(type_error("expected secret key")),
+ }
+ }
}
pub fn data_error(msg: impl Into<Cow<'static, str>>) -> AnyError {