 				client.clientSecret = encrypted
 				client.salt = salt
 		afterFind: (client, options) ->
+			if !client then return client
 			clientSecret = client.clientSecret
 			salt = client.salt
 			unencrypted = crypto.unaes clientSecret, salt, secret

			return encrypted is fromDatabase
		_dummy: ->
			Clients.create
				clientId: "bestapp"
				clientName: "BestApp"
				clientSecret: "secret"
				redirectUri: "localhost"
	hooks:
		beforeCreate: (client, options) ->
			unencrypted = client.clientSecret

	redirectUri:
		type: Seq.STRING
		allowNull: false
		unique: true
		validate:
			isUrl: true
			notEmpty: true,
