// SPDX-License-Identifier: MIT package roomsrv import ( "context" "encoding/json" "fmt" "go.cryptoscope.co/muxrpc/v2" ) type manifestHandler string func (h manifestHandler) HandleAsync(ctx context.Context, req *muxrpc.Request) (interface{}, error) { return json.RawMessage(h), nil } func init() { if !json.Valid([]byte(manifest)) { manifestMap := make(map[string]interface{}) err := json.Unmarshal([]byte(manifest), &manifestMap) fmt.Println(err) panic("manifest blob is broken json") } } // this is a very simple hardcoded manifest.json dump which oasis' ssb-client expects to do it's magic. const manifest manifestHandler = ` { "manifest": "sync", "whoami":"async", "room": { "registerAlias": "async", "revokeAlias": "async", "announce": "sync", "leave": "sync", "connect": "duplex", "endpoints": "source", "isRoom": "async", "ping": "sync" }, "tunnel": { "announce": "sync", "leave": "sync", "connect": "duplex", "endpoints": "source", "isRoom": "async", "ping": "sync" } }`