verifier

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: MIT Imports: 9 Imported by: 1

README

StoreKit Postback Verifier

GoSkPostbackVerifier is a go library from Tenjin that can be used to verify StoreKit postbacks data from Apple.

Sample code

$ go run sample_code/main.go

Documentation

Index

Constants

View Source
const (
	// ApplePublicKey is Apple's public key for SkAdNetwork postback verification.
	ApplePublicKey = "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEWdp8GPcGqmhgzEFj9Z2nSpQVddayaPe4FMzqM9wib1+aHaaIzoHoLN9zW4K8y4SPykE3YVK3sVqW6Af0lfx3gg=="

	// AppleDelimiter is the delimiter used for joining parameters
	AppleDelimiter = "\u2063"
)
View Source
const (
	// ApplePublicKeyLegacy has been deprecated by Apple, but can be used for verifying postbacks versions 1.0 and 2.0.
	ApplePublicKeyLegacy = "MEkwEwYHKoZIzj0CAQYIKoZIzj0DAQEDMgAEMyHD625uvsmGq4C43cQ9BnfN2xslVT5V1nOmAMP6qaRRUll3PB1JYmgSm+62sosG"
)

Variables

View Source
var (
	// ErrorInvalidData indicates input data is invalid
	ErrorInvalidData = errors.New("invalid data")

	// ErrorSignatureMismatch indicates signature did not match input data
	ErrorSignatureMismatch = errors.New("signature mismatch")
)

Functions

This section is empty.

Types

type Verifier

type Verifier struct {
	// contains filtered or unexported fields
}

Verifier verifies that a given postback data matches its signature

func NewLegacyVerifier

func NewLegacyVerifier() *Verifier

NewLegacyVerifier can be used for postbacks versions 1.0 and 2.0. Google's certificate-transparency-go does not work with ApplePublicKeyLegacy but we can create it manually.

func NewVerifier

func NewVerifier() *Verifier

NewVerifier is used to create an instance of Verifier for postback versions 2.1 and later.

func (*Verifier) VerifySignature

func (v *Verifier) VerifySignature(data interface{}, signature string) error

VerifySignature verifies a given postback data and signature The parameter data is expected to be a byte array. If string array is given, the function will use the correct delimiter to create the byte array needed to verify the signature against.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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