Description
Original discussion: #162
The specification here states that the JWT secret must be a 256 bit secret written as a 0x prefixed hex string. As a long time JWT user, I found this arbitrary constraint to be very difficult to understand. Why must it be so rigid? I believe this is a serious UX concern and client teams will have to go through considerable efforts to communicate these requirements to users in documentation, cli help text, and well defined error messages. Users will have to adjust their previously well established practices with JWTs specifically for Ethereum client operation.
From a technical perspective, the signature part of HS256 does not require any length for a secret. Even an empty string is sufficient to construct a valid and verifiable JWT.
signature = HMACSHA256(
base64UrlEncode(header) + "." +
base64UrlEncode(payload),
secret)
While it may be wise for a user to specify a secret of at least a given length to prevent brute for attacks, it seems like a poor trade off between UX and security to require the secret in a 0x prefixed hex string of at least 32 bytes. I'm also afraid that many at home stakers are not highly technical and these requirements add complexity and difficulty for end users that could lead to improper software operation.
Suggestion 1: Remove hard requirements on 0x prefixed hex string formats.
Suggestion 2: Consider a reasonable secret key length or no secret key length requirement strongly enforced.
Suggestion 3: Require clients to interpret 0x prefix as an indicator the rest of the file must be parsed as hex. Absence of 0x indicates the file is an ascii string.