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

fix: improved message api #818

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

fix: improved message api #818

wants to merge 3 commits into from

Conversation

fboucquez
Copy link
Contributor

@fboucquez fboucquez commented Oct 25, 2021

fix: Improved Crypto unit testing
fix: Moved "decode" to Convert.hexToUtf8
fix: EncryptedMessage payload wasn't reproducible.

This fix allows devs to pull the transfer's message bytes as-is without any conventions. message.toBuffer()

@fboucquez fboucquez requested a review from rg911 October 25, 2021 15:59
@fboucquez fboucquez force-pushed the message_improvements branch from 68177a2 to 191f4d0 Compare November 2, 2021 17:46
@fboucquez fboucquez force-pushed the message_improvements branch 2 times, most recently from b61d875 to 632f299 Compare December 11, 2021 09:51
@fboucquez fboucquez requested a review from Jaguar0625 December 11, 2021 10:31
fix: Improved Crypto unit testing
fix: Moved "decode" to Convert.hexToUtf8
fix: EncryptedMessage payload wasn't reproducible.
@fboucquez fboucquez force-pushed the message_improvements branch from 632f299 to 1bbee2b Compare December 15, 2021 00:59
@0x6861746366574 0x6861746366574 self-requested a review December 17, 2021 13:25
@@ -0,0 +1,38 @@
/*
* Copyright 2018 NEM
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be (C) Symbol Contributors 2021.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll update this one, but we would need to update licensing in all the files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/*
 * (C) Symbol Contributors 2021
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Is this the new correct licensing? We would need to patch all the files in another pr.

@@ -171,7 +177,7 @@ export class Crypto {
try {
const decoded = Crypto._decode(recipientPrivate, senderPublic, payloadBuffer, tagAndIv);
return decoded.toUpperCase();
} catch {
} catch (e) {
// To return empty string rather than error throwing if authentication failed
Copy link
Contributor

Choose a reason for hiding this comment

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

What was the reasoning behind returning an empty string rather than an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, we should probably raise an Error. This is a behaviour change, we could do it now too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to raise an error. Note that clients would need to catch them if they aren't decrypting correctly.

fboucquez and others added 2 commits December 17, 2021 16:48
@fboucquez fboucquez force-pushed the message_improvements branch from 6aa0a5e to 1317bed Compare December 19, 2021 18:34
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

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