From fa3982d07a28e1279da33665c681f2c8ab59b515 Mon Sep 17 00:00:00 2001 From: Daniel <dhaavi@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:26:44 +0200 Subject: [PATCH] Fix linter warnings --- core.go | 4 ++-- core_test.go | 2 +- session.go | 4 ++-- suites.go | 14 +++++++------- suites_test.go | 2 +- tools/toollogic.go | 2 +- truststores/keyring.go | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/core.go b/core.go index 188d71e..04bd7f8 100644 --- a/core.go +++ b/core.go @@ -304,7 +304,7 @@ func (s *Session) Open(letter *Letter) ([]byte, error) { //nolint:gocognit,gocyc for i := len(s.integratedCiphers) - 1; i >= 0; i-- { data, err = s.integratedCiphers[i].AuthenticatedDecrypt(data, associatedData) if err != nil { - return nil, fmt.Errorf("%w: [%s] %s", ErrIntegrityViolation, s.integratedCiphers[i].Info().Name, err) + return nil, fmt.Errorf("%w: [%s] %w", ErrIntegrityViolation, s.integratedCiphers[i].Info().Name, err) } } @@ -312,7 +312,7 @@ func (s *Session) Open(letter *Letter) ([]byte, error) { //nolint:gocognit,gocyc for i := len(s.ciphers) - 1; i >= 0; i-- { data, err = s.ciphers[i].Decrypt(data) if err != nil { - return nil, fmt.Errorf("%w: decryption failed: [%s] %s", ErrIntegrityViolation, s.ciphers[i].Info().Name, err) + return nil, fmt.Errorf("%w: decryption failed: [%s] %w", ErrIntegrityViolation, s.ciphers[i].Info().Name, err) } } diff --git a/core_test.go b/core_test.go index ea07472..e2c3849 100644 --- a/core_test.go +++ b/core_test.go @@ -19,7 +19,7 @@ const ( Qui voluptates quod omnis rerum. Soluta dolore quia eius quo similique accusamus. Quisquam fugiat sed voluptatibus eos earum sed. Numquam quia at commodi aut esse ducimus enim. Enim nihil architecto architecto. Reprehenderit at assumenda labore. Et ut sed ut inventore tenetur autem. Iusto et neque ab dolores eum. Praesentium amet sint ut voluptate impedit sit. A accusantium ullam voluptatibus. Adipisci architecto minus dolore tenetur eos. Id illum quo neque laborum numquam laborum animi libero. - Debitis voluptatem non aut ex. Et et quis qui aut aut fugit accusantium. Est dolor quia accusantium culpa. + Debitis voluptatem non aut ex. Et et quis qui aut fugit accusantium. Est dolor quia accusantium culpa. Facere iste dolor a qui. Earum aut facilis maxime repudiandae magnam. Laborum illum distinctio quo libero corrupti maxime. Eum nam officiis culpa nobis. Et repellat qui ut quaerat error explicabo. Distinctio repudiandae sit dolores nam at. Suscipit aliquam alias ullam id.` diff --git a/session.go b/session.go index 24d5d2a..9db282d 100644 --- a/session.go +++ b/session.go @@ -369,7 +369,7 @@ func newSession(e *Envelope) (*Session, error) { //nolint:maintidx // final checks // ============ - // check requirements requirements + // check requirements if s.toolRequirements.Empty() { return nil, errors.New("envelope excludes all security requirements, no meaningful operation possible") } @@ -518,7 +518,7 @@ func (s *Session) checkSecurityLevel(levelToCheck int, subject func() string) er switch { case minimumSecurityLevel > 0: // check against minimumSecurityLevel - // minimumSecurityLevel overrides other checks + // (overrides other checks) if levelToCheck < minimumSecurityLevel { return fmt.Errorf( `%s with a security level of %d is weaker than the desired security level of %d`, diff --git a/suites.go b/suites.go index bfaaf30..c9b5915 100644 --- a/suites.go +++ b/suites.go @@ -67,19 +67,19 @@ var ( // Currently Recommended Suites. - // SuiteKey is a a cipher suite for encryption with a key. + // SuiteKey is a cipher suite for encryption with a key. SuiteKey = SuiteKeyV1 - // SuitePassword is a a cipher suite for encryption with a password. + // SuitePassword is a cipher suite for encryption with a password. SuitePassword = SuitePasswordV1 - // SuiteRcptOnly is a a cipher suite for encrypting for someone, but without verifying the sender/source. + // SuiteRcptOnly is a cipher suite for encrypting for someone, but without verifying the sender/source. SuiteRcptOnly = SuiteRcptOnlyV1 - // SuiteSign is a a cipher suite for signing (no encryption). + // SuiteSign is a cipher suite for signing (no encryption). SuiteSign = SuiteSignV1 - // SuiteSignFile is a a cipher suite for signing files (no encryption). + // SuiteSignFile is a cipher suite for signing files (no encryption). SuiteSignFile = SuiteSignFileV1 - // SuiteComplete is a a cipher suite for both encrypting for someone and signing. + // SuiteComplete is a cipher suite for both encrypting for someone and signing. SuiteComplete = SuiteCompleteV1 - // SuiteWire is a a cipher suite for network communication, including authentication of the server, but not the client. + // SuiteWire is a cipher suite for network communication, including authentication of the server, but not the client. SuiteWire = SuiteWireV1 ) diff --git a/suites_test.go b/suites_test.go index 277f63a..c505df2 100644 --- a/suites_test.go +++ b/suites_test.go @@ -294,7 +294,7 @@ func suiteBullshitCheck(suite *Suite) error { //nolint:maintidx // final checks // ============ - // check requirements requirements + // check requirements if s.toolRequirements.Empty() { return errors.New("suite does not provide any security attributes") } diff --git a/tools/toollogic.go b/tools/toollogic.go index 0461d38..aec2cd0 100644 --- a/tools/toollogic.go +++ b/tools/toollogic.go @@ -101,7 +101,7 @@ type ToolLogic interface { // Signet Handling - // LoadKey loads a key from the Signet's key storage (`Key`) into the Signet's cache (`Loaded*`). If the Signet is marked as public, the storage is expected to only have the public key present, only only it will be loaded. + // LoadKey loads a key from the Signet's key storage (`Key`) into the Signet's cache (`Loaded*`). If the Signet is marked as public, the storage is expected to only have the public key present, only it will be loaded. // Must work with a static (no Setup()) ToolLogic. // Must be overridden by tools that declare FeatureKeyExchange, FeatureKeyEncapsulation or FeatureSigning. LoadKey(SignetInt) error diff --git a/truststores/keyring.go b/truststores/keyring.go index 1132b53..4f09c7e 100644 --- a/truststores/keyring.go +++ b/truststores/keyring.go @@ -58,7 +58,7 @@ func (krts *KeyringTrustStore) GetSignet(id string, recipient bool) (*jess.Signe // Get data from keyring. data, err := keyring.Get(krts.serviceName, id) if err != nil { - return nil, fmt.Errorf("%w: %s", jess.ErrSignetNotFound, err) + return nil, fmt.Errorf("%w: %w", jess.ErrSignetNotFound, err) } // Parse and return. @@ -111,7 +111,7 @@ func (krts *KeyringTrustStore) GetEnvelope(name string) (*jess.Envelope, error) // Get data from keyring. data, err := keyring.Get(krts.serviceName, name) if err != nil { - return nil, fmt.Errorf("%w: %s", jess.ErrEnvelopeNotFound, err) + return nil, fmt.Errorf("%w: %w", jess.ErrEnvelopeNotFound, err) } // Parse and return.