diff --git a/identity-account/src/stronghold/hint.rs b/identity-account/src/stronghold/hint.rs new file mode 100644 index 0000000000..ad7a7c378e --- /dev/null +++ b/identity-account/src/stronghold/hint.rs @@ -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(data: &T) -> Result +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() +} diff --git a/identity-account/src/stronghold/mod.rs b/identity-account/src/stronghold/mod.rs index 05aad9ef97..58cf6d2926 100644 --- a/identity-account/src/stronghold/mod.rs +++ b/identity-account/src/stronghold/mod.rs @@ -1,6 +1,7 @@ // Copyright 2020-2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 +mod hint; mod records; mod result; mod runtime; @@ -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;