x/ref: Restructure services/wspr

The high-level renaming is services/wsprd -> services/wspr

The other renamings are:

services/wsprd/wspr.go        -> services/wspr/wsprd/main.go
services/wsprd/browspr/main   -> services/wspr/browsprd
services/wsprd/wspr           -> services/wspr/wsprlib
services/wsprd/account        -> services/wspr/internal/account
services/wsprd/app            -> services/wspr/internal/app
services/wsprd/browspr        -> services/wspr/internal/browspr
services/wsprd/channel        -> services/wspr/internal/channel
services/wsprd/lib            -> services/wspr/internal/lib
services/wsprd/lib/testwriter -> services/wspr/internal/lib/testwriter
services/wsprd/namespace      -> services/wspr/internal/namespace
services/wsprd/principal      -> services/wspr/internal/principal
services/wsprd/rpc            -> services/wspr/internal/rpc
services/wsprd/rpc/server     -> services/wspr/internal/rpc/server

MultiPart: 1/3
Change-Id: I056b527f6f17495d6c2fffc2dc68d7ac126a5068
diff --git a/cmd/servicerunner/main.go b/cmd/servicerunner/main.go
index 58d8311..339ecc0 100644
--- a/cmd/servicerunner/main.go
+++ b/cmd/servicerunner/main.go
@@ -123,7 +123,7 @@
 	defer proxyShutdown()
 	vars["PROXY_NAME"] = proxyEndpoint.Name()
 
-	h, err = sh.Start(WSPRCommand, nil, "--v23.tcp.protocol=ws", "--v23.tcp.address=127.0.0.1:0", "--v23.proxy=test/proxy", "--identd=test/identd")
+	h, err = sh.Start(WSPRDCommand, nil, "--v23.tcp.protocol=ws", "--v23.tcp.address=127.0.0.1:0", "--v23.proxy=test/proxy", "--identd=test/identd")
 	panicOnError(err)
 	panicOnError(updateVars(h, vars, "WSPR_ADDR"))
 
diff --git a/cmd/servicerunner/wspr.go b/cmd/servicerunner/wspr.go
index 9bc3acb..a972136 100644
--- a/cmd/servicerunner/wspr.go
+++ b/cmd/servicerunner/wspr.go
@@ -11,7 +11,7 @@
 
 	"v.io/v23"
 
-	"v.io/x/ref/services/wsprd/wspr"
+	"v.io/x/ref/services/wspr/wsprlib"
 	"v.io/x/ref/test/modules"
 )
 
@@ -20,10 +20,10 @@
 	identd *string = flag.CommandLine.String("identd", "", "identd server name. Must be set.")
 )
 
-const WSPRCommand = "wsprd"
+const WSPRDCommand = "wsprd"
 
 func init() {
-	modules.RegisterChild(WSPRCommand, modules.Usage(flag.CommandLine), startWSPR)
+	modules.RegisterChild(WSPRDCommand, modules.Usage(flag.CommandLine), startWSPR)
 }
 
 func startWSPR(stdin io.Reader, stdout, stderr io.Writer, env map[string]string, args ...string) error {
@@ -31,7 +31,7 @@
 	defer shutdown()
 
 	l := v23.GetListenSpec(ctx)
-	proxy := wspr.NewWSPR(ctx, *port, &l, *identd, nil)
+	proxy := wsprlib.NewWSPR(ctx, *port, &l, *identd, nil)
 	defer proxy.Shutdown()
 
 	addr := proxy.Listen()
diff --git a/services/wsprd/browspr/main/main_nacl.go b/services/wspr/browsprd/main_nacl.go
similarity index 98%
rename from services/wsprd/browspr/main/main_nacl.go
rename to services/wspr/browsprd/main_nacl.go
index 5b8bd6c..036e8b3 100644
--- a/services/wsprd/browspr/main/main_nacl.go
+++ b/services/wspr/browsprd/main_nacl.go
@@ -19,8 +19,8 @@
 	_ "v.io/x/ref/profiles/chrome"
 	"v.io/x/ref/profiles/internal/lib/websocket"
 	vsecurity "v.io/x/ref/security"
-	"v.io/x/ref/services/wsprd/browspr"
-	"v.io/x/ref/services/wsprd/channel/channel_nacl"
+	"v.io/x/ref/services/wspr/internal/browspr"
+	"v.io/x/ref/services/wspr/internal/channel/channel_nacl"
 )
 
 func main() {
diff --git a/services/wsprd/account/account.go b/services/wspr/internal/account/account.go
similarity index 98%
rename from services/wsprd/account/account.go
rename to services/wspr/internal/account/account.go
index 857ca84..f577b59 100644
--- a/services/wsprd/account/account.go
+++ b/services/wspr/internal/account/account.go
@@ -15,7 +15,7 @@
 	"v.io/v23/rpc"
 	"v.io/v23/security"
 	"v.io/x/lib/vlog"
-	"v.io/x/ref/services/wsprd/principal"
+	"v.io/x/ref/services/wspr/internal/principal"
 )
 
 type BlesserService interface {
diff --git a/services/wsprd/account/account.vdl b/services/wspr/internal/account/account.vdl
similarity index 100%
rename from services/wsprd/account/account.vdl
rename to services/wspr/internal/account/account.vdl
diff --git a/services/wsprd/account/account.vdl.go b/services/wspr/internal/account/account.vdl.go
similarity index 89%
rename from services/wsprd/account/account.vdl.go
rename to services/wspr/internal/account/account.vdl.go
index 9b14fc6..cc306d0 100644
--- a/services/wsprd/account/account.vdl.go
+++ b/services/wspr/internal/account/account.vdl.go
@@ -20,7 +20,7 @@
 }
 
 func (Caveat) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/account.Caveat"
