Jiri Simsa | 756772c | 2015-03-25 15:40:54 -0700 | [diff] [blame] | 1 | // 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 Rosencrantz | 786f727 | 2015-02-11 15:18:07 -0800 | [diff] [blame] | 5 | package app |
| 6 | |
Matt Rosencrantz | feefb77 | 2015-02-18 14:58:49 -0800 | [diff] [blame] | 7 | import ( |
Matt Rosencrantz | ec3b950 | 2015-02-19 12:53:13 -0800 | [diff] [blame] | 8 | "signature" |
Matt Rosencrantz | feefb77 | 2015-02-18 14:58:49 -0800 | [diff] [blame] | 9 | |
Jiri Simsa | 1f1302c | 2015-02-23 16:18:34 -0800 | [diff] [blame] | 10 | "v.io/v23/security" |
Todd Wang | 5b77a34 | 2015-04-06 18:31:37 -0700 | [diff] [blame] | 11 | "v.io/x/ref/services/wspr/internal/principal" |
Matt Rosencrantz | feefb77 | 2015-02-18 14:58:49 -0800 | [diff] [blame] | 12 | ) |
| 13 | |
Matt Rosencrantz | 786f727 | 2015-02-11 15:18:07 -0800 | [diff] [blame] | 14 | type Controller interface { |
Matt Rosencrantz | feefb77 | 2015-02-18 14:58:49 -0800 | [diff] [blame] | 15 | // 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 Wang | baf1684 | 2015-03-16 14:12:29 -0700 | [diff] [blame] | 26 | // UnlinkBlessings removes the given blessings from the blessings store. |
Benjamin Prosnitz | 23bf1a0 | 2015-03-30 16:17:04 -0700 | [diff] [blame] | 27 | UnlinkBlessings(handle principal.BlessingsHandle) error |
Benjamin Prosnitz | 3340833 | 2015-04-23 14:45:26 -0700 | [diff] [blame] | 28 | // BlessingsDebugString gets a string useful for debugging blessings. |
| 29 | BlessingsDebugString(handle principal.BlessingsHandle) (string | error) |
Benjamin Prosnitz | 23bf1a0 | 2015-03-30 16:17:04 -0700 | [diff] [blame] | 30 | // Bless binds extensions of blessings held by this principal to |
| 31 | // another principal (represented by its public key). |
Todd Wang | d87d746 | 2015-04-26 01:59:54 -0700 | [diff] [blame] | 32 | Bless(publicKey string, handle principal.BlessingsHandle, extension string, caveat []security.Caveat) (publicKeyOut string, handleOut principal.BlessingsHandle | error) |
Benjamin Prosnitz | 23bf1a0 | 2015-03-30 16:17:04 -0700 | [diff] [blame] | 33 | // BlessSelf creates a blessing with the provided name for this principal. |
Todd Wang | d87d746 | 2015-04-26 01:59:54 -0700 | [diff] [blame] | 34 | BlessSelf(name string, caveats []security.Caveat) (publicKeyOut string, handleOut principal.BlessingsHandle | error) |
Benjamin Prosnitz | 9e42399 | 2015-04-10 13:10:35 -0700 | [diff] [blame] | 35 | // PutToBlessingStore puts the specified blessing to the blessing store under the provided pattern. |
Todd Wang | d87d746 | 2015-04-26 01:59:54 -0700 | [diff] [blame] | 36 | PutToBlessingStore(handle principal.BlessingsHandle, pattern security.BlessingPattern) (?principal.JsBlessings | error) |
Benjamin Prosnitz | 782a8a1 | 2015-04-22 15:02:38 -0700 | [diff] [blame] | 37 | // AddToRoots adds the provided blessing as a root. |
Todd Wang | d87d746 | 2015-04-26 01:59:54 -0700 | [diff] [blame] | 38 | AddToRoots(handle principal.BlessingsHandle) error |
Matt Rosencrantz | ec3b950 | 2015-02-19 12:53:13 -0800 | [diff] [blame] | 39 | |
| 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 Jayaraman | 07136a7 | 2015-04-13 13:34:41 -0700 | [diff] [blame] | 44 | |
| 45 | // GetDefaultBlessings fetches the default blessings for the principal of the controller. |
| 46 | GetDefaultBlessings() (?principal.JsBlessings | error) |
Matt Rosencrantz | 786f727 | 2015-02-11 15:18:07 -0800 | [diff] [blame] | 47 | } |