Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cryptography/lib/src/browser/_javascript_bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import 'package:meta/meta.dart';
/// Note that browsers support Web Cryptography only in secure contexts.
@internal
final bool isWebCryptoAvailable =
_subtle.isDefinedAndNotNull && _isSecureContext.toDart;
_subtle.isDefinedAndNotNull && (_isSecureContext?.toDart ?? false);

@JS('window.isSecureContext')
external JSBoolean get _isSecureContext;
@JS('isSecureContext')
external JSBoolean? get _isSecureContext;

@JS('crypto.subtle')
external JSAny get _subtle;
Expand Down
2 changes: 1 addition & 1 deletion cryptography/lib/src/cryptography/secret_key.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class SecretKeyData extends SecretKey {
/// Generates _N_ random bytes.
///
/// A description of the random number generator:
/// * In browsers, `window.crypto.getRandomValues() is used directly.
/// * In browsers, `crypto.getRandomValues()` is used directly.
/// * In other platforms, _dart:math_ [Random.secure()] is used.
///
/// You can give a custom random number generator. This can be useful for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ void fillBytesWithSecureRandom(Uint8List bytes, {Random? random}) {
}
}

@JS('window.crypto.getRandomValues')
@JS('crypto.getRandomValues')
external void _webCryptoRandom(JSUint8Array buffer);