Skip to content

JWE.encrypt throwing (undefined method `public_encrypt'  #20

@antarr

Description

@antarr

I'm trying to use the encrypt method. When I call JWE.encrypt it throws the error

(undefined method `public_encrypt' for #<String:0x00007f8fa78b75c0>)
require 'json'
require 'open-uri'
require 'jwe'

URL = 'https://gist.githubusercontent.com/.../my_json_file.json'.freeze
KEY = "-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----".freeze

data = JSON.load(open(URL))
encrypted = JWE.encrypt(JSON.dump(data), KEY)
puts encrypted
IO.popen('pbcopy', 'r+') { |clipboard| clipboard.puts encrypted }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions