-
Notifications
You must be signed in to change notification settings - Fork 55
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-3570] Use Web Crypto API for encrypting and decrypting #1299
Merged
lawrence-forooghian
merged 16 commits into
integration/v2
from
1292-use-web-crypto-for-encrypting-and-decrypting
Jun 6, 2023
Merged
[SDK-3570] Use Web Crypto API for encrypting and decrypting #1299
lawrence-forooghian
merged 16 commits into
integration/v2
from
1292-use-web-crypto-for-encrypting-and-decrypting
Jun 6, 2023
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
lawrence-forooghian
changed the base branch from
main
to
convert-crypto-to-TypeScript
May 24, 2023 19:57
lawrence-forooghian
force-pushed
the
1292-use-web-crypto-for-encrypting-and-decrypting
branch
from
May 24, 2023 20:04
745e6a5
to
4fb7f0e
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1299/bundle-report
May 24, 2023 20:06
Inactive
lawrence-forooghian
force-pushed
the
1292-use-web-crypto-for-encrypting-and-decrypting
branch
from
May 24, 2023 20:21
4fb7f0e
to
a7a8221
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1299/bundle-report
May 24, 2023 20:22
Inactive
lawrence-forooghian
force-pushed
the
1292-use-web-crypto-for-encrypting-and-decrypting
branch
from
May 24, 2023 20:23
a7a8221
to
2357cc0
Compare
lawrence-forooghian
force-pushed
the
1292-use-web-crypto-for-encrypting-and-decrypting
branch
from
May 24, 2023 20:24
2357cc0
to
2332a84
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1299/bundle-report
May 24, 2023 20:25
Inactive
lawrence-forooghian
force-pushed
the
convert-crypto-to-TypeScript
branch
4 times, most recently
from
May 25, 2023 18:10
61f442a
to
a56148c
Compare
lawrence-forooghian
force-pushed
the
1292-use-web-crypto-for-encrypting-and-decrypting
branch
from
May 29, 2023 13:49
2332a84
to
979ded8
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1299/bundle-report
May 29, 2023 13:51
Inactive
lawrence-forooghian
force-pushed
the
1292-use-web-crypto-for-encrypting-and-decrypting
branch
from
May 29, 2023 16:45
979ded8
to
29bb2b8
Compare
github-actions
bot
temporarily deployed
to
staging/pull/1299/bundle-report
May 29, 2023 16:47
Inactive
lawrence-forooghian
changed the title
1292 use web crypto for encrypting and decrypting
Use Web Crypto API for encrypting and decrypting
May 30, 2023
lawrence-forooghian
changed the base branch from
convert-crypto-to-TypeScript
to
1293-make-ICipher.decrypt-async
May 30, 2023 12:06
lawrence-forooghian
force-pushed
the
1292-use-web-crypto-for-encrypting-and-decrypting
branch
from
May 30, 2023 12:11
29bb2b8
to
854578d
Compare
owenpearson
approved these changes
Jun 5, 2023
lawrence-forooghian
force-pushed
the
1293-make-ICipher.decrypt-async
branch
from
June 5, 2023 20:11
5ccfe55
to
c955702
Compare
Base automatically changed from
1293-make-ICipher.decrypt-async
to
integration/v2
June 5, 2023 21:14
Instead, make it so that we can compare any two Bufferlike objects. When I was changing some test code (hence, not TypeScript) that made use of bufferCompare, I found myself having to think more than I would have liked about which type of objects I could pass it.
Gives richer type information to compiler (i.e. whether the object was created with the ArrayBuffer constructor instead of whether it just conforms to the ArrayBuffer interface), which I believe a type guard can't express. I’m doing this because the the compiler seemed to consider a TypedArray to satisfy the ArrayBuffer interface: > const foo: TypedArray = new Uint8Array(); > const bar: ArrayBuffer = foo; // This compiles, weird! The effect of this was that, given an object of TypeScript type `ArrayBuffer | TypedArray`, then, after performing an `is ArrayBuffer` type guard that returned false, the compiler believed the object to be of type `never` (when in fact it could still be a TypedArray).
This is a more broad definition that means that our web Bufferlike type agrees with the web standards’ list of binary data types [1]. [1] https://www.w3.org/TR/WebIDL-1/#common-BufferSource
There’s no need for this indirection.
Part of #1300 (removing CryptoJS functionality from web’s BufferUtils).
And make it return just a boolean instead of a number — we aren’t making use of the ordering information it provides, which I don’t really understand and don’t want to spend time trying to reproduce when I reimplement the web version of this method.
Now, web’s BufferUtils only uses the CryptoJS library to provide the functionality needed by our web Crypto class for: - checking if something is a WordArray - converting something to a WordArray - converting a WordArray to an ArrayBuffer We will remove this remaining CryptoJS code after implementing #1299 (removing the use of CryptoJS in our web Crypto class). Resolves #1300.
It’s only a WordArray on web, not in Node.
This test is executed on all platforms, but WordArray is only used on web.
I’m going to want to inject a BufferUtils instance in an upcoming commit.
Preparation for #1292 (using Web Crypto API for encrypting and decrypting).
Preparation for #1292 (using Web Crypto API for encrypting and decrypting).
The web crypto code now no longer emits any WordArray objects — it only uses them internally. Preparation for #1292 (using Web Crypto API for encrypting and decrypting).
All of the rest of the crypto code is built around a non-configurable block length, so this property is just misleading.
lawrence-forooghian
force-pushed
the
1292-use-web-crypto-for-encrypting-and-decrypting
branch
from
June 5, 2023 21:16
959c7e7
to
fcdb9f3
Compare
lawrence-forooghian
deleted the
1292-use-web-crypto-for-encrypting-and-decrypting
branch
June 6, 2023 12:51
This was referenced Jun 6, 2023
hayleynewton
changed the title
Use Web Crypto API for encrypting and decrypting
[SDK-3570] Use Web Crypto API for encrypting and decrypting
Jul 28, 2023
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 is based on top of #1311; please review that one first.
This PR changes the web crypto code to use the Web Crypto API instead of the CryptoJS library. See commit messages for more details.
Resolves #1292, resolves #1296, resolves #1300.