-
Notifications
You must be signed in to change notification settings - Fork 398
Description
I'd like to raise a proposal to remove the deprecation notice in EncodeSegment
.
Our use case:
We sign JWTs using AWS KMS. Because we create an asymmetric key for signing/verification in KMS, the private key never leaves KMS, and so we have to sign our JWTs within KMS via their API. The returned signature is a binary blob which needs to be base64 encoded.
Currently, we do this manually (which took me some time to figure out which encoding type to use):
signature := base64.RawURLEncoding.EncodeToString(rawSignature)
but discovered EncodeSegment
does the same thing, and makes the code a little cleaner as we offload this implementation detail to the more appropriate jwt
lib, especially because the same encoding is required for decoding by the consumer of the JWT. In fact, we leverage the JWT lib to perform the JWT verification, instead of KMS. This requires Decoding the signature; so having consistent encoding and decoding methods is important for use cases like ours where signing and verification are performed by different libraries.
It would be a shame to lose this capability, and so would like to request for it to remain exported.
If we agree to this proposal, I can put together the PR.