feat(dangerous protections): disable dangerous operations by default

This commit is contained in:
2025-07-29 12:13:26 +00:00
parent cb6e79ba50
commit dfbf66e339
3 changed files with 16 additions and 0 deletions

View File

@@ -97,6 +97,12 @@ export class BunqCard {
* Update card settings
*/
public async update(updates: any): Promise<void> {
// Check if this is a dangerous operation
if ((updates.status === 'CANCELLED' || updates.status === 'BLOCKED') &&
!this.bunqAccount.options.dangerousOperations) {
throw new Error('Dangerous operations are not enabled. Initialize the BunqAccount with dangerousOperations: true to allow cancelling or blocking cards.');
}
await this.bunqAccount.apiContext.ensureValidSession();
const cardType = this.type === 'MASTERCARD' ? 'CardCredit' : 'CardDebit';