pakstr 0.11.0 → 0.12.1

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.
@@ -0,0 +1,28 @@
1
+ package com.pakstr.app.debug
2
+
3
+ import androidx.test.ext.junit.runners.AndroidJUnit4
4
+ import org.junit.Assert.assertEquals
5
+ import org.junit.Test
6
+ import org.junit.runner.RunWith
7
+
8
+ @RunWith(AndroidJUnit4::class)
9
+ class AppDebugLoggerTest {
10
+
11
+ @Test
12
+ fun release_sanitizer_redacts_object_and_array_payloads() {
13
+ assertEquals(
14
+ "\"event\":\"***\"",
15
+ AppDebugLogger.sanitize(
16
+ "\"event\":{\"kind\":1}",
17
+ isDebugBuild = false
18
+ )
19
+ )
20
+ assertEquals(
21
+ "\"signing_payload\":\"***\"",
22
+ AppDebugLogger.sanitize(
23
+ "\"signing_payload\":[1,2,3]",
24
+ isDebugBuild = false
25
+ )
26
+ )
27
+ }
28
+ }
@@ -209,6 +209,7 @@ class MainActivity : AppCompatActivity(), PermissionHandler {
209
209
  private fun setupSupportUnlockGesture() {
210
210
  supportUnlockGestureLayout.onUnlock = {
211
211
  SupportUnlock.unlock(this)
212
+ DeveloperToolsManager.enableDebug(this)
212
213
  WebViewDebugManager.enable(this)
213
214
  Toast.makeText(
214
215
  this,
@@ -138,8 +138,15 @@ object AppDebugLogger {
138
138
  internal fun sanitize(
139
139
  message: String
140
140
  ): String {
141
+ return sanitize(message, BuildConfig.DEBUG)
142
+ }
143
+
144
+ internal fun sanitize(
145
+ message: String,
146
+ isDebugBuild: Boolean
147
+ ): String {
141
148
 
142
- if (BuildConfig.DEBUG) {
149
+ if (isDebugBuild) {
143
150
  return message
144
151
  }
145
152
 
@@ -154,7 +161,7 @@ object AppDebugLogger {
154
161
  }
155
162
  .replace(
156
163
  Regex(
157
- "(?i)\"(event|signing_?payload)\"\\s*:\\s*(\\{[^\\r\\n]*}|\\[[^\\r\\n]*])"
164
+ "(?i)\"(event|signing_?payload)\"\\s*:\\s*(\\{[^\\r\\n]*\\}|\\[[^\\r\\n]*\\])"
158
165
  )
159
166
  ) { match ->
160
167
  val key = match.groupValues[1]
@@ -0,0 +1,25 @@
1
+ package com.pakstr.app.debug
2
+
3
+ import org.junit.Assert.assertEquals
4
+ import org.junit.Test
5
+
6
+ class AppDebugLoggerTest {
7
+
8
+ @Test
9
+ fun release_sanitizer_redacts_object_and_array_payloads() {
10
+ assertEquals(
11
+ "\"event\":\"***\"",
12
+ AppDebugLogger.sanitize(
13
+ "\"event\":{\"kind\":1}",
14
+ isDebugBuild = false
15
+ )
16
+ )
17
+ assertEquals(
18
+ "\"signing_payload\":\"***\"",
19
+ AppDebugLogger.sanitize(
20
+ "\"signing_payload\":[1,2,3]",
21
+ isDebugBuild = false
22
+ )
23
+ )
24
+ }
25
+ }
package/dist/cli.js CHANGED
@@ -51,6 +51,7 @@ async function runCLI(argv) {
51
51
  await (0, run_1.runCommand)(configFlag ?? undefined, {
52
52
  verifyPublish: args.includes("--verify-publish"),
53
53
  publishOutJson: extractFlag(args, "--publish-out-json"),
54
+ dryRun: args.includes("--dry-run"),
54
55
  });
55
56
  return;
56
57
  default:
@@ -75,7 +76,7 @@ Usage:
75
76
  pakstr build [--config <path>]
76
77
  pakstr sign [--config <path>]
77
78
  pakstr publish [--config <path>] [--dry-run] [--verify] [--out-json <path>]
78
- pakstr run [--config <path>] [--verify-publish] [--publish-out-json <path>]
79
+ pakstr run [--config <path>] [--dry-run] [--verify-publish] [--publish-out-json <path>]
79
80
 
80
81
  pakstr --version
81
82
  pakstr --help
@@ -17,6 +17,10 @@ const publish_1 = require("./publish");
17
17
  * Each step is atomic and fail-fast (§7). The signed APK at build.out is
18
18
  * preserved on a publish failure; only ephemeral/derived material is cleaned
19
19
  * up. `init` is NOT part of `run`.
20
+ *
21
+ * `--dry-run` skips build + sign (no Docker, no APK) and only runs a dry-run
22
+ * publish with stub values and a mock relay — a safe offline smoke test of
23
+ * the Nostr event-signing path.
20
24
  */
21
25
  async function runCommand(configPath, options = {}) {
22
26
  // Step 1: load & validate config, pre-validate nsecs.
@@ -41,6 +45,22 @@ async function runCommand(configPath, options = {}) {
41
45
  console.log("Web:", config.build.web);
42
46
  console.log("Out:", path_1.default.resolve(config.build.out));
43
47
  console.log("Publish:", config.publish.zapstoreEnabled ? "enabled" : "disabled");
48
+ if (options.dryRun) {
49
+ // Skip build + sign — no Docker, no APK. Only exercise the publish
50
+ // event-signing path with stub values and a mock relay.
51
+ if (config.publish.zapstoreEnabled) {
52
+ console.log("\n— Dry run: skipping build + sign, publish only —");
53
+ await (0, publish_1.publishCommand)(config.configPath || undefined, {
54
+ dryRun: true,
55
+ outJson: options.publishOutJson,
56
+ });
57
+ }
58
+ else {
59
+ console.log("\nDry run: publish disabled (publish.zapstore.enabled: false). Nothing to do.");
60
+ }
61
+ console.log("\n✅ pakstr run complete (dry-run)");
62
+ return;
63
+ }
44
64
  // Step 3: build the unsigned APK.
45
65
  console.log("\n— Step 1/3: build —");
46
66
  await (0, build_1.buildCommand)(config.configPath || undefined);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pakstr",
3
- "version": "0.11.0",
3
+ "version": "0.12.1",
4
4
  "description": "CLI for packaging Nostr web apps into Android APKs",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",