Module: JOSE::JWA::Curve25519_RbNaCl

Extended by:
Curve25519_RbNaCl
Included in:
Curve25519_RbNaCl
Defined in:
lib/jose/jwa/curve25519_rbnacl.rb

Instance Method Summary collapse

Instance Method Details

#__ruby__?Boolean

Returns:

  • (Boolean)


5
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 5

def __ruby__?; false; end

#__supported__?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 7

def __supported__?
  return @supported ||= begin
    begin
      require 'rbnacl'
    rescue LoadError
    end
    !!(defined?(RbNaCl::GroupElements::Curve25519))
  end
end

#ed25519_keypair(secret = nil) ⇒ Object



17
18
19
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 17

def ed25519_keypair(secret = nil)
  return JOSE::JWA::Ed25519_RbNaCl.keypair(secret)
end

#ed25519_secret_to_public(sk) ⇒ Object



21
22
23
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 21

def ed25519_secret_to_public(sk)
  return JOSE::JWA::Ed25519_RbNaCl.sk_to_pk(sk)
end

#ed25519_sign(m, sk) ⇒ Object



25
26
27
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 25

def ed25519_sign(m, sk)
  return JOSE::JWA::Ed25519_RbNaCl.sign(m, sk)
end

#ed25519_verify(sig, m, pk) ⇒ Object



29
30
31
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 29

def ed25519_verify(sig, m, pk)
  return JOSE::JWA::Ed25519_RbNaCl.verify(sig, m, pk)
end

#ed25519ph_keypair(secret = nil) ⇒ Object



33
34
35
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 33

def ed25519ph_keypair(secret = nil)
  return JOSE::JWA::Ed25519_RbNaCl.keypair(secret)
end

#ed25519ph_secret_to_public(sk) ⇒ Object



37
38
39
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 37

def ed25519ph_secret_to_public(sk)
  return JOSE::JWA::Ed25519_RbNaCl.sk_to_pk(sk)
end

#ed25519ph_sign(m, sk) ⇒ Object



41
42
43
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 41

def ed25519ph_sign(m, sk)
  return JOSE::JWA::Ed25519_RbNaCl.sign_ph(m, sk)
end

#ed25519ph_verify(sig, m, pk) ⇒ Object



45
46
47
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 45

def ed25519ph_verify(sig, m, pk)
  return JOSE::JWA::Ed25519_RbNaCl.verify_ph(sig, m, pk)
end

#x25519_keypair(secret = nil) ⇒ Object



49
50
51
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 49

def x25519_keypair(secret = nil)
  return JOSE::JWA::X25519_RbNaCl.keypair(secret)
end

#x25519_secret_to_public(sk) ⇒ Object



53
54
55
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 53

def x25519_secret_to_public(sk)
  return JOSE::JWA::X25519_RbNaCl.sk_to_pk(sk)
end

#x25519_shared_secret(pk, sk) ⇒ Object



57
58
59
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 57

def x25519_shared_secret(pk, sk)
  return JOSE::JWA::X25519_RbNaCl.shared_secret(pk, sk)
end