skadnetwork

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Postback

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

func NewPostback

func NewPostback(bytes []byte) (Postback, error)

NewPostback returns a new postback from given JSON bytes presentation

func NewPostbackFromString

func NewPostbackFromString(s string) (Postback, error)

NewPostbackFromString returns a new postback from JSON string presentation

func (Postback) ValidateSchema

func (p Postback) ValidateSchema() (bool, []ValidationError, error)

ValidateSchema checks the postback structure using JSON schema. Returns a slice of validation errors, which is empty if the postback is valid. Returns an error if the validation itself has failed.

func (Postback) VerifySignature

func (p Postback) VerifySignature() (bool, error)

VerifySignature verifies the postback cryptographic signature. Returns an error if the version is not supported or the signature has an invalid format.

func (Postback) Version added in v0.1.2

func (p Postback) Version() (string, bool)

type PostbackValidator

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

func NewPostbackValidator

func NewPostbackValidator() PostbackValidator

NewPostbackValidator returns a new validator for SKAdNetwork postbacks.

func (*PostbackValidator) Check added in v0.1.2

func (v *PostbackValidator) Check() (bool, error)

Check performs all actual checks: schema validation and signature verification

func (*PostbackValidator) Errors

func (v *PostbackValidator) Errors() []ValidationError

Errors returns all validation errors found by [Validate]. Calling this function does not reset the errors, but they will be reset on a subsequent calls to [Validate].

func (*PostbackValidator) Init added in v0.1.2

func (v *PostbackValidator) Init(bytes []byte) error

func (*PostbackValidator) Validate

func (v *PostbackValidator) Validate(bytes []byte) (bool, error)

Validate performs all validations for a given postback presented as JSON bytes:

  • checks if the postback version is supported by the validator
  • runs all checks

Validate returns the validation result and an error. Non-nil error indicates that the validation itself has failed and we are not sure if the postback is valid or not.

func (*PostbackValidator) ValidateString

func (v *PostbackValidator) ValidateString(s string) (bool, error)

ValidateString validates given postback presented as JSON string.

func (*PostbackValidator) VersionSupported added in v0.1.2

func (v *PostbackValidator) VersionSupported() (bool, error)

type ValidationError

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

func NewValidationError added in v0.1.1

func NewValidationError(msg string) ValidationError

func (*ValidationError) Error

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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