@@ -17,7 +17,6 @@ import {
1717 ENABLED_KEY_NAME ,
1818 METADATA_KEY_NAME ,
1919 ETAG_KEY_NAME ,
20- FEATURE_FLAG_ID_KEY_NAME ,
2120 FEATURE_FLAG_REFERENCE_KEY_NAME ,
2221 ALLOCATION_KEY_NAME ,
2322 SEED_KEY_NAME ,
@@ -671,7 +670,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
671670 const metadata = featureFlag [ TELEMETRY_KEY_NAME ] [ METADATA_KEY_NAME ] ;
672671 featureFlag [ TELEMETRY_KEY_NAME ] [ METADATA_KEY_NAME ] = {
673672 [ ETAG_KEY_NAME ] : setting . etag ,
674- [ FEATURE_FLAG_ID_KEY_NAME ] : await this . #calculateFeatureFlagId( setting ) ,
675673 [ FEATURE_FLAG_REFERENCE_KEY_NAME ] : this . #createFeatureFlagReference( setting ) ,
676674 ...( metadata || { } )
677675 } ;
@@ -699,56 +697,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
699697 return featureFlag ;
700698 }
701699
702- async #calculateFeatureFlagId( setting : ConfigurationSetting < string > ) : Promise < string > {
703- let crypto ;
704-
705- // Check for browser environment
706- if ( typeof window !== "undefined" && window . crypto && window . crypto . subtle ) {
707- crypto = window . crypto ;
708- }
709- // Check for Node.js environment
710- else if ( typeof global !== "undefined" && global . crypto ) {
711- crypto = global . crypto ;
712- }
713- // Fallback to native Node.js crypto module
714- else {
715- try {
716- if ( typeof module !== "undefined" && module . exports ) {
717- crypto = require ( "crypto" ) ;
718- }
719- else {
720- crypto = await import ( "crypto" ) ;
721- }
722- } catch ( error ) {
723- console . error ( "Failed to load the crypto module:" , error . message ) ;
724- throw error ;
725- }
726- }
727-
728- let baseString = `${ setting . key } \n` ;
729- if ( setting . label && setting . label . trim ( ) . length !== 0 ) {
730- baseString += `${ setting . label } ` ;
731- }
732-
733- // Convert to UTF-8 encoded bytes
734- const data = new TextEncoder ( ) . encode ( baseString ) ;
735-
736- // In the browser, use crypto.subtle.digest
737- if ( crypto . subtle ) {
738- const hashBuffer = await crypto . subtle . digest ( "SHA-256" , data ) ;
739- const hashArray = new Uint8Array ( hashBuffer ) ;
740- // btoa/atob is also available in Node.js 18+
741- const base64String = btoa ( String . fromCharCode ( ...hashArray ) ) ;
742- const base64urlString = base64String . replace ( / \+ / g, "-" ) . replace ( / \/ / g, "_" ) . replace ( / = + $ / , "" ) ;
743- return base64urlString ;
744- }
745- // In Node.js, use the crypto module's hash function
746- else {
747- const hash = crypto . createHash ( "sha256" ) . update ( data ) . digest ( ) ;
748- return hash . toString ( "base64url" ) ;
749- }
750- }
751-
752700 #createFeatureFlagReference( setting : ConfigurationSetting < string > ) : string {
753701 let featureFlagReference = `${ this . #clientManager. endpoint . origin } /kv/${ setting . key } ` ;
754702 if ( setting . label && setting . label . trim ( ) . length !== 0 ) {
0 commit comments