notifications

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: BSD-2-Clause Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignIdentity

func SignIdentity(priv rsa.PrivateKey, identity [][]byte, timestamp time.Time,
	tag NotificationTag, rand io.Reader) ([]byte, error)

SignIdentity is the client side signing code for a client registering an identity with the notifications server. It signs the identity the client's private key, along with the timestamp of signing (which the remote will verify is within +/- 5s, and a tag of the specific operation (registering or unregistering)

func SignToken

func SignToken(priv rsa.PrivateKey, token, app string, timestamp time.Time,
	tag NotificationTag, rand io.Reader) ([]byte, error)

SignToken is the client side signing code for a client registering a token with the notifications server. It signs the token and app designator with the client's private key, along with the timestamp of signing (which the remote will verify is within +/- 5s), and a tag of the specific operation (registering or unregistering)

func VerifyIdentity

func VerifyIdentity(pub rsa.PublicKey, identity [][]byte, timestamp time.Time,
	tag NotificationTag, sig []byte) error

VerifyIdentity is the server side verifying code for a client trying to register an identity with the notifications server. It verifies the identity with the clients verified public key, along with the timestamp of signing (which the remote will verify is withing +/- 5s, and a tag of the specific operation (registering or unregistering). WARNING: The tag must be provided locally, do not receive it over the wire

func VerifyToken

func VerifyToken(pub rsa.PublicKey, token, app string, timestamp time.Time,
	tag NotificationTag, sig []byte) error

VerifyToken is the server side verifying code for a client trying to register a token with the notifications server. It verifies the token and app designator with the clients verified public key, along with the timestamp of signing (which the remote will verify is withing +/- 5s, and a tag of the specific operation (registering or unregistering). WARNING: The tag must be provided locally, do not receive it over the wire

Types

type NotificationTag

type NotificationTag uint8
const (
	RegisterTokenTag NotificationTag = iota
	UnregisterTokenTag
	RegisterTrackedIDTag
	UnregisterTrackedIDTag
)

Tags defining which operation is being executed, they ensure that the operation cannot be changed

func (NotificationTag) String

func (nt NotificationTag) String() string

Jump to

Keyboard shortcuts

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