Documentation ¶
Index ¶
- Variables
- func CalcDeviceKey(uuid string, key string) (*crypto.PublicKey, error)
- func CalcUserKey(uid string, key string) (*crypto.PublicKey, error)
- func DecodePushToken(token string) ([]byte, error)
- func NewAESGCM(key []byte) (cipher.AEAD, error)
- type DB
- type Device
- type Message
- func (m *Message) ActionContent(text string, title string, actions []string) *Message
- func (m *Message) AudioContent(path string, fname string, title string, duration uint64, size int) *Message
- func (m *Message) DisableToken() *Message
- func (m *Message) EncryptContent(key []byte)
- func (m *Message) EncryptData(key []byte, ts uint64) []byte
- func (m *Message) FileContent(path string, filename string, desc string, size int, actions []string) *Message
- func (m *Message) ImageContent(path string, t *Thumbnail, size int) *Message
- func (m *Message) IsTimeline() bool
- func (m *Message) LinkContent(link string) *Message
- func (m *Message) Marshal() []byte
- func (m *Message) SetInterruptionLevel(interruptionLevel string) *Message
- func (m *Message) SetPriority(priority int) *Message
- func (m *Message) SetTimeline(timeline bool) *Message
- func (m *Message) SoundName(sound string) *Message
- func (m *Message) TextContent(text string, title string, copytext string, autocopy string) *Message
- func (m *Message) TextFileContent(path string, filename string, title string, desc string, size int, ...) *Message
- func (m *Message) TimelineContent(code string, title string, ts *time.Time, items []*MsgTimeItem) *Message
- type MsgTimeItem
- type OpenDB
- type Thumbnail
- type Token
- func (tk *Token) GetChannel() []byte
- func (tk *Token) GetNodeID() []byte
- func (tk *Token) GetUserID() string
- func (tk *Token) HashValue() []byte
- func (tk *Token) IsExpires() bool
- func (tk *Token) RawToken() string
- func (tk *Token) VerifyDataHash(data []byte) bool
- func (tk *Token) VerifySign(key []byte) bool
- type User
Constants ¶
This section is empty.
Variables ¶
var ( ErrDriverNotFound = errors.New("driver not found") ErrNotImplemented = errors.New("not implemented") ErrInvalidDeviceID = errors.New("invalid device id") ErrInvalidUserID = errors.New("invalid user id") ErrInvalidPublicKey = errors.New("invalid public key") ErrInvalidToken = errors.New("invalid token") ErrInvalidDSN = errors.New("invalid dsn") )
variable define
Functions ¶
func CalcDeviceKey ¶
CalcDeviceKey from device public key
func CalcUserKey ¶
CalcUserKey from user public key
Types ¶
type DB ¶
type DB interface { GetOption(key string, value interface{}) error SetOption(key string, value interface{}) error GetUser(uid string) (*User, error) UpsertUser(u *User) error BindDevice(uid string, uuid string, key []byte, devType int) error UnbindDevice(uid string, uuid string) error UpdatePushToken(uid string, uuid string, token []byte, sandbox bool) error GetDeviceKey(uuid string) ([]byte, error) GetDevices(uid string) ([]*Device, error) Close() }
DB base interface
type Message ¶ added in v1.0.1
Message for notification
func (*Message) ActionContent ¶ added in v1.1.4
ActionContent set custom action notification
func (*Message) AudioContent ¶ added in v1.1.6
func (m *Message) AudioContent(path string, fname string, title string, duration uint64, size int) *Message
AudioContent set audio notification
func (*Message) DisableToken ¶ added in v1.0.1
DisableToken clear token
func (*Message) EncryptContent ¶ added in v1.0.1
EncryptContent return encrypted content with key
func (*Message) EncryptData ¶ added in v1.0.1
EncryptData return encrypted body with key & timestamp
func (*Message) FileContent ¶ added in v1.0.6
func (m *Message) FileContent(path string, filename string, desc string, size int, actions []string) *Message
FileContent set file notification
func (*Message) ImageContent ¶ added in v1.0.2
ImageContent set image notification
func (*Message) IsTimeline ¶ added in v1.2.2
IsTimeline return is timeline notification
func (*Message) LinkContent ¶ added in v1.0.5
LinkContent set link notification
func (*Message) SetInterruptionLevel ¶ added in v1.2.9
SetInterruptionLevel set time sensitive notification
func (*Message) SetPriority ¶ added in v1.0.1
SetPriority set notification priority
func (*Message) SetTimeline ¶ added in v1.2.2
SetTimeline set timeline notification
func (*Message) TextContent ¶ added in v1.0.1
TextContent set text notification
func (*Message) TextFileContent ¶ added in v1.0.10
func (m *Message) TextFileContent(path string, filename string, title string, desc string, size int, actions []string) *Message
TextFileContent set text file notification
func (*Message) TimelineContent ¶ added in v1.2.2
func (m *Message) TimelineContent(code string, title string, ts *time.Time, items []*MsgTimeItem) *Message
TimelineContent set timeline notification
type MsgTimeItem ¶ added in v1.2.2
type MsgTimeItem struct { Name string Value interface{} }
MsgTimeItem define data for timeline
type Thumbnail ¶ added in v1.0.4
type Thumbnail struct {
// contains filtered or unexported fields
}
Thumbnail for image
func NewThumbnail ¶ added in v1.0.4
NewThumbnail from image width & height
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
Token for sender
func ParseToken ¶
ParseToken create token from base64 string
func (*Token) VerifyDataHash ¶ added in v1.0.2
VerifyDataHash check the hash of uri limit
func (*Token) VerifySign ¶ added in v1.0.0
VerifySign check token sign
type User ¶
User information
func (*User) GetPublicKeyString ¶ added in v1.0.0
GetPublicKeyString return the user public key
func (*User) PublicKeyEncrypt ¶
PublicKeyEncrypt return encrypted public key
func (*User) SetServerless ¶
SetServerless for user configuration