-
Notifications
You must be signed in to change notification settings - Fork 56
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
[SDK-3735] Create tree-shakable Crypto
module
#1419
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
temporarily deployed
to
staging/pull/1419/bundle-report
August 3, 2023 12:58
Inactive
lawrence-forooghian
force-pushed
the
1396-Crypto-tree-shaking
branch
2 times, most recently
from
August 3, 2023 13:36
4db984d
to
ac1b598
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1419/bundle-report
August 3, 2023 13:37
Inactive
lawrence-forooghian
force-pushed
the
1396-Crypto-tree-shaking
branch
from
August 3, 2023 13:48
ac1b598
to
288923f
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1419/bundle-report
August 3, 2023 13:49
Inactive
lawrence-forooghian
force-pushed
the
1396-Crypto-tree-shaking
branch
from
August 3, 2023 14:06
288923f
to
66ac29a
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1419/bundle-report
August 3, 2023 14:07
Inactive
lawrence-forooghian
force-pushed
the
1396-Crypto-tree-shaking
branch
from
August 3, 2023 18:04
66ac29a
to
5417d89
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1419/bundle-report
August 3, 2023 18:06
Inactive
lawrence-forooghian
force-pushed
the
1415-tree-shaking-attempt-2
branch
2 times, most recently
from
August 15, 2023 13:19
214c2cf
to
afb0235
Compare
lawrence-forooghian
force-pushed
the
1396-Crypto-tree-shaking
branch
from
August 15, 2023 14:07
5417d89
to
349cc38
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1419/features
August 15, 2023 14:07
Inactive
github-actions
bot
temporarily deployed
to
staging/pull/1419/bundle-report
August 15, 2023 14:08
Inactive
lawrence-forooghian
force-pushed
the
1415-tree-shaking-attempt-2
branch
from
August 15, 2023 16:45
afb0235
to
8091660
Compare
lawrence-forooghian
force-pushed
the
1396-Crypto-tree-shaking
branch
2 times, most recently
from
August 15, 2023 17:26
e45c239
to
6e6c3a1
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1419/features
August 15, 2023 17:27
Inactive
github-actions
bot
temporarily deployed
to
staging/pull/1419/typedoc
October 26, 2023 16:40
Inactive
github-actions
bot
temporarily deployed
to
staging/pull/1419/bundle-report
October 26, 2023 16:40
Inactive
lawrence-forooghian
force-pushed
the
1415-tree-shaking-attempt-2
branch
from
October 26, 2023 17:21
1be851b
to
7e21e56
Compare
lawrence-forooghian
force-pushed
the
1396-Crypto-tree-shaking
branch
from
October 26, 2023 17:22
2a59784
to
fd7e1a4
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1419/features
October 26, 2023 17:22
Inactive
github-actions
bot
temporarily deployed
to
staging/pull/1419/typedoc
October 26, 2023 17:23
Inactive
github-actions
bot
temporarily deployed
to
staging/pull/1419/bundle-report
October 26, 2023 17:23
Inactive
owenpearson
requested changes
Nov 1, 2023
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.
Looks good overall, one question though:
owenpearson
approved these changes
Nov 1, 2023
lawrence-forooghian
force-pushed
the
1415-tree-shaking-attempt-2
branch
2 times, most recently
from
November 6, 2023 19:09
70bee18
to
abec79c
Compare
The type of this property in ably.d.ts does not permit it to be absent or null. So, instead, throw an error if the user attempts to access it when not set (for example, in the noencryption variant of the library).
Preparation for #1396 (making crypto functionality tree-shakable).
A bit clearer. Also use a named instead of default export.
We have decided that we don’t want the tree-shakable version of the library to make use of static properties or methods, as they are not amenable to tree-shaking. There’s also no obvious way to set a static property in the API that we’ve chosen for tree-shaking (since we pass dependencies into the class’s constructor). Instead, the tree-shakable version of the library now exports standalone functions which replace the removed static methods.
I want to use it in a second test file.
This removes the static BaseClient.Message property and the static Message.{fromEncoded, fromEncodedArray} methods. The motivation, and the approach taken for the tree-shakable and non tree-shakable versions of the library, are as in c859b90. Note that instead of fromEncoded and fromEncodedArray, the standalone functions are named decodeMessage and decodeMessages — after some discussion we decided that this naming was more consistent with the kind of naming used for standalone functions in JavaScript libraries.
We move the crypto functionality into a tree-shakable Crypto module. Then, we split the decodeMessage* functions introduced in 601b46b in two; we introduce new decodeEncryptedMessage* variants which import the Crypto module and are hence able to decrypt encrypted messages, and we change the existing functions to not import the Crypto module and to fail if they are given cipher options. Resolves #1396.
lawrence-forooghian
force-pushed
the
1396-Crypto-tree-shaking
branch
from
November 6, 2023 19:21
fd7e1a4
to
63f5524
Compare
Base automatically changed from
1415-tree-shaking-attempt-2
to
integration/v2
November 6, 2023 19:47
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: This PR is based on top of #1417; please review that one first.
This encapsulates the crypto functionality in a tree-shakable module. See commit messages for more details.
Resolves #1396.