UNPKG

sns-payload-validator

Version:

Node.js library that validates an AWS SNS payload of an HTTP/S POST or Lambda.

15 lines (11 loc) 488 B
'use strict'; exports.getKeys = (type) => { if (type === 'SubscriptionConfirmation' || type === 'UnsubscribeConfirmation') { // Support Both HTTP/S and Lambda Keys for SubscribeURL return ['Message', 'MessageId', 'SubscribeURL', 'SubscribeUrl', 'Timestamp', 'Token', 'TopicArn', 'Type']; } else if (type === 'Notification') { return ['Message', 'MessageId', 'Subject', 'Timestamp', 'TopicArn', 'Type']; } throw new Error('Invalid Type'); };