@firebase/util 1.13.0 → 1.14.0-20260224183151

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.
package/dist/index.cjs.js CHANGED
@@ -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
  exports.CONSTANTS = CONSTANTS;
2322
2355
  exports.DecodeBase64StringError = DecodeBase64StringError;
2323
2356
  exports.Deferred = Deferred;
@@ -2344,6 +2377,7 @@ exports.deepEqual = deepEqual;
2344
2377
  exports.deepExtend = deepExtend;
2345
2378
  exports.errorPrefix = errorPrefix;
2346
2379
  exports.extractQuerystring = extractQuerystring;
2380
+ exports.generateSHA256Hash = generateSHA256Hash;
2347
2381
  exports.getDefaultAppConfig = getDefaultAppConfig;
2348
2382
  exports.getDefaultEmulatorHost = getDefaultEmulatorHost;
2349
2383
  exports.getDefaultEmulatorHostnameAndPort = getDefaultEmulatorHostnameAndPort;