BrowserCryptography class

An implementation of Cryptography that uses Web Cryptography API for better performance in browsers.

Browsers support Web Cryptography only in secure (HTTPS) contexts. In non-secure contexts, pure Dart implementations will be used. You can check whether Web Cryptography is used in the current environment by reading the value of BrowserCryptography.isSupported.

Optimized algorithms

The following configurations are optimized using Web Cryptography:

The class extends DartCryptography so other factory methods will return pure Dart implementations.

Inheritance

Constructors

BrowserCryptography({Random? random})
Constructs an instance of BrowserCryptography.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

aesCbc({required MacAlgorithm macAlgorithm, PaddingAlgorithm paddingAlgorithm = PaddingAlgorithm.pkcs7, int secretKeyLength = 32}) AesCbc
A factory used by AesCbc.
inherited
aesCtr({required MacAlgorithm macAlgorithm, int secretKeyLength = 32, int counterBits = AesCtr.defaultCounterBits}) AesCtr
A factory used by AesCtr.
inherited
aesGcm({int secretKeyLength = 32, int nonceLength = 12}) AesGcm
A factory used by AesGcm.
inherited
argon2id({required int memory, required int parallelism, required int iterations, required int hashLength}) Argon2id
A factory used by Argon2id.
inherited
blake2b({int hashLengthInBytes = 64}) Blake2b
A factory used by Blake2b.
inherited
blake2s({int hashLengthInBytes = 32}) Blake2s
A factory used by Blake2s.
inherited
chacha20({required MacAlgorithm macAlgorithm}) Chacha20
A factory used by Chacha20.
inherited
chacha20Poly1305Aead() Chacha20
A factory used by Chacha20.poly1305Aead.
inherited
ecdhP256({required int length}) Ecdh
A factory used by Ecdh.p256.
inherited
ecdhP384({required int length}) Ecdh
A factory used by Ecdh.p384.
inherited
ecdhP521({required int length}) Ecdh
A factory used by Ecdh.p521.
inherited
ecdsaP256(HashAlgorithm hashAlgorithm) Ecdsa
A factory used by Ecdsa.p256.
inherited
ecdsaP384(HashAlgorithm hashAlgorithm) Ecdsa
A factory used by Ecdsa.p384.
inherited
ecdsaP521(HashAlgorithm hashAlgorithm) Ecdsa
A factory used by Ecdsa.p521.
inherited
ed25519() Ed25519
A factory used by Ed25519.
inherited
hchacha20() Hchacha20
A factory used by Hchacha20.
inherited
hkdf({required Hmac hmac, required int outputLength}) Hkdf
A factory used by Hkdf.
inherited
hmac(HashAlgorithm hashAlgorithm) Hmac
A factory used by Hmac.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pbkdf2({required MacAlgorithm macAlgorithm, required int iterations, required int bits}) Pbkdf2
A factory used by Pbkdf2.
inherited
poly1305() Poly1305
A factory used by Poly1305.
inherited
rsaPss(HashAlgorithm hashAlgorithm, {required int nonceLengthInBytes}) RsaPss
A factory used by RsaPss.
inherited
rsaSsaPkcs1v15(HashAlgorithm hashAlgorithm) RsaSsaPkcs1v15
A factory used by RsaSsaPkcs1v15.
inherited
sha1() Sha1
A factory used by Sha1.
inherited
sha224() Sha224
A factory used by Sha224.
inherited
sha256() Sha256
A factory used by Sha256.
inherited
sha384() Sha384
A factory used by Sha384.
inherited
sha512() Sha512
A factory used by Sha512.
inherited
toString() String
A string representation of this object.
inherited
withRandom(Random? random) BrowserCryptography
override
x25519() X25519
A factory used by X25519.
inherited
xchacha20({required MacAlgorithm macAlgorithm}) Xchacha20
A factory used by Xchacha20.
inherited
xchacha20Poly1305Aead() Xchacha20
A factory used by Xchacha20.poly1305Aead.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

defaultInstance Cryptography
Platform-specific default instance.
final
isSupported bool
Whether Web Cryptography is supported in this platform.
no setter