-
Notifications
You must be signed in to change notification settings - Fork 57
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
base: dev
Are you sure you want to change the base?
Conversation
68177a2
to
191f4d0
Compare
b61d875
to
632f299
Compare
fix: Improved Crypto unit testing fix: Moved "decode" to Convert.hexToUtf8 fix: EncryptedMessage payload wasn't reproducible.
632f299
to
1bbee2b
Compare
@@ -0,0 +1,38 @@ | |||
/* | |||
* Copyright 2018 NEM |
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.
This should be (C) Symbol Contributors 2021.
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.
I'll update this one, but we would need to update licensing in all the files.
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.
/*
* (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.
src/core/crypto/Crypto.ts
Outdated
@@ -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 |
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.
What was the reasoning behind returning an empty string rather than an error?
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.
You are right, we should probably raise an Error. This is a behaviour change, we could do it now too
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.
Updated to raise an error. Note that clients would need to catch them if they aren't decrypting correctly.
Throwing error when payload cannot be decrypted.
6aa0a5e
to
1317bed
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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()