Skip to content

ChannelOptions.withCipherKey + tests#513

Merged
paddybyers merged 5 commits intoably:developfrom
amihaiemil:492
Nov 5, 2019
Merged

ChannelOptions.withCipherKey + tests#513
paddybyers merged 5 commits intoably:developfrom
amihaiemil:492

Conversation

@amihaiemil
Copy link
Copy Markdown
Contributor

PR for #492
Changes:

  • Commit 1: moved attributes of ChannelOptions at the top + javadocs
  • Commit 2: formatted method getCipher() (we should avoid inline ifs)
  • Commit 3:
    • Added method withChiperKey as per spec and deprecated fromCipherKey.
    • Added tests.
  • Commit 4: cosmetic changes on RealtimeCryptoTest:
    • added braces to ifs;
    • renamed tx and rx to sender and receiver respectively
    • fixed asserts' error messages
    • removed multiple inline variable initializations

@amihaiemil amihaiemil changed the title ChannelOptions.withCipherKey + tests 3482631 ChannelOptions.withCipherKey + tests Nov 1, 2019
@amihaiemil amihaiemil requested a review from paddybyers November 1, 2019 10:49
Copy link
Copy Markdown
Member

@paddybyers paddybyers left a comment

Choose a reason for hiding this comment

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

LGTM, but a couple of comments.

public Object cipherParams;

/**
* Are these options encrypted or not?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Whether or not this ChannelOptions is encrypted"

I don't like a question here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@paddybyers fixed.

if(cipher != null) return cipher;
return (cipher = Crypto.getCipher(this));
if(!this.encrypted) {
return null;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with the change to add braces, but why the insistence on using this ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@paddybyers I use this. all the time when dealing with class variables. It just seems cleaner to me and its clear from the start that it is a class attribute. I don't like relying on colours :)

I also do it automatically... in previous projects, the build would fail if this, was not used.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Personally I don't like that. I prefer using this where necessary for disambiguation, but not unconditionally.

fail("init0: Unexpected exception instantiating library");
} finally {
if(ably1 != null)
ably1.close();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Braces here pls

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@paddybyers braces are already added. You commented on the 3rd commit (3482631), but the latest is the 4th (d04cc19) where the braces are added everywhere.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok

@amihaiemil
Copy link
Copy Markdown
Contributor Author

@paddybyers please see my answers :)

Copy link
Copy Markdown
Member

@paddybyers paddybyers left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@amihaiemil
Copy link
Copy Markdown
Contributor Author

@paddybyers so can we merge it? :D

@paddybyers paddybyers merged commit 5415f94 into ably:develop Nov 5, 2019
@paddybyers
Copy link
Copy Markdown
Member

so can we merge it?

Yes, if it's approved, then it can be merged.

@amihaiemil
Copy link
Copy Markdown
Contributor Author

@paddybyers I'm just asking because I don't have the rights to merge PRs :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants