mirror of
https://github.com/balzack/databag.git
synced 2025-02-11 19:19:16 +00:00
applied gofmt to changes
This commit is contained in:
parent
820cd39b68
commit
26f8d395a7
@ -129,10 +129,10 @@ func AddCard(w http.ResponseWriter, r *http.Request) {
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
ErrResponse(w, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
ErrResponse(w, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
SetStatus(account)
|
||||
|
@ -2,94 +2,139 @@ package databag
|
||||
|
||||
//APPTokenSize config for size of random access token
|
||||
const APPTokenSize = 16
|
||||
|
||||
//APPBodyLimit config for max size of api body
|
||||
const APPBodyLimit = 1048576
|
||||
|
||||
//APPVersion config for current version of api
|
||||
const APPVersion = "0.0.1"
|
||||
|
||||
//APPCreateExpire config for valid duration of create token
|
||||
const APPCreateExpire = 86400
|
||||
|
||||
//APPCreateSize config for size of create token
|
||||
const APPCreateSize = 16
|
||||
|
||||
//APPResetExpire config for valid duration of reset token
|
||||
const APPResetExpire = 86400
|
||||
|
||||
//APPResetSize config for size of reset token
|
||||
const APPResetSize = 16
|
||||
|
||||
//APPConnectExpire config for valid duration of connection message
|
||||
const APPConnectExpire = 30
|
||||
|
||||
//APPKeySize config for default key size
|
||||
const APPKeySize = 4096
|
||||
|
||||
//APPRSA4096 config for rsa 4096 alg name
|
||||
const APPRSA4096 = "RSA4096"
|
||||
|
||||
//APPRSA2048 config for rsa 2048 alg name
|
||||
const APPRSA2048 = "RSA2048"
|
||||
|
||||
//APPSignPKCS1V15 config for pkcsv15 alg name
|
||||
const APPSignPKCS1V15 = "PKCS1v15"
|
||||
|
||||
//APPSignPSS config for pss alg name
|
||||
const APPSignPSS = "PSS"
|
||||
|
||||
//APPMsgAuthenticate config for authorize message name
|
||||
const APPMsgAuthenticate = "authenticate"
|
||||
|
||||
//APPMsgIdentity config for identity message name
|
||||
const APPMsgIdentity = "identity"
|
||||
|
||||
//APPMsgConnect config for connect message name
|
||||
const APPMsgConnect = "connect"
|
||||
|
||||
//APPMsgDisconnect config for disconnect message name
|
||||
const APPMsgDisconnect = "disconnect"
|
||||
|
||||
//APPCardPending config for pending status name
|
||||
const APPCardPending = "pending"
|
||||
|
||||
//APPCardConfirmed config for confirmed status name
|
||||
const APPCardConfirmed = "confirmed"
|
||||
|
||||
//APPCardRequested config for requested status name
|
||||
const APPCardRequested = "requested"
|
||||
|
||||
//APPCardConnecting config for connecting status name
|
||||
const APPCardConnecting = "connecting"
|
||||
|
||||
//APPCardConnected config for connected status name
|
||||
const APPCardConnected = "connected"
|
||||
|
||||
//APPNotifyProfile config for notification name for profile
|
||||
const APPNotifyProfile = "profile"
|
||||
|
||||
//APPNotifyArticle config for notification name for article
|
||||
const APPNotifyArticle = "article"
|
||||
|
||||
//APPNotifyChannel config for notification name for channel
|
||||
const APPNotifyChannel = "channel"
|
||||
|
||||
//APPNotifyView config for notification name for view
|
||||
const APPNotifyView = "view"
|
||||
|
||||
//APPTokenAgent config for query param name for self token
|
||||
const APPTokenAgent = "agent"
|
||||
|
||||
//APPTokenContact config for query param name for contact token
|
||||
const APPTokenContact = "contact"
|
||||
|
||||
//APPTokenAttach config for query param name for attach token
|
||||
const APPTokenAttach = "attach"
|
||||
|
||||
//APPTokenCreate config for query param name for create token
|
||||
const APPTokenCreate = "create"
|
||||
|
||||
//APPTokenReset config for query param name for reset token
|
||||
const APPTokenReset = "reset"
|
||||
|
||||
//APPNotifyBuffer config for size of channel reciving notifications
|
||||
const APPNotifyBuffer = 4096
|
||||
|
||||
//APPTopicUnconfirmed config for status name for unconfirmed
|
||||
const APPTopicUnconfirmed = "unconfirmed"
|
||||
|
||||
//APPTopicConfirmed config for status name for confirmed
|
||||
const APPTopicConfirmed = "confirmed"
|
||||
|
||||
//APPAssetReady config for status name for ready
|
||||
const APPAssetReady = "ready"
|
||||
|
||||
//APPAssetWaiting config for status name for waiting
|
||||
const APPAssetWaiting = "waiting"
|
||||
|
||||
//APPAssetProcessing config for status name for processing
|
||||
const APPAssetProcessing = "processing"
|
||||
|
||||
//APPAssetError config for status name for error
|
||||
const APPAssetError = "error"
|
||||
|
||||
//APPTransformComplete config for status name for completed processing
|
||||
const APPTransformComplete = "complete"
|
||||
|
||||
//APPTransformIncomplete config for status name for not complete processing
|
||||
const APPTransformIncomplete = "incomplete"
|
||||
|
||||
//APPTransformError config for status name for processing error
|
||||
const APPTransformError = "error"
|
||||
|
||||
//APPQueueAudio config for queue name for audio assets
|
||||
const APPQueueAudio = "audio"
|
||||
|
||||
//APPQueueVideo config for queue name for video assets
|
||||
const APPQueueVideo = "video"
|
||||
|
||||
//APPQueuePhoto config for queue name for photo assets
|
||||
const APPQueuePhoto = "photo"
|
||||
|
||||
//APPQueueDefault config for queue name for other assets
|
||||
const APPQueueDefault = ""
|
||||
|
||||
//APPDefaultPath config for default path to store assets
|
||||
const APPDefaultPath = "./asset"
|
||||
|
||||
|
@ -106,9 +106,9 @@ func WriteDataMessage(privateKey string, publicKey string, keyType string,
|
||||
signedData.MessageType = messageType
|
||||
signedData.Value = string(data)
|
||||
data, err = json.Marshal(&signedData)
|
||||
if err != nil {
|
||||
return nil, errors.New("marshall failed");
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.New("marshall failed")
|
||||
}
|
||||
message := base64.StdEncoding.EncodeToString(data)
|
||||
|
||||
if keyType != APPRSA2048 && keyType != APPRSA4096 {
|
||||
@ -131,9 +131,9 @@ func WriteDataMessage(privateKey string, publicKey string, keyType string,
|
||||
} else {
|
||||
return nil, errors.New("unsupported signature type")
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.New("rsa sign failed");
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.New("rsa sign failed")
|
||||
}
|
||||
signature := base64.StdEncoding.EncodeToString(data)
|
||||
|
||||
dataMessage := DataMessage{
|
||||
|
@ -1,9 +1,9 @@
|
||||
package databag
|
||||
|
||||
import (
|
||||
"github.com/gorilla/mux"
|
||||
"net/http"
|
||||
"strings"
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
type route struct {
|
||||
|
@ -51,14 +51,14 @@ func (c *TestContactData) updateContact() (err error) {
|
||||
if err = c.updateContactCardDetail(); err != nil {
|
||||
return
|
||||
}
|
||||
c.cardDetailRevision = c.card.Data.DetailRevision
|
||||
c.cardDetailRevision = c.card.Data.DetailRevision
|
||||
}
|
||||
|
||||
if c.cardProfileRevision != c.card.Data.ProfileRevision {
|
||||
if err = c.updateContactCardProfile(); err != nil {
|
||||
return
|
||||
}
|
||||
c.cardProfileRevision = c.card.Data.ProfileRevision
|
||||
c.cardProfileRevision = c.card.Data.ProfileRevision
|
||||
}
|
||||
|
||||
// sync rest only if connected
|
||||
@ -70,7 +70,7 @@ func (c *TestContactData) updateContact() (err error) {
|
||||
if err = c.updateContactProfile(); err != nil {
|
||||
return
|
||||
}
|
||||
c.profileRevision = c.card.Data.NotifiedProfile
|
||||
c.profileRevision = c.card.Data.NotifiedProfile
|
||||
}
|
||||
|
||||
if c.viewRevision != c.card.Data.NotifiedView {
|
||||
@ -79,23 +79,23 @@ func (c *TestContactData) updateContact() (err error) {
|
||||
} else if err = c.updateContactChannels(); err != nil {
|
||||
return
|
||||
}
|
||||
c.articleRevision = c.card.Data.NotifiedArticle
|
||||
c.channelRevision = c.card.Data.NotifiedChannel
|
||||
c.viewRevision = c.card.Data.NotifiedView
|
||||
c.articleRevision = c.card.Data.NotifiedArticle
|
||||
c.channelRevision = c.card.Data.NotifiedChannel
|
||||
c.viewRevision = c.card.Data.NotifiedView
|
||||
}
|
||||
|
||||
if c.articleRevision != c.card.Data.NotifiedArticle {
|
||||
if err = c.updateContactArticle(); err != nil {
|
||||
return
|
||||
}
|
||||
c.articleRevision = c.card.Data.NotifiedArticle
|
||||
c.articleRevision = c.card.Data.NotifiedArticle
|
||||
}
|
||||
|
||||
if c.channelRevision != c.card.Data.NotifiedChannel {
|
||||
if err = c.updateContactChannels(); err != nil {
|
||||
return
|
||||
}
|
||||
c.channelRevision = c.card.Data.NotifiedChannel
|
||||
c.channelRevision = c.card.Data.NotifiedChannel
|
||||
}
|
||||
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user