Skip to content
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

make secretbox methods return nullable #102

Merged
merged 1 commit into from
Jul 18, 2024
Merged

Conversation

wiyarmir
Copy link
Member

this matches the actual api contract of the underlying tweetnacl java implementation

this matches the actual api contract of the underlying tweetnacl java implementation
@wiyarmir wiyarmir requested a review from jszmltr July 18, 2024 11:55
@wiyarmir wiyarmir enabled auto-merge July 18, 2024 11:55
TweetNaclFast.SecretBox(secretKey).box(message, nonce)

override fun open(box: ByteArray, nonce: ByteArray): ByteArray =
override fun open(box: ByteArray, nonce: ByteArray): ByteArray? =
TweetNaclFast.SecretBox(secretKey).open(box, nonce)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this throw instead of returning null ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can runCatching getOrNull here ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally with some logger 👀 :¯_(ツ)_/¯

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok. It was throwing nullpointer exception with the result being null 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry the nope was at the throw comment 😂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a library, I think the functionality should be minimal. I'm doing all those things in the app

@wiyarmir wiyarmir added this pull request to the merge queue Jul 18, 2024
@jszmltr jszmltr self-assigned this Jul 18, 2024
Merged via the queue into main with commit b78cfc8 Jul 18, 2024
1 check passed
@wiyarmir wiyarmir deleted the secretbox-nullability branch July 18, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants