@firebase/util 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2318,6 +2318,39 @@ function getModularInstance(service) {
2318
2318
  }
2319
2319
  }
2320
2320
 
2321
+ /**
2322
+ * @license
2323
+ * Copyright 2025 Google LLC
2324
+ *
2325
+ * Licensed under the Apache License, Version 2.0 (the "License");
2326
+ * you may not use this file except in compliance with the License.
2327
+ * You may obtain a copy of the License at
2328
+ *
2329
+ * http://www.apache.org/licenses/LICENSE-2.0
2330
+ *
2331
+ * Unless required by applicable law or agreed to in writing, software
2332
+ * distributed under the License is distributed on an "AS IS" BASIS,
2333
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2334
+ * See the License for the specific language governing permissions and
2335
+ * limitations under the License.
2336
+ */
2337
+ /**
2338
+ * @public
2339
+ * Generates a SHA-256 hash for the given input string.
2340
+ *
2341
+ * @param input The string to hash.
2342
+ * @returns A promise that resolves to the SHA-256 hash as a hex string.
2343
+ */
2344
+ async function generateSHA256Hash(input) {
2345
+ const textEncoder = new TextEncoder();
2346
+ const data = textEncoder.encode(input);
2347
+ const hashBuffer = await crypto.subtle.digest('SHA-256', data);
2348
+ // Convert ArrayBuffer to hex string
2349
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
2350
+ const hexHash = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
2351
+ return hexHash;
2352
+ }
2353
+
2321
2354
  /**
2322
2355
  * @license
2323
2356
  * Copyright 2017 Google LLC
@@ -2363,6 +2396,7 @@ exports.deepEqual = deepEqual;
2363
2396
  exports.deepExtend = deepExtend;
2364
2397
  exports.errorPrefix = errorPrefix;
2365
2398
  exports.extractQuerystring = extractQuerystring;
2399
+ exports.generateSHA256Hash = generateSHA256Hash;
2366
2400
  exports.getDefaultAppConfig = getDefaultAppConfig;
2367
2401
  exports.getDefaultEmulatorHost = getDefaultEmulatorHost;
2368
2402
  exports.getDefaultEmulatorHostnameAndPort = getDefaultEmulatorHostnameAndPort;