mirror of
https://github.com/balzack/databag.git
synced 2025-02-11 19:19:16 +00:00
preparing account authorization
This commit is contained in:
parent
22d6c74f9a
commit
12dfca0da3
30
doc/api.oa3
30
doc/api.oa3
@ -4030,7 +4030,7 @@ components:
|
||||
$ref: '#/components/schemas/AppData'
|
||||
attached:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
|
||||
AppData:
|
||||
type: object
|
||||
@ -4164,7 +4164,7 @@ components:
|
||||
type: string
|
||||
created:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
|
||||
Insight:
|
||||
type: object
|
||||
@ -4208,7 +4208,7 @@ components:
|
||||
type: string
|
||||
created:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
active:
|
||||
type: boolean
|
||||
insightRevision:
|
||||
@ -4263,10 +4263,10 @@ components:
|
||||
type: string
|
||||
created:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
modified:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
status:
|
||||
type: string
|
||||
enum: [ unconfirmed, confirmed, complete, error ]
|
||||
@ -4275,7 +4275,7 @@ components:
|
||||
format: int32
|
||||
tagUpdate:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
tagRevision:
|
||||
type: integer
|
||||
format: int64
|
||||
@ -4306,10 +4306,10 @@ components:
|
||||
type: string
|
||||
created:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
modified:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
status:
|
||||
type: string
|
||||
enum: [ unconfirmed, confirmed, complete, error ]
|
||||
@ -4326,7 +4326,7 @@ components:
|
||||
format: int32
|
||||
tagUpdate:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
tagRevision:
|
||||
type: integer
|
||||
format: int64
|
||||
@ -4352,10 +4352,10 @@ components:
|
||||
type: string
|
||||
created:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
modified:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
|
||||
Label:
|
||||
type: object
|
||||
@ -4378,7 +4378,7 @@ components:
|
||||
type: string
|
||||
created:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
groups: # present only in account holder responses
|
||||
type: array
|
||||
items:
|
||||
@ -4397,7 +4397,7 @@ components:
|
||||
type: string
|
||||
timestamp:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
|
||||
Connect:
|
||||
type: object
|
||||
@ -4415,7 +4415,7 @@ components:
|
||||
type: string
|
||||
timestamp:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
profile:
|
||||
$ref: '#/components/schemas/Profile'
|
||||
token:
|
||||
@ -4437,7 +4437,7 @@ components:
|
||||
type: string
|
||||
timestamp:
|
||||
type: integer
|
||||
format: int32
|
||||
format: int64
|
||||
|
||||
DataMessage:
|
||||
type: object
|
||||
|
@ -1,24 +1,13 @@
|
||||
/*
|
||||
* DataBag
|
||||
*
|
||||
* DataBag provides storage for decentralized identity based self-hosting apps. It is intended to support sharing of personal data and hosting group conversations.
|
||||
*
|
||||
* API version: 0.0.1
|
||||
* Contact: roland.osborne@gmail.com
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
package databag
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Authorize(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
account, res := BearerAppToken(r);
|
||||
PrintMsg(res);
|
||||
PrintMsg(account);
|
||||
|
||||
if res != nil {
|
||||
w.WriteHeader(http.StatusUnauthorized)
|
||||
return
|
||||
@ -28,6 +17,24 @@ PrintMsg(account);
|
||||
return
|
||||
}
|
||||
|
||||
// extract token from body
|
||||
var token string
|
||||
if ParseRequest(r, w, &token) != nil {
|
||||
w.WriteHeader(http.StatusBadRequest);
|
||||
return
|
||||
}
|
||||
|
||||
// load details to sign data
|
||||
|
||||
|
||||
// generate message
|
||||
auth := Authenticate{
|
||||
Guid: account.Guid,
|
||||
Token: token,
|
||||
Timestamp: time.Now().Unix(),
|
||||
}
|
||||
PrintMsg(auth);
|
||||
|
||||
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ type Announce struct {
|
||||
type App struct {
|
||||
AppId string `json:"appId"`
|
||||
AppData *AppData `json:"appData"`
|
||||
Attached int32 `json:"attached"`
|
||||
Attached int64 `json:"attached"`
|
||||
}
|
||||
|
||||
type AppData struct {
|
||||
@ -43,13 +43,13 @@ type Article struct {
|
||||
ArticleRevision int64 `json:"articleRevision"`
|
||||
Type_ string `json:"type"`
|
||||
Data string `json:"data"`
|
||||
Created int32 `json:"created"`
|
||||
Modified int32 `json:"modified"`
|
||||
Created int64 `json:"created"`
|
||||
Modified int64 `json:"modified"`
|
||||
Status string `json:"status"`
|
||||
Labels []string `json:"labels"`
|
||||
Groups []string `json:"groups,omitempty"`
|
||||
TagCount int32 `json:"tagCount"`
|
||||
TagUpdate int32 `json:"tagUpdate,omitempty"`
|
||||
TagUpdate int64 `json:"tagUpdate,omitempty"`
|
||||
TagRevision int64 `json:"tagRevision"`
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ type Asset struct {
|
||||
type Authenticate struct {
|
||||
Guid string `json:"guid"`
|
||||
Token string `json:"token"`
|
||||
Timestamp int32 `json:"timestamp"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type Card struct {
|
||||
@ -110,7 +110,7 @@ type CardView struct {
|
||||
type Connect struct {
|
||||
RequestorcardId string `json:"requestorcardId,omitempty"`
|
||||
RequestedcardId string `json:"requestedcardId,omitempty"`
|
||||
Timestamp int32 `json:"timestamp"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Profile *Profile `json:"profile"`
|
||||
Token string `json:"token"`
|
||||
ContentRevision int64 `json:"contentRevision"`
|
||||
@ -139,7 +139,7 @@ type Dialogue struct {
|
||||
DialogueRevison int64 `json:"dialogueRevison,omitempty"`
|
||||
Type_ string `json:"type"`
|
||||
Data string `json:"data"`
|
||||
Created int32 `json:"created"`
|
||||
Created int64 `json:"created"`
|
||||
Active bool `json:"active"`
|
||||
InsightRevision int64 `json:"insightRevision,omitempty"`
|
||||
Insights []DialogueInsights `json:"insights"`
|
||||
@ -158,7 +158,7 @@ type DialogueInsights struct {
|
||||
type Disconnect struct {
|
||||
RequestorId string `json:"requestorId"`
|
||||
RequestedId string `json:"requestedId"`
|
||||
Timestamp int32 `json:"timestamp"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
@ -166,8 +166,8 @@ type Group struct {
|
||||
GroupRevision int64 `json:"groupRevision"`
|
||||
Type_ string `json:"type"`
|
||||
Data string `json:"data"`
|
||||
Created int32 `json:"created"`
|
||||
Modified int32 `json:"modified"`
|
||||
Created int64 `json:"created"`
|
||||
Modified int64 `json:"modified"`
|
||||
}
|
||||
|
||||
type GroupsGroupIdBody struct {
|
||||
@ -215,7 +215,7 @@ type Label struct {
|
||||
LabelRevision int64 `json:"labelRevision"`
|
||||
Type_ string `json:"type"`
|
||||
Data string `json:"data"`
|
||||
Created int32 `json:"created"`
|
||||
Created int64 `json:"created"`
|
||||
Groups []string `json:"groups,omitempty"`
|
||||
}
|
||||
|
||||
@ -271,7 +271,7 @@ type Tag struct {
|
||||
Revision int64 `json:"revision"`
|
||||
Type_ string `json:"type"`
|
||||
Data string `json:"data"`
|
||||
Created int32 `json:"created"`
|
||||
Created int64 `json:"created"`
|
||||
}
|
||||
|
||||
type Topic struct {
|
||||
@ -279,11 +279,11 @@ type Topic struct {
|
||||
TopicRevision int64 `json:"topicRevision"`
|
||||
Type_ string `json:"type"`
|
||||
Data string `json:"data"`
|
||||
Created int32 `json:"created"`
|
||||
Modified int32 `json:"modified"`
|
||||
Created int64 `json:"created"`
|
||||
Modified int64 `json:"modified"`
|
||||
Status string `json:"status"`
|
||||
TagCount int32 `json:"tagCount"`
|
||||
TagUpdate int32 `json:"tagUpdate,omitempty"`
|
||||
TagUpdate int64 `json:"tagUpdate,omitempty"`
|
||||
TagRevision int64 `json:"tagRevision"`
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user