Skip to content

Commit

Permalink
hint helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
l1h3r committed Mar 2, 2021
1 parent 52fc5a2 commit 0e930c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions identity-account/src/stronghold/hint.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2020-2021 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

use iota_stronghold::Error;
use iota_stronghold::RecordHint;

use crate::error::Result;

pub fn hint<T>(data: &T) -> Result<RecordHint>
where
T: AsRef<[u8]> + ?Sized,
{
RecordHint::new(data.as_ref()).map_err(Error::from).map_err(Into::into)
}

pub fn default_hint() -> RecordHint {
RecordHint::new([0; 24]).unwrap()
}
3 changes: 3 additions & 0 deletions identity-account/src/stronghold/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2020-2021 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

mod hint;
mod records;
mod result;
mod runtime;
Expand All @@ -10,6 +11,8 @@ mod vault;

pub(crate) use self::runtime::Runtime;

pub use self::hint::default_hint;
pub use self::hint::hint;
pub use self::records::RecordIndex;
pub use self::records::RecordTag;
pub use self::records::Records;
Expand Down

0 comments on commit 0e930c4

Please sign in to comment.