• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / deviceauth / 1235120144

01 Apr 2024 06:38AM UTC coverage: 82.855%. Remained the same
1235120144

Pull #709

gitlab-ci

web-flow
chore: bump the golang-dependencies group with 1 update

Bumps the golang-dependencies group with 1 update: [github.com/stretchr/testify](https://github.com/stretchr/testify).


Updates `github.com/stretchr/testify` from 1.8.4 to 1.9.0
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.4...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: golang-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #709: chore: bump the golang-dependencies group with 1 update

4852 of 5856 relevant lines covered (82.86%)

47.34 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.0
/model/authreq.go
1
// Copyright 2023 Northern.tech AS
2
//
3
//        Licensed under the Apache License, Version 2.0 (the "License");
4
//        you may not use this file except in compliance with the License.
5
//        You may obtain a copy of the License at
6
//
7
//            http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//        Unless required by applicable law or agreed to in writing, software
10
//        distributed under the License is distributed on an "AS IS" BASIS,
11
//        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//        See the License for the specific language governing permissions and
13
//        limitations under the License.
14
package model
15

16
import (
17
        "crypto"
18
        "errors"
19

20
        "github.com/mendersoftware/deviceauth/utils"
21
)
22

23
// note: fields with underscores need the 'bson' decorator
24
// otherwise the underscore will be removed upon write to mongo
25
type AuthReq struct {
26
        IdData      string `json:"id_data" bson:"id_data"`
27
        TenantToken string `json:"tenant_token" bson:"tenant_token"`
28
        PubKey      string `json:"pubkey"`
29

30
        //helpers, not serialized
31
        PubKeyStruct crypto.PublicKey `json:"-" bson:"-"`
32
}
33

34
func (r *AuthReq) Validate() error {
1✔
35
        if r.IdData == "" {
1✔
36
                return errors.New("id_data must be provided")
×
37
        }
×
38

39
        if r.PubKey == "" {
1✔
40
                return errors.New("pubkey must be provided")
×
41
        }
×
42

43
        // normalize pubkey by parsing+serializing the key string
44
        //in between, save it in a temp field because it will be useful outside of Validate()
45
        key, err := utils.ParsePubKey(r.PubKey)
1✔
46
        if err != nil {
2✔
47
                return err
1✔
48
        }
1✔
49

50
        r.PubKeyStruct = key
1✔
51

1✔
52
        serialized, err := utils.SerializePubKey(key)
1✔
53
        if err != nil {
1✔
54
                return err
×
55
        }
×
56

57
        r.PubKey = serialized
1✔
58

1✔
59
        if sorted, err := utils.JsonSort(r.IdData); err != nil {
1✔
60
                return err
×
61
        } else {
1✔
62
                r.IdData = sorted
1✔
63
        }
1✔
64

65
        // not checking tenant token for now - TODO
66
        return nil
1✔
67
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc