         default     : -> new Date
 
   remove$: permit 'send invitations',
-    success: (client, callback=->)->
+    success: (client, callback) ->
       @remove callback
 
-  @byCode = (code, callback)->
-    @one {code}, callback
-
-  # TODO - generate a better invitation code
-  @generateInvitationCode = (email, group)->
-    code = crypto.createHmac 'sha1', 'kodingsecret'
-    code.update email
-    code.update group
-    code.digest 'hex'
-
-  accept$: secure (client, callback=->)->
+  accept$: secure (client, callback) ->
     { delegate } = client.connection
     @accept delegate, callback
 

    operation = $set : { status: 'accepted' }
    @update operation, callback

  @create = secure (client, options, callback)->
    { groupName, delegate } = client.connection

    groupName  or= 'koding'

    { emails }  = options

    name = getName delegate

    queue = emails.map (email)=>=>
      code = @generateInvitationCode email, groupName


      invite = new JInvitation {
        code
        email
        groupName
      }

      invite.save (err)->
        return callback err   if err

        options =


    dash queue, callback

  getName = (delegate) ->
    { nickname, firstName, lastName } = delegate.profile.nickname

    name = nickname
