tom_crypto 1.2.0
tom_crypto: ^1.2.0 copied to clipboard
Cryptographic utilities for secure authentication and data protection including JWT tokens, password hashing, and RSA encryption.
1.2.0 #
- Fixed:
TomJwtConfigurationcould not be constructed by a consumer. All four positional parameters of its constructor are typed by this package's dependencies —JWTKeyandJWTAlgorithmfromdart_jsonwebtoken,RSAPrivateKeyandRSAPublicKeyfrompointycastle— and none of the four was exported, so no code outside this package could name them. The class's own dartdoc documents the construction it made impossible.TomClientJwtToken.tokenand.audiencehad the same problem: their values could be read but their types could not be written down. - Added: the barrel now exports the types this package's public API names —
Audience,JWT,JWTAlgorithm,JWTKeyandSecretKeyfromdart_jsonwebtoken, andRSAPrivateKeyandRSAPublicKeyfrompointycastle. The lists are exactly the names this surface mentions. Both dependencies declare anRSAPrivateKeyand anRSAPublicKey, so exporting either wholesale would give consumers an ambiguous name; the pointycastle pair wins because it is whatTomJwtConfigurationholds and whatRsaKeyHelper.parsePrivateKeyFromPemreturns. Code needingdart_jsonwebtoken's own RSA/EC/EdDSA signing keys, which this surface never names, imports that package directly. - Added:
test/barrel_surface_test.dart, a compile-time guard. It imports only the barrel and names each type in a declaration, so losing an export stops the file compiling rather than failing an assertion inside it.
1.1.0 #
- Fixed: secure random bytes could never take the value
255. Both places that drew raw randomness usedRandom.nextInt(255), whose bound is exclusive, so every generated byte fell in0..254. This affected the Fortuna seed inRsaKeyHelper.getSecureRandom(and therefore every RSA key pair) and the salt inTomPasswordHasher.generateSalt(which is hex-encoded into the storedsalt$hash). The loss is about 0.0056 bits per byte. Existing password hashes remain verifiable — the salt is stored alongside the hash — so no migration is required. - Added:
TomSecureBytes.generate, now the single source of raw randomness in this package. Both call sites above previously carried their own copy of the same draw loop, and both copies were wrong in the same way; there is now one implementation for a third copy to not drift from.
1.0.0 #
- Initial version.