Update for tm
This commit is contained in:
parent
e013edc656
commit
e93fe50b5f
|
|
@ -1240,6 +1240,11 @@ func NewContext(db * badger.DB, log Logger) (*Context, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = ctx.RegisterNodeType(BaseNodeType, []ExtType{})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
err = ctx.RegisterNodeType(GQLNodeType, []ExtType{GroupExtType, GQLExtType})
|
err = ctx.RegisterNodeType(GQLNodeType, []ExtType{GroupExtType, GQLExtType})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
19
gql.go
19
gql.go
|
|
@ -31,6 +31,25 @@ import (
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func AuthorizationHeader(node *Node) (string, error) {
|
||||||
|
key_ser, err := x509.MarshalPKCS8PrivateKey(node.Key)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
id_bytes, err := node.ID.MarshalBinary()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
id_str := base64.StdEncoding.EncodeToString(id_bytes)
|
||||||
|
key_str := base64.StdEncoding.EncodeToString(key_ser)
|
||||||
|
|
||||||
|
bytes := append([]byte(id_str), ':')
|
||||||
|
bytes = append(bytes, []byte(key_str)...)
|
||||||
|
|
||||||
|
return base64.StdEncoding.EncodeToString(bytes), nil
|
||||||
|
}
|
||||||
|
|
||||||
func NodeInterfaceDefaultIsType(required_extensions []ExtType) func(graphql.IsTypeOfParams) bool {
|
func NodeInterfaceDefaultIsType(required_extensions []ExtType) func(graphql.IsTypeOfParams) bool {
|
||||||
return func(p graphql.IsTypeOfParams) bool {
|
return func(p graphql.IsTypeOfParams) bool {
|
||||||
ctx, ok := p.Context.Value("resolve").(*ResolveContext)
|
ctx, ok := p.Context.Value("resolve").(*ResolveContext)
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ var (
|
||||||
GroupExtType = NewExtType("GROUP")
|
GroupExtType = NewExtType("GROUP")
|
||||||
|
|
||||||
GQLNodeType = NewNodeType("GQL")
|
GQLNodeType = NewNodeType("GQL")
|
||||||
|
BaseNodeType = NewNodeType("BASE")
|
||||||
|
|
||||||
StopSignalType = NewSignalType("STOP")
|
StopSignalType = NewSignalType("STOP")
|
||||||
CreateSignalType = NewSignalType("CREATE")
|
CreateSignalType = NewSignalType("CREATE")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue