-
Notifications
You must be signed in to change notification settings - Fork 111
Tip function #6115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tip function #6115
Conversation
Bumps androidx.compose:compose-bom from 2026.01.00 to 2026.01.01. --- updated-dependencies: - dependency-name: androidx.compose:compose-bom dependency-version: 2026.01.01 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps androidx.activity:activity-ktx from 1.12.2 to 1.12.3. --- updated-dependencies: - dependency-name: androidx.activity:activity-ktx dependency-version: 1.12.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps `pagingVersion` from 3.3.6 to 3.4.0. Updates `androidx.paging:paging-runtime-ktx` from 3.3.6 to 3.4.0 Updates `androidx.paging:paging-common-ktx` from 3.3.6 to 3.4.0 --- updated-dependencies: - dependency-name: androidx.paging:paging-runtime-ktx dependency-version: 3.4.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: androidx.paging:paging-common-ktx dependency-version: 3.4.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps androidx.work:work-runtime-ktx from 2.11.0 to 2.11.1. --- updated-dependencies: - dependency-name: androidx.work:work-runtime-ktx dependency-version: 2.11.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps androidx.activity:activity-compose from 1.12.2 to 1.12.3. --- updated-dependencies: - dependency-name: androidx.activity:activity-compose dependency-version: 1.12.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…23 (#6107) Bumps [com.googlecode.libphonenumber:libphonenumber](https://github.com/google/libphonenumber) from 9.0.22 to 9.0.23. - [Release notes](https://github.com/google/libphonenumber/releases) - [Changelog](https://github.com/google/libphonenumber/blob/master/release_notes.txt) - [Commits](google/libphonenumber@v9.0.22...v9.0.23) --- updated-dependencies: - dependency-name: com.googlecode.libphonenumber:libphonenumber dependency-version: 9.0.23 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps `composeVersion` from 1.10.1 to 1.10.2. Updates `androidx.compose.ui:ui-tooling` from 1.10.1 to 1.10.2 Updates `androidx.compose.ui:ui` from 1.10.1 to 1.10.2 Updates `androidx.compose.material:material` from 1.10.1 to 1.10.2 Updates `androidx.compose.ui:ui-tooling-preview` from 1.10.1 to 1.10.2 Updates `androidx.compose.runtime:runtime` from 1.10.1 to 1.10.2 Updates `androidx.compose.runtime:runtime-livedata` from 1.10.1 to 1.10.2 Updates `androidx.compose.runtime:runtime-rxjava2` from 1.10.1 to 1.10.2 Updates `androidx.compose.foundation:foundation` from 1.10.1 to 1.10.2 Updates `androidx.compose.ui:ui-test-junit4` from 1.10.1 to 1.10.2 --- updated-dependencies: - dependency-name: androidx.compose.ui:ui-tooling dependency-version: 1.10.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.compose.ui:ui dependency-version: 1.10.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.compose.material:material dependency-version: 1.10.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.compose.ui:ui-tooling-preview dependency-version: 1.10.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.compose.runtime:runtime dependency-version: 1.10.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.compose.runtime:runtime-livedata dependency-version: 1.10.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.compose.runtime:runtime-rxjava2 dependency-version: 1.10.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.compose.foundation:foundation dependency-version: 1.10.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.compose.ui:ui-test-junit4 dependency-version: 1.10.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps `cameraxVersion` from 1.5.2 to 1.5.3. Updates `androidx.camera:camera-core` from 1.5.2 to 1.5.3 Updates `androidx.camera:camera-camera2` from 1.5.2 to 1.5.3 Updates `androidx.camera:camera-view` from 1.5.2 to 1.5.3 Updates `androidx.camera:camera-lifecycle` from 1.5.2 to 1.5.3 Updates `androidx.camera:camera-video` from 1.5.2 to 1.5.3 --- updated-dependencies: - dependency-name: androidx.camera:camera-core dependency-version: 1.5.3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.camera:camera-camera2 dependency-version: 1.5.3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.camera:camera-view dependency-version: 1.5.3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.camera:camera-lifecycle dependency-version: 1.5.3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.camera:camera-video dependency-version: 1.5.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps `navigationVersion` from 2.9.6 to 2.9.7. Updates `androidx.navigation:navigation-fragment-ktx` from 2.9.6 to 2.9.7 Updates `androidx.navigation:navigation-ui-ktx` from 2.9.6 to 2.9.7 Updates `androidx.navigation:navigation-compose` from 2.9.6 to 2.9.7 Updates `androidx.navigation:navigation-testing` from 2.9.6 to 2.9.7 --- updated-dependencies: - dependency-name: androidx.navigation:navigation-fragment-ktx dependency-version: 2.9.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.navigation:navigation-ui-ktx dependency-version: 2.9.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.navigation:navigation-compose dependency-version: 2.9.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: androidx.navigation:navigation-testing dependency-version: 2.9.7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the TipNode code to use a simpler ByteArray-based API instead of the Scalar object API from the tip library, simplifying the cryptographic key handling.
Changes:
- Replaced Scalar object usage with ByteArray for private keys throughout TipNode
- Updated Tip library method calls to use new ByteArray-based functions (newPrivateKeyFromBytes, publicKeyFromBytes, signFromBytes, etc.)
- Fixed list subtraction operation by converting to Set before subtraction
- Changed a variable from var to val in Tip.kt for immutability
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| app/src/main/java/one/mixin/android/tip/TipNode.kt | Refactored to use ByteArray instead of Scalar for private key handling, updated all Tip library method calls, removed clone() call, fixed list subtraction |
| app/src/main/java/one/mixin/android/tip/Tip.kt | Changed local variable from var to val for better immutability |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ): TipSignRespData { | ||
| val signerPk = Tip.pubKeyFromBase58(signer.identity) | ||
| val plain = Tip.decrypt(signerPk, userSk, resp.data.cipher.hexStringToByteArray()) | ||
| val plain = Tip.decrypt(signerPk, Tip.privateKeyFromHex(userSk.toHex()), resp.data.cipher.hexStringToByteArray()) |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conversion here appears inefficient. The code converts a ByteArray to hex string and then back to a private key format (userSk.toHex() -> privateKeyFromHex()). Since userSk is already in ByteArray format, consider whether the Tip library provides a decrypt method that accepts ByteArray directly, or if newPrivateKeyFromBytes already returns the correct format that can be used directly with decrypt. This round-trip conversion may be unnecessary and impacts performance.
| val plain = Tip.decrypt(signerPk, Tip.privateKeyFromHex(userSk.toHex()), resp.data.cipher.hexStringToByteArray()) | |
| val plain = Tip.decrypt( | |
| signerPk, | |
| Tip.newPrivateKeyFromBytes(userSk), | |
| resp.data.cipher.hexStringToByteArray(), | |
| ) |
| val dataJson = gson.toJson(data).toByteArray() | ||
| Timber.e("genTipSignRequest encrypt start ${tipSigner.index}") | ||
| val cipher = Tip.encrypt(signerPk, userSk, dataJson) | ||
| val cipher = Tip.encrypt(signerPk, Tip.privateKeyFromHex(userSk.toHex()), dataJson) |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conversion here appears inefficient. The code converts a ByteArray to hex string and then back to a private key format (userSk.toHex() -> privateKeyFromHex()). Since userSk is already in ByteArray format, consider whether the Tip library provides an encrypt method that accepts ByteArray directly, or if newPrivateKeyFromBytes already returns the correct format that can be used directly with encrypt. This round-trip conversion may be unnecessary and impacts performance.
| val cipher = Tip.encrypt(signerPk, Tip.privateKeyFromHex(userSk.toHex()), dataJson) | |
| val cipher = Tip.encrypt(signerPk, Tip.newPrivateKeyFromBytes(userSk), dataJson) |
| var retryCount = 0 | ||
| while (retryCount < maxRequestCount) { | ||
| val (sign, tipNodeError) = signTipNode(userSk.clone(), signer, ephemeral, watcher, nonce + retryCount, grace, assignee) | ||
| val (sign, tipNodeError) = signTipNode(userSk, signer, ephemeral, watcher, nonce + retryCount, grace, assignee) |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of clone() here could be problematic if the Tip library functions modify the ByteArray in place. The userSk ByteArray is being passed to multiple concurrent async coroutines (one for each signer), and if any of the Tip library methods (signFromBytes, encrypt, decrypt, etc.) modify the ByteArray, this could lead to race conditions or corrupted data. Consider whether userSk needs to be cloned for each async operation to ensure thread safety, or verify that all Tip library methods treat the ByteArray as immutable.
| val (sign, tipNodeError) = signTipNode(userSk, signer, ephemeral, watcher, nonce + retryCount, grace, assignee) | |
| val (sign, tipNodeError) = signTipNode(userSk.clone(), signer, ephemeral, watcher, nonce + retryCount, grace, assignee) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.