Skip to content

Commit

Permalink
Merge branch '2.0' into refactor-MetadataFeature
Browse files Browse the repository at this point in the history
  • Loading branch information
Thoralf-M authored Jan 11, 2024
2 parents 990dac1 + 5ac148f commit a7d04a0
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
5 changes: 5 additions & 0 deletions bindings/core/src/method/secret_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ pub enum SecretManagerMethod {
#[derivative(Debug(format_with = "OmittedDebug::omitted_fmt"))]
password: String,
},
/// Clear the stronghold password.
/// Expected response: [`Ok`](crate::Response::Ok)
#[cfg(feature = "stronghold")]
#[cfg_attr(docsrs, doc(cfg(feature = "stronghold")))]
ClearStrongholdPassword
}

#[cfg(test)]
Expand Down
12 changes: 12 additions & 0 deletions bindings/core/src/method_handler/secret_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ where
stronghold.change_password(password).await?;
Response::Ok
}
#[cfg(feature = "stronghold")]
SecretManagerMethod::ClearStrongholdPassword => {
let stronghold = if let Some(secret_manager) = secret_manager.downcast::<StrongholdSecretManager>() {
secret_manager
} else if let Some(SecretManager::Stronghold(secret_manager)) = secret_manager.downcast::<SecretManager>() {
secret_manager
} else {
return Err(iota_sdk::client::Error::SecretManagerMismatch.into());
};
stronghold.clear_key().await;
Response::Ok
}
};
Ok(response)
}
9 changes: 9 additions & 0 deletions bindings/nodejs/lib/secret_manager/secret-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,13 @@ export class SecretManager {
data: { password },
});
}

/**
* Clear the Stronghold password.
*/
async clearStrongholdPassword(): Promise<void> {
await this.methodHandler.callMethod({
name: 'clearStrongholdPassword',
});
}
}
4 changes: 3 additions & 1 deletion bindings/nodejs/lib/types/secret_manager/bridge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type {
__SignSecp256k1EcdsaMethod__,
__SetStrongholdPasswordMethod__,
__ChangeStrongholdPasswordMethod__,
__ClearStrongholdPasswordMethod__,
} from './secret-manager';

export type __SecretManagerMethods__ =
Expand All @@ -23,4 +24,5 @@ export type __SecretManagerMethods__ =
| __SignEd25519Method__
| __SignSecp256k1EcdsaMethod__
| __SetStrongholdPasswordMethod__
| __ChangeStrongholdPasswordMethod__;
| __ChangeStrongholdPasswordMethod__
| __ClearStrongholdPasswordMethod__;
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,7 @@ export interface __ChangeStrongholdPasswordMethod__ {
name: 'changeStrongholdPassword';
data: { password: string };
}

export interface __ClearStrongholdPasswordMethod__ {
name: 'clearStrongholdPassword';
}

0 comments on commit a7d04a0

Please sign in to comment.