@@ -18,7 +18,6 @@ import {
1818 ENABLED_KEY_NAME ,
1919 METADATA_KEY_NAME ,
2020 ETAG_KEY_NAME ,
21- FEATURE_FLAG_ID_KEY_NAME ,
2221 FEATURE_FLAG_REFERENCE_KEY_NAME ,
2322 ALLOCATION_ID_KEY_NAME ,
2423 ALLOCATION_KEY_NAME ,
@@ -683,7 +682,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
683682 }
684683 featureFlag [ TELEMETRY_KEY_NAME ] [ METADATA_KEY_NAME ] = {
685684 [ ETAG_KEY_NAME ] : setting . etag ,
686- [ FEATURE_FLAG_ID_KEY_NAME ] : await this . #calculateFeatureFlagId( setting ) ,
687685 [ FEATURE_FLAG_REFERENCE_KEY_NAME ] : this . #createFeatureFlagReference( setting ) ,
688686 ...( allocationId !== "" && { [ ALLOCATION_ID_KEY_NAME ] : allocationId } ) ,
689687 ...( metadata || { } )
@@ -712,56 +710,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
712710 return featureFlag ;
713711 }
714712
715- async #calculateFeatureFlagId( setting : ConfigurationSetting < string > ) : Promise < string > {
716- let crypto ;
717-
718- // Check for browser environment
719- if ( typeof window !== "undefined" && window . crypto && window . crypto . subtle ) {
720- crypto = window . crypto ;
721- }
722- // Check for Node.js environment
723- else if ( typeof global !== "undefined" && global . crypto ) {
724- crypto = global . crypto ;
725- }
726- // Fallback to native Node.js crypto module
727- else {
728- try {
729- if ( typeof module !== "undefined" && module . exports ) {
730- crypto = require ( "crypto" ) ;
731- }
732- else {
733- crypto = await import ( "crypto" ) ;
734- }
735- } catch ( error ) {
736- console . error ( "Failed to load the crypto module:" , error . message ) ;
737- throw error ;
738- }
739- }
740-
741- let baseString = `${ setting . key } \n` ;
742- if ( setting . label && setting . label . trim ( ) . length !== 0 ) {
743- baseString += `${ setting . label } ` ;
744- }
745-
746- // Convert to UTF-8 encoded bytes
747- const data = new TextEncoder ( ) . encode ( baseString ) ;
748-
749- // In the browser, use crypto.subtle.digest
750- if ( crypto . subtle ) {
751- const hashBuffer = await crypto . subtle . digest ( "SHA-256" , data ) ;
752- const hashArray = new Uint8Array ( hashBuffer ) ;
753- // btoa/atob is also available in Node.js 18+
754- const base64String = btoa ( String . fromCharCode ( ...hashArray ) ) ;
755- const base64urlString = base64String . replace ( / \+ / g, "-" ) . replace ( / \/ / g, "_" ) . replace ( / = + $ / , "" ) ;
756- return base64urlString ;
757- }
758- // In Node.js, use the crypto module's hash function
759- else {
760- const hash = crypto . createHash ( "sha256" ) . update ( data ) . digest ( ) ;
761- return hash . toString ( "base64url" ) ;
762- }
763- }
764-
765713 #createFeatureFlagReference( setting : ConfigurationSetting < string > ) : string {
766714 let featureFlagReference = `${ this . #clientManager. endpoint . origin } /kv/${ setting . key } ` ;
767715 if ( setting . label && setting . label . trim ( ) . length !== 0 ) {
0 commit comments