diff --git a/auth/services/selfsigned/test/generate_test.go b/auth/services/selfsigned/test/generate_test.go index 26e4787ab0..5e4c752b71 100644 --- a/auth/services/selfsigned/test/generate_test.go +++ b/auth/services/selfsigned/test/generate_test.go @@ -41,7 +41,7 @@ func Test_GenerateTestData(t *testing.T) { createdTime := time.Date(2023, 4, 20, 9, 53, 3, 0, time.UTC) expirationTime := createdTime.Add(4 * 24 * time.Hour) - // WithParam up crypto + // Set up crypto const keyID = "did:nuts:8NYzfsndZJHh6GqzKiSBpyERrFxuX64z6tE5raa7nEjm#bYcuet6EHojMlaMqwNoC3c6etKlUHoJ9rRvUu3ZKEEw" privateKeyData, err := os.ReadFile("private.pem") require.NoError(t, err) diff --git a/crypto/cmd/cmd_test.go b/crypto/cmd/cmd_test.go index 6d046b50cf..de9ccf8f5c 100644 --- a/crypto/cmd/cmd_test.go +++ b/crypto/cmd/cmd_test.go @@ -74,7 +74,7 @@ func newRootCommand() *cobra.Command { } func Test_fs2VaultCommand(t *testing.T) { - // WithParam up webserver that stubs Vault + // Set up webserver that stubs Vault importRequests := make(map[string]string, 0) s := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { data, err := io.ReadAll(request.Body) @@ -124,7 +124,7 @@ func Test_fs2VaultCommand(t *testing.T) { func Test_fs2ExternalStore(t *testing.T) { // tests imports 1 new key, skips a known one, and the server returns an error for the third one t.Run("ok", func(t *testing.T) { - // WithParam up webserver that stubs Vault + // Set up webserver that stubs Vault importRequests := make(map[string]string, 0) s := httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { @@ -186,7 +186,7 @@ func setupFSStoreData(t *testing.T, testDirectory string) { t.Helper() ctx := context.Background() - // WithParam up crypto filesystem with some keys + // Set up crypto filesystem with some keys pk1, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) pk2, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) pk3, _ := ecdsa.GenerateKey(elliptic.P256(), rand.Reader) diff --git a/discovery/client.go b/discovery/client.go index c0caf80634..47d910ef86 100644 --- a/discovery/client.go +++ b/discovery/client.go @@ -78,7 +78,7 @@ func (r *defaultClientRegistrationManager) activate(ctx context.Context, service } log.Logger().Debugf("Successfully registered Verifiable Presentation on Discovery Service (service=%s, did=%s)", serviceID, subjectDID) - // WithParam presentation to be refreshed before it expires + // Set presentation to be refreshed before it expires // TODO: When to refresh? For now, we refresh when the registration is about to expire (75% of max age) refreshVPAfter := time.Now().Add(time.Duration(float64(service.PresentationMaxValidity)*0.75) * time.Second) if err := r.store.updatePresentationRefreshTime(serviceID, subjectDID, &refreshVPAfter); err != nil { diff --git a/discovery/store.go b/discovery/store.go index bfee265bbb..8ffe5f00e2 100644 --- a/discovery/store.go +++ b/discovery/store.go @@ -274,7 +274,7 @@ func (s *sqlStore) updateTag(tx *gorm.DB, serviceID string, newTimestamp Tag) (* result = &ts service.LastTag = ts.Tag(service.TagPrefix) } else { - // WithParam tag: just store it + // Set tag: just store it service.LastTag = newTimestamp } if err := tx.Save(service).Error; err != nil { diff --git a/http/echo_test.go b/http/echo_test.go index 56b6109aa2..cb353773b4 100644 --- a/http/echo_test.go +++ b/http/echo_test.go @@ -68,7 +68,7 @@ func Test_MultiEcho(t *testing.T) { const defaultAddress = ":1323" - // WithParam up expected echo servers + // Set up expected echo servers defaultServer := NewMockEchoServer(ctrl) defaultServer.EXPECT().Add("PATCH", "/other/default-endpoint", gomock.Any()) defaultServer.EXPECT().Start(defaultAddress) diff --git a/http/engine_test.go b/http/engine_test.go index 0e76ffd0e3..5aff265177 100644 --- a/http/engine_test.go +++ b/http/engine_test.go @@ -484,7 +484,7 @@ func generateEd25519TestKey(t *testing.T) (jwk.Key, *jwt.Serializer, []byte) { jwkKey, err := jwk.FromRaw(priv) require.NoError(t, err) - // WithParam the key ID for the jwk to be the public key fingerprint + // Set the key ID for the jwk to be the public key fingerprint err = jwkKey.Set(jwk.KeyIDKey, ssh.FingerprintSHA256(sshPub)) require.NoError(t, err) diff --git a/http/tokenV2/middleware.go b/http/tokenV2/middleware.go index 431f46eab9..dbe0bd8846 100644 --- a/http/tokenV2/middleware.go +++ b/http/tokenV2/middleware.go @@ -180,7 +180,7 @@ func accessGranted(authKey authorizedKey, context echo.Context, token jwt.Token, auditLog := auditLogger(context, token.Subject(), audit.AccessGrantedEvent) auditLog.Infof("Access granted to user '%v' with JWT %s issued to %s by %s", authKey.comment, token.JwtID(), token.Subject(), token.Issuer()) - // WithParam the username from authorized_keys as the username in the context + // Set the username from authorized_keys as the username in the context context.Set(core.UserContextKey, token.Issuer()) // Call the next handler/middleware, probably serving some content/processing the API request @@ -402,7 +402,7 @@ func unauthorizedError(context echo.Context, reason error) *echo.HTTPError { // set the error writer to the unauthorized error writer so the error response follow the default control logic context.Set(core.ErrorWriterContextKey, &unauthorizedErrorWriter{}) - // WithParam an empty username for this context + // Set an empty username for this context context.Set(core.UserContextKey, "") // Log an entry in the audit log about this failure diff --git a/http/tokenV2/middleware_test.go b/http/tokenV2/middleware_test.go index 8a438bd16c..7c6883e95a 100644 --- a/http/tokenV2/middleware_test.go +++ b/http/tokenV2/middleware_test.go @@ -73,7 +73,7 @@ func generateEd25519TestKey(t *testing.T) (jwk.Key, *jwt.Serializer, []byte) { jwkKey, err := jwk.FromRaw(priv) require.NoError(t, err) - // WithParam the key ID for the jwk to be the public key fingerprint + // Set the key ID for the jwk to be the public key fingerprint err = jwkKey.Set(jwk.KeyIDKey, ssh.FingerprintSHA256(sshPub)) require.NoError(t, err) @@ -101,7 +101,7 @@ func generateECDSATestKey(t *testing.T, curve elliptic.Curve, signingAlgorithm j jwkKey, err := jwk.FromRaw(priv) require.NoError(t, err) - // WithParam the key ID for the jwk to be the public key fingerprint + // Set the key ID for the jwk to be the public key fingerprint err = jwkKey.Set(jwk.KeyIDKey, ssh.FingerprintSHA256(sshPub)) require.NoError(t, err) @@ -129,7 +129,7 @@ func generateRSATestKey(t *testing.T, bits int, signingAlgorithm jwa.SignatureAl jwkKey, err := jwk.FromRaw(priv) require.NoError(t, err) - // WithParam the key ID for the jwk to be the public key fingerprint + // Set the key ID for the jwk to be the public key fingerprint err = jwkKey.Set(jwk.KeyIDKey, ssh.FingerprintSHA256(sshPub)) require.NoError(t, err) @@ -206,7 +206,7 @@ func TestAuditLogAccessDenied(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -251,7 +251,7 @@ func TestAuditLogAccessGranted(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -302,7 +302,7 @@ func TestValidJWTEd25519(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -348,7 +348,7 @@ func TestValidJWTEd25519JWKFingerprint(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -391,7 +391,7 @@ func TestValidJWTSingleAudience(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -434,7 +434,7 @@ func TestInvalidSingleAudience(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -473,7 +473,7 @@ func TestValidIssProxiedSub(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -516,7 +516,7 @@ func TestInvalidIss(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -556,7 +556,7 @@ func TestEmptySub(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -594,7 +594,7 @@ func TestValidJWTCaseInsensitiveBearer(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("bEaReR %v", string(serialized)) request.Header.Set("Authorization", header) @@ -631,7 +631,7 @@ func TestValidJWTECDSAES256(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -668,7 +668,7 @@ func TestValidJWTECDSAES384(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -705,7 +705,7 @@ func TestValidJWTECDSAES512(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -743,7 +743,7 @@ func TestWrongAudienceJWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -766,7 +766,7 @@ func TestWrongKeyID(t *testing.T) { token := validJWT(t) token.Set(jwt.AudienceKey, []string{invalidHostname}) - // WithParam the key id to something invalid that the middleware will not be able to locate in its in-memory database + // Set the key id to something invalid that the middleware will not be able to locate in its in-memory database require.NoError(t, key.Set(jwk.KeyIDKey, "invalid-key-id")) // Sign and serialize the JWT @@ -785,7 +785,7 @@ func TestWrongKeyID(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -829,7 +829,7 @@ func TestCorrectKeyIDWithIncorrectSignature(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -870,7 +870,7 @@ func TestExpiredJWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -913,7 +913,7 @@ func TestFutureIATJWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -956,7 +956,7 @@ func TestFutureNBFJWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -997,7 +997,7 @@ func TestUnauthorizedKey(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1035,7 +1035,7 @@ func TestNoAuthorizedKeys(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1107,7 +1107,7 @@ func TestMalformedAuthorizationHeader(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer BAD %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1145,7 +1145,7 @@ func TestNonBearerToken(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Basic %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1184,7 +1184,7 @@ func TestInsecureRS256JWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1223,7 +1223,7 @@ func TestInsecureRS384JWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1261,7 +1261,7 @@ func TestInsecure1024BitRS512JWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1306,7 +1306,7 @@ func TestSecureRS512JWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1350,7 +1350,7 @@ func TestPS256JWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1390,7 +1390,7 @@ func TestPS384JWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1428,7 +1428,7 @@ func TestSecurePS512JWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1459,7 +1459,7 @@ func TestHS256JWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request token := "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.M4GTX4kpyuK-nthSEEgwCjmP8xVGJsW7kQh5CMY5CmM" header := fmt.Sprintf("Bearer %v", token) request.Header.Set("Authorization", header) @@ -1487,7 +1487,7 @@ func TestHS384JWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request token := "eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.KlhAYnODU2I87_7bafWOb1UAOOxoPAyTt3Qxm0NRMiB7vIj3mRTfHNzdTU8sTaYp" header := fmt.Sprintf("Bearer %v", token) request.Header.Set("Authorization", header) @@ -1515,7 +1515,7 @@ func TestHS512JWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request token := "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.D6rYXV3Phv0vymZodiEcztZfXnhvaV14h7hrWG_MJht2NxuxKZ2_-wjg3S_oimWfz0LaF_Uazma1GPA2A_LHDg" header := fmt.Sprintf("Bearer %v", token) request.Header.Set("Authorization", header) @@ -1547,7 +1547,7 @@ func TestNoneAlgUnsignedJWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1587,7 +1587,7 @@ func TestMissingAud(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1627,7 +1627,7 @@ func TestMissingIss(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1667,7 +1667,7 @@ func TestMissingSub(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1707,7 +1707,7 @@ func TestMissingJTI(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1747,7 +1747,7 @@ func TestNonUUIDJTI(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1787,7 +1787,7 @@ func TestMissingIAT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1827,7 +1827,7 @@ func TestMissingEXP(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1867,7 +1867,7 @@ func TestMissingNBF(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1913,7 +1913,7 @@ func TestExpiresLongAfterNotBeforeJWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -1959,7 +1959,7 @@ func TestExpiresLongAfterIssuedAtJWT(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -2005,7 +2005,7 @@ func TestNotBeforePriorToIssuedAt(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request header := fmt.Sprintf("Bearer %v", string(serialized)) request.Header.Set("Authorization", header) @@ -2032,7 +2032,7 @@ func TestRepeatedACharAuthorizationHeader(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request token := "" for len(token) < 99999 { token += "A" @@ -2063,7 +2063,7 @@ func TestNOPSledAuthorizationHeader(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request token := []byte("") for len(token) < 99999 { // 0x90 is an encoded NOP instruction on x86/amd64 and thus serves as a common NOP sled @@ -2095,7 +2095,7 @@ func TestLongB64TripletAuthorizationHeader(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request encodedES512Header := "eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9" raw := make(map[string]string) raw["A"] = "" @@ -2131,7 +2131,7 @@ func TestB64JSONNOPSledAuthorizationHeader(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request encodedES512Header := "eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9" raw := make(map[string][]byte) raw["NOP"] = []byte("") @@ -2167,7 +2167,7 @@ func TestB64NOPSledAuthorizationHeader(t *testing.T) { request, err := http.NewRequest("GET", "/", nil) require.NoError(t, err) - // WithParam the authorization header in the test request + // Set the authorization header in the test request encodedES512Header := "eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9" raw := []byte{} for len(raw) < 8096 { diff --git a/network/network_integration_test.go b/network/network_integration_test.go index 7dbddbb260..bbf8887616 100644 --- a/network/network_integration_test.go +++ b/network/network_integration_test.go @@ -442,7 +442,7 @@ func TestNetworkIntegration_NodeDIDAuthentication(t *testing.T) { }) node2 := startNode(t, "node2", testDirectory) - // WithParam node DID to an unauthenticatable DID, such that authentication must fail + // Set node DID to an unauthenticatable DID, such that authentication must fail malloryDID, _ := did.ParseDID("did:nuts:mallory") node1.network.nodeDID = *malloryDID @@ -470,7 +470,7 @@ func TestNetworkIntegration_NodeDIDAuthentication(t *testing.T) { cfg.NodeDID = "did:nuts:node2" }) - // WithParam node DID to an unauthenticatable DID, such that authentication must fail + // Set node DID to an unauthenticatable DID, such that authentication must fail malloryDID, _ := did.ParseDID("did:nuts:mallory") node2.network.nodeDID = *malloryDID diff --git a/network/transport/grpc/connection.go b/network/transport/grpc/connection.go index 1d0cb99802..8f938f5a5b 100644 --- a/network/transport/grpc/connection.go +++ b/network/transport/grpc/connection.go @@ -134,7 +134,7 @@ func (mc *conn) disconnect() { } mc.outboxes = make(map[string]chan interface{}) - // WithParam peer ID, since when it reconnects it might have changed (due to a reboot). Also reset node DID because it has to be re-authenticated. + // Set peer ID, since when it reconnects it might have changed (due to a reboot). Also reset node DID because it has to be re-authenticated. peer := mc.Peer() peer.ID = "" peer.NodeDID = did.DID{} diff --git a/network/transport/grpc/connection_manager_test.go b/network/transport/grpc/connection_manager_test.go index b879caefdc..2db69baa0b 100644 --- a/network/transport/grpc/connection_manager_test.go +++ b/network/transport/grpc/connection_manager_test.go @@ -253,7 +253,7 @@ func Test_grpcConnectionManager_dialerLoop(t *testing.T) { func Test_grpcConnectionManager_dial(t *testing.T) { t.Run("ok - user agent", func(t *testing.T) { - // WithParam up gRPC stream interceptor to capture headers sent by client + // Set up gRPC stream interceptor to capture headers sent by client actualUserAgent := atomic.Value{} defaultInterceptors = append(defaultInterceptors, func(_ interface{}, stream grpc.ServerStream, _ *grpc.StreamServerInfo, h grpc.StreamHandler) error { m, _ := metadata.FromIncomingContext(stream.Context()) diff --git a/pki/pki_test.go b/pki/pki_test.go index be7528e2c8..5722015d4c 100644 --- a/pki/pki_test.go +++ b/pki/pki_test.go @@ -109,7 +109,7 @@ func TestPKI_CheckHealth(t *testing.T) { require.NotNil(t, e.denylist) t.Run("ok", func(t *testing.T) { - // WithParam time to zero to match non-updated crls/denylist. This works because crls for issuers not valid at nowFunc() are not checked + // Set time to zero to match non-updated crls/denylist. This works because crls for issuers not valid at nowFunc() are not checked nowFunc = func() time.Time { return time.Time{}.Add(time.Hour) } diff --git a/vcr/api/openid4vci/v0/types.go b/vcr/api/openid4vci/v0/types.go index eeff1ac6c2..bd375be388 100644 --- a/vcr/api/openid4vci/v0/types.go +++ b/vcr/api/openid4vci/v0/types.go @@ -1,3 +1,21 @@ +/* + * Copyright (C) 2024 Nuts community + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package v0 import "github.com/nuts-foundation/nuts-node/auth/oauth" diff --git a/vcr/api/vcr/v2/api.go b/vcr/api/vcr/v2/api.go index 37db6ae91c..c5979340d9 100644 --- a/vcr/api/vcr/v2/api.go +++ b/vcr/api/vcr/v2/api.go @@ -111,7 +111,7 @@ func (w Wrapper) IssueVC(ctx context.Context, request IssueVCRequestObject) (Iss { // set missing defaults; // TODO add deprecation warning for this? - // WithParam default context, if not set + // Set default context, if not set if len(requestedVC.Context) == 0 { requestedVC.Context = []ssi.URI{vc.VCContextV1URI(), credential.NutsV1ContextURI} } @@ -145,7 +145,7 @@ func parseCredentialOptions(request IssueVCRequestObject) (*issuer.CredentialOpt options := issuer.CredentialOptions{} - // WithParam format + // Set format if request.Body.Format != nil { options.Format = string(*request.Body.Format) } @@ -176,7 +176,7 @@ func parseCredentialOptions(request IssueVCRequestObject) (*issuer.CredentialOpt if *request.Body.Visibility != Public && *request.Body.Visibility != Private { return nil, core.InvalidInputError("invalid value for visibility") } - // WithParam the actual value + // Set the actual value options.Public = *request.Body.Visibility == Public } diff --git a/vcr/credential/store/sql.go b/vcr/credential/store/sql.go index 91a3b51e50..a23181c3e9 100644 --- a/vcr/credential/store/sql.go +++ b/vcr/credential/store/sql.go @@ -79,7 +79,7 @@ func (c CredentialStore) Store(db *gorm.DB, credential vc.VerifiableCredential) SubjectID: subjectDID.String(), Raw: credential.Raw(), } - // WithParam type + // Set type for _, currType := range credential.Type { if currType.String() != "VerifiableCredential" { val := currType.String() diff --git a/vdr/didjwk/resolver.go b/vdr/didjwk/resolver.go index 6ddd6a0a4a..dae339209d 100644 --- a/vdr/didjwk/resolver.go +++ b/vdr/didjwk/resolver.go @@ -92,7 +92,7 @@ func (w Resolver) Resolve(id did.DID, _ *resolver.ResolveMetadata) (*did.Documen // Create an empty DID document var document did.Document - // WithParam the document ID + // Set the document ID document.ID = id // Add the verification method