Dane caused this monstrosity to occur.. Port over remaining transfer/archive code to gin, delete http.go
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
package tokens
|
||||
|
||||
import (
|
||||
cache2 "github.com/patrickmn/go-cache"
|
||||
"github.com/patrickmn/go-cache"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type TokenStore struct {
|
||||
cache *cache2.Cache
|
||||
cache *cache.Cache
|
||||
mutex *sync.Mutex
|
||||
}
|
||||
|
||||
var _tokens *TokenStore
|
||||
|
||||
// Returns the global unqiue token store cache. This is used to validate
|
||||
// Returns the global unique token store cache. This is used to validate
|
||||
// one time token usage by storing any received tokens in a local memory
|
||||
// cache until they are ready to expire.
|
||||
func getTokenStore() *TokenStore {
|
||||
if _tokens == nil {
|
||||
_tokens = &TokenStore{
|
||||
cache: cache2.New(time.Minute*60, time.Minute*5),
|
||||
cache: cache.New(time.Minute*60, time.Minute*5),
|
||||
mutex: &sync.Mutex{},
|
||||
}
|
||||
}
|
||||
|
||||
14
router/tokens/transfer.go
Normal file
14
router/tokens/transfer.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package tokens
|
||||
|
||||
import (
|
||||
"github.com/gbrlsnchs/jwt/v3"
|
||||
)
|
||||
|
||||
type TransferPayload struct {
|
||||
jwt.Payload
|
||||
}
|
||||
|
||||
// GetPayload returns the JWT payload.
|
||||
func (p *TransferPayload) GetPayload() *jwt.Payload {
|
||||
return &p.Payload
|
||||
}
|
||||
Reference in New Issue
Block a user