+	Name string "v.io/x/ref/services/wspr/internal/account.Caveat"
 }) {
 }
 
diff --git a/services/wsprd/app/app.go b/services/wspr/internal/app/app.go
similarity index 98%
rename from services/wsprd/app/app.go
rename to services/wspr/internal/app/app.go
index 435f7ad..6c8b51c 100644
--- a/services/wsprd/app/app.go
+++ b/services/wspr/internal/app/app.go
@@ -27,15 +27,15 @@
 	"v.io/v23/vom"
 	"v.io/v23/vtrace"
 	"v.io/x/lib/vlog"
-	"v.io/x/ref/services/wsprd/lib"
-	"v.io/x/ref/services/wsprd/namespace"
-	"v.io/x/ref/services/wsprd/principal"
-	"v.io/x/ref/services/wsprd/rpc/server"
+	"v.io/x/ref/services/wspr/internal/lib"
+	"v.io/x/ref/services/wspr/internal/namespace"
+	"v.io/x/ref/services/wspr/internal/principal"
+	"v.io/x/ref/services/wspr/internal/rpc/server"
 )
 
 const (
 	// pkgPath is the prefix os errors in this package.
-	pkgPath = "v.io/x/ref/services/wsprd/app"
+	pkgPath = "v.io/x/ref/services/wspr/internal/app"
 )
 
 // Errors
diff --git a/services/wsprd/app/app.vdl b/services/wspr/internal/app/app.vdl
similarity index 100%
rename from services/wsprd/app/app.vdl
rename to services/wspr/internal/app/app.vdl
diff --git a/services/wsprd/app/app.vdl.go b/services/wspr/internal/app/app.vdl.go
similarity index 93%
rename from services/wsprd/app/app.vdl.go
rename to services/wspr/internal/app/app.vdl.go
index 8573ee7..60dfc1f 100644
--- a/services/wsprd/app/app.vdl.go
+++ b/services/wspr/internal/app/app.vdl.go
@@ -32,7 +32,7 @@
 }
 
 func (RpcRequest) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/app.RpcRequest"
+	Name string "v.io/x/ref/services/wspr/internal/app.RpcRequest"
 }) {
 }
 
@@ -54,7 +54,7 @@
 	RpcCallOptionRetryTimeout struct{ Value time.Duration }
 	// __RpcCallOptionReflect describes the RpcCallOption union type.
 	__RpcCallOptionReflect struct {
-		Name  string "v.io/x/ref/services/wsprd/app.RpcCallOption"
+		Name  string "v.io/x/ref/services/wspr/internal/app.RpcCallOption"
 		Type  RpcCallOption
 		Union struct {
 			AllowedServersPolicy RpcCallOptionAllowedServersPolicy
@@ -79,7 +79,7 @@
 }
 
 func (RpcResponse) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/app.RpcResponse"
+	Name string "v.io/x/ref/services/wspr/internal/app.RpcResponse"
 }) {
 }
 
diff --git a/services/wsprd/app/app_test.go b/services/wspr/internal/app/app_test.go
similarity index 98%
rename from services/wsprd/app/app_test.go
rename to services/wspr/internal/app/app_test.go
index a03c05f..772714d 100644
--- a/services/wsprd/app/app_test.go
+++ b/services/wspr/internal/app/app_test.go
@@ -28,9 +28,9 @@
 	"v.io/x/ref/profiles"
 	vsecurity "v.io/x/ref/security"
 	"v.io/x/ref/services/mounttable/mounttablelib"
-	"v.io/x/ref/services/wsprd/lib"
-	"v.io/x/ref/services/wsprd/lib/testwriter"
-	"v.io/x/ref/services/wsprd/rpc/server"
+	"v.io/x/ref/services/wspr/internal/lib"
+	"v.io/x/ref/services/wspr/internal/lib/testwriter"
+	"v.io/x/ref/services/wspr/internal/rpc/server"
 	"v.io/x/ref/test"
 	"v.io/x/ref/test/testutil"
 )
diff --git a/services/wsprd/app/controller.vdl b/services/wspr/internal/app/controller.vdl
similarity index 96%
rename from services/wsprd/app/controller.vdl
rename to services/wspr/internal/app/controller.vdl
index 5298f7b..5e7e498 100644
--- a/services/wsprd/app/controller.vdl
+++ b/services/wspr/internal/app/controller.vdl
@@ -8,7 +8,7 @@
 	"signature"
 
 	"v.io/v23/security"
-	"v.io/x/ref/services/wsprd/principal"
+	"v.io/x/ref/services/wspr/internal/principal"
 )
 
 type Controller interface {
diff --git a/services/wsprd/app/controller.vdl.go b/services/wspr/internal/app/controller.vdl.go
similarity index 98%
rename from services/wsprd/app/controller.vdl.go
rename to services/wspr/internal/app/controller.vdl.go
index ccb8ee0..ffe9ae5 100644
--- a/services/wsprd/app/controller.vdl.go
+++ b/services/wspr/internal/app/controller.vdl.go
@@ -16,7 +16,7 @@
 	// VDL user imports
 	"v.io/v23/security"
 	"v.io/v23/vdlroot/signature"
-	"v.io/x/ref/services/wsprd/principal"
+	"v.io/x/ref/services/wspr/internal/principal"
 )
 
 // ControllerClientMethods is the client interface
