Improve JwtBuilder JavaDoc to recommend to sign with a SecretKey
Following this question opened in stackoverflow: Static secret as byte[], Key or String?. The JwtBuilder JavaDoc could have some recomendation about using SecretKey instead of byte[] or String to sign a JWT.
According with SecretKey JavaDoc:
Implementations should override the default destroy and isDestroyed methods from the Destroyable interface to enable sensitive key information to be destroyed, cleared, or in the case where such information is immutable, unreferenced.
Since MacProvider.generateKey() uses SecretKeySpec to gerenate the SecretKey, we can ensure that implementation of SecretKey is following the Oracle JavaDoc.
My suggestion is adding something like it: "Using JwtBuilder signWith(SignatureAlgorithm var1, Key var2); is more safe, because SecretKey implementation ensures to destroy sensitive key information from the memory when this object is eligible for garbage collection."
Thanks for the issue! If you feel inclined to open a PR for this change, that'd be awesome ;)
Suggestion implemented and released in 0.10.0 along with a new recommended .setSigningKey(Key) method. Thanks for the issue!