@@ -440,7 +440,7 @@ export class DerivedKeyMaterial {
440440 */
441441 static async setup ( bytes : Uint8Array ) {
442442 const exportable = false ;
443- const hkdf = await window . crypto . subtle . importKey (
443+ const hkdf = await globalThis . crypto . subtle . importKey (
444444 "raw" ,
445445 bytes ,
446446 "HKDF" ,
@@ -482,7 +482,7 @@ export class DerivedKeyMaterial {
482482 length : 32 * 8 ,
483483 } ;
484484
485- return window . crypto . subtle . deriveKey (
485+ return globalThis . crypto . subtle . deriveKey (
486486 algorithm ,
487487 this . #hkdf,
488488 gcmParams ,
@@ -503,10 +503,10 @@ export class DerivedKeyMaterial {
503503 const gcmKey = await this . deriveAesGcmCryptoKey ( domainSep ) ;
504504
505505 // The nonce must never be reused with a given key
506- const nonce = window . crypto . getRandomValues ( new Uint8Array ( 12 ) ) ;
506+ const nonce = globalThis . crypto . getRandomValues ( new Uint8Array ( 12 ) ) ;
507507
508508 const ciphertext = new Uint8Array (
509- await window . crypto . subtle . encrypt (
509+ await globalThis . crypto . subtle . encrypt (
510510 { name : "AES-GCM" , iv : nonce } ,
511511 gcmKey ,
512512 asBytes ( message ) ,
@@ -541,7 +541,7 @@ export class DerivedKeyMaterial {
541541 const gcmKey = await this . deriveAesGcmCryptoKey ( domainSep ) ;
542542
543543 try {
544- const ptext = await window . crypto . subtle . decrypt (
544+ const ptext = await globalThis . crypto . subtle . decrypt (
545545 { name : "AES-GCM" , iv : nonce } ,
546546 gcmKey ,
547547 ciphertext ,
@@ -805,7 +805,7 @@ export class IbeSeed {
805805 */
806806 static random ( ) {
807807 return new IbeSeed (
808- window . crypto . getRandomValues ( new Uint8Array ( SEED_BYTES ) ) ,
808+ globalThis . crypto . getRandomValues ( new Uint8Array ( SEED_BYTES ) ) ,
809809 ) ;
810810 }
811811
0 commit comments