Module: SecretHub::Sodium
- Included in:
- GitHubClient
- Defined in:
- lib/secret_hub/sodium.rb
Instance Method Summary collapse
Instance Method Details
#encrypt(secret, public_key) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/secret_hub/sodium.rb', line 6 def encrypt(secret, public_key) key = Base64.decode64 public_key public_key = RbNaCl::PublicKey.new key box = RbNaCl::Boxes::Sealed.from_public_key public_key encrypted_secret = box.encrypt secret Base64.strict_encode64 encrypted_secret end |