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()

fix: Improved Crypto unit testing
fix: Moved "decode" to Convert.hexToUtf8
fix: EncryptedMessage payload wasn't reproducible.
@@ -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
@sonarcloud
Copy link

sonarcloud bot commented Dec 19, 2021

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.

None yet

2 participants