nov/json-jwt

Can payload for signing with JWT be a string instead of a json

Phuong5664 opened this issue · 2 comments

Hi,
I'm just wondering if there is a way to sign a message as a string?? Like:

payload = 'my string to sign'
signed_message = JSON::JWT.new(payload).sign(my_private_key, :RS256)

instead of:
payload = {
foo: 'my string to sign'
}
Thanks in advance and appreciate your help!

nov commented

you can't.

@Phuong5664 that wouldn't be a JSON web token (see RFC 7519 for the specification) — but you can sign an arbitrary string using OpenSSL directly if you want to!