pub struct JsVault { /* private fields */ }
Expand description
This object provides a safe serialization format for an in-rest encoded vault file for the IOP Stack™.
Implementations§
Source§impl JsVault
impl JsVault
Sourcepub fn create(
phrase: &str,
bip39_password: &str,
unlock_password: &str,
language: Option<String>,
) -> Result<JsVault, JsValue>
pub fn create( phrase: &str, bip39_password: &str, unlock_password: &str, language: Option<String>, ) -> Result<JsVault, JsValue>
Creates a new in-memory vault object from a BIP39 phrase, a seed password (aka 25th word), an unlock password used for encryption of the secrets in rest, and optionally a language code (e.g. ‘zh-hans’ or ‘es’) for the BIP39 phrase words (‘en’ by default).
Sourcepub fn load(data: &JsValue) -> Result<JsVault, JsValue>
pub fn load(data: &JsValue) -> Result<JsVault, JsValue>
Loads the vault from its JSON serialization format. Note that no private keys can be calculated without unlocking the loaded vault with {@link unlock} or with some plugins like {@link HydraPlugin.private} or {@link MorpheusPlugin.private}. The public keys can be enumerated and used without the unlock password.
Sourcepub fn save(&mut self) -> Result<JsValue, JsValue>
pub fn save(&mut self) -> Result<JsValue, JsValue>
Saves the vault into its JSON serialization format. The private keys are encrypted with the unlock password, but the public keys can be enumerated from the file, so make sure you understand the privacy aspects of sharing such file with 3rd parties.
Note that calling this method clears the {@link dirty} flag on the vault.
Sourcepub fn is_dirty(&self) -> Result<bool, JsValue>
pub fn is_dirty(&self) -> Result<bool, JsValue>
Returns whether the vault has changes since it has been last saved.
@see save
Sourcepub fn set_to_dirty(&mut self) -> Result<(), JsValue>
pub fn set_to_dirty(&mut self) -> Result<(), JsValue>
Manually sets the dirty flag on the vault.
Sourcepub fn unlock(&self, password: &str) -> Result<JsSeed, JsValue>
pub fn unlock(&self, password: &str) -> Result<JsSeed, JsValue>
Unlocks the secrets in the vault with a password. Make sure the password is difficult to guess. Good passwords are a few words randomly picked from huge dictionaries, like what the passphrase option of the Bitwarden password generator creates (See correct horse battery staple).
Trait Implementations§
Source§impl FromWasmAbi for JsVault
impl FromWasmAbi for JsVault
Source§impl IntoWasmAbi for JsVault
impl IntoWasmAbi for JsVault
Source§impl LongRefFromWasmAbi for JsVault
impl LongRefFromWasmAbi for JsVault
Source§impl OptionFromWasmAbi for JsVault
impl OptionFromWasmAbi for JsVault
Source§impl OptionIntoWasmAbi for JsVault
impl OptionIntoWasmAbi for JsVault
Source§impl RefFromWasmAbi for JsVault
impl RefFromWasmAbi for JsVault
Source§impl RefMutFromWasmAbi for JsVault
impl RefMutFromWasmAbi for JsVault
Source§impl TryFromJsValue for JsVault
impl TryFromJsValue for JsVault
Source§impl VectorFromWasmAbi for JsVault
impl VectorFromWasmAbi for JsVault
Source§impl VectorIntoWasmAbi for JsVault
impl VectorIntoWasmAbi for JsVault
impl SupportsConstructor for JsVault
impl SupportsInstanceProperty for JsVault
impl SupportsStaticProperty for JsVault
Auto Trait Implementations§
impl Freeze for JsVault
impl !RefUnwindSafe for JsVault
impl Send for JsVault
impl Sync for JsVault
impl Unpin for JsVault
impl !UnwindSafe for JsVault
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::Abi
Source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.