@@ -252,7 +252,7 @@
 // descController hides the desc to keep godoc clean.
 var descController = rpc.InterfaceDesc{
 	Name:    "Controller",
-	PkgPath: "v.io/x/ref/services/wsprd/app",
+	PkgPath: "v.io/x/ref/services/wspr/internal/app",
 	Methods: []rpc.MethodDesc{
 		{
 			Name: "Serve",
diff --git a/services/wsprd/app/messaging.go b/services/wspr/internal/app/messaging.go
similarity index 97%
rename from services/wsprd/app/messaging.go
rename to services/wspr/internal/app/messaging.go
index d42e6fa..ff9c7c4 100644
--- a/services/wsprd/app/messaging.go
+++ b/services/wspr/internal/app/messaging.go
@@ -14,11 +14,11 @@
 	"v.io/v23/vom"
 	"v.io/v23/vtrace"
 	"v.io/x/lib/vlog"
-	"v.io/x/ref/services/wsprd/lib"
+	"v.io/x/ref/services/wspr/internal/lib"
 )
 
 const (
-	verrorPkgPath = "v.io/x/ref/services/wsprd/app"
+	verrorPkgPath = "v.io/x/ref/services/wspr/internal/app"
 )
 
 var (
diff --git a/services/wsprd/app/mock_jsServer_test.go b/services/wspr/internal/app/mock_jsServer_test.go
similarity index 98%
rename from services/wsprd/app/mock_jsServer_test.go
rename to services/wspr/internal/app/mock_jsServer_test.go
index 55bbd30..febba77 100644
--- a/services/wsprd/app/mock_jsServer_test.go
+++ b/services/wspr/internal/app/mock_jsServer_test.go
@@ -15,9 +15,9 @@
 	"v.io/v23/vdl"
 	"v.io/v23/vdlroot/signature"
 	"v.io/v23/vom"
-	"v.io/x/ref/services/wsprd/lib"
-	"v.io/x/ref/services/wsprd/principal"
-	"v.io/x/ref/services/wsprd/rpc/server"
+	"v.io/x/ref/services/wspr/internal/lib"
+	"v.io/x/ref/services/wspr/internal/principal"
+	"v.io/x/ref/services/wspr/internal/rpc/server"
 )
 
 type mockJSServer struct {
diff --git a/services/wsprd/app/stream.go b/services/wspr/internal/app/stream.go
similarity index 97%
rename from services/wsprd/app/stream.go
rename to services/wspr/internal/app/stream.go
index f526d45..a5c3637 100644
--- a/services/wsprd/app/stream.go
+++ b/services/wspr/internal/app/stream.go
@@ -8,7 +8,7 @@
 	"fmt"
 
 	"v.io/v23/rpc"
-	"v.io/x/ref/services/wsprd/lib"
+	"v.io/x/ref/services/wspr/internal/lib"
 )
 
 type initConfig struct {
diff --git a/services/wsprd/app/v23_internal_test.go b/services/wspr/internal/app/v23_internal_test.go
similarity index 100%
rename from services/wsprd/app/v23_internal_test.go
rename to services/wspr/internal/app/v23_internal_test.go
diff --git a/services/wsprd/browspr/browspr.go b/services/wspr/internal/browspr/browspr.go
similarity index 98%
rename from services/wsprd/browspr/browspr.go
rename to services/wspr/internal/browspr/browspr.go
index 9ab4206..a8f1f37 100644
--- a/services/wsprd/browspr/browspr.go
+++ b/services/wspr/internal/browspr/browspr.go
@@ -16,8 +16,8 @@
 	"v.io/v23/vdl"
 	"v.io/v23/vtrace"
 	"v.io/x/lib/vlog"
-	"v.io/x/ref/services/wsprd/account"
-	"v.io/x/ref/services/wsprd/principal"
+	"v.io/x/ref/services/wspr/internal/account"
+	"v.io/x/ref/services/wspr/internal/principal"
 )
 
 // Browspr is an intermediary between our javascript code and the vanadium
diff --git a/services/wspr/internal/browspr/browspr.vdl b/services/wspr/internal/browspr/browspr.vdl
new file mode 100644
index 0000000..f0016ed
--- /dev/null
+++ b/services/wspr/internal/browspr/browspr.vdl
@@ -0,0 +1,46 @@
+// 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 browspr
+
+import (
+	"v.io/x/ref/services/identity"
+	"v.io/x/ref/services/wspr/internal/account"
+)
+
+type StartMessage struct {
+	Identityd             string
+	IdentitydBlessingRoot identity.BlessingRootResponse
+	Proxy                 string
+	NamespaceRoot         string
+	LogLevel              int32
+	LogModule             string
+}
+
+type AssociateAccountMessage struct {
+	Account string
+	Origin  string
+	Caveats []account.Caveat
+}
+
+type CreateAccountMessage struct {
+	Token string
+}
+
+type CleanupMessage struct {
+	InstanceId int32
+}
+
+type OriginHasAccountMessage struct {
+	Origin string
+}
+
+type GetAccountsMessage struct{}
+
+type CreateInstanceMessage struct {
+	InstanceId     int32
+	Origin         string
+	NamespaceRoots []string
+	Proxy          string
+}
diff --git a/services/wsprd/browspr/browspr.vdl.go b/services/wspr/internal/browspr/browspr.vdl.go
similarity index 75%
rename from services/wsprd/browspr/browspr.vdl.go
rename to services/wspr/internal/browspr/browspr.vdl.go
index 81f87c9..e4a4600 100644
--- a/services/wsprd/browspr/browspr.vdl.go
+++ b/services/wspr/internal/browspr/browspr.vdl.go
@@ -13,7 +13,7 @@
 
 	// VDL user imports
 	"v.io/x/ref/services/identity"
-	"v.io/x/ref/services/wsprd/account"
+	"v.io/x/ref/services/wspr/internal/account"
 )
 
 type StartMessage struct {
@@ -26,7 +26,7 @@
 }
 
 func (StartMessage) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/browspr.StartMessage"
+	Name string "v.io/x/ref/services/wspr/internal/browspr.StartMessage"
 }) {
 }
 
