Repository: google/exposure-notifications-server
Pull request #1456 (2021-03-15 19:05:47)

Make database package public to share with verification server
**Release Note**

<!-- Enter your extended release note in the below block. If the PR requires
additional action from users switching to the new release, include the string
"action required". If no release note is required, write "NONE". -->

```release-note
Make database package public to share with verification server
```


Patch:
diff --git a/cmd/migrate/main.go b/cmd/migrate/main.go
index 65464e7..29e3e37 100644
--- a/cmd/migrate/main.go
+++ b/cmd/migrate/main.go
@@ -27,8 +27,8 @@ import (
 
 	"github.com/golang-migrate/migrate/v4"
 	"github.com/google/exposure-notifications-server/internal/buildinfo"
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/setup"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 )
 
diff --git a/internal/admin/config.go b/internal/admin/config.go
index a9fc6ac..687813d 100644
--- a/internal/admin/config.go
+++ b/internal/admin/config.go
@@ -22,9 +22,9 @@ import (
 	"html/template"
 	"net/http"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/setup"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
 )
diff --git a/internal/authorizedapp/database/authorized_app.go b/internal/authorizedapp/database/authorized_app.go
index 497e803..373140c 100644
--- a/internal/authorizedapp/database/authorized_app.go
+++ b/internal/authorizedapp/database/authorized_app.go
@@ -22,7 +22,7 @@ import (
 	"strings"
 
 	"github.com/google/exposure-notifications-server/internal/authorizedapp/model"
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	pgx "github.com/jackc/pgx/v4"
 )
 
diff --git a/internal/authorizedapp/database_provider.go b/internal/authorizedapp/database_provider.go
index defd788..6ebf80a 100644
--- a/internal/authorizedapp/database_provider.go
+++ b/internal/authorizedapp/database_provider.go
@@ -22,8 +22,8 @@ import (
 
 	authorizedappdb "github.com/google/exposure-notifications-server/internal/authorizedapp/database"
 	"github.com/google/exposure-notifications-server/internal/authorizedapp/model"
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/pkg/cache"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 )
 
diff --git a/internal/cleanup/config.go b/internal/cleanup/config.go
index 7225c05..499a7bb 100644
--- a/internal/cleanup/config.go
+++ b/internal/cleanup/config.go
@@ -17,9 +17,9 @@ package cleanup
 import (
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/setup"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/observability"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
 )
diff --git a/internal/debugger/config.go b/internal/debugger/config.go
index 5c6904d..610fd26 100644
--- a/internal/debugger/config.go
+++ b/internal/debugger/config.go
@@ -16,9 +16,9 @@ package debugger
 
 import (
 	"github.com/google/exposure-notifications-server/internal/authorizedapp"
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/setup"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
 )
diff --git a/internal/export/batcher.go b/internal/export/batcher.go
index 3b7e2f3..e49a1be 100644
--- a/internal/export/batcher.go
+++ b/internal/export/batcher.go
@@ -21,10 +21,10 @@ import (
 	"net/http"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	exportdatabase "github.com/google/exposure-notifications-server/internal/export/database"
 	"github.com/google/exposure-notifications-server/internal/export/model"
 	publishmodel "github.com/google/exposure-notifications-server/internal/publish/model"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"go.opencensus.io/stats"
 
 	"github.com/google/exposure-notifications-server/pkg/logging"
diff --git a/internal/export/config.go b/internal/export/config.go
index 18c1258..9553009 100644
--- a/internal/export/config.go
+++ b/internal/export/config.go
@@ -18,9 +18,9 @@ package export
 import (
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/setup"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/exposure-notifications-server/pkg/observability"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
diff --git a/internal/export/database/export.go b/internal/export/database/export.go
index b9dd8cb..2082a09 100644
--- a/internal/export/database/export.go
+++ b/internal/export/database/export.go
@@ -23,10 +23,10 @@ import (
 	"math/rand"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/export/model"
 	"github.com/google/exposure-notifications-server/internal/storage"
 	"github.com/google/exposure-notifications-server/pkg/cryptorand"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 
 	pgx "github.com/jackc/pgx/v4"
diff --git a/internal/export/worker.go b/internal/export/worker.go
index cc91da7..f73aab2 100644
--- a/internal/export/worker.go
+++ b/internal/export/worker.go
@@ -25,10 +25,10 @@ import (
 	"strings"
 	"time"
 
-	coredb "github.com/google/exposure-notifications-server/internal/database"
 	exportdatabase "github.com/google/exposure-notifications-server/internal/export/database"
 	publishdatabase "github.com/google/exposure-notifications-server/internal/publish/database"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	coredb "github.com/google/exposure-notifications-server/pkg/database"
 	"go.opencensus.io/stats"
 	"go.opencensus.io/tag"
 
diff --git a/internal/exportimport/config.go b/internal/exportimport/config.go
index 52cedf9..63cd8ff 100644
--- a/internal/exportimport/config.go
+++ b/internal/exportimport/config.go
@@ -17,8 +17,8 @@ package exportimport
 import (
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/setup"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/observability"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
 )
diff --git a/internal/exportimport/database/exportimport.go b/internal/exportimport/database/exportimport.go
index 8593a76..5e03a3e 100644
--- a/internal/exportimport/database/exportimport.go
+++ b/internal/exportimport/database/exportimport.go
@@ -20,8 +20,8 @@ import (
 	"fmt"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/exportimport/model"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 	"github.com/jackc/pgx/v4"
 )
diff --git a/internal/exportimport/importer.go b/internal/exportimport/importer.go
index 45e3efb..527e8a1 100644
--- a/internal/exportimport/importer.go
+++ b/internal/exportimport/importer.go
@@ -21,8 +21,8 @@ import (
 	"net/http"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/exportimport/model"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 
 	"go.opencensus.io/stats"
diff --git a/internal/exportimport/scheduler.go b/internal/exportimport/scheduler.go
index bfee262..b9c9fe2 100644
--- a/internal/exportimport/scheduler.go
+++ b/internal/exportimport/scheduler.go
@@ -25,10 +25,10 @@ import (
 	"strings"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	exportimportdb "github.com/google/exposure-notifications-server/internal/exportimport/database"
 	"github.com/google/exposure-notifications-server/internal/exportimport/model"
 	"github.com/google/exposure-notifications-server/internal/project"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 	"go.opencensus.io/stats"
 	"go.opencensus.io/trace"
diff --git a/internal/exportimport/server.go b/internal/exportimport/server.go
index 7f630cb..bcaac29 100644
--- a/internal/exportimport/server.go
+++ b/internal/exportimport/server.go
@@ -19,12 +19,12 @@ import (
 	"context"
 	"fmt"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	eidb "github.com/google/exposure-notifications-server/internal/exportimport/database"
 	"github.com/google/exposure-notifications-server/internal/middleware"
 	pubdb "github.com/google/exposure-notifications-server/internal/publish/database"
 	"github.com/google/exposure-notifications-server/internal/serverenv"
 	verifyapi "github.com/google/exposure-notifications-server/pkg/api/v1"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 	"github.com/google/exposure-notifications-server/pkg/server"
 	"github.com/gorilla/mux"
diff --git a/internal/federationin/config.go b/internal/federationin/config.go
index 2e46be3..7861bc1 100644
--- a/internal/federationin/config.go
+++ b/internal/federationin/config.go
@@ -18,8 +18,8 @@ import (
 	"regexp"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/setup"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/observability"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
 )
diff --git a/internal/federationin/database/federationin.go b/internal/federationin/database/federationin.go
index 39c5bc5..c1d7a79 100644
--- a/internal/federationin/database/federationin.go
+++ b/internal/federationin/database/federationin.go
@@ -21,9 +21,9 @@ import (
 	"fmt"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/federationin/model"
 	"github.com/google/exposure-notifications-server/internal/pb/federation"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	pgx "github.com/jackc/pgx/v4"
 )
 
diff --git a/internal/federationin/federationin.go b/internal/federationin/federationin.go
index 4051260..7ab4443 100644
--- a/internal/federationin/federationin.go
+++ b/internal/federationin/federationin.go
@@ -27,7 +27,6 @@ import (
 	"strings"
 	"time"
 
-	coredb "github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/federationin/database"
 	"github.com/google/exposure-notifications-server/internal/federationin/model"
 	"github.com/google/exposure-notifications-server/internal/pb/federation"
@@ -35,6 +34,7 @@ import (
 	publishdb "github.com/google/exposure-notifications-server/internal/publish/database"
 	publishmodel "github.com/google/exposure-notifications-server/internal/publish/model"
 	verifyapi "github.com/google/exposure-notifications-server/pkg/api/v1alpha1"
+	coredb "github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 
 	"google.golang.org/api/idtoken"
diff --git a/internal/federationout/config.go b/internal/federationout/config.go
index 9d950f6..358f84a 100644
--- a/internal/federationout/config.go
+++ b/internal/federationout/config.go
@@ -17,8 +17,8 @@ package federationout
 import (
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/setup"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/observability"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
 )
diff --git a/internal/federationout/database/federationout.go b/internal/federationout/database/federationout.go
index 57aa40c..9e194c2 100644
--- a/internal/federationout/database/federationout.go
+++ b/internal/federationout/database/federationout.go
@@ -20,8 +20,8 @@ import (
 	"errors"
 	"fmt"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/federationin/model"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	pgx "github.com/jackc/pgx/v4"
 )
 
diff --git a/internal/federationout/federationout.go b/internal/federationout/federationout.go
index 1ac7776..a054bed 100644
--- a/internal/federationout/federationout.go
+++ b/internal/federationout/federationout.go
@@ -24,7 +24,6 @@ import (
 	"strings"
 	"time"
 
-	coredb "github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/federationin/model"
 	"github.com/google/exposure-notifications-server/internal/federationout/database"
 	"github.com/google/exposure-notifications-server/internal/pb/federation"
@@ -32,6 +31,7 @@ import (
 	publishdb "github.com/google/exposure-notifications-server/internal/publish/database"
 	publishmodel "github.com/google/exposure-notifications-server/internal/publish/model"
 	verifyapi "github.com/google/exposure-notifications-server/pkg/api/v1"
+	coredb "github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 	"go.opencensus.io/stats"
 
diff --git a/internal/generate/config.go b/internal/generate/config.go
index bd4e84c..d385e25 100644
--- a/internal/generate/config.go
+++ b/internal/generate/config.go
@@ -18,9 +18,9 @@ package generate
 import (
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/publish/model"
 	"github.com/google/exposure-notifications-server/internal/setup"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/observability"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
 )
diff --git a/internal/jwks/config.go b/internal/jwks/config.go
index 943bd3c..65b47d5 100644
--- a/internal/jwks/config.go
+++ b/internal/jwks/config.go
@@ -17,8 +17,8 @@ package jwks
 import (
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/setup"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
 )
 
diff --git a/internal/jwks/handle_update_all.go b/internal/jwks/handle_update_all.go
index b8153e4..5d21f1c 100644
--- a/internal/jwks/handle_update_all.go
+++ b/internal/jwks/handle_update_all.go
@@ -21,7 +21,7 @@ import (
 	"net/http"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 	"go.opencensus.io/stats"
 )
diff --git a/internal/jwks/jwks.go b/internal/jwks/jwks.go
index 0009206..1c107c5 100644
--- a/internal/jwks/jwks.go
+++ b/internal/jwks/jwks.go
@@ -30,11 +30,11 @@ import (
 	"sync"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/project"
 	hadb "github.com/google/exposure-notifications-server/internal/verification/database"
 	"github.com/google/exposure-notifications-server/internal/verification/model"
 	"github.com/google/exposure-notifications-server/pkg/cryptorand"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 	"github.com/hashicorp/go-multierror"
 	"github.com/rakutentech/jwk-go/jwk"
diff --git a/internal/keyrotation/config.go b/internal/keyrotation/config.go
index 6543aa9..405b7bd 100644
--- a/internal/keyrotation/config.go
+++ b/internal/keyrotation/config.go
@@ -17,9 +17,9 @@ package keyrotation
 import (
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/revision"
 	"github.com/google/exposure-notifications-server/internal/setup"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/exposure-notifications-server/pkg/observability"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
diff --git a/internal/keyrotation/rotate.go b/internal/keyrotation/rotate.go
index 70ad063..c6374f4 100644
--- a/internal/keyrotation/rotate.go
+++ b/internal/keyrotation/rotate.go
@@ -22,8 +22,8 @@ import (
 	"net/http"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	revisiondatabase "github.com/google/exposure-notifications-server/internal/revision/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 	"github.com/hashicorp/go-multierror"
 	"go.opencensus.io/stats"
diff --git a/internal/keyrotation/server.go b/internal/keyrotation/server.go
index 9e5a562..b756b35 100644
--- a/internal/keyrotation/server.go
+++ b/internal/keyrotation/server.go
@@ -19,10 +19,10 @@ import (
 	"context"
 	"fmt"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/middleware"
 	revisiondb "github.com/google/exposure-notifications-server/internal/revision/database"
 	"github.com/google/exposure-notifications-server/internal/serverenv"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 	"github.com/google/exposure-notifications-server/pkg/server"
 	"github.com/gorilla/mux"
diff --git a/internal/mirror/config.go b/internal/mirror/config.go
index 8c038e3..94f85fc 100644
--- a/internal/mirror/config.go
+++ b/internal/mirror/config.go
@@ -17,9 +17,9 @@ package mirror
 import (
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/setup"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/observability"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
 )
diff --git a/internal/mirror/database/mirror.go b/internal/mirror/database/mirror.go
index 4a6b739..67cb3e7 100644
--- a/internal/mirror/database/mirror.go
+++ b/internal/mirror/database/mirror.go
@@ -19,8 +19,8 @@ import (
 	"context"
 	"fmt"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/mirror/model"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/jackc/pgx/v4"
 )
 
diff --git a/internal/mirror/mirror.go b/internal/mirror/mirror.go
index f93f2f0..f81c063 100644
--- a/internal/mirror/mirror.go
+++ b/internal/mirror/mirror.go
@@ -27,10 +27,10 @@ import (
 	"strings"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	mirrordatabase "github.com/google/exposure-notifications-server/internal/mirror/database"
 	"github.com/google/exposure-notifications-server/internal/mirror/model"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 	"github.com/hashicorp/go-multierror"
 	"go.opencensus.io/stats"
diff --git a/internal/mirror/server.go b/internal/mirror/server.go
index 51a07be..01d4ebf 100644
--- a/internal/mirror/server.go
+++ b/internal/mirror/server.go
@@ -19,10 +19,10 @@ import (
 	"context"
 	"fmt"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/middleware"
 	mirrordb "github.com/google/exposure-notifications-server/internal/mirror/database"
 	"github.com/google/exposure-notifications-server/internal/serverenv"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 	"github.com/google/exposure-notifications-server/pkg/server"
 	"github.com/gorilla/mux"
diff --git a/internal/publish/config.go b/internal/publish/config.go
index d2b2e56..e61f80a 100644
--- a/internal/publish/config.go
+++ b/internal/publish/config.go
@@ -20,12 +20,12 @@ import (
 	"time"
 
 	"github.com/google/exposure-notifications-server/internal/authorizedapp"
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/middleware"
 	"github.com/google/exposure-notifications-server/internal/publish/model"
 	"github.com/google/exposure-notifications-server/internal/revision"
 	"github.com/google/exposure-notifications-server/internal/setup"
 	"github.com/google/exposure-notifications-server/internal/verification"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/exposure-notifications-server/pkg/observability"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
diff --git a/internal/publish/database/exposure.go b/internal/publish/database/exposure.go
index 4aaa460..8c75750 100644
--- a/internal/publish/database/exposure.go
+++ b/internal/publish/database/exposure.go
@@ -25,11 +25,11 @@ import (
 	"strings"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/pb"
 	"github.com/google/exposure-notifications-server/internal/publish/model"
 	verifyapi "github.com/google/exposure-notifications-server/pkg/api/v1alpha1"
 	"github.com/google/exposure-notifications-server/pkg/base64util"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 
 	pgx "github.com/jackc/pgx/v4"
diff --git a/internal/revision/database/revision.go b/internal/revision/database/revision.go
index aaa7191..028d673 100644
--- a/internal/revision/database/revision.go
+++ b/internal/revision/database/revision.go
@@ -33,7 +33,7 @@ import (
 	"strconv"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 	"github.com/jackc/pgx/v4"
diff --git a/internal/serverenv/env.go b/internal/serverenv/env.go
index caf86f8..59ece5e 100644
--- a/internal/serverenv/env.go
+++ b/internal/serverenv/env.go
@@ -21,9 +21,9 @@ import (
 	"fmt"
 
 	"github.com/google/exposure-notifications-server/internal/authorizedapp"
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/metrics"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/exposure-notifications-server/pkg/observability"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
diff --git a/internal/setup/setup.go b/internal/setup/setup.go
index ff5bbff..6300ac7 100644
--- a/internal/setup/setup.go
+++ b/internal/setup/setup.go
@@ -20,10 +20,10 @@ import (
 	"fmt"
 
 	"github.com/google/exposure-notifications-server/internal/authorizedapp"
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/metrics"
 	"github.com/google/exposure-notifications-server/internal/serverenv"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 	"github.com/google/exposure-notifications-server/pkg/observability"
diff --git a/internal/utils/utils.go b/internal/utils/utils.go
index 56b0a19..3de81d5 100644
--- a/internal/utils/utils.go
+++ b/internal/utils/utils.go
@@ -37,10 +37,10 @@ import (
 	"time"
 
 	"github.com/dgrijalva/jwt-go"
-	"github.com/google/exposure-notifications-server/internal/database"
 	vdb "github.com/google/exposure-notifications-server/internal/verification/database"
 	vm "github.com/google/exposure-notifications-server/internal/verification/model"
 	verifyapi "github.com/google/exposure-notifications-server/pkg/api/v1"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	vutil "github.com/google/exposure-notifications-server/pkg/verification"
 )
 
diff --git a/internal/verification/database/health_authority_db.go b/internal/verification/database/health_authority_db.go
index a1afd4d..5ad9321 100644
--- a/internal/verification/database/health_authority_db.go
+++ b/internal/verification/database/health_authority_db.go
@@ -21,8 +21,8 @@ import (
 	"fmt"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/verification/model"
+	"github.com/google/exposure-notifications-server/pkg/database"
 
 	pgx "github.com/jackc/pgx/v4"
 )
diff --git a/internal/verification/phaverify.go b/internal/verification/phaverify.go
index 8820439..f13b8ac 100644
--- a/internal/verification/phaverify.go
+++ b/internal/verification/phaverify.go
@@ -123,7 +123,7 @@ func (v *Verifier) VerifyDiagnosisCertificate(ctx context.Context, authApp *aamo
 				return hak.PublicKey()
 			}
 		}
-		return nil, fmt.Errorf("key not found: iss: %v kid: %v", claims.Issuer, kid)
+		return nil, fmt.Errorf("key not found: iss: %v, kid: %v", claims.Issuer, kid)
 	})
 	if err != nil {
 		return nil, err
diff --git a/pkg/server/healthz.go b/pkg/server/healthz.go
index d1547ec..f85555d 100644
--- a/pkg/server/healthz.go
+++ b/pkg/server/healthz.go
@@ -19,7 +19,7 @@ import (
 	"net/http"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 
 	"golang.org/x/time/rate"
diff --git a/tools/export-config/main.go b/tools/export-config/main.go
index 88fce33..3ea446e 100644
--- a/tools/export-config/main.go
+++ b/tools/export-config/main.go
@@ -22,10 +22,10 @@ import (
 	"strings"
 	"time"
 
-	coredb "github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/export/database"
 	"github.com/google/exposure-notifications-server/internal/export/model"
 	"github.com/google/exposure-notifications-server/internal/setup"
+	coredb "github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var (
diff --git a/tools/federationin-query/main.go b/tools/federationin-query/main.go
index 209cc59..b938420 100644
--- a/tools/federationin-query/main.go
+++ b/tools/federationin-query/main.go
@@ -22,12 +22,12 @@ import (
 	"regexp"
 	"time"
 
-	coredb "github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/federationin"
 	"github.com/google/exposure-notifications-server/internal/federationin/database"
 	"github.com/google/exposure-notifications-server/internal/federationin/model"
 	cflag "github.com/google/exposure-notifications-server/internal/flag"
 	"github.com/google/exposure-notifications-server/internal/setup"
+	coredb "github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var (
diff --git a/tools/federationout-authorization/main.go b/tools/federationout-authorization/main.go
index d2ee519..27a2c5b 100644
--- a/tools/federationout-authorization/main.go
+++ b/tools/federationout-authorization/main.go
@@ -21,12 +21,12 @@ import (
 	"flag"
 	"log"
 
-	coredb "github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/federationin"
 	"github.com/google/exposure-notifications-server/internal/federationin/model"
 	"github.com/google/exposure-notifications-server/internal/federationout/database"
 	cflag "github.com/google/exposure-notifications-server/internal/flag"
 	"github.com/google/exposure-notifications-server/internal/setup"
+	coredb "github.com/google/exposure-notifications-server/pkg/database"
 )
 
 const (
diff --git a/tools/seed/main.go b/tools/seed/main.go
index 695a66b..86cf238 100644
--- a/tools/seed/main.go
+++ b/tools/seed/main.go
@@ -31,10 +31,10 @@ import (
 	authorizedappdatabase "github.com/google/exposure-notifications-server/internal/authorizedapp/database"
 	authorizedappmodel "github.com/google/exposure-notifications-server/internal/authorizedapp/model"
 	"github.com/google/exposure-notifications-server/internal/buildinfo"
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/setup"
 	verificationdatabase "github.com/google/exposure-notifications-server/internal/verification/database"
 	verificationmodel "github.com/google/exposure-notifications-server/internal/verification/model"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/exposure-notifications-server/pkg/logging"
 )


Test patch:
diff --git a/internal/admin/admin_test.go b/internal/admin/admin_test.go
index 87f4941..fc76e17 100644
--- a/internal/admin/admin_test.go
+++ b/internal/admin/admin_test.go
@@ -28,9 +28,9 @@ import (
 	"testing"
 
 	"github.com/gin-gonic/gin"
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/project"
 	"github.com/google/exposure-notifications-server/internal/serverenv"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 )
 
diff --git a/internal/authorizedapp/database/database_test.go b/internal/authorizedapp/database/database_test.go
index 469042c..f25a037 100644
--- a/internal/authorizedapp/database/database_test.go
+++ b/internal/authorizedapp/database/database_test.go
@@ -17,7 +17,7 @@ package database
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/cleanup/cleanup_test.go b/internal/cleanup/cleanup_test.go
index d7142a8..abc4e34 100644
--- a/internal/cleanup/cleanup_test.go
+++ b/internal/cleanup/cleanup_test.go
@@ -19,10 +19,10 @@ import (
 	"testing"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/project"
 	"github.com/google/exposure-notifications-server/internal/serverenv"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/export/database/database_test.go b/internal/export/database/database_test.go
index 469042c..f25a037 100644
--- a/internal/export/database/database_test.go
+++ b/internal/export/database/database_test.go
@@ -17,7 +17,7 @@ package database
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/export/database/export_test.go b/internal/export/database/export_test.go
index 735d0e4..8f0acce 100644
--- a/internal/export/database/export_test.go
+++ b/internal/export/database/export_test.go
@@ -21,11 +21,11 @@ import (
 	"testing"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/export/model"
 	"github.com/google/exposure-notifications-server/internal/project"
 	publishdb "github.com/google/exposure-notifications-server/internal/publish/database"
 	publishmodel "github.com/google/exposure-notifications-server/internal/publish/model"
+	"github.com/google/exposure-notifications-server/pkg/database"
 
 	"github.com/google/go-cmp/cmp"
 	pgx "github.com/jackc/pgx/v4"
diff --git a/internal/export/export_test.go b/internal/export/export_test.go
index cd40324..4925be5 100644
--- a/internal/export/export_test.go
+++ b/internal/export/export_test.go
@@ -17,7 +17,7 @@ package export
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/export/server_test.go b/internal/export/server_test.go
index 10191bb..8c79e90 100644
--- a/internal/export/server_test.go
+++ b/internal/export/server_test.go
@@ -18,10 +18,10 @@ import (
 	"fmt"
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/project"
 	"github.com/google/exposure-notifications-server/internal/serverenv"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 )
 
diff --git a/internal/exportimport/database/database_test.go b/internal/exportimport/database/database_test.go
index 469042c..f25a037 100644
--- a/internal/exportimport/database/database_test.go
+++ b/internal/exportimport/database/database_test.go
@@ -17,7 +17,7 @@ package database
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/exportimport/database/exportimport_test.go b/internal/exportimport/database/exportimport_test.go
index 521c91c..63372bc 100644
--- a/internal/exportimport/database/exportimport_test.go
+++ b/internal/exportimport/database/exportimport_test.go
@@ -23,9 +23,9 @@ import (
 	"testing"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/exportimport/model"
 	"github.com/google/exposure-notifications-server/internal/project"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/go-cmp/cmp"
 	"github.com/google/go-cmp/cmp/cmpopts"
 )
diff --git a/internal/exportimport/exportimport_test.go b/internal/exportimport/exportimport_test.go
index 7826274..e8eb024 100644
--- a/internal/exportimport/exportimport_test.go
+++ b/internal/exportimport/exportimport_test.go
@@ -17,7 +17,7 @@ package exportimport
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/federationin/database/database_test.go b/internal/federationin/database/database_test.go
index 469042c..f25a037 100644
--- a/internal/federationin/database/database_test.go
+++ b/internal/federationin/database/database_test.go
@@ -17,7 +17,7 @@ package database
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/federationin/database/federationin_test.go b/internal/federationin/database/federationin_test.go
index bc08ea4..7d18c01 100644
--- a/internal/federationin/database/federationin_test.go
+++ b/internal/federationin/database/federationin_test.go
@@ -19,10 +19,10 @@ import (
 	"testing"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/federationin/model"
 	"github.com/google/exposure-notifications-server/internal/pb/federation"
 	"github.com/google/exposure-notifications-server/internal/project"
+	"github.com/google/exposure-notifications-server/pkg/database"
 
 	"github.com/google/go-cmp/cmp"
 	"github.com/google/go-cmp/cmp/cmpopts"
diff --git a/internal/federationout/database/database_test.go b/internal/federationout/database/database_test.go
index 469042c..f25a037 100644
--- a/internal/federationout/database/database_test.go
+++ b/internal/federationout/database/database_test.go
@@ -17,7 +17,7 @@ package database
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/federationout/database/federationout_test.go b/internal/federationout/database/federationout_test.go
index 1000653..9592367 100644
--- a/internal/federationout/database/federationout_test.go
+++ b/internal/federationout/database/federationout_test.go
@@ -18,9 +18,9 @@ import (
 	"errors"
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/federationin/model"
 	"github.com/google/exposure-notifications-server/internal/project"
+	"github.com/google/exposure-notifications-server/pkg/database"
 
 	"github.com/google/go-cmp/cmp"
 )
diff --git a/internal/generate/generate_test.go b/internal/generate/generate_test.go
index fef43cb..2534116 100644
--- a/internal/generate/generate_test.go
+++ b/internal/generate/generate_test.go
@@ -21,11 +21,11 @@ import (
 	"testing"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/project"
 	publishdb "github.com/google/exposure-notifications-server/internal/publish/database"
 	publishmodel "github.com/google/exposure-notifications-server/internal/publish/model"
 	"github.com/google/exposure-notifications-server/internal/setup"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/observability"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
 	"github.com/sethvargo/go-envconfig"
diff --git a/internal/integration/integration_test.go b/internal/integration/integration_test.go
index 432b287..ec3741a 100644
--- a/internal/integration/integration_test.go
+++ b/internal/integration/integration_test.go
@@ -25,7 +25,6 @@ import (
 	"testing"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/export"
 	exportpb "github.com/google/exposure-notifications-server/internal/pb/export"
 	"github.com/google/exposure-notifications-server/internal/project"
@@ -35,6 +34,7 @@ import (
 	"github.com/google/exposure-notifications-server/internal/utils"
 	verifyapi "github.com/google/exposure-notifications-server/pkg/api/v1"
 	"github.com/google/exposure-notifications-server/pkg/base64util"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/enkstest"
 	"github.com/google/exposure-notifications-server/pkg/util"
 	"github.com/google/go-cmp/cmp"
diff --git a/internal/jwks/jwks_test.go b/internal/jwks/jwks_test.go
index 9efa6c4..94c7dd0 100644
--- a/internal/jwks/jwks_test.go
+++ b/internal/jwks/jwks_test.go
@@ -23,10 +23,10 @@ import (
 	"testing"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/project"
 	hadb "github.com/google/exposure-notifications-server/internal/verification/database"
 	"github.com/google/exposure-notifications-server/internal/verification/model"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/errcmp"
 )
 
diff --git a/internal/keyrotation/keyrotation_test.go b/internal/keyrotation/keyrotation_test.go
index b6b56a6..1a73781 100644
--- a/internal/keyrotation/keyrotation_test.go
+++ b/internal/keyrotation/keyrotation_test.go
@@ -17,7 +17,7 @@ package keyrotation
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/keyrotation/rotate_test.go b/internal/keyrotation/rotate_test.go
index b99192e..e3f14de 100644
--- a/internal/keyrotation/rotate_test.go
+++ b/internal/keyrotation/rotate_test.go
@@ -25,11 +25,11 @@ import (
 	"testing"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/project"
 	"github.com/google/exposure-notifications-server/internal/revision"
 	revisiondb "github.com/google/exposure-notifications-server/internal/revision/database"
 	"github.com/google/exposure-notifications-server/internal/serverenv"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/jackc/pgx/v4"
 )
diff --git a/internal/mirror/database/database_test.go b/internal/mirror/database/database_test.go
index 469042c..f25a037 100644
--- a/internal/mirror/database/database_test.go
+++ b/internal/mirror/database/database_test.go
@@ -17,7 +17,7 @@ package database
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/mirror/mirror_test.go b/internal/mirror/mirror_test.go
index c90d6bc..a6626a4 100644
--- a/internal/mirror/mirror_test.go
+++ b/internal/mirror/mirror_test.go
@@ -24,12 +24,12 @@ import (
 	"testing"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	mirrordatabase "github.com/google/exposure-notifications-server/internal/mirror/database"
 	mirrormodel "github.com/google/exposure-notifications-server/internal/mirror/model"
 	"github.com/google/exposure-notifications-server/internal/project"
 	"github.com/google/exposure-notifications-server/internal/serverenv"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/errcmp"
 	"github.com/google/go-cmp/cmp"
 	"github.com/gorilla/mux"
diff --git a/internal/mirror/server_test.go b/internal/mirror/server_test.go
index 18eb4a7..eb8ea67 100644
--- a/internal/mirror/server_test.go
+++ b/internal/mirror/server_test.go
@@ -17,10 +17,10 @@ package mirror
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/project"
 	"github.com/google/exposure-notifications-server/internal/serverenv"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/errcmp"
 )
 
diff --git a/internal/publish/database/database_test.go b/internal/publish/database/database_test.go
index 469042c..f25a037 100644
--- a/internal/publish/database/database_test.go
+++ b/internal/publish/database/database_test.go
@@ -17,7 +17,7 @@ package database
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/publish/database/exposure_test.go b/internal/publish/database/exposure_test.go
index ec5bd82..6ec75e6 100644
--- a/internal/publish/database/exposure_test.go
+++ b/internal/publish/database/exposure_test.go
@@ -26,11 +26,11 @@ import (
 	"testing"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/pb"
 	"github.com/google/exposure-notifications-server/internal/project"
 	"github.com/google/exposure-notifications-server/internal/publish/model"
 	verifyapi "github.com/google/exposure-notifications-server/pkg/api/v1alpha1"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/errcmp"
 	pgx "github.com/jackc/pgx/v4"
 
diff --git a/internal/publish/publish_test.go b/internal/publish/publish_test.go
index 6cb5fdc..c2c6f85 100644
--- a/internal/publish/publish_test.go
+++ b/internal/publish/publish_test.go
@@ -32,7 +32,6 @@ import (
 	"github.com/google/exposure-notifications-server/internal/authorizedapp"
 	aadb "github.com/google/exposure-notifications-server/internal/authorizedapp/database"
 	aamodel "github.com/google/exposure-notifications-server/internal/authorizedapp/model"
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/pb"
 	"github.com/google/exposure-notifications-server/internal/project"
 	pubdb "github.com/google/exposure-notifications-server/internal/publish/database"
@@ -42,6 +41,7 @@ import (
 	"github.com/google/exposure-notifications-server/internal/serverenv"
 	vermodel "github.com/google/exposure-notifications-server/internal/verification/model"
 	"github.com/google/exposure-notifications-server/pkg/base64util"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/exposure-notifications-server/pkg/timeutils"
 	"github.com/google/exposure-notifications-server/pkg/util"
diff --git a/internal/revision/database/database_test.go b/internal/revision/database/database_test.go
index 469042c..f25a037 100644
--- a/internal/revision/database/database_test.go
+++ b/internal/revision/database/database_test.go
@@ -17,7 +17,7 @@ package database
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/revision/database/revision_test.go b/internal/revision/database/revision_test.go
index ab00887..f4956f1 100644
--- a/internal/revision/database/revision_test.go
+++ b/internal/revision/database/revision_test.go
@@ -18,8 +18,8 @@ import (
 	"testing"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/project"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/go-cmp/cmp"
 	"github.com/google/go-cmp/cmp/cmpopts"
diff --git a/internal/revision/revision_test.go b/internal/revision/revision_test.go
index f6c9c9d..e8c25fb 100644
--- a/internal/revision/revision_test.go
+++ b/internal/revision/revision_test.go
@@ -19,11 +19,11 @@ import (
 	"testing"
 	"time"
 
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/pb"
 	"github.com/google/exposure-notifications-server/internal/project"
 	"github.com/google/exposure-notifications-server/internal/publish/model"
 	revisiondb "github.com/google/exposure-notifications-server/internal/revision/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/go-cmp/cmp"
 	"github.com/google/go-cmp/cmp/cmpopts"
diff --git a/internal/setup/setup_test.go b/internal/setup/setup_test.go
index 61e4221..10307eb 100644
--- a/internal/setup/setup_test.go
+++ b/internal/setup/setup_test.go
@@ -20,10 +20,10 @@ import (
 	"time"
 
 	"github.com/google/exposure-notifications-server/internal/authorizedapp"
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/project"
 	"github.com/google/exposure-notifications-server/internal/setup"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/exposure-notifications-server/pkg/observability"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
diff --git a/internal/verification/database/database_test.go b/internal/verification/database/database_test.go
index 469042c..f25a037 100644
--- a/internal/verification/database/database_test.go
+++ b/internal/verification/database/database_test.go
@@ -17,7 +17,7 @@ package database
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/verification/verification_test.go b/internal/verification/verification_test.go
index c1fd5aa..2eacb16 100644
--- a/internal/verification/verification_test.go
+++ b/internal/verification/verification_test.go
@@ -17,7 +17,7 @@ package verification
 import (
 	"testing"
 
-	"github.com/google/exposure-notifications-server/internal/database"
+	"github.com/google/exposure-notifications-server/pkg/database"
 )
 
 var testDatabaseInstance *database.TestInstance
diff --git a/internal/database/config.go b/pkg/database/config.go
similarity index 100%
rename from internal/database/config.go
rename to pkg/database/config.go
diff --git a/internal/database/connection.go b/pkg/database/connection.go
similarity index 100%
rename from internal/database/connection.go
rename to pkg/database/connection.go
diff --git a/internal/database/connection_test.go b/pkg/database/connection_test.go
similarity index 100%
rename from internal/database/connection_test.go
rename to pkg/database/connection_test.go
diff --git a/internal/database/database.go b/pkg/database/database.go
similarity index 100%
rename from internal/database/database.go
rename to pkg/database/database.go
diff --git a/internal/database/database_test.go b/pkg/database/database_test.go
similarity index 100%
rename from internal/database/database_test.go
rename to pkg/database/database_test.go
diff --git a/internal/database/database_util.go b/pkg/database/database_util.go
similarity index 100%
rename from internal/database/database_util.go
rename to pkg/database/database_util.go
diff --git a/internal/database/lock.go b/pkg/database/lock.go
similarity index 100%
rename from internal/database/lock.go
rename to pkg/database/lock.go
diff --git a/internal/database/lock_test.go b/pkg/database/lock_test.go
similarity index 100%
rename from internal/database/lock_test.go
rename to pkg/database/lock_test.go
diff --git a/pkg/enkstest/server.go b/pkg/enkstest/server.go
index b5502db..7ac672a 100644
--- a/pkg/enkstest/server.go
+++ b/pkg/enkstest/server.go
@@ -23,7 +23,6 @@ import (
 
 	"github.com/google/exposure-notifications-server/internal/authorizedapp"
 	"github.com/google/exposure-notifications-server/internal/cleanup"
-	"github.com/google/exposure-notifications-server/internal/database"
 	"github.com/google/exposure-notifications-server/internal/export"
 	"github.com/google/exposure-notifications-server/internal/federationin"
 	"github.com/google/exposure-notifications-server/internal/keyrotation"
@@ -34,6 +33,9 @@ import (
 	revisiondatabase "github.com/google/exposure-notifications-server/internal/revision/database"
 	"github.com/google/exposure-notifications-server/internal/serverenv"
 	"github.com/google/exposure-notifications-server/internal/storage"
+	verificationdatabase "github.com/google/exposure-notifications-server/internal/verification/database"
+	verificationmodel "github.com/google/exposure-notifications-server/internal/verification/model"
+	"github.com/google/exposure-notifications-server/pkg/database"
 	"github.com/google/exposure-notifications-server/pkg/keys"
 	"github.com/google/exposure-notifications-server/pkg/secrets"
 	"github.com/google/exposure-notifications-server/pkg/server"
@@ -236,6 +238,12 @@ func NewServer(tb testing.TB, testDatabaseInstance *database.TestInstance) *Serv
 	}
 }
 
+// AddHealthAuthorityKey updates the health authority. This exists so tests
+// can override the PEM without exposing all the internal packages.
+func (s *Server) AddHealthAuthorityKey(ctx context.Context, healthAuthority *verificationmodel.HealthAuthority, healthAuthorityKey *verificationmodel.HealthAuthorityKey) error {
+	return verificationdatabase.New(s.Env.Database()).AddHealthAuthorityKey(ctx, healthAuthority, healthAuthorityKey)
+}
+
 func processDefaults(tb testing.TB, i interface{}) {
 	tb.Helper()