blob: 68376f077c3eac7e006f4b9b5fe0c5d3a2591298 [file] [log] [blame]
// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package app
import (
"signature"
"v.io/v23/security"
"v.io/x/ref/services/wspr/internal/principal"
)
type Controller interface {
// Serve instructs WSPR to start listening for calls on behalf
// of a javascript server.
Serve(name string, serverId uint32) error
// Stop instructs WSPR to stop listening for calls for the
// given javascript server.
Stop(serverId uint32) error
// AddName adds a published name to an existing server.
AddName(serverId uint32, name string) error
// RemoveName removes a published name from an existing server.
RemoveName(serverId uint32, name string) error
// UnlinkBlessings removes the given blessings from the blessings store.
UnlinkBlessings(handle principal.BlessingsHandle) error
// BlessingsDebugString gets a string useful for debugging blessings.
BlessingsDebugString(handle principal.BlessingsHandle) (string | error)
// Bless binds extensions of blessings held by this principal to
// another principal (represented by its public key).
Bless(publicKey string, handle principal.BlessingsHandle, extension string, caveat []security.Caveat) (publicKeyOut string, handleOut principal.BlessingsHandle | error)
// BlessSelf creates a blessing with the provided name for this principal.
BlessSelf(name string, caveats []security.Caveat) (publicKeyOut string, handleOut principal.BlessingsHandle | error)
// PutToBlessingStore puts the specified blessing to the blessing store under the provided pattern.
PutToBlessingStore(handle principal.BlessingsHandle, pattern security.BlessingPattern) (?principal.JsBlessings | error)
// AddToRoots adds the provided blessing as a root.
AddToRoots(handle principal.BlessingsHandle) error
// RemoteBlessings fetches the remote blessings for a given name and method.
RemoteBlessings(name, method string) ([]string | error)
// Signature fetches the signature for a given name.
Signature(name string) ([]signature.Interface | error)
// GetDefaultBlessings fetches the default blessings for the principal of the controller.
GetDefaultBlessings() (?principal.JsBlessings | error)
}