@@ -37,7 +37,7 @@
 }
 
 func (AssociateAccountMessage) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/browspr.AssociateAccountMessage"
+	Name string "v.io/x/ref/services/wspr/internal/browspr.AssociateAccountMessage"
 }) {
 }
 
@@ -46,7 +46,7 @@
 }
 
 func (CreateAccountMessage) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/browspr.CreateAccountMessage"
+	Name string "v.io/x/ref/services/wspr/internal/browspr.CreateAccountMessage"
 }) {
 }
 
@@ -55,7 +55,7 @@
 }
 
 func (CleanupMessage) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/browspr.CleanupMessage"
+	Name string "v.io/x/ref/services/wspr/internal/browspr.CleanupMessage"
 }) {
 }
 
@@ -64,7 +64,7 @@
 }
 
 func (OriginHasAccountMessage) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/browspr.OriginHasAccountMessage"
+	Name string "v.io/x/ref/services/wspr/internal/browspr.OriginHasAccountMessage"
 }) {
 }
 
@@ -72,7 +72,7 @@
 }
 
 func (GetAccountsMessage) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/browspr.GetAccountsMessage"
+	Name string "v.io/x/ref/services/wspr/internal/browspr.GetAccountsMessage"
 }) {
 }
 
@@ -84,7 +84,7 @@
 }
 
 func (CreateInstanceMessage) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/browspr.CreateInstanceMessage"
+	Name string "v.io/x/ref/services/wspr/internal/browspr.CreateInstanceMessage"
 }) {
 }
 
diff --git a/services/wsprd/browspr/browspr_account_test.go b/services/wspr/internal/browspr/browspr_account_test.go
similarity index 100%
rename from services/wsprd/browspr/browspr_account_test.go
rename to services/wspr/internal/browspr/browspr_account_test.go
diff --git a/services/wsprd/browspr/browspr_test.go b/services/wspr/internal/browspr/browspr_test.go
similarity index 98%
rename from services/wsprd/browspr/browspr_test.go
rename to services/wspr/internal/browspr/browspr_test.go
index 0d99fb9..81ab8d0 100644
--- a/services/wsprd/browspr/browspr_test.go
+++ b/services/wspr/internal/browspr/browspr_test.go
@@ -23,8 +23,8 @@
 
 	"v.io/x/ref/profiles"
 	"v.io/x/ref/services/mounttable/mounttablelib"
-	"v.io/x/ref/services/wsprd/app"
-	"v.io/x/ref/services/wsprd/lib"
+	"v.io/x/ref/services/wspr/internal/app"
+	"v.io/x/ref/services/wspr/internal/lib"
 	"v.io/x/ref/test"
 )
 
diff --git a/services/wsprd/browspr/file_serializer_nacl.go b/services/wspr/internal/browspr/file_serializer_nacl.go
similarity index 100%
rename from services/wsprd/browspr/file_serializer_nacl.go
rename to services/wspr/internal/browspr/file_serializer_nacl.go
diff --git a/services/wsprd/browspr/pipe.go b/services/wspr/internal/browspr/pipe.go
similarity index 96%
rename from services/wsprd/browspr/pipe.go
rename to services/wspr/internal/browspr/pipe.go
index 1c358f4..138e3ef 100644
--- a/services/wsprd/browspr/pipe.go
+++ b/services/wspr/internal/browspr/pipe.go
@@ -9,8 +9,8 @@
 	"fmt"
 
 	"v.io/x/lib/vlog"
-	"v.io/x/ref/services/wsprd/app"
-	"v.io/x/ref/services/wsprd/lib"
+	"v.io/x/ref/services/wspr/internal/app"
+	"v.io/x/ref/services/wspr/internal/lib"
 )
 
 // pipe controls the flow of messages for a specific instance (corresponding to a specific tab).
diff --git a/services/wsprd/browspr/v23_internal_test.go b/services/wspr/internal/browspr/v23_internal_test.go
similarity index 100%
rename from services/wsprd/browspr/v23_internal_test.go
rename to services/wspr/internal/browspr/v23_internal_test.go
diff --git a/services/wsprd/browspr/writer.go b/services/wspr/internal/browspr/writer.go
similarity index 89%
rename from services/wsprd/browspr/writer.go
rename to services/wspr/internal/browspr/writer.go
index 259b650..17222f1 100644
--- a/services/wsprd/browspr/writer.go
+++ b/services/wspr/internal/browspr/writer.go
@@ -5,8 +5,8 @@
 package browspr
 
 import (
-	"v.io/x/ref/services/wsprd/app"
-	"v.io/x/ref/services/wsprd/lib"
+	"v.io/x/ref/services/wspr/internal/app"
+	"v.io/x/ref/services/wspr/internal/lib"
 )
 
 // postMessageWriter is a lib.ClientWriter that handles sending messages over postMessage to the extension.
diff --git a/services/wsprd/channel/channel.go b/services/wspr/internal/channel/channel.go
similarity index 100%
rename from services/wsprd/channel/channel.go
rename to services/wspr/internal/channel/channel.go
diff --git a/services/wsprd/channel/channel.vdl b/services/wspr/internal/channel/channel.vdl
similarity index 100%
rename from services/wsprd/channel/channel.vdl
rename to services/wspr/internal/channel/channel.vdl
diff --git a/services/wsprd/channel/channel.vdl.go b/services/wspr/internal/channel/channel.vdl.go
similarity index 91%
rename from services/wsprd/channel/channel.vdl.go
rename to services/wspr/internal/channel/channel.vdl.go
index a15b9c1..34c163f 100644
--- a/services/wsprd/channel/channel.vdl.go
+++ b/services/wspr/internal/channel/channel.vdl.go
@@ -19,7 +19,7 @@
 }
 
 func (Request) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/channel.Request"
+	Name string "v.io/x/ref/services/wspr/internal/channel.Request"
 }) {
 }
 
@@ -30,7 +30,7 @@
 }
 
 func (Response) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/channel.Response"
+	Name string "v.io/x/ref/services/wspr/internal/channel.Response"
 }) {
 }
 
@@ -52,7 +52,7 @@
 	MessageResponse struct{ Value Response }
 	// __MessageReflect describes the Message union type.
 	__MessageReflect struct {
-		Name  string "v.io/x/ref/services/wsprd/channel.Message"
+		Name  string "v.io/x/ref/services/wspr/internal/channel.Message"
 		Type  Message
 		Union struct {
 			Request  MessageRequest
diff --git a/services/wsprd/channel/channel_nacl/channel_nacl.go b/services/wspr/internal/channel/channel_nacl/channel_nacl.go
similarity index 94%
rename from services/wsprd/channel/channel_nacl/channel_nacl.go
rename to services/wspr/internal/channel/channel_nacl/channel_nacl.go
index 48aa3b3..347a355 100644
--- a/services/wsprd/channel/channel_nacl/channel_nacl.go
+++ b/services/wspr/internal/channel/channel_nacl/channel_nacl.go
@@ -11,7 +11,7 @@
 
 	"v.io/v23/vdl"
 	"v.io/v23/vom"
-	"v.io/x/ref/services/wsprd/channel" // contains most of the logic, factored out for testing
+	"v.io/x/ref/services/wspr/internal/channel" // contains most of the logic, factored out for testing
 )
 
 type Channel struct {
diff --git a/services/wsprd/channel/channel_test.go b/services/wspr/internal/channel/channel_test.go
similarity index 98%
rename from services/wsprd/channel/channel_test.go
rename to services/wspr/internal/channel/channel_test.go
index 26d9c03..4513bd1 100644
--- a/services/wsprd/channel/channel_test.go
+++ b/services/wspr/internal/channel/channel_test.go
@@ -10,7 +10,7 @@
 	"testing"
 
 	"v.io/v23/vdl"
-	"v.io/x/ref/services/wsprd/channel"
+	"v.io/x/ref/services/wspr/internal/channel"
 )
 
 func TestChannelRpcs(t *testing.T) {
diff --git a/services/wsprd/lib/case.go b/services/wspr/internal/lib/case.go
similarity index 100%
rename from services/wsprd/lib/case.go
rename to services/wspr/internal/lib/case.go
diff --git a/services/wsprd/lib/signature_manager.go b/services/wspr/internal/lib/signature_manager.go
similarity index 98%
rename from services/wsprd/lib/signature_manager.go
rename to services/wspr/internal/lib/signature_manager.go
index 22d69b4..41271e8 100644
--- a/services/wsprd/lib/signature_manager.go
+++ b/services/wspr/internal/lib/signature_manager.go
@@ -58,8 +58,6 @@
 	return time.Now().Sub(c.lastAccessed) > ttl
 }
 
-const pkgPath = "v.io/x/ref/services/wsprd/lib"
-
 func (sm *signatureManager) lookupCacheLocked(name string) []signature.Interface {
 	if entry := sm.cache[name]; entry != nil && !entry.expired() {
 		entry.lastAccessed = time.Now()
diff --git a/services/wsprd/lib/signature_manager_test.go b/services/wspr/internal/lib/signature_manager_test.go
similarity index 100%
rename from services/wsprd/lib/signature_manager_test.go
rename to services/wspr/internal/lib/signature_manager_test.go
diff --git a/services/wsprd/lib/simple_client.go b/services/wspr/internal/lib/simple_client.go
similarity index 100%
rename from services/wsprd/lib/simple_client.go
rename to services/wspr/internal/lib/simple_client.go
diff --git a/services/wsprd/lib/simple_client_test.go b/services/wspr/internal/lib/simple_client_test.go
similarity index 100%
rename from services/wsprd/lib/simple_client_test.go
rename to services/wspr/internal/lib/simple_client_test.go
diff --git a/services/wsprd/lib/testwriter/writer.go b/services/wspr/internal/lib/testwriter/writer.go
similarity index 98%
rename from services/wsprd/lib/testwriter/writer.go
rename to services/wspr/internal/lib/testwriter/writer.go
index 65dabb9..01c78d4 100644
--- a/services/wsprd/lib/testwriter/writer.go
+++ b/services/wspr/internal/lib/testwriter/writer.go
@@ -13,7 +13,7 @@
 	"time"
 
 	"v.io/v23/verror"
-	"v.io/x/ref/services/wsprd/lib"
+	"v.io/x/ref/services/wspr/internal/lib"
 )
 
 type TestHarness interface {
diff --git a/services/wsprd/lib/time.go b/services/wspr/internal/lib/time.go
similarity index 100%
rename from services/wsprd/lib/time.go
rename to services/wspr/internal/lib/time.go
diff --git a/services/wsprd/lib/vom.go b/services/wspr/internal/lib/vom.go
similarity index 100%
rename from services/wsprd/lib/vom.go
rename to services/wspr/internal/lib/vom.go
diff --git a/services/wsprd/lib/writer.go b/services/wspr/internal/lib/writer.go
similarity index 100%
rename from services/wsprd/lib/writer.go
rename to services/wspr/internal/lib/writer.go
diff --git a/services/wsprd/lib/writer.vdl b/services/wspr/internal/lib/writer.vdl
similarity index 100%
rename from services/wsprd/lib/writer.vdl
rename to services/wspr/internal/lib/writer.vdl
diff --git a/services/wsprd/lib/writer.vdl.go b/services/wspr/internal/lib/writer.vdl.go
similarity index 89%
rename from services/wsprd/lib/writer.vdl.go
rename to services/wspr/internal/lib/writer.vdl.go
index e2845a9..1930733 100644
--- a/services/wsprd/lib/writer.vdl.go
+++ b/services/wspr/internal/lib/writer.vdl.go
@@ -24,7 +24,7 @@
 }
 
 func (ServerRpcReply) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/lib.ServerRpcReply"
+	Name string "v.io/x/ref/services/wspr/internal/lib.ServerRpcReply"
 }) {
 }
 
