Skip to content
This repository was archived by the owner on Jul 12, 2023. It is now read-only.

Commit 0472c4b

Browse files
committed
Fix gofmt
1 parent 19f6956 commit 0472c4b

File tree

22 files changed

+84
-56
lines changed

22 files changed

+84
-56
lines changed

internal/project/context.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ func TestContext(tb testing.TB) context.Context {
3333
// TestLogger returns a logger configured for test. See the following link for
3434
// more information:
3535
//
36-
// https://pkg.go.dev/go.uber.org/zap/zaptest
37-
//
36+
// https://pkg.go.dev/go.uber.org/zap/zaptest
3837
func TestLogger(tb testing.TB) *zap.SugaredLogger {
3938
if testing.Verbose() {
4039
return zaptest.NewLogger(tb, zaptest.Level(zap.DebugLevel)).Sugar()

pkg/api/api.go

+28-22
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ type UserReportRequest struct {
382382
}
383383

384384
// UserReportResponse is the reply from a UserReportRequest.
385-
//
386385
type UserReportResponse struct {
387386
Padding Padding `json:"padding"`
388387

@@ -398,33 +397,40 @@ type UserReportResponse struct {
398397
ErrorCode string `json:"errorCode,omitempty"`
399398
}
400399

401-
// VerifyCodeRequest is the request structure for exchanging a short term Verification Code
402-
// (OTP) for a long term token (a JWT) that can later be used to sign TEKs.
403-
//
404-
// 'code' is either the issued short code or long code issued to the user. Either one is
405-
// acceptable. Note that they normally have different expiry times.
406-
// 'accept' is a list of accepted test types by the client. Acceptable values are
407-
// - ["confirmed"]
408-
// - ["confirmed", "likely"] == ["likely"]
409-
// - ["confirmed", "likely", "negative"] == ["negative"]
410-
// These values form a hierarchy, if a client will accept 'likely' they must accept
411-
// both confirmed and likely. 'negative' indicates you accept confirmed, likely, and negative.
412-
// A client can pass in the complete list they accept or the "highest" value they can accept.
413-
// If this value is omitted or is empty, the client agrees to accept ALL possible
414-
// test types, including test types that may be introduced in the future.
415-
// The special type of test, '"user-report"' can be added safely to any of the other types.
416-
//
417-
// The nonce must be provided when validating a self report key.
400+
// VerifyCodeRequest is the request structure for exchanging a short term
401+
// Verification Code (OTP) for a long term token (a JWT) that can later be used
402+
// to sign TEKs.
418403
//
419404
// Requires API key in a HTTP header, X-API-Key: APIKEY
420405
type VerifyCodeRequest struct {
421406
Padding Padding `json:"padding"`
422407

423-
VerificationCode string `json:"code"`
424-
AcceptTestTypes []string `json:"accept"`
408+
// VerificationCode (code) is either the issued short code or long code issued
409+
// to the user. Either one is acceptable. Note that they normally have
410+
// different expiry times.
411+
VerificationCode string `json:"code"`
412+
413+
// AcceptTestTypes (accept) is a list of accepted test types by the client.
414+
// Acceptable values are:
415+
//
416+
// - ["confirmed"]
417+
// - ["confirmed", "likely"] == ["likely"]
418+
// - ["confirmed", "likely", "negative"] == ["negative"]
419+
//
420+
// These values form a hierarchy, if a client will accept 'likely' they must
421+
// accept both confirmed and likely. 'negative' indicates you accept
422+
// confirmed, likely, and negative. A client can pass in the complete list
423+
// they accept or the "highest" value they can accept. If this value is
424+
// omitted or is empty, the client agrees to accept ALL possible test types,
425+
// including test types that may be introduced in the future.
426+
//
427+
// The special type of test, '"user-report"' can be added safely to any of the
428+
// other types.
429+
AcceptTestTypes []string `json:"accept"`
425430

426-
// Optional: If present must be the same nonce that was used to request the verification code.
427-
// base64 encoded.
431+
// Nonce (nonce) If present must be the same nonce that was used to request
432+
// the verification code. base64 encoded. The nonce must be provided when
433+
// validating a self report key.
428434
Nonce string `json:"nonce,omitempty"`
429435
}
430436

pkg/api/ios.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
package api
1616

1717
// IOSDataResponse is the iOS format is specified by:
18-
// https://developer.apple.com/documentation/safariservices/supporting_associated_domains
1918
//
19+
// https://developer.apple.com/documentation/safariservices/supporting_associated_domains
2020
type IOSDataResponse struct {
2121
Applinks IOSAppLinks `json:"applinks"`
2222

pkg/controller/admin/events.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ func (c *Controller) HandleEventsShow() http.Handler {
103103
}
104104

105105
func (c *Controller) renderEvents(ctx context.Context, w http.ResponseWriter,
106-
events []*database.AuditEntry, paginator *pagination.Paginator, from, to string, realm *database.Realm) {
106+
events []*database.AuditEntry, paginator *pagination.Paginator, from, to string, realm *database.Realm,
107+
) {
107108
m := controller.TemplateMapFromContext(ctx)
108109
m["events"] = events
109110
m["paginator"] = paginator

pkg/controller/admin/mobile_apps.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ func (c *Controller) HandleMobileAppsIndex() http.Handler {
6060
}
6161

6262
func (c *Controller) renderMobileAppsIndex(ctx context.Context, w http.ResponseWriter,
63-
apps []*database.MobileApp, paginator *pagination.Paginator, q string) {
63+
apps []*database.MobileApp, paginator *pagination.Paginator, q string,
64+
) {
6465
m := controller.TemplateMapFromContext(ctx)
6566
m.Title("Mobile apps - System Admin")
6667
m["apps"] = apps

pkg/controller/admin/realms.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ func (c *Controller) HandleRealmsCreate() http.Handler {
175175
}
176176

177177
func (c *Controller) renderNewRealm(ctx context.Context, w http.ResponseWriter,
178-
realm *database.Realm, smsConfig *database.SMSConfig, emailConfig *database.EmailConfig) {
178+
realm *database.Realm, smsConfig *database.SMSConfig, emailConfig *database.EmailConfig,
179+
) {
179180
m := controller.TemplateMapFromContext(ctx)
180181
m.Title("New Realm - System Admin")
181182
m["realm"] = realm
@@ -309,7 +310,8 @@ func (c *Controller) renderEditRealm(ctx context.Context, w http.ResponseWriter,
309310
realm *database.Realm, membership *database.Membership, smsConfig *database.SMSConfig, emailConfig *database.EmailConfig,
310311
chaffEvents []*database.RealmChaffEvent,
311312
quotaLimit, quotaRemaining uint64,
312-
translations []*database.DynamicTranslation) {
313+
translations []*database.DynamicTranslation,
314+
) {
313315
m := controller.TemplateMapFromContext(ctx)
314316
m.Title("Realm: %s - System Admin", realm.Name)
315317
m["realm"] = realm

pkg/controller/admin/sms.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ func (c *Controller) HandleSMSUpdate() http.Handler {
119119
}
120120

121121
func (c *Controller) renderShowSMS(ctx context.Context, w http.ResponseWriter,
122-
smsConfig *database.SMSConfig, smsFromNumbers []*database.SMSFromNumber) {
122+
smsConfig *database.SMSConfig, smsFromNumbers []*database.SMSFromNumber,
123+
) {
123124
m := controller.TemplateMapFromContext(ctx)
124125
m.Title("SMS - System Admin")
125126
m["smsConfig"] = smsConfig

pkg/controller/apikey/index.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ func (c *Controller) HandleIndex() http.Handler {
6666

6767
// renderIndex renders the index page.
6868
func (c *Controller) renderIndex(ctx context.Context, w http.ResponseWriter,
69-
apps []*database.AuthorizedApp, paginator *pagination.Paginator, query string) {
69+
apps []*database.AuthorizedApp, paginator *pagination.Paginator, query string,
70+
) {
7071
m := controller.TemplateMapFromContext(ctx)
7172
m.Title("API keys")
7273
m["apps"] = apps

pkg/controller/appsync/helpers.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ func (c *Controller) syncApps(ctx context.Context, apps *appsync.AppsResponse) *
125125
}
126126

127127
func (c *Controller) findRealmForApp(
128-
app appsync.App, realms map[string]*database.Realm) (*database.Realm, error) {
128+
app appsync.App, realms map[string]*database.Realm,
129+
) (*database.Realm, error) {
129130
var err error
130131
realm, has := realms[app.Region]
131132
if !has { // Find this apps region and cache it in our realms map
@@ -139,7 +140,8 @@ func (c *Controller) findRealmForApp(
139140
}
140141

141142
func (c *Controller) findAppsForRealm(
142-
realmID uint, appsByRealm map[uint][]*database.MobileApp) ([]*database.MobileApp, error) {
143+
realmID uint, appsByRealm map[uint][]*database.MobileApp,
144+
) ([]*database.MobileApp, error) {
143145
var err error
144146
realmApps, has := appsByRealm[realmID]
145147
if !has { // Find all of the apps for this realm and cache that list in our appByRealmMap

pkg/controller/associated/associated.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
// protocols. For more discussion of these protocols, please see:
1717
//
1818
// Android:
19-
// https://developer.android.com/training/app-links/verify-site-associations
19+
//
20+
// https://developer.android.com/training/app-links/verify-site-associations
2021
//
2122
// iOS:
22-
// https://developer.apple.com/documentation/safariservices/supporting_associated_domains
23+
//
24+
// https://developer.apple.com/documentation/safariservices/supporting_associated_domains
2325
package associated
2426

2527
import (

pkg/controller/associated/index.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
// protocols. For more discussion of these protocols, please see:
1717
//
1818
// Android:
19-
// https://developer.android.com/training/app-links/verify-site-associations
19+
//
20+
// https://developer.android.com/training/app-links/verify-site-associations
21+
//
2022
// iOS:
21-
// https://developer.apple.com/documentation/safariservices/supporting_associated_domains
23+
//
24+
// https://developer.apple.com/documentation/safariservices/supporting_associated_domains
2225
package associated
2326

2427
import (

pkg/controller/certapi/signers.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ func (c *Controller) getSignerForAuthApp(ctx context.Context, authApp *database.
4040

4141
// GetSignerForRealm gets the certificate signer info for the given realm.
4242
func GetSignerForRealm(ctx context.Context, realmID uint,
43-
cfg config.CertificateSigningConfig, cache *cache.Cache[*SignerInfo], db *database.Database, kms keys.KeyManager) (*SignerInfo, error) {
43+
cfg config.CertificateSigningConfig, cache *cache.Cache[*SignerInfo], db *database.Database, kms keys.KeyManager,
44+
) (*SignerInfo, error) {
4445
signer, err := cache.WriteThruLookup(fmt.Sprintf("%d", realmID),
4546
func() (*SignerInfo, error) {
4647
realm, err := db.FindRealm(realmID)

pkg/controller/codes/index.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ func (c *Controller) renderStatus(
6060
w http.ResponseWriter,
6161
realm *database.Realm,
6262
user *database.User,
63-
code *database.VerificationCode) error {
63+
code *database.VerificationCode,
64+
) error {
6465
recentCodes, err := realm.ListRecentCodes(c.db, user)
6566
if err != nil {
6667
return err

pkg/controller/email.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ import (
2525

2626
// SendInviteEmailFunc returns a function capable of sending a new user invitation.
2727
func SendInviteEmailFunc(ctx context.Context, db *database.Database, h *render.Renderer, email string,
28-
realm *database.Realm) (auth.InviteUserEmailFunc, error) {
28+
realm *database.Realm,
29+
) (auth.InviteUserEmailFunc, error) {
2930
// Lookup the email provider
3031
emailer, err := realm.EmailProvider(db)
3132
if err != nil {
@@ -73,7 +74,8 @@ func SendInviteEmailFunc(ctx context.Context, db *database.Database, h *render.R
7374
// SendPasswordResetEmailFunc returns a function capable of sending a password
7475
// reset for the given user.
7576
func SendPasswordResetEmailFunc(ctx context.Context, db *database.Database, h *render.Renderer, email string,
76-
realm *database.Realm) (auth.ResetPasswordEmailFunc, error) {
77+
realm *database.Realm,
78+
) (auth.ResetPasswordEmailFunc, error) {
7779
// Lookup the email provider
7880
emailer, err := realm.EmailProvider(db)
7981
if err != nil {
@@ -120,7 +122,8 @@ func SendPasswordResetEmailFunc(ctx context.Context, db *database.Database, h *r
120122
// SendEmailVerificationEmailFunc returns a function capable of sending an email
121123
// verification email.
122124
func SendEmailVerificationEmailFunc(ctx context.Context, db *database.Database, h *render.Renderer, email string,
123-
realm *database.Realm) (auth.EmailVerificationEmailFunc, error) {
125+
realm *database.Realm,
126+
) (auth.EmailVerificationEmailFunc, error) {
124127
// Lookup the email provider
125128
emailer, err := realm.EmailProvider(db)
126129
if err != nil {

pkg/controller/login/register_phone.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ func (c *Controller) HandleRegisterPhone() http.Handler {
7575
}
7676

7777
func (c *Controller) renderRegisterPhone(ctx context.Context, w http.ResponseWriter,
78-
mode *database.AuthRequirement, mfaEnabled bool) {
78+
mode *database.AuthRequirement, mfaEnabled bool,
79+
) {
7980
m := controller.TemplateMapFromContext(ctx)
8081
m.Title("Multi-factor authentication registration")
8182
m["mfaMode"] = mode

pkg/controller/realmadmin/events.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ func (c *Controller) HandleEvents() http.Handler {
7575
}
7676

7777
func (c *Controller) renderEvents(ctx context.Context, w http.ResponseWriter,
78-
realm *database.Realm, events []*database.AuditEntry, paginator *pagination.Paginator, from, to string) {
78+
realm *database.Realm, events []*database.AuditEntry, paginator *pagination.Paginator, from, to string,
79+
) {
7980
m := controller.TemplateMapFromContext(ctx)
8081
m.Title("Events")
8182
m["user"] = realm

pkg/controller/realmadmin/settings_show.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ type TemplateData struct {
3333
func (c *Controller) renderSettings(
3434
ctx context.Context, w http.ResponseWriter, r *http.Request, realm *database.Realm,
3535
smsConfig *database.SMSConfig, emailConfig *database.EmailConfig, keyServerStats *database.KeyServerStats,
36-
quotaLimit, quotaRemaining uint64) {
36+
quotaLimit, quotaRemaining uint64,
37+
) {
3738
if smsConfig == nil {
3839
var err error
3940
smsConfig, err = realm.SMSConfig(c.db)

pkg/controller/user/import_batch.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ func (c *Controller) HandleImportBatch() http.Handler {
7878

7979
func (c *Controller) importUsers(ctx context.Context,
8080
realm *database.Realm, realmMemberships map[uint]rbac.Permission, actor database.Auditable,
81-
users []api.BatchUser, sendInvites bool) ([]*api.BatchUser, *multierror.Error) {
81+
users []api.BatchUser, sendInvites bool,
82+
) ([]*api.BatchUser, *multierror.Error) {
8283
logger := logging.FromContext(ctx).Named("user.importUsers")
8384

8485
addedUsers := make([]*api.BatchUser, 0, len(users))

pkg/controller/user/index.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ func (c *Controller) HandleIndex() http.Handler {
8181

8282
func (c *Controller) renderIndex(
8383
ctx context.Context, w http.ResponseWriter,
84-
memberships []*database.Membership, paginator *pagination.Paginator, query string) {
84+
memberships []*database.Membership, paginator *pagination.Paginator, query string,
85+
) {
8586
m := controller.TemplateMapFromContext(ctx)
8687
m.Title("Users")
8788
m["memberships"] = memberships

pkg/database/authorized_app.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,7 @@ func (db *Database) generateAPIKeyHMACs(apiKey string) ([]string, error) {
358358
// GenerateAPIKey generates a new API key that is bound to the given realm. This
359359
// API key is NOT stored in the database. API keys are of the format:
360360
//
361-
// key:realmID:hex(hmac)
362-
//
361+
// key:realmID:hex(hmac)
363362
func (db *Database) GenerateAPIKey(realmID uint) (string, error) {
364363
// Create the "key" parts.
365364
buf := make([]byte, apiKeyBytes)

pkg/database/token_test.go

-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ func TestIssueToken(t *testing.T) {
170170
Subject *Subject
171171
ClaimError string
172172
}{
173-
174173
{
175174
Name: "normal_token_issue",
176175
Verification: func() *VerificationCode {

pkg/email/config.go

+8-6
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ const (
3232
ProviderTypeSMTP ProviderType = "SIMPLE_SMTP"
3333
)
3434

35-
// Config represents the env var based configuration for email SMTP server connection.
35+
// Config represents the env var based configuration for email SMTP server
36+
// connection.
3637
//
37-
// Note: This will only work with email providers that accept external connections.
38-
// The provider must accept TLS, and users should independently consider the security
39-
// of the email provider / account.
40-
// Gmail or Google Workspace accounts can be used with an app-password, but will
41-
// not work with security features such as Advanced Protection enabled.
38+
// This will only work with email providers that accept external connections.
39+
//
40+
// The provider must accept TLS, and users should independently consider the
41+
// security of the email provider / account. Gmail or Google Workspace accounts
42+
// can be used with an app-password, but will not work with security features
43+
// such as Advanced Protection enabled.
4244
type Config struct {
4345
ProviderType ProviderType
4446

0 commit comments

Comments
 (0)