blob: 33f1befc682161ef618c095b73a231aaea5ed726 [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 {
// NewServer instructs WSPR to create a server and start listening for calls on
// behalf of a JavaScript server.
NewServer(name string, serverId uint32, serverOpts []RpcServerOption) 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
// Bless binds extensions of blessings held by this principal to
// another principal (represented by its public key).
Bless(publicKey []byte, blessings security.WireBlessings, extension string, caveat []security.Caveat) (principal.BlessingsId | error)
// BlessSelf creates a blessing with the provided name for this principal.
BlessSelf(name string, caveats []security.Caveat) (principal.BlessingsId | error)
// AddToRoots adds the provided blessing as a root.
AddToRoots(blessings security.WireBlessings) error
// BlessingStoreSet puts the specified blessing in the blessing store under the provided pattern.
BlessingStoreSet(blessingsblessings security.WireBlessings, pattern security.BlessingPattern) (principal.BlessingsId | error)
// BlessingStoreForPeer retrieves the blessings marked for the given peers.
BlessingStoreForPeer(peerBlessings []string) (principal.BlessingsId | error)
// BlessingStoreSetDefault sets the default blessings.
BlessingStoreSetDefault(blessingsblessings security.WireBlessings) error
// BlessingStoreDefault fetches the default blessings for the principal of the controller.
BlessingStoreDefault() (principal.BlessingsId | error)
// BlessingStorePublicKey fetches the public key of the principal for which this store hosts blessings.
BlessingStorePublicKey() ([]byte | error)
// BlessingStorePeerBlessings returns all the blessings that the BlessingStore holds.
BlessingStorePeerBlessings() (map[security.BlessingPattern]principal.BlessingsId | error)
// BlessingStoreDebugString retrieves a debug string describing the state of the blessing store
BlessingStoreDebugString() (string | 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)
}