@@ -70,7 +70,7 @@
 }
 
 func (LogLevel) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/lib.LogLevel"
+	Name string "v.io/x/ref/services/wspr/internal/lib.LogLevel"
 	Enum struct{ Info, Error string }
 }) {
 }
@@ -81,7 +81,7 @@
 }
 
 func (LogMessage) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/lib.LogMessage"
+	Name string "v.io/x/ref/services/wspr/internal/lib.LogMessage"
 }) {
 }
 
diff --git a/services/wsprd/namespace/namespace.vdl b/services/wspr/internal/namespace/namespace.vdl
similarity index 100%
rename from services/wsprd/namespace/namespace.vdl
rename to services/wspr/internal/namespace/namespace.vdl
diff --git a/services/wsprd/namespace/namespace.vdl.go b/services/wspr/internal/namespace/namespace.vdl.go
similarity index 99%
rename from services/wsprd/namespace/namespace.vdl.go
rename to services/wspr/internal/namespace/namespace.vdl.go
index 14ac360..a15e808 100644
--- a/services/wsprd/namespace/namespace.vdl.go
+++ b/services/wspr/internal/namespace/namespace.vdl.go
@@ -399,7 +399,7 @@
 // descNamespace hides the desc to keep godoc clean.
 var descNamespace = rpc.InterfaceDesc{
 	Name:    "Namespace",
-	PkgPath: "v.io/x/ref/services/wsprd/namespace",
+	PkgPath: "v.io/x/ref/services/wspr/internal/namespace",
 	Methods: []rpc.MethodDesc{
 		{
 			Name: "Glob",
diff --git a/services/wsprd/namespace/request_handler.go b/services/wspr/internal/namespace/request_handler.go
similarity index 100%
rename from services/wsprd/namespace/request_handler.go
rename to services/wspr/internal/namespace/request_handler.go
diff --git a/services/wsprd/principal/blessings.go b/services/wspr/internal/principal/blessings.go
similarity index 100%
rename from services/wsprd/principal/blessings.go
rename to services/wspr/internal/principal/blessings.go
diff --git a/services/wsprd/principal/blessings.vdl b/services/wspr/internal/principal/blessings.vdl
similarity index 100%
rename from services/wsprd/principal/blessings.vdl
rename to services/wspr/internal/principal/blessings.vdl
diff --git a/services/wsprd/principal/blessings.vdl.go b/services/wspr/internal/principal/blessings.vdl.go
similarity index 81%
rename from services/wsprd/principal/blessings.vdl.go
rename to services/wspr/internal/principal/blessings.vdl.go
index 0c09ae3..dc078be 100644
--- a/services/wsprd/principal/blessings.vdl.go
+++ b/services/wspr/internal/principal/blessings.vdl.go
@@ -15,7 +15,7 @@
 type BlessingsHandle int32
 
 func (BlessingsHandle) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/principal.BlessingsHandle"
+	Name string "v.io/x/ref/services/wspr/internal/principal.BlessingsHandle"
 }) {
 }
 
@@ -25,7 +25,7 @@
 }
 
 func (JsBlessings) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/principal.JsBlessings"
+	Name string "v.io/x/ref/services/wspr/internal/principal.JsBlessings"
 }) {
 }
 
diff --git a/services/wsprd/principal/js_blessings_store.go b/services/wspr/internal/principal/js_blessings_store.go
similarity index 100%
rename from services/wsprd/principal/js_blessings_store.go
rename to services/wspr/internal/principal/js_blessings_store.go
diff --git a/services/wsprd/principal/js_blessings_store_test.go b/services/wspr/internal/principal/js_blessings_store_test.go
similarity index 100%
rename from services/wsprd/principal/js_blessings_store_test.go
rename to services/wspr/internal/principal/js_blessings_store_test.go
diff --git a/services/wsprd/principal/principal.go b/services/wspr/internal/principal/principal.go
similarity index 99%
rename from services/wsprd/principal/principal.go
rename to services/wspr/internal/principal/principal.go
index 7e74c69..acffdc5 100644
--- a/services/wsprd/principal/principal.go
+++ b/services/wspr/internal/principal/principal.go
@@ -70,7 +70,7 @@
 	Accounts map[string]security.Blessings
 }
 
