Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

apps-android-sha-list.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const Table = require("cli-table");
  5. const command_1 = require("../command");
  6. const projectUtils_1 = require("../projectUtils");
  7. const apps_1 = require("../management/apps");
  8. const requireAuth_1 = require("../requireAuth");
  9. const logger_1 = require("../logger");
  10. const utils_1 = require("../utils");
  11. function logCertificatesList(certificates) {
  12. if (certificates.length === 0) {
  13. logger_1.logger.info("No SHA certificate hashes found.");
  14. return;
  15. }
  16. const tableHead = ["App Id", "SHA Id", "SHA Hash", "SHA Hash Type"];
  17. const table = new Table({ head: tableHead, style: { head: ["green"] } });
  18. certificates.forEach(({ name, shaHash, certType }) => {
  19. const splitted = name.split("/");
  20. const appId = splitted[3];
  21. const shaId = splitted[5];
  22. table.push([appId, shaId, shaHash, certType]);
  23. });
  24. logger_1.logger.info(table.toString());
  25. }
  26. function logCertificatesCount(count = 0) {
  27. if (count === 0) {
  28. return;
  29. }
  30. logger_1.logger.info("");
  31. logger_1.logger.info(`${count} SHA hash(es) total.`);
  32. }
  33. exports.command = new command_1.Command("apps:android:sha:list <appId>")
  34. .description("list the SHA certificate hashes for a given app id. ")
  35. .before(requireAuth_1.requireAuth)
  36. .action(async (appId = "", options) => {
  37. const projectId = (0, projectUtils_1.needProjectId)(options);
  38. const shaCertificates = await (0, utils_1.promiseWithSpinner)(async () => await (0, apps_1.listAppAndroidSha)(projectId, appId), "Preparing the list of your Firebase Android app SHA certificate hashes");
  39. logCertificatesList(shaCertificates);
  40. logCertificatesCount(shaCertificates.length);
  41. return shaCertificates;
  42. });