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


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

def __ruby__?; false; end

#__supported__?Boolean


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

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

#ed25519_keypair(secret = nil) ⇒ Object


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

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

#ed25519_secret_to_public(sk) ⇒ Object


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

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

#ed25519_sign(m, sk) ⇒ Object


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

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

#ed25519_verify(sig, m, pk) ⇒ Object


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

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

#ed25519ph_keypair(secret = nil) ⇒ Object


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

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

#ed25519ph_secret_to_public(sk) ⇒ Object


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

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

#ed25519ph_sign(m, sk) ⇒ Object


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

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

#ed25519ph_verify(sig, m, pk) ⇒ Object


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

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

#x25519_keypair(secret = nil) ⇒ Object


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

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

#x25519_secret_to_public(sk) ⇒ Object


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

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

#x25519_shared_secret(pk, sk) ⇒ Object


61
62
63
# File 'lib/jose/jwa/curve25519_rbnacl.rb', line 61

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