anchor.diff:  
             session = #watts_rsp_session{}
            }).
  -
  -show_rsa(File) ->
  -    {ok, Bin} = file:read_file(File),
  -    [PemEntry] = public_key:pem_decode(Bin),
  -    Key = public_key:pem_entry_decode(PemEntry),
  -    {E, N} =
  -        case Key of
  -            #'RSAPrivateKey'{} ->
  -                 {Key#'RSAPrivateKey'.modulus
  -                 ,Key#'RSAPrivateKey'.publicExponent};
  -            #'RSAPublicKey'{} ->
  -                 {Key#'RSAPublicKey'.modulus
  -                 ,Key#'RSAPublicKey'.publicExponent}
  -        end,
  -    NEnc = base64url:encode(binary:encode_unsigned(N)),
  -    EEnc = base64url:encode(binary:encode_unsigned(E)),
  -    io:format("n: ~p, e: ~p ~n",[N, E]),
  -    io:format("n: ~p, e: ~p ~n",[NEnc, EEnc]),
  -    ok.
  -
   
   
   get_list() ->
  
positive.code: extract_rsp_keys({error, Reason}) ->
      {error, list_to_binary(io_lib:format("error reading keys: ~p", [Reason]))}.
  
  extract_rsp_keys([], List) ->
      {ok, List};
  extract_rsp_keys([#{kty := <<"RSA">>,
                      use := <<"sig">>,
                      alg := <<"RS256">>,
                      kid := KeyId,
                      n := N,
                      e := E
                     } | T], List) ->
      extract_rsp_keys(T, [ rsp_rsa_key(KeyId, N, E) | List ]);
  extract_rsp_keys([H | T], List) ->
      lager:warning("Init: skipping unsupported key ~p", [H]),
      extract_rsp_keys(T, List);
  extract_rsp_keys(#{keys := Keys}, List) ->
      extract_rsp_keys(Keys, List);
  extract_rsp_keys(_, _List) ->
      {error, bad_json}.
  
  rsp_rsa_key(KeyId, N0, E0) ->
      N = binary:decode_unsigned(base64url:decode(N0)),
      E = binary:decode_unsigned(base64url:decode(E0)),
      Key = [E, N],
      #{kty => rsa, alg => rs256, use => sign, kid => KeyId, key => Key}.
  
  safe_decode(Data, Default) when is_binary(Data) ->
      Res = jsone:try_decode(Data, [{object_format, map}, {keys, attempt_atom}]),
      safe_decode(Res, Default);
  
negative.code: 
  
  
  validate_jwt(Jwt) ->
      Rsp = get_rsp(erljwt:to_map(Jwt)),
      validate_jwt(erljwt:parse(Jwt, Rsp#watts_rsp.keys), Rsp).
  
  get_rsp(#{claims := #{ iss := Iss}}) ->
      get_info(Iss);
  get_rsp(_) ->
      #watts_rsp{}.
  
  
  validate_jwt(#{ claims := #{iss := _Iss,
                              sub := _Sub,
                              exp := _Exp,
                              iat := _Iat,
                              watts_service := _Service
                             } = Jwt
                } , Rsp) ->
      {Jwt, Rsp};
  validate_jwt(_, _) ->
      {invalid, unknown}.
  