 {SlicerBuffer} = require '../openpgp/buffer'
 {SRF} = require '../rand'
 bn = require '../bn'
-tweetnacl = require 'tweetnacl'
+kbnacl = require 'keybase-nacl'
 
 #=================================================================
 

  # multiply by curve base G, this is the pub key R.
  generate : (cb) ->
    await @random_scalar defer x
    R = new Buffer(tweetnacl.scalarMult.base(x))
    # pgp uses different endianess, internally we store keys in
    # pgp-compatible byte order.
    x = Curve25519.reverse_buf(x)

  encrypt : (R, cb) ->
    await @random_scalar defer v

    nacl = kbnacl.alloc {}

    V = nacl.scalarmult_base(v)
    S = nacl.scalarmult(v, R)

    cb {V, S}

