pakstr 0.12.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pakstr",
3
- "version": "0.12.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",