 				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

		type: Seq.UUID
		defaultValue: Seq.UUIDV4
		primaryKey: true
	clientId:
		type: Seq.STRING
		allowNull: false
		unique: true
		validate:
			isAlphanumeric: true
			notEmpty: true
	clientName:
		type: Seq.STRING
		allowNull: false
		validate:
			isAlphanumeric: true
			notEmpty: true

			return encrypted is fromDatabase
		_dummy: ->
			Clients.create
					client: "postman"
					clientSecret: "secret"
					redirectUri: "https://www.getpostman.com/oauth2/callback"
				.then () ->
					Clients.create
						client: "tonaccount"
						clientSecret: "secret"
						redirectUri: "http://localhost:5001/api/callback"
	hooks:
		beforeCreate: (client, options) ->
			unencrypted = client.clientSecret
