Tutorial: CognitoEvent

CognitoEvent

Anti-Cheating Cognito Event Handler

This example is based off the one documented here.

import { CognitoEvent, OK, ERROR } from 'node-lambda-events';

class ScoreKeyValidator extends Cloudformation {
  perform() {
    const { scoreKey } = this.records;
    if(scoreKey && scoreKey.newValue > 2112) {
      this.delete(scoreKey);
    }
    this.respond(OK, this.event);
  }
}