-const pkgPath = "v.io/x/ref/services/wsprd/principal"
+const pkgPath = "v.io/x/ref/services/wspr/internal/principal"
 
 // Errors.
 var (
diff --git a/services/wsprd/principal/principal_test.go b/services/wspr/internal/principal/principal_test.go
similarity index 100%
rename from services/wsprd/principal/principal_test.go
rename to services/wspr/internal/principal/principal_test.go
diff --git a/services/wsprd/principal/util_test.go b/services/wspr/internal/principal/util_test.go
similarity index 100%
rename from services/wsprd/principal/util_test.go
rename to services/wspr/internal/principal/util_test.go
diff --git a/services/wsprd/rpc/server/authorizer.go b/services/wspr/internal/rpc/server/authorizer.go
similarity index 100%
rename from services/wsprd/rpc/server/authorizer.go
rename to services/wspr/internal/rpc/server/authorizer.go
diff --git a/services/wsprd/rpc/server/dispatcher.go b/services/wspr/internal/rpc/server/dispatcher.go
similarity index 98%
rename from services/wsprd/rpc/server/dispatcher.go
rename to services/wspr/internal/rpc/server/dispatcher.go
index 21cec44..82efad2 100644
--- a/services/wsprd/rpc/server/dispatcher.go
+++ b/services/wspr/internal/rpc/server/dispatcher.go
@@ -10,13 +10,12 @@
 	"fmt"
 	"sync"
 
-	"v.io/x/ref/services/wsprd/lib"
-
 	"v.io/v23/rpc"
 	"v.io/v23/security"
 	"v.io/v23/vdlroot/signature"
 	"v.io/v23/verror"
 	"v.io/x/lib/vlog"
+	"v.io/x/ref/services/wspr/internal/lib"
 )
 
 type flowFactory interface {
diff --git a/services/wsprd/rpc/server/dispatcher_test.go b/services/wspr/internal/rpc/server/dispatcher_test.go
similarity index 97%
rename from services/wsprd/rpc/server/dispatcher_test.go
rename to services/wspr/internal/rpc/server/dispatcher_test.go
index f0a8798..b659aab 100644
--- a/services/wsprd/rpc/server/dispatcher_test.go
+++ b/services/wspr/internal/rpc/server/dispatcher_test.go
@@ -14,8 +14,8 @@
 	"v.io/v23/security"
 	"v.io/v23/vdl"
 	"v.io/v23/vdlroot/signature"
-	"v.io/x/ref/services/wsprd/lib"
-	"v.io/x/ref/services/wsprd/lib/testwriter"
+	"v.io/x/ref/services/wspr/internal/lib"
+	"v.io/x/ref/services/wspr/internal/lib/testwriter"
 )
 
 type mockFlowFactory struct {
diff --git a/services/wsprd/rpc/server/invoker.go b/services/wspr/internal/rpc/server/invoker.go
similarity index 97%
rename from services/wsprd/rpc/server/invoker.go
rename to services/wspr/internal/rpc/server/invoker.go
index 93c3144..90e86e9 100644
--- a/services/wsprd/rpc/server/invoker.go
+++ b/services/wspr/internal/rpc/server/invoker.go
@@ -16,7 +16,7 @@
 
 var typedNil []int
 
-const pkgPath = "v.io/x/ref/services/wsprd/rpc/server"
+const pkgPath = "v.io/x/ref/services/wspr/internal/rpc/server"
 
 // Errors.
 var (
diff --git a/services/wsprd/rpc/server/server.go b/services/wspr/internal/rpc/server/server.go
similarity index 99%
rename from services/wsprd/rpc/server/server.go
rename to services/wspr/internal/rpc/server/server.go
index 8fe0131..3a97693 100644
--- a/services/wsprd/rpc/server/server.go
+++ b/services/wspr/internal/rpc/server/server.go
@@ -12,9 +12,6 @@
 	"sync"
 	"time"
 
-	"v.io/x/ref/services/wsprd/lib"
-	"v.io/x/ref/services/wsprd/principal"
-
 	"v.io/v23"
 	"v.io/v23/context"
 	"v.io/v23/naming"
@@ -26,6 +23,8 @@
 	"v.io/v23/verror"
 	"v.io/v23/vtrace"
 	"v.io/x/lib/vlog"
+	"v.io/x/ref/services/wspr/internal/lib"
+	"v.io/x/ref/services/wspr/internal/principal"
 )
 
 type Flow struct {
diff --git a/services/wsprd/rpc/server/server.vdl b/services/wspr/internal/rpc/server/server.vdl
similarity index 94%
rename from services/wsprd/rpc/server/server.vdl
rename to services/wspr/internal/rpc/server/server.vdl
index 6dd891e..043a986 100644
--- a/services/wsprd/rpc/server/server.vdl
+++ b/services/wspr/internal/rpc/server/server.vdl
@@ -5,8 +5,8 @@
 package server
 
 import (
-  "v.io/x/ref/services/wsprd/principal"
   "v.io/v23/security"
+  "v.io/x/ref/services/wspr/internal/principal"
 )
 
 type SecurityCall struct {
diff --git a/services/wsprd/rpc/server/server.vdl.go b/services/wspr/internal/rpc/server/server.vdl.go
similarity index 78%
rename from services/wsprd/rpc/server/server.vdl.go
rename to services/wspr/internal/rpc/server/server.vdl.go
index a58943a..21c0041 100644
--- a/services/wsprd/rpc/server/server.vdl.go
+++ b/services/wspr/internal/rpc/server/server.vdl.go
@@ -16,7 +16,7 @@
 
 	// VDL user imports
 	"v.io/v23/security"
-	"v.io/x/ref/services/wsprd/principal"
+	"v.io/x/ref/services/wspr/internal/principal"
 )
 
 type SecurityCall struct {
@@ -32,7 +32,7 @@
 }
 
 func (SecurityCall) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/rpc/server.SecurityCall"
+	Name string "v.io/x/ref/services/wspr/internal/rpc/server.SecurityCall"
 }) {
 }
 
@@ -42,7 +42,7 @@
 }
 
 func (CaveatValidationRequest) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/rpc/server.CaveatValidationRequest"
+	Name string "v.io/x/ref/services/wspr/internal/rpc/server.CaveatValidationRequest"
 }) {
 }
 
@@ -51,7 +51,7 @@
 }
 
 func (CaveatValidationResponse) __VDLReflect(struct {
-	Name string "v.io/x/ref/services/wsprd/rpc/server.CaveatValidationResponse"
+	Name string "v.io/x/ref/services/wspr/internal/rpc/server.CaveatValidationResponse"
 }) {
 }
 
