 module.exports = (robot) ->
 
   robot.respond /tf create key$/i, (msg) ->
+    unless robot.auth.isAdmin(msg.envelope.user) or robot.auth.hasRole(msg.envelope.user,'tf')
+      return msg.send {room: msg.message.user.name}, "Not authorized.  Missing 'tf' role."
+
     fn = msg.message.user.name
     fn.replace /\//, "_"
     fp = basepath + "/" + fn

    fs.unlinkSync("#{fp}")
    fs.unlinkSync("#{fp}.pub")
    return msg.send {room: msg.message.user.name}, "Key destroyed!"

    return msg.send {room: msg.message.user.name}, "```\n#{pubkey}\n```"

  robot.respond /tf destroy key$/i, (msg) ->
    unless robot.auth.isAdmin(msg.envelope.user) or robot.auth.hasRole(msg.envelope.user,'tf')
      return msg.send {room: msg.message.user.name}, "Not authorized.  Missing 'tf' role."

    fn = msg.message.user.name
    fn.replace /\//, "_"
    fp = basepath + "/" + fn
