@@ -17,7 +17,6 @@ import {
17
17
ENABLED_KEY_NAME ,
18
18
METADATA_KEY_NAME ,
19
19
ETAG_KEY_NAME ,
20
- FEATURE_FLAG_ID_KEY_NAME ,
21
20
FEATURE_FLAG_REFERENCE_KEY_NAME ,
22
21
ALLOCATION_KEY_NAME ,
23
22
SEED_KEY_NAME ,
@@ -671,7 +670,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
671
670
const metadata = featureFlag [ TELEMETRY_KEY_NAME ] [ METADATA_KEY_NAME ] ;
672
671
featureFlag [ TELEMETRY_KEY_NAME ] [ METADATA_KEY_NAME ] = {
673
672
[ ETAG_KEY_NAME ] : setting . etag ,
674
- [ FEATURE_FLAG_ID_KEY_NAME ] : await this . #calculateFeatureFlagId( setting ) ,
675
673
[ FEATURE_FLAG_REFERENCE_KEY_NAME ] : this . #createFeatureFlagReference( setting ) ,
676
674
...( metadata || { } )
677
675
} ;
@@ -699,56 +697,6 @@ export class AzureAppConfigurationImpl implements AzureAppConfiguration {
699
697
return featureFlag ;
700
698
}
701
699
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
-
752
700
#createFeatureFlagReference( setting : ConfigurationSetting < string > ) : string {
753
701
let featureFlagReference = `${ this . #clientManager. endpoint . origin } /kv/${ setting . key } ` ;
754
702
if ( setting . label && setting . label . trim ( ) . length !== 0 ) {
0 commit comments