@@ -62,8 +62,8 @@
 }
 
 var (
-	ErrCaveatValidationTimeout                 = verror.Register("v.io/x/ref/services/wsprd/rpc/server.CaveatValidationTimeout", verror.NoRetry, "{1:}{2:} Caveat validation has timed out")
-	ErrInvalidValidationResponseFromJavascript = verror.Register("v.io/x/ref/services/wsprd/rpc/server.InvalidValidationResponseFromJavascript", verror.NoRetry, "{1:}{2:} Invalid validation response from javascript")
+	ErrCaveatValidationTimeout                 = verror.Register("v.io/x/ref/services/wspr/internal/rpc/server.CaveatValidationTimeout", verror.NoRetry, "{1:}{2:} Caveat validation has timed out")
+	ErrInvalidValidationResponseFromJavascript = verror.Register("v.io/x/ref/services/wspr/internal/rpc/server.InvalidValidationResponseFromJavascript", verror.NoRetry, "{1:}{2:} Invalid validation response from javascript")
 )
 
 func init() {
diff --git a/services/wsprd/wspr.go b/services/wspr/wsprd/main.go
similarity index 88%
rename from services/wsprd/wspr.go
rename to services/wspr/wsprd/main.go
index 9e242ee..bd2c1ea 100644
--- a/services/wsprd/wspr.go
+++ b/services/wspr/wsprd/main.go
@@ -14,7 +14,7 @@
 	"v.io/x/ref/lib/signals"
 	// TODO(cnicolaou,benj): figure out how to support roaming as a chrome plugin
 	_ "v.io/x/ref/profiles/roaming"
-	"v.io/x/ref/services/wsprd/wspr"
+	"v.io/x/ref/services/wspr/wsprlib"
 )
 
 func main() {
@@ -27,7 +27,7 @@
 	defer shutdown()
 
 	listenSpec := v23.GetListenSpec(ctx)
-	proxy := wspr.NewWSPR(ctx, *port, &listenSpec, *identd, nil)
+	proxy := wsprlib.NewWSPR(ctx, *port, &listenSpec, *identd, nil)
 	defer proxy.Shutdown()
 
 	addr := proxy.Listen()
diff --git a/services/wsprd/wspr/pipe.go b/services/wspr/wsprlib/pipe.go
similarity index 97%
rename from services/wsprd/wspr/pipe.go
rename to services/wspr/wsprlib/pipe.go
index 1411487..2fa9aaf 100644
--- a/services/wsprd/wspr/pipe.go
+++ b/services/wspr/wsprlib/pipe.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package wspr
+package wsprlib
 
 import (
 	"encoding/json"
@@ -14,8 +14,8 @@
 
 	"v.io/v23"
 	"v.io/x/lib/vlog"
-	"v.io/x/ref/services/wsprd/app"
-	"v.io/x/ref/services/wsprd/lib"
+	"v.io/x/ref/services/wspr/internal/app"
+	"v.io/x/ref/services/wspr/internal/lib"
 
 	"github.com/gorilla/websocket"
 )
diff --git a/services/wsprd/wspr/writer.go b/services/wspr/wsprlib/writer.go
similarity index 94%
rename from services/wsprd/wspr/writer.go
rename to services/wspr/wsprlib/writer.go
index 956c6bb..ef4be93 100644
--- a/services/wsprd/wspr/writer.go
+++ b/services/wspr/wsprlib/writer.go
@@ -2,18 +2,17 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-package wspr
+package wsprlib
 
 import (
 	"fmt"
 	"path/filepath"
 	"runtime"
 
-	"v.io/x/ref/services/wsprd/lib"
-
 	"v.io/v23/verror"
 	"v.io/x/lib/vlog"
-	"v.io/x/ref/services/wsprd/app"
+	"v.io/x/ref/services/wspr/internal/app"
+	"v.io/x/ref/services/wspr/internal/lib"
 
 	"github.com/gorilla/websocket"
 )
diff --git a/services/wsprd/wspr/wspr.go b/services/wspr/wsprlib/wspr.go
similarity index 97%
rename from services/wsprd/wspr/wspr.go
rename to services/wspr/wsprlib/wspr.go
index 83e59a5..5b87b2b 100644
--- a/services/wsprd/wspr/wspr.go
+++ b/services/wspr/wsprlib/wspr.go
@@ -16,7 +16,7 @@
 //   "IsStreaming" : true/false
 // }
 //
-package wspr
+package wsprlib
 
 import (
 	"bytes"
@@ -34,8 +34,8 @@
 	"v.io/v23/rpc"
 	"v.io/x/lib/vlog"
 
-	"v.io/x/ref/services/wsprd/account"
-	"v.io/x/ref/services/wsprd/principal"
+	"v.io/x/ref/services/wspr/internal/account"
+	"v.io/x/ref/services/wspr/internal/principal"
 )
 
 const (
diff --git a/services/wsprd/browspr/browspr.vdl b/services/wsprd/browspr/browspr.vdl
deleted file mode 100644
index 276bc30..0000000
--- a/services/wsprd/browspr/browspr.vdl
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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 browspr
-
-import(
-  "v.io/x/ref/services/wsprd/account"
-  "v.io/x/ref/services/identity"
-)
-
-type StartMessage struct {
-  Identityd             string
-  IdentitydBlessingRoot identity.BlessingRootResponse
-  Proxy                 string
-  NamespaceRoot         string
-  LogLevel              int32
-  LogModule             string
-}
-
-type AssociateAccountMessage struct {
-  Account string
-  Origin  string
-  Caveats []account.Caveat
-}
-
-type CreateAccountMessage struct {
-  Token string
-}
-
-type CleanupMessage struct {
-  InstanceId int32
-}
-
-type OriginHasAccountMessage struct {
-  Origin string
-}
-
-type GetAccountsMessage struct {}
-
-type CreateInstanceMessage struct {
-  InstanceId     int32
-  Origin         string
-  NamespaceRoots []string
-  Proxy          string
-}