Page MenuHomePhabricator

D13119.id43491.diff
No OneTemporary

D13119.id43491.diff

diff --git a/web/push-notif/notif-crypto-utils.js b/web/push-notif/notif-crypto-utils.js
--- a/web/push-notif/notif-crypto-utils.js
+++ b/web/push-notif/notif-crypto-utils.js
@@ -33,6 +33,8 @@
exportKeyToJWK,
generateCryptoKey,
encryptedAESDataValidator,
+ cryptoKeyValidator,
+ subtleCrypto$JsonWebKeyValidator,
extendedCryptoKeyValidator,
} from '../crypto/aes-gcm-crypto-utils.js';
import { initOlm } from '../olm/olm-utils.js';
@@ -125,10 +127,15 @@
async function validateCryptoKey(
cryptoKey: CryptoKey | SubtleCrypto$JsonWebKey,
): Promise<CryptoKey> {
- if (!isDesktopSafari) {
- return ((cryptoKey: any): CryptoKey);
+ try {
+ return assertWithValidator(cryptoKey, cryptoKeyValidator);
+ } catch (e) {
+ const jwkCryptoKey = assertWithValidator(
+ cryptoKey,
+ subtleCrypto$JsonWebKeyValidator,
+ );
+ return await importJWKKey(jwkCryptoKey);
}
- return await importJWKKey(((cryptoKey: any): SubtleCrypto$JsonWebKey));
}
async function validateCryptoKeyOptional(

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 19, 3:26 PM (21 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2323638
Default Alt Text
D13119.id43491.diff (1 KB)

Event Timeline