@solana-mobile/dapp-store-cli 0.4.3 → 0.5.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.
package/lib/CliSetup.js CHANGED
@@ -151,7 +151,7 @@ function resolveBuildToolsPath(buildToolsPath) {
151
151
  /**
152
152
  * This method should be updated with each new release of the CLI, and just do nothing when there isn't anything to report
153
153
  */ function latestReleaseMessage() {
154
- showMessage("Publishing Tools Version ".concat(Constants.CLI_VERSION), "- S3 bucket-based storage support added \n" + "- short_description value reduced to 30 character limit", "warning");
154
+ showMessage("Publishing Tools Version ".concat(Constants.CLI_VERSION), "- short_description value reduced to 30 character limit", "warning");
155
155
  }
156
156
  function tryWithErrorMessage(block) {
157
157
  return _tryWithErrorMessage.apply(this, arguments);
package/lib/CliUtils.js CHANGED
@@ -159,7 +159,7 @@ export var Constants = function Constants() {
159
159
  "use strict";
160
160
  _class_call_check(this, Constants);
161
161
  };
162
- _define_property(Constants, "CLI_VERSION", "0.4.3");
162
+ _define_property(Constants, "CLI_VERSION", "0.5.0");
163
163
  _define_property(Constants, "CONFIG_FILE_NAME", "config.yaml");
164
164
  _define_property(Constants, "DEFAULT_RPC_DEVNET", "https://api.devnet.solana.com");
165
165
  _define_property(Constants, "getConfigFilePath", function() {
@@ -456,15 +456,15 @@ var checkIconDimensions = function() {
456
456
  }();
457
457
  var getAndroidDetails = function() {
458
458
  var _ref = _async_to_generator(function(aaptDir, apkPath) {
459
- var stdout, appPackage, versionCode, versionName, minSdk, permissions, locales, _locales_values, localeArray, localesSrc, _appPackage_, _minSdk_, _versionCode_, _versionName_, e;
459
+ var stdout, appPackage, versionCode, versionName, minSdk, permissions, locales, _locales_values, localeArray, localesSrc, _appPackage_, _minSdk_, _versionCode_, _versionName_, _tmp, e;
460
460
  return _ts_generator(this, function(_state) {
461
461
  switch(_state.label){
462
462
  case 0:
463
463
  _state.trys.push([
464
464
  0,
465
- 2,
465
+ 3,
466
466
  ,
467
- 3
467
+ 4
468
468
  ]);
469
469
  return [
470
470
  4,
@@ -488,23 +488,27 @@ var getAndroidDetails = function() {
488
488
  if (localeArray.length >= 60) {
489
489
  showMessage("The bundle apk claims supports for following locales", "Claim for supported locales::\n" + localeArray + "\nIf this release does not support all these locales the release may be rejected" + "\nSee details at https://developer.android.com/guide/topics/resources/multilingual-support#design for configuring the supported locales", "warning");
490
490
  }
491
+ _tmp = {
492
+ android_package: (_appPackage_ = appPackage === null || appPackage === void 0 ? void 0 : appPackage[1]) !== null && _appPackage_ !== void 0 ? _appPackage_ : "",
493
+ min_sdk: parseInt((_minSdk_ = minSdk === null || minSdk === void 0 ? void 0 : minSdk[1]) !== null && _minSdk_ !== void 0 ? _minSdk_ : "0", 10),
494
+ version_code: parseInt((_versionCode_ = versionCode === null || versionCode === void 0 ? void 0 : versionCode[1]) !== null && _versionCode_ !== void 0 ? _versionCode_ : "0", 10),
495
+ version: (_versionName_ = versionName === null || versionName === void 0 ? void 0 : versionName[1]) !== null && _versionName_ !== void 0 ? _versionName_ : "0"
496
+ };
491
497
  return [
492
- 2,
493
- {
494
- android_package: (_appPackage_ = appPackage === null || appPackage === void 0 ? void 0 : appPackage[1]) !== null && _appPackage_ !== void 0 ? _appPackage_ : "",
495
- min_sdk: parseInt((_minSdk_ = minSdk === null || minSdk === void 0 ? void 0 : minSdk[1]) !== null && _minSdk_ !== void 0 ? _minSdk_ : "0", 10),
496
- version_code: parseInt((_versionCode_ = versionCode === null || versionCode === void 0 ? void 0 : versionCode[1]) !== null && _versionCode_ !== void 0 ? _versionCode_ : "0", 10),
497
- version: (_versionName_ = versionName === null || versionName === void 0 ? void 0 : versionName[1]) !== null && _versionName_ !== void 0 ? _versionName_ : "0",
498
- permissions: permissions.flatMap(function(permission) {
499
- return permission[1];
500
- }),
501
- locales: localeArray
502
- }
498
+ 4,
499
+ extractCertFingerprint(aaptDir, apkPath)
503
500
  ];
504
501
  case 2:
502
+ return [
503
+ 2,
504
+ (_tmp.cert_fingerprint = _state.sent(), _tmp.permissions = permissions.flatMap(function(permission) {
505
+ return permission[1];
506
+ }), _tmp.locales = localeArray, _tmp)
507
+ ];
508
+ case 3:
505
509
  e = _state.sent();
506
510
  throw new Error("There was an error parsing your APK. Please ensure you have provided a valid Android tools directory containing AAPT2.");
507
- case 3:
511
+ case 4:
508
512
  return [
509
513
  2
510
514
  ];
@@ -515,6 +519,38 @@ var getAndroidDetails = function() {
515
519
  return _ref.apply(this, arguments);
516
520
  };
517
521
  }();
522
+ export var extractCertFingerprint = function() {
523
+ var _ref = _async_to_generator(function(aaptDir, apkPath) {
524
+ var stdout, regex, match;
525
+ return _ts_generator(this, function(_state) {
526
+ switch(_state.label){
527
+ case 0:
528
+ return [
529
+ 4,
530
+ runExec("".concat(aaptDir, '/apksigner verify --print-certs -v "').concat(apkPath, '"'))
531
+ ];
532
+ case 1:
533
+ stdout = _state.sent().stdout;
534
+ regex = /Signer #1 certificate SHA-256 digest:\s*([a-fA-F0-9]+)/;
535
+ match = stdout.match(regex);
536
+ if (match && match[1]) {
537
+ return [
538
+ 2,
539
+ match[1]
540
+ ];
541
+ } else {
542
+ throw new Error("Could not obtain cert fingerprint");
543
+ }
544
+ return [
545
+ 2
546
+ ];
547
+ }
548
+ });
549
+ });
550
+ return function extractCertFingerprint(aaptDir, apkPath) {
551
+ return _ref.apply(this, arguments);
552
+ };
553
+ }();
518
554
  export var writeToPublishDetails = function() {
519
555
  var _ref = _async_to_generator(function(param) {
520
556
  var publisher, app, release, currentConfig, _publisher_address, _app_address, _release_address, newConfig;
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana-mobile/dapp-store-cli",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -53,7 +53,7 @@
53
53
  "dependencies": {
54
54
  "@aws-sdk/client-s3": "^3.321.1",
55
55
  "@metaplex-foundation/js-plugin-aws": "^0.18.3",
56
- "@solana-mobile/dapp-store-publishing-tools": "workspace:0.4.3",
56
+ "@solana-mobile/dapp-store-publishing-tools": "workspace:0.5.0",
57
57
  "@solana/web3.js": "1.68.0",
58
58
  "@types/semver": "^7.3.13",
59
59
  "ajv": "^8.11.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana-mobile/dapp-store-cli",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -46,7 +46,7 @@
46
46
  "dependencies": {
47
47
  "@aws-sdk/client-s3": "^3.321.1",
48
48
  "@metaplex-foundation/js-plugin-aws": "^0.18.3",
49
- "@solana-mobile/dapp-store-publishing-tools": "0.4.3",
49
+ "@solana-mobile/dapp-store-publishing-tools": "0.5.0",
50
50
  "@solana/web3.js": "1.68.0",
51
51
  "@types/semver": "^7.3.13",
52
52
  "ajv": "^8.11.0",
package/src/CliSetup.ts CHANGED
@@ -48,7 +48,6 @@ function resolveBuildToolsPath(buildToolsPath: string | undefined) {
48
48
  function latestReleaseMessage() {
49
49
  showMessage(
50
50
  `Publishing Tools Version ${ Constants.CLI_VERSION }`,
51
- "- S3 bucket-based storage support added \n" +
52
51
  "- short_description value reduced to 30 character limit",
53
52
  "warning"
54
53
  );
package/src/CliUtils.ts CHANGED
@@ -18,7 +18,7 @@ import { awsStorage } from "@metaplex-foundation/js-plugin-aws";
18
18
  import { S3StorageManager } from "./config/index.js";
19
19
 
20
20
  export class Constants {
21
- static CLI_VERSION = "0.4.3";
21
+ static CLI_VERSION = "0.5.0";
22
22
  static CONFIG_FILE_NAME = "config.yaml";
23
23
  static DEFAULT_RPC_DEVNET = "https://api.devnet.solana.com";
24
24
 
@@ -237,6 +237,7 @@ const getAndroidDetails = async (
237
237
  min_sdk: parseInt(minSdk?.[1] ?? "0", 10),
238
238
  version_code: parseInt(versionCode?.[1] ?? "0", 10),
239
239
  version: versionName?.[1] ?? "0",
240
+ cert_fingerprint: await extractCertFingerprint(aaptDir, apkPath),
240
241
  permissions: permissions.flatMap(permission => permission[1]),
241
242
  locales: localeArray
242
243
  };
@@ -245,6 +246,19 @@ const getAndroidDetails = async (
245
246
  }
246
247
  };
247
248
 
249
+ export const extractCertFingerprint = async (aaptDir: string, apkPath: string): Promise<string> => {
250
+ const { stdout } = await runExec(`${aaptDir}/apksigner verify --print-certs -v "${apkPath}"`);
251
+
252
+ const regex = /Signer #1 certificate SHA-256 digest:\s*([a-fA-F0-9]+)/;
253
+ const match = stdout.match(regex);
254
+
255
+ if (match && match[1]) {
256
+ return match[1];
257
+ } else {
258
+ throw new Error("Could not obtain cert fingerprint")
259
+ }
260
+ }
261
+
248
262
  export const writeToPublishDetails = async ({ publisher, app, release }: SaveToConfigArgs) => {
249
263
  const currentConfig = await loadPublishDetailsWithChecks();
250
264