-
Notifications
You must be signed in to change notification settings - Fork 26
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
ARTCipherParams
and ARTCrypto
doc comments
#1439
Conversation
I've added @m-hulbert as a reviewer here, too, since he might be picking up any necessary changes to the canonical documentation once @tbedford rolls off this project. |
@@ -28,13 +28,20 @@ NS_ASSUME_NONNULL_BEGIN | |||
@end | |||
|
|||
/** | |||
ARTCipherParams contains configuration options for a channel cipher, including algorithm, mode, key length and key. | |||
Ably client libraries currently support AES with CBC, PKCS#7 with a default key length of 256 bits. All implementations also support AES128. | |||
The ARTCipherParams object contains properties to configure encryption for a channel. |
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.
The ARTCipherParams object contains properties to configure encryption for a channel. | |
The `ARTCipherParams` object contains properties to configure encryption for a channel. |
@tbedford @m-hulbert I’d suggest that this sort of formatting should be in the canonical documentation, what do you think?
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.
Agree with the formatting. It is already styled as code in the canonical docs though.
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 will link to the page that user is already on. Is this what was expected? @lawrence-forooghian
Source/ARTCrypto.h
Outdated
*/ | ||
@interface ARTCipherParams : NSObject <ARTCipherParamsCompatible> | ||
|
||
/// The algorithm to use for encryption. Only AES is supported. |
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.
@tbedford @m-hulbert For consistency with the documentation for mode
, should this not be the following?
/// The algorithm to use for encryption. Only AES is supported. | |
/// The algorithm to use for encryption. Only `"AES"` is supported. |
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 just be AES
(no " ") as per the canonical table.
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.
Source/ARTCrypto.h
Outdated
@property (readonly, nonatomic) NSUInteger keyLength; | ||
|
||
/// The cipher mode. Only "CBC" is supported. |
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.
/// The cipher mode. Only "CBC" is supported. | |
/// The cipher mode. Only `"CBC"` is supported. |
@tbedford @m-hulbert as I mentioned elsewhere in this PR, I think this sort of formatting should be part of the canonical docs?
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 just be CBC
(no " ") as per the canonical table.
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.
@@ -44,11 +51,30 @@ NS_ASSUME_NONNULL_BEGIN | |||
|
|||
@end | |||
|
|||
/** | |||
The ARTCrypto object ensures that message payloads are encrypted, can never be decrypted by Ably, and can only be decrypted by other clients that share the same secret symmetric key. |
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.
The ARTCrypto object ensures that message payloads are encrypted, can never be decrypted by Ably, and can only be decrypted by other clients that share the same secret symmetric key. | |
The `ARTCrypto` object ensures that message payloads are encrypted, can never be decrypted by Ably, and can only be decrypted by other clients that share the same secret symmetric key. |
@tbedford @m-hulbert as I mentioned elsewhere in this PR, I think this sort of formatting should be part of the canonical docs?
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.
Agree with the change and this is also part of the canonical table already.
@@ -44,11 +51,30 @@ NS_ASSUME_NONNULL_BEGIN | |||
|
|||
@end | |||
|
|||
/** | |||
The ARTCrypto object ensures that message payloads are encrypted, can never be decrypted by Ably, and can only be decrypted by other clients that share the same secret symmetric key. |
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.
The ARTCrypto object ensures that message payloads are encrypted, can never be decrypted by Ably, and can only be decrypted by other clients that share the same secret symmetric key. | |
The ARTCrypto class ensures that message payloads are encrypted, can never be decrypted by Ably, and can only be decrypted by other clients that share the same secret symmetric key. |
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'm not sure whether I agree with this description entirely. I think that the description of how encryption works in Ably is a good one, but it's not the ARTCrypto
class itself that's responsible for performing the encryption. It’s more of a utility class, which helps you to create the parameters used to configure encryption elsewhere in the SDK.
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.
Is something like the following more accurate?
The `ARTCrypto` class enables you to set the parameters required for configuring the encryption of message payloads.
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.
How about
The
ARTCrypto
class enables you to generate the parameters required for configuring the encryption of message payloads.
Source/ARTCrypto.h
Outdated
/** | ||
Retrieves, or optionally sets, the `ARTCipherParams` for the channel. | ||
@param params Overrides the default parameters. A suitable key must be provided as a minimum. | ||
@return `ARTCipherParams` A ARTCipherParams object, using the default values for any field not supplied. |
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.
@return `ARTCipherParams` A ARTCipherParams object, using the default values for any field not supplied. | |
@return `ARTCipherParams` A `ARTCipherParams` object, using the default values for any field not supplied. |
Source/ARTCrypto.h
Outdated
/** | ||
Retrieves, or optionally sets, the `ARTCipherParams` for the channel. | ||
@param params Overrides the default parameters. A suitable key must be provided as a minimum. | ||
@return `ARTCipherParams` A ARTCipherParams object, using the default values for any field not supplied. |
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 think it should be "An ARTCipherParams object", not "A".
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.
Source/ARTCrypto.h
Outdated
|
||
/** | ||
Generates a random key to be used in the encryption of the channel. | ||
@param keyLength The length of the key, in bits, to be generated. If not specified, this is equal to the default keyLength of the default algorithm: for AES this is 256 bits. |
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.
@param keyLength The length of the key, in bits, to be generated. If not specified, this is equal to the default keyLength of the default algorithm: for AES this is 256 bits. | |
@param keyLength The length of the key, in bits, to be generated. If not specified, this is equal to the default key length of the default algorithm: for AES this is 256 bits. |
@tbedford @m-hulbert I think an encryption algorithm is an abstract concept and not a class in our SDK, so I'm not sure that using keyLength
, which suggests a property name, is appropriate here. Not sure though.
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.
@QuintinWillison are you able to confirm this if possible?
Source/ARTCrypto.h
Outdated
|
||
/** | ||
Generates a random key to be used in the encryption of the channel. | ||
@param keyLength The length of the key, in bits, to be generated. If not specified, this is equal to the default keyLength of the default algorithm: for AES this is 256 bits. |
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.
@maratal what does it mean to "not specify" a keyLength
here?
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.
Source/ARTCrypto.h
Outdated
/** | ||
Retrieves, or optionally sets, the `ARTCipherParams` for the channel. | ||
@param params Overrides the default parameters. A suitable key must be provided as a minimum. | ||
@return `ARTCipherParams` A ARTCipherParams object, using the default values for any field not supplied. |
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.
@maratal this question applies to all of the @return
tags where you've written the return type as part of the tag – do you think this is necessary? The return type is already displayed in the Jazzy documentation as part of the method signature:
If you look at Apple's documentation (example), the "Return Value" section doesn't repeat the return type; rather, it's used to provide semantic information about the return value:
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.
Source/ARTCrypto.h
Outdated
+ (NSData *)generateRandomKey:(NSUInteger)keyLength; | ||
|
||
/** | ||
Same as `+getDefaultParams:`, but with the default algorithm and key length: AES, 256 bits. |
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.
The description for generateRandomKey
is the following in the canonical table:
Generates a random key to be used in the encryption of the channel.
I'm assuming this should be something like "Generates a random key to use for encrypting message payloads." instead given @lawrence-forooghian 's comment on getDefaultParams
.
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.
But we have two methods with this name: one with parameter keyLength
, and one without parameters. Canonical table contains only one description and notes that "If not specified, this is equal to the default keyLength of the default algorithm: for AES this is 256 bits.". So I decided to produce different description for method without parameter. Also I've messed up with the referred method: +getDefaultParams:
instead of generateRandomKey:
. Duh! @lawrence-forooghian @m-hulbert
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.
Closed in favor of #1491 |
Added docstrings according to ably/sdk-api-reference#8
Was checked for compatibility with
jazzy
.