Skip to content

Commit

Permalink
Update js-sdk usages around Buffers to avoid needing Buffer polyfill
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Dec 3, 2024
1 parent 865c5b0 commit 36108c0
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 20 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@
"babel-loader": "^9.0.0",
"babel-plugin-jsx-remove-data-test-id": "^3.0.0",
"blob-polyfill": "^9.0.0",
"buffer": "^6.0.3",
"chokidar": "^4.0.0",
"concurrently": "^9.0.0",
"copy-webpack-plugin": "^12.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import QRCode from "../QRCode";

interface IProps {
/** The data for the QR code. If `undefined`, a spinner is shown. */
qrCodeBytes: undefined | Buffer;
qrCodeBytes: undefined | Uint8ClampedArray;
}

export default class VerificationQRCode extends React.PureComponent<IProps> {
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/right_panel/VerificationPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ interface IState {
* We attempt to calculate this once the verification request transitions into the "Ready" phase. If the other
* side cannot scan QR codes, it will remain `undefined`.
*/
qrCodeBytes: Buffer | undefined;
qrCodeBytes: Uint8ClampedArray | undefined;

sasEvent: ShowSasCallbacks | null;
emojiButtonClicked?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/tokens/pickling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export async function buildAndEncodePickleKey(
data.encrypted,
);
if (pickleKeyBuf) {
return encodeUnpaddedBase64(pickleKeyBuf);
return encodeUnpaddedBase64(new Uint8Array(pickleKeyBuf));
}
} catch {
logger.error("Error decrypting pickle key");
Expand Down
2 changes: 0 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ module.exports = (env, argv) => {

// Polyfill needed by counterpart
"util": require.resolve("util/"),
// Polyfill needed by matrix-js-sdk/src/crypto
"buffer": require.resolve("buffer/"),
// Polyfill needed by sentry
"process/browser": require.resolve("process/browser"),
},
Expand Down
15 changes: 1 addition & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4044,11 +4044,6 @@ base64-arraybuffer@^1.0.2:
resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz#1c37589a7c4b0746e34bd1feb951da2df01c1bdc"
integrity sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==

base64-js@^1.3.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==

[email protected]:
version "0.6.1"
resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16"
Expand Down Expand Up @@ -4170,14 +4165,6 @@ buffer-from@^1.0.0:
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5"
integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==

buffer@^6.0.3:
version "6.0.3"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6"
integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
dependencies:
base64-js "^1.3.1"
ieee754 "^1.2.1"

builtin-modules@^3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6"
Expand Down Expand Up @@ -6777,7 +6764,7 @@ icss-utils@^5.0.0, icss-utils@^5.1.0:
resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae"
integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==

ieee754@^1.1.12, ieee754@^1.2.1:
ieee754@^1.1.12:
version "1.2.1"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
Expand Down

0 comments on commit 36108c0

Please sign in to comment.