go-ssb-room/roomsrv/manifest.go

62 lines
1.1 KiB
Go
Raw Normal View History

// SPDX-FileCopyrightText: 2021 The NGI Pointer Secure-Scuttlebutt Team of 2020/2021
//
2021-02-09 11:53:33 +00:00
// SPDX-License-Identifier: MIT
2021-01-25 17:31:09 +00:00
package roomsrv
import (
"context"
"encoding/json"
"fmt"
"github.com/ssbc/go-muxrpc/v2"
2021-01-25 17:31:09 +00:00
)
type manifestHandler string
func (h manifestHandler) HandleAsync(ctx context.Context, req *muxrpc.Request) (interface{}, error) {
return json.RawMessage(h), nil
2021-01-25 17:31:09 +00:00
}
2021-01-26 17:33:29 +00:00
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")
}
}
2021-01-25 17:31:09 +00:00
// 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",
"gossip": {
"ping": "duplex"
},
2021-03-16 08:13:27 +00:00
"room": {
"registerAlias": "async",
"revokeAlias": "async",
"listAliases": "async",
2021-03-16 08:13:27 +00:00
"connect": "duplex",
2021-05-17 13:31:29 +00:00
"attendants": "source",
"members": "source",
2021-05-17 13:31:29 +00:00
"metadata": "async",
2021-03-16 08:13:27 +00:00
"ping": "sync"
},
2021-01-25 17:31:09 +00:00
"tunnel": {
"announce": "sync",
"leave": "sync",
"connect": "duplex",
"endpoints": "source",
"isRoom": "async",
2021-01-26 17:33:29 +00:00
"ping": "sync"
2021-01-25 17:31:09 +00:00
}
}`