@@ -66,7 +66,7 @@ class LaravelEncrypter {
6666 'aes-128-cbc' : { size : 16 , aead : false } ,
6767 'aes-256-cbc' : { size : 32 , aead : false } ,
6868 'aes-128-gcm' : { size : 16 , aead : true } ,
69- 'aes-256-gcm' : { size : 32 , aead : true } ,
69+ 'aes-256-gcm' : { size : 32 , aead : true }
7070 } ;
7171
7272 /**
@@ -112,9 +112,9 @@ class LaravelEncrypter {
112112
113113 // Laravel 10.x default settings (works for Laravel 5.x - 12.x)
114114 // These settings are optimized for Laravel and usually don't need to be changed
115- this . detectMacMethod = options . macMethod || 'laravel10' ; // Laravel 10.x MAC method is default
116- this . macPrefix = options . macPrefix || 'laravel.' ; // Not used for Laravel 10.x
117- this . autoDetectMac = options . autoDetectMac ?? false ; // Default off for better performance
115+ this . detectMacMethod = options . macMethod || 'laravel10' ; // Laravel 10.x MAC method is default
116+ this . macPrefix = options . macPrefix || 'laravel.' ; // Not used for Laravel 10.x
117+ this . autoDetectMac = options . autoDetectMac ?? false ; // Default off for better performance
118118
119119 if ( ! this . supported ( this . cipher ) ) {
120120 throw new Error ( `Unsupported cipher: ${ cipher } ` ) ;
@@ -284,7 +284,7 @@ class LaravelEncrypter {
284284 // Serialize the value if needed
285285 const valueToEncrypt = serialize ? this . serialize ( value ) : value ;
286286
287- let encrypted , tag = '' ;
287+ let encrypted ; let tag = '' ;
288288
289289 if ( this . isAead ( ) ) {
290290 // AEAD mode (GCM)
@@ -308,7 +308,7 @@ class LaravelEncrypter {
308308 iv : iv . toString ( 'base64' ) ,
309309 value : encrypted . toString ( 'base64' ) ,
310310 mac : '' ,
311- tag : tag
311+ tag
312312 } ;
313313
314314 // Generate MAC for non-AEAD ciphers
@@ -463,16 +463,16 @@ class LaravelEncrypter {
463463 * @returns {string } - The detected MAC method
464464 */
465465 detectMacMethodFromPayload ( payload ) {
466- const data = typeof payload === 'string' ?
467- JSON . parse ( Buffer . from ( payload , 'base64' ) . toString ( 'utf8' ) ) :
468- payload ;
466+ const data = typeof payload === 'string'
467+ ? JSON . parse ( Buffer . from ( payload , 'base64' ) . toString ( 'utf8' ) )
468+ : payload ;
469469
470470 // Laravel 10.x uses direct concatenation of base64 strings
471471 const message = data . iv + data . value ;
472472 const mac = crypto . createHmac ( 'sha256' , this . key ) . update ( message ) . digest ( 'hex' ) ;
473473
474474 if ( mac === data . mac ) {
475- console . log ( ` ✅ Auto-detected Laravel 10.x MAC method` ) ;
475+ console . log ( ' ✅ Auto-detected Laravel 10.x MAC method' ) ;
476476 return 'laravel10' ;
477477 }
478478
@@ -542,7 +542,7 @@ class LaravelEncrypter {
542542 return {
543543 decoded : data ,
544544 providedMac : data . mac ,
545- calculatedMac : calculatedMac ,
545+ calculatedMac,
546546 macMatches : calculatedMac === data . mac ,
547547 keyLength : this . key . length ,
548548 keyBase64 : this . key . toString ( 'base64' ) ,
@@ -621,4 +621,3 @@ class Crypt {
621621
622622// Export both classes
623623module . exports = { LaravelEncrypter, Crypt } ;
624-
0 commit comments