Documentation ¶
Index ¶
- Constants
- Variables
- func CancelMultisig(ctx context.Context, id string, uid, sid, sessionKey string) error
- func Chunked(source []interface{}, size int) [][]interface{}
- func CreateRaw(ctx context.Context)
- func DeleteAddress(ctx context.Context, addressId, uid, sid, sessionKey, pin, pinToken string) error
- func EncryptEd25519PIN(ctx context.Context, pin, pinTokenBase64, sessionId, privateKey string, ...) (string, error)
- func EncryptPIN(ctx context.Context, pin, pinToken, sessionId, privateKey string, ...) (string, error)
- func OAuthGetAccessToken(ctx context.Context, clientID, clientSecret string, authorizationCode string, ...) (string, string, string, error)
- func PostAcknowledgements(ctx context.Context, requests []*ReceiptAcknowledgementRequest, ...) error
- func PostMessage(ctx context.Context, ...) error
- func PostMessages(ctx context.Context, messages []*MessageRequest, ...) error
- func PrivateKeyToCurve25519(curve25519Private *[32]byte, privateKey ed25519.PrivateKey)
- func PublicKeyToCurve25519(publicKey ed25519.PublicKey) ([]byte, error)
- func Request(ctx context.Context, method, path string, body []byte, accessToken string) ([]byte, error)
- func RequestWithId(ctx context.Context, method, path string, body []byte, ...) ([]byte, error)
- func SetBaseUri(base string)
- func SetBlazeUri(blaze string)
- func SignAuthenticationToken(uid, sid, privateKey, method, uri, body string) (string, error)
- func SignAuthenticationTokenWithoutBody(uid, sid, privateKey, method, uri string) (string, error)
- func SignOauthAccessToken(appID, authorizationID, privateKey, method, uri, body, scp string, ...) (string, error)
- func UniqueConversationId(userId, recipientId string) string
- func UnlockMultisig(ctx context.Context, id, pin string, uid, sid, sessionKey string) error
- func UpdatePin(ctx context.Context, ...) error
- func UuidFromBytes(input []byte) (uuid.UUID, error)
- func UuidFromString(id string) (uuid.UUID, error)
- func UuidNewV4() uuid.UUID
- type Address
- type AddressInput
- type Asset
- type Attachment
- type BlazeClient
- func (b *BlazeClient) Loop(ctx context.Context, listener BlazeListener) error
- func (b *BlazeClient) SendAppButton(ctx context.Context, conversationId, recipientId, label, action, color string) error
- func (b *BlazeClient) SendAppCard(ctx context.Context, ...) error
- func (b *BlazeClient) SendContact(ctx context.Context, conversationId, recipientId, contactId string) error
- func (b *BlazeClient) SendMessage(ctx context.Context, ...) error
- func (b *BlazeClient) SendPlainText(ctx context.Context, msg MessageView, content string) error
- func (b *BlazeClient) SendPost(ctx context.Context, msg MessageView, content string) error
- type BlazeListener
- type BlazeMessage
- type Conversation
- type DepositEntry
- type EdDSASigningMethod
- type Error
- type Fiat
- type GhostKeyRequest
- type GhostKeys
- type LiveMessagePayload
- type MessageRequest
- type MessageView
- type MultisigRequest
- type MultisigUTXO
- type Participant
- type ParticipantSessionView
- type Payment
- type PaymentRequest
- type RawTransaction
- type RecallMessagePayload
- type ReceiptAcknowledgementRequest
- type Snapshot
- func CreateTransfer(ctx context.Context, in *TransferInput, ...) (*Snapshot, error)
- func CreateWithdrawal(ctx context.Context, in *WithdrawalInput, ...) (*Snapshot, error)
- func NetworkSnapshot(ctx context.Context, snapshotId string) (*Snapshot, error)
- func NetworkSnapshotByToken(ctx context.Context, snapshotId, accessToken string) (*Snapshot, error)
- func ReadTransferByTrace(ctx context.Context, traceId, uid, sid, sessionKey string) (*Snapshot, error)
- func SnapshotById(ctx context.Context, snapshotId string, uid, sid, sessionKey string) (*Snapshot, error)
- func SnapshotByToken(ctx context.Context, snapshotId string, accessToken string) (*Snapshot, error)
- func Snapshots(ctx context.Context, limit int, ...) ([]*Snapshot, error)
- func SnapshotsByToken(ctx context.Context, limit int, offset, assetId, order, accessToken string) ([]*Snapshot, error)
- type SnapshotShort
- type Transaction
- type TransferInput
- type TransferView
- type Turn
- type User
- func CreateUser(ctx context.Context, sessionSecret, fullName, uid, sid, sessionKey string) (*User, error)
- func GetUser(ctx context.Context, userId, uid, sid, sessionKey string) (*User, error)
- func Relationship(ctx context.Context, uid, sid, privateKey string, userId, action string) (*User, error)
- func SearchUser(ctx context.Context, mixinId, uid, sid, sessionKey string) (*User, error)
- func UpdatePreference(ctx context.Context, uid, sid, privateKey string, ...) (*User, error)
- func UpdateUserMe(ctx context.Context, uid, sid, privateKey, fullName, avatarBase64 string) (*User, error)
- func UserMe(ctx context.Context, accessToken string) (*User, error)
- func VerifyPIN(ctx context.Context, uid, pin, pinToken, sessionId, privateKey string) (*User, error)
- type WithdrawalInput
Constants ¶
View Source
const ( MessageCategoryPlainText = "PLAIN_TEXT" MessageCategoryPlainImage = "PLAIN_IMAGE" MessageCategoryPlainData = "PLAIN_DATA" MessageCategoryPlainSticker = "PLAIN_STICKER" MessageCategoryPlainLive = "PLAIN_LIVE" MessageCategoryPlainContact = "PLAIN_CONTACT" MessageCategoryPlainPost = "PLAIN_POST" MessageCategorySystemConversation = "SYSTEM_CONVERSATION" MessageCategorySystemAccountSnapshot = "SYSTEM_ACCOUNT_SNAPSHOT" MessageCategoryMessageRecall = "MESSAGE_RECALL" MessageCategoryAppButtonGroup = "APP_BUTTON_GROUP" MessageCategoryAppCard = "APP_CARD" )
View Source
const ( RelationshipActionAdd = "ADD" RelationshipActionUpdate = "UPDATE" RelationshipActionRemove = "REMOVE" RelationshipActionBlock = "BLOCK" RelationshipActionUnblock = "UNBLOCK" )
Variables ¶
View Source
var (
ErrEdDSAVerification = errors.New("crypto/eddsa: verification error")
)
View Source
var Nil = uuid.Nil
Functions ¶
func CancelMultisig ¶
func DeleteAddress ¶
func EncryptEd25519PIN ¶
func EncryptPIN ¶
func OAuthGetAccessToken ¶
func OAuthGetAccessToken(ctx context.Context, clientID, clientSecret string, authorizationCode string, codeVerifier string, ed25519 string) (string, string, string, error)
OAuthGetAccessToken get the access token of a user ed25519 is optional, only use it when you want to sign OAuth access token locally
func PostAcknowledgements ¶
func PostAcknowledgements(ctx context.Context, requests []*ReceiptAcknowledgementRequest, clientId, sessionId, secret string) error
func PostMessage ¶
func PostMessages ¶
func PostMessages(ctx context.Context, messages []*MessageRequest, clientId, sessionId, secret string) error
func PrivateKeyToCurve25519 ¶
func PrivateKeyToCurve25519(curve25519Private *[32]byte, privateKey ed25519.PrivateKey)
func PublicKeyToCurve25519 ¶
func RequestWithId ¶
func SetBaseUri ¶
func SetBaseUri(base string)
func SetBlazeUri ¶
func SetBlazeUri(blaze string)
func SignAuthenticationToken ¶
func SignOauthAccessToken ¶
func UniqueConversationId ¶
func UnlockMultisig ¶
Types ¶
type Address ¶
type Address struct { AddressId string `json:"address_id"` AssetId string `json:"asset_id"` Label string `json:"label"` Destination string `json:"destination"` Tag string `json:"tag"` Fee string `json:"fee"` Reserve string `json:"reserve"` UpdatedAt string `json:"updated_at"` }
func CreateAddress ¶
func GetAddressesByAssetId ¶
type AddressInput ¶
type Asset ¶
type Asset struct { AssetId string `json:"asset_id"` ChainId string `json:"chain_id"` Symbol string `json:"symbol"` Name string `json:"name"` IconURL string `json:"icon_url"` PriceBTC string `json:"price_btc"` PriceUSD string `json:"price_usd"` Balance string `json:"balance"` Destination string `json:"destination"` Tag string `json:"tag"` Confirmations int `json:"confirmations"` DepositEntries []DepositEntry `json:"deposit_entries"` }
type Attachment ¶
type Attachment struct { Type string `json:"type"` AttachmentId string `json:"attachment_id"` ViewURL string `json:"view_url"` UploadUrl string `json:"upload_url"` }
func AttachmentShow ¶
func AttachmentShow(ctx context.Context, uid, sid, key, id string) (*Attachment, error)
func CreateAttachment ¶
func CreateAttachment(ctx context.Context, uid, sid, key string) (*Attachment, error)
type BlazeClient ¶
type BlazeClient struct {
// contains filtered or unexported fields
}
func NewBlazeClient ¶
func NewBlazeClient(uid, sid, key string) *BlazeClient
func (*BlazeClient) Loop ¶
func (b *BlazeClient) Loop(ctx context.Context, listener BlazeListener) error
func (*BlazeClient) SendAppButton ¶
func (b *BlazeClient) SendAppButton(ctx context.Context, conversationId, recipientId, label, action, color string) error
func (*BlazeClient) SendAppCard ¶
func (b *BlazeClient) SendAppCard(ctx context.Context, conversationId, recipientId, title, description, action, iconUrl string) error
func (*BlazeClient) SendContact ¶
func (b *BlazeClient) SendContact(ctx context.Context, conversationId, recipientId, contactId string) error
func (*BlazeClient) SendMessage ¶
func (b *BlazeClient) SendMessage(ctx context.Context, conversationId, recipientId, messageId, category, content, representativeId string) error
func (*BlazeClient) SendPlainText ¶
func (b *BlazeClient) SendPlainText(ctx context.Context, msg MessageView, content string) error
func (*BlazeClient) SendPost ¶
func (b *BlazeClient) SendPost(ctx context.Context, msg MessageView, content string) error
type BlazeListener ¶
type BlazeListener interface {
OnMessage(ctx context.Context, msg MessageView, userId string) error
}
type BlazeMessage ¶
type Conversation ¶
type Conversation struct { ConversationId string `json:"conversation_id"` CreatorId string `json:"creator_id"` Category string `json:"category"` Name string `json:"name"` IconURL string `json:"icon_url"` Announcement string `json:"announcement"` CreatedAt time.Time `json:"created_at"` Participants []Participant `json:"participants"` ParticipantSessions []ParticipantSessionView `json:"participant_sessions"` }
func ConversationShow ¶
func CreateConversation ¶
func CreateConversation(ctx context.Context, category, conversationId string, name, announcement string, participants []Participant, uid, sid, key string) (*Conversation, error)
type DepositEntry ¶
type EdDSASigningMethod ¶
type EdDSASigningMethod struct{}
var Ed25519SigningMethod *EdDSASigningMethod
func (*EdDSASigningMethod) Alg ¶
func (sm *EdDSASigningMethod) Alg() string
func (*EdDSASigningMethod) Sign ¶
func (sm *EdDSASigningMethod) Sign(signingString string, key interface{}) (string, error)
func (*EdDSASigningMethod) Verify ¶
func (sm *EdDSASigningMethod) Verify(signingString, signature string, key interface{}) error
type Error ¶
type Error struct { Status int `json:"status"` Code int `json:"code"` Description string `json:"description"` Extra interface{} `json:"extra,omitempty"` // contains filtered or unexported fields }
func AuthorizationError ¶
func BadDataError ¶
func ForbiddenError ¶
type GhostKeyRequest ¶
type GhostKeys ¶
type GhostKeys struct { Type string `json:"type"` Mask string `json:"mask"` Keys []string `json:"keys"` }
func ReadGhostKey ¶
func ReadGhostKeys ¶
type LiveMessagePayload ¶
type MessageRequest ¶
type MessageRequest struct { ConversationId string `json:"conversation_id"` RecipientId string `json:"recipient_id"` MessageId string `json:"message_id"` Category string `json:"category"` Data string `json:"data"` RepresentativeId string `json:"representative_id"` QuoteMessageId string `json:"quote_message_id"` }
type MessageView ¶
type MessageView struct { ConversationId string `json:"conversation_id"` UserId string `json:"user_id"` MessageId string `json:"message_id"` Category string `json:"category"` Data string `json:"data"` RepresentativeId string `json:"representative_id"` QuoteMessageId string `json:"quote_message_id"` Status string `json:"status"` Source string `json:"source"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type MultisigRequest ¶
type MultisigRequest struct { Type string `json:"type"` RequestId string `json:"request_id"` UserId string `json:"user_id"` AssetId string `json:"asset_id"` Amount string `json:"amount"` Threshold int64 `json:"threshold"` Senders []string `json:"senders"` Receivers []string `json:"receivers"` Signers []string `json:"signers"` Memo string `json:"memo"` Action string `json:"action"` State string `json:"state"` TransactionHash string `json:"transaction_hash"` RawTransaction string `json:"raw_transaction"` CreatedAt time.Time `json:"created_at"` CodeId string `json:"code_id"` }
func CreateMultisig ¶
func CreateMultisig(ctx context.Context, action, raw string, uid, sid, sessionKey string) (*MultisigRequest, error)
CreateMultisig create a multisigs request which action is `unlock` or `sign`
func SignMultisig ¶
type MultisigUTXO ¶
type MultisigUTXO struct { Type string `json:"type"` UserId string `json:"user_id"` UTXOId string `json:"utxo_id"` AssetId string `json:"asset_id"` TransactionHash string `json:"transaction_hash"` OutputIndex int64 `json:"output_index"` Amount string `json:"amount"` Threshold int64 `json:"threshold"` Members []string `json:"members"` Memo string `json:"memo"` State string `json:"state"` CreatedAt time.Time `json:"created_at"` SignedBy string `json:"signed_by"` SignedTx string `json:"signed_tx"` }
func ReadMultisigs ¶
func ReadMultisigs(ctx context.Context, limit int, offset, state, uid, sid, sessionKey string) ([]*MultisigUTXO, error)
state: spent, unspent, signed
func ReadMultisigsLegacy ¶
type Participant ¶
type ParticipantSessionView ¶
type Payment ¶
type Payment struct { Type string `json:"type"` TraceId string `json:"trace_id"` AssetId string `json:"asset_id"` Amount string `json:"amount"` Threshold int64 `json:"threshold"` Receivers []string `json:"receivers"` Memo string `json:"memo"` Status string `json:"status"` CodeId string `json:"code_id"` CreatedAt time.Time `json:"created_at"` }
func CreatePaymentRequest ¶
type PaymentRequest ¶
type RawTransaction ¶
type RawTransaction struct { Type string `json:"type"` SnapshotId string `json:"snapshot_id"` OpponentKey string `json:"opponent_key"` AssetId string `json:"asset_id"` Amount string `json:"amount"` TraceId string `json:"trace_id"` Memo string `json:"memo"` State string `json:"state"` CreatedAt time.Time `json:"created_at"` TransactionHash string `json:"transaction_hash"` SnapshotHash string `json:"snapshot_hash"` SnapshotAt time.Time `json:"snapshot_at"` }
func CreateMultisigTransaction ¶
func CreateMultisigTransaction(ctx context.Context, in *TransferInput, uid, sid, sessionKey, pin, pinToken string) (*RawTransaction, error)
func CreateTransaction ¶
func CreateTransaction(ctx context.Context, in *TransferInput, uid, sid, sessionKey, pin, pinToken string) (*RawTransaction, error)
type RecallMessagePayload ¶
type RecallMessagePayload struct {
MessageId string `json:"message_id"`
}
type Snapshot ¶
type Snapshot struct { Type string `json:"type"` SnapshotId string `json:"snapshot_id"` AssetId string `json:"asset_id"` Amount string `json:"amount"` OpeningBalance string `json:"opening_balance"` ClosingBalance string `json:"closing_balance"` CreatedAt time.Time `json:"created_at"` // deposit & withdrawal TransactionHash string `json:"transaction_hash,omitempty"` OutputIndex int64 `json:"output_index,omitempty"` Sender string `json:"sender,omitempty"` Receiver string `json:"receiver,omitempty"` // transfer SnapshotHash string `json:"snapshot_hash,omitempty"` SnapshotAt time.Time `json:"snapshot_at,omitempty"` OpponentId string `json:"opponent_id,omitempty"` TraceId string `json:"trace_id,omitempty"` Memo string `json:"memo,omitempty"` Confirmations int64 `json:"confirmations,omitempty"` State string `json:"state,omitempty"` Fee struct { Amount string `json:"amount"` AssetId string `json:"asset_id"` } `json:"fee,omitempty"` }
func CreateTransfer ¶
func CreateWithdrawal ¶
func NetworkSnapshot ¶
func NetworkSnapshotByToken ¶
func ReadTransferByTrace ¶
func SnapshotById ¶
func SnapshotByToken ¶
type SnapshotShort ¶
type SnapshotShort struct { Type string `json:"type"` SnapshotId string `json:"snapshot_id"` Source string `json:"source"` Amount string `json:"amount"` Asset struct { Type string `json:"type"` AssetId string `json:"asset_id"` ChainId string `json:"chain_id"` MixinId string `json:"mixin_id"` Symbol string `json:"symbol"` Name string `json:"name"` AssetKey string `json:"asset_key"` IconUrl string `json:"icon_url"` } `json:"asset"` CreatedAt time.Time `json:"created_at"` TraceId string `json:"trace_id"` OpponentId string `json:"opponent_id"` Memo string `json:"data"` }
func NetworkSnapshots ¶
func NetworkSnapshotsByToken ¶
type Transaction ¶
type Transaction struct { Type string `json:"type"` TransactionId string `json:"transaction_id"` TransactionHash string `json:"transaction_hash"` Sender string `json:"sender"` ChainId string `json:"chain_id"` AssetId string `json:"asset_id"` Amount string `json:"amount"` Destination string `json:"destination"` Tag string `json:"tag"` Confirmations int `json:"confirmations"` Threshold int `json:"threshold"` CreatedAt string `json:"created_at"` }
func ExternalTranactions ¶
func ExternalTranactions(ctx context.Context, asset, destination, tag string) ([]*Transaction, error)
type TransferInput ¶
type TransferView ¶
type TransferView struct { Type string `json:"type"` SnapshotId string `json:"snapshot_id"` CounterUserId string `json:"counter_user_id"` AssetId string `json:"asset_id"` Amount string `json:"amount"` TraceId string `json:"trace_id"` Memo string `json:"memo"` CreatedAt time.Time `json:"created_at"` }
type Turn ¶
type User ¶
type User struct { UserId string `json:"user_id"` SessionId string `json:"session_id"` PinToken string `json:"pin_token"` PINTokenBase64 string `json:"pin_token_base64"` IdentityNumber string `json:"identity_number"` Phone string `json:"phone"` FullName string `json:"full_name"` AvatarURL string `json:"avatar_url"` DeviceStatus string `json:"device_status"` CreatedAt string `json:"created_at"` }
func CreateUser ¶
func Relationship ¶
func SearchUser ¶
func UpdatePreference ¶
func UpdateUserMe ¶
type WithdrawalInput ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.