Skip to content

Commit 36108c0

Browse files
committed
Update js-sdk usages around Buffers to avoid needing Buffer polyfill
Signed-off-by: Michael Telatynski <[email protected]>
1 parent 865c5b0 commit 36108c0

File tree

6 files changed

+4
-20
lines changed

6 files changed

+4
-20
lines changed

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@
214214
"babel-loader": "^9.0.0",
215215
"babel-plugin-jsx-remove-data-test-id": "^3.0.0",
216216
"blob-polyfill": "^9.0.0",
217-
"buffer": "^6.0.3",
218217
"chokidar": "^4.0.0",
219218
"concurrently": "^9.0.0",
220219
"copy-webpack-plugin": "^12.0.0",

src/components/views/elements/crypto/VerificationQRCode.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import QRCode from "../QRCode";
1212

1313
interface IProps {
1414
/** The data for the QR code. If `undefined`, a spinner is shown. */
15-
qrCodeBytes: undefined | Buffer;
15+
qrCodeBytes: undefined | Uint8ClampedArray;
1616
}
1717

1818
export default class VerificationQRCode extends React.PureComponent<IProps> {

src/components/views/right_panel/VerificationPanel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ interface IState {
4646
* We attempt to calculate this once the verification request transitions into the "Ready" phase. If the other
4747
* side cannot scan QR codes, it will remain `undefined`.
4848
*/
49-
qrCodeBytes: Buffer | undefined;
49+
qrCodeBytes: Uint8ClampedArray | undefined;
5050

5151
sasEvent: ShowSasCallbacks | null;
5252
emojiButtonClicked?: boolean;

src/utils/tokens/pickling.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export async function buildAndEncodePickleKey(
118118
data.encrypted,
119119
);
120120
if (pickleKeyBuf) {
121-
return encodeUnpaddedBase64(pickleKeyBuf);
121+
return encodeUnpaddedBase64(new Uint8Array(pickleKeyBuf));
122122
}
123123
} catch {
124124
logger.error("Error decrypting pickle key");

webpack.config.js

-2
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,6 @@ module.exports = (env, argv) => {
231231

232232
// Polyfill needed by counterpart
233233
"util": require.resolve("util/"),
234-
// Polyfill needed by matrix-js-sdk/src/crypto
235-
"buffer": require.resolve("buffer/"),
236234
// Polyfill needed by sentry
237235
"process/browser": require.resolve("process/browser"),
238236
},

yarn.lock

+1-14
Original file line numberDiff line numberDiff line change
@@ -4044,11 +4044,6 @@ base64-arraybuffer@^1.0.2:
40444044
resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz#1c37589a7c4b0746e34bd1feb951da2df01c1bdc"
40454045
integrity sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==
40464046

4047-
base64-js@^1.3.1:
4048-
version "1.5.1"
4049-
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
4050-
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
4051-
40524047
40534048
version "0.6.1"
40544049
resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16"
@@ -4170,14 +4165,6 @@ buffer-from@^1.0.0:
41704165
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5"
41714166
integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==
41724167

4173-
buffer@^6.0.3:
4174-
version "6.0.3"
4175-
resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6"
4176-
integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
4177-
dependencies:
4178-
base64-js "^1.3.1"
4179-
ieee754 "^1.2.1"
4180-
41814168
builtin-modules@^3.3.0:
41824169
version "3.3.0"
41834170
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6"
@@ -6777,7 +6764,7 @@ icss-utils@^5.0.0, icss-utils@^5.1.0:
67776764
resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae"
67786765
integrity sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==
67796766

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

0 commit comments

Comments
 (0)