aws_sns_verifier

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

README

AWS SNS Verifier

Simple package for verifying the signature of the AWS SNS Message

Installation

go get github.com/Sfinks80/aws_sns_verifier

Usage

package main

import (
	"encoding/json"
	"fmt"

	sns "github.com/Sfinks80/aws_sns_verifier"
)

func main() {
	body := []byte(`{
    "Type": "Notification",
    "MessageId": "some",
    "TopicArn": "some",
    "Subject": "some",
    "Message": "some",
    "Timestamp": "some",
    "SignatureVersion": "1",
    "Signature": "some",
    "SigningCertURL": "some",
    "UnsubscribeURL": "some"
}`)

	notify := &sns.Notification{}
	json.Unmarshal(body, notify)
	
	awsRegion := "eu-central-1"
	valid, _ := notify.VerifySignature(awsRegion)
	
	fmt.Println(valid)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notification

type Notification struct {
	Type             string
	MessageId        string
	TopicArn         string
	Subject          string
	Message          string
	Timestamp        string
	SignatureVersion string
	Signature        string
	SigningCertURL   string
	UnsubscribeURL   string
}

func (*Notification) VerifySignature

func (sns *Notification) VerifySignature(awsRegion string) (bool, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL