Skip to content

Commit a0790ff

Browse files
majectymergify[bot]
authored andcommittedNov 30, 2020
Rename seal to encryption
"Seal" can be confusing since it is used for signatures for block.
1 parent acc406d commit a0790ff

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed
 

‎key/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ pub use crate::ed25519::{
3232
sign, verify, KeyPair as Ed25519KeyPair, Private as Ed25519Private, Public as Ed25519Public, Signature,
3333
SIGNATURE_LENGTH,
3434
};
35-
pub use crate::encryption::{decrypt, encrypt, KeyPair as SealKeyPair, Private as SealPrivate, Public as SealPublic};
35+
pub use crate::encryption::{
36+
decrypt, encrypt, KeyPair as EncryptionKeyPair, Private as EncryptionPrivate, Public as EncryptionPublic,
37+
};
3638
pub use crate::error::Error;
3739
pub use crate::keypair::KeyPair as KeyPairTrait;
3840
pub use crate::network::NetworkId;

‎key/src/random.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

17-
use crate::{Ed25519KeyPair, Generator, KeyPairTrait, SealKeyPair, X25519KeyPair, X25519Private, X25519Public};
17+
use crate::{Ed25519KeyPair, EncryptionKeyPair, Generator, KeyPairTrait, X25519KeyPair, X25519Private, X25519Public};
1818
use never_type::Never;
1919
use rand::rngs::OsRng;
2020
#[cfg(test)]
@@ -128,12 +128,12 @@ impl Generator<X25519KeyPair> for XorShiftRng {
128128
}
129129
}
130130

131-
impl Generator<SealKeyPair> for Random {
131+
impl Generator<EncryptionKeyPair> for Random {
132132
type Error = ::std::io::Error;
133133

134134
//FIXME: there is no distinction between the two generate functions
135135
#[cfg(not(test))]
136-
fn generate(&mut self) -> Result<SealKeyPair, Self::Error> {
136+
fn generate(&mut self) -> Result<EncryptionKeyPair, Self::Error> {
137137
let mut rng = OsRng::new()?;
138138
match rng.generate() {
139139
Ok(pair) => Ok(pair),
@@ -142,7 +142,7 @@ impl Generator<SealKeyPair> for Random {
142142
}
143143

144144
#[cfg(test)]
145-
fn generate(&mut self) -> Result<SealKeyPair, Self::Error> {
145+
fn generate(&mut self) -> Result<EncryptionKeyPair, Self::Error> {
146146
RNG.with(|rng| {
147147
match rng.borrow_mut().generate() {
148148
Ok(pair) => Ok(pair),
@@ -152,20 +152,20 @@ impl Generator<SealKeyPair> for Random {
152152
}
153153
}
154154

155-
impl Generator<SealKeyPair> for OsRng {
155+
impl Generator<EncryptionKeyPair> for OsRng {
156156
type Error = Never;
157157

158-
fn generate(&mut self) -> Result<SealKeyPair, Self::Error> {
158+
fn generate(&mut self) -> Result<EncryptionKeyPair, Self::Error> {
159159
let (publ, sec) = gen_curve25519xsalsa20poly1305();
160-
Ok(SealKeyPair::from_keypair(sec.into(), publ.into()))
160+
Ok(EncryptionKeyPair::from_keypair(sec.into(), publ.into()))
161161
}
162162
}
163163

164-
impl Generator<SealKeyPair> for XorShiftRng {
164+
impl Generator<EncryptionKeyPair> for XorShiftRng {
165165
type Error = Never;
166166

167-
fn generate(&mut self) -> Result<SealKeyPair, Self::Error> {
167+
fn generate(&mut self) -> Result<EncryptionKeyPair, Self::Error> {
168168
let (publ, sec) = gen_curve25519xsalsa20poly1305();
169-
Ok(SealKeyPair::from_keypair(sec.into(), publ.into()))
169+
Ok(EncryptionKeyPair::from_keypair(sec.into(), publ.into()))
170170
}
171171
}

0 commit comments

Comments
 (0)
Please sign in to comment.