From f3b077faeb4a8ee9b8770139464fa78043549ce7 Mon Sep 17 00:00:00 2001 From: Micah Wood Date: Tue, 7 Mar 2023 18:10:38 -0500 Subject: [PATCH] Decrypt token when calling `wp option get nfd_data_token` from WP-CLI --- bootstrap.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bootstrap.php b/bootstrap.php index d1032cb..15a9893 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -49,6 +49,18 @@ function ( $value ) { } ); + // Auto-decrypt token when fetched via WP-CLI + if ( defined( 'WP_CLI' ) && WP_CLI ) { + add_filter( + 'option_nfd_data_token', + function ( $value ) { + $encryption = new Encryption(); + + return $encryption->decrypt( $value ); + } + ); + } + // Register activation hook add_action( 'newfold_container_set',