// Generated by IcedCoffeeScript 1.8.0-d
(function() {
  var Sodium, TweetNaCl, e, mod, mods, nacl_c, nacl_js, _i, _len;

  nacl_js = require('tweetnacl/nacl-fast');

  nacl_c = null;

  Sodium = require('./sodium').Sodium;

  TweetNaCl = require('./tweetnacl').TweetNaCl;

  nacl_c;

  mods = ["sodium", "keybase-sodium"];

  for (_i = 0, _len = mods.length; _i < _len; _i++) {
    mod = mods[_i];
    try {
      nacl_c = require(mod).api;
      break;
    } catch (_error) {
      e = _error;
    }
  }

  exports.sign = {
    publicKeyLength: nacl_js.sign.publicKeyLength,
    secretKeyLength: nacl_js.sign.secretKeyLength,
    signatureLength: nacl_js.sign.signatureLength,
    seedLength: nacl_js.sign.seedLength
  };

  exports.alloc = function(_arg) {
    var force_js, publicKey, ret, secretKey;
    publicKey = _arg.publicKey, secretKey = _arg.secretKey, force_js = _arg.force_js;
    ret = force_js || (nacl_c == null) ? new TweetNaCl({
      publicKey: publicKey,
      secretKey: secretKey
    }) : new Sodium({
      publicKey: publicKey,
      secretKey: secretKey
    });
    ret.lib = {
      c: nacl_c,
      js: nacl_js
    };
    return ret;
  };

}).call(this);
