blob: 68376f077c3eac7e006f4b9b5fe0c5d3a2591298 [file] [log] [blame]
Jiri Simsa756772c2015-03-25 15:40:54 -07001// Copyright 2015 The Vanadium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
Matt Rosencrantz786f7272015-02-11 15:18:07 -08005package app
6
Matt Rosencrantzfeefb772015-02-18 14:58:49 -08007import (
Matt Rosencrantzec3b9502015-02-19 12:53:13 -08008 "signature"
Matt Rosencrantzfeefb772015-02-18 14:58:49 -08009
Jiri Simsa1f1302c2015-02-23 16:18:34 -080010 "v.io/v23/security"
Todd Wang5b77a342015-04-06 18:31:37 -070011 "v.io/x/ref/services/wspr/internal/principal"
Matt Rosencrantzfeefb772015-02-18 14:58:49 -080012)
13
Matt Rosencrantz786f7272015-02-11 15:18:07 -080014type Controller interface {
Matt Rosencrantzfeefb772015-02-18 14:58:49 -080015 // Serve instructs WSPR to start listening for calls on behalf
16 // of a javascript server.
17 Serve(name string, serverId uint32) error
18 // Stop instructs WSPR to stop listening for calls for the
19 // given javascript server.
20 Stop(serverId uint32) error
21 // AddName adds a published name to an existing server.
22 AddName(serverId uint32, name string) error
23 // RemoveName removes a published name from an existing server.
24 RemoveName(serverId uint32, name string) error
25
Todd Wangbaf16842015-03-16 14:12:29 -070026 // UnlinkBlessings removes the given blessings from the blessings store.
Benjamin Prosnitz23bf1a02015-03-30 16:17:04 -070027 UnlinkBlessings(handle principal.BlessingsHandle) error
Benjamin Prosnitz33408332015-04-23 14:45:26 -070028 // BlessingsDebugString gets a string useful for debugging blessings.
29 BlessingsDebugString(handle principal.BlessingsHandle) (string | error)
Benjamin Prosnitz23bf1a02015-03-30 16:17:04 -070030 // Bless binds extensions of blessings held by this principal to
31 // another principal (represented by its public key).
Todd Wangd87d7462015-04-26 01:59:54 -070032 Bless(publicKey string, handle principal.BlessingsHandle, extension string, caveat []security.Caveat) (publicKeyOut string, handleOut principal.BlessingsHandle | error)
Benjamin Prosnitz23bf1a02015-03-30 16:17:04 -070033 // BlessSelf creates a blessing with the provided name for this principal.
Todd Wangd87d7462015-04-26 01:59:54 -070034 BlessSelf(name string, caveats []security.Caveat) (publicKeyOut string, handleOut principal.BlessingsHandle | error)
Benjamin Prosnitz9e423992015-04-10 13:10:35 -070035 // PutToBlessingStore puts the specified blessing to the blessing store under the provided pattern.
Todd Wangd87d7462015-04-26 01:59:54 -070036 PutToBlessingStore(handle principal.BlessingsHandle, pattern security.BlessingPattern) (?principal.JsBlessings | error)
Benjamin Prosnitz782a8a12015-04-22 15:02:38 -070037 // AddToRoots adds the provided blessing as a root.
Todd Wangd87d7462015-04-26 01:59:54 -070038 AddToRoots(handle principal.BlessingsHandle) error
Matt Rosencrantzec3b9502015-02-19 12:53:13 -080039
40 // RemoteBlessings fetches the remote blessings for a given name and method.
41 RemoteBlessings(name, method string) ([]string | error)
42 // Signature fetches the signature for a given name.
43 Signature(name string) ([]signature.Interface | error)
Shyam Jayaraman07136a72015-04-13 13:34:41 -070044
45 // GetDefaultBlessings fetches the default blessings for the principal of the controller.
46 GetDefaultBlessings() (?principal.JsBlessings | error)
Matt Rosencrantz786f7272015-02-11 15:18:07 -080047}