Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions examples/signer-server/signer-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/IABTechLab/adscert/pkg/adscert/discovery"
"github.com/IABTechLab/adscert/pkg/adscert/logger"
"github.com/IABTechLab/adscert/pkg/adscert/signatory"
"github.com/benbjohnson/clock"
)

var (
Expand All @@ -35,7 +34,6 @@ func main() {
signatoryApi := signatory.NewLocalAuthenticatedConnectionsSignatory(
*origin,
crypto_rand.Reader,
clock.New(),
discovery.NewDefaultDnsResolver(),
discovery.NewDefaultDomainStore(),
time.Duration(30*time.Second), // domain check interval
Expand Down
2 changes: 0 additions & 2 deletions examples/verifier-parser/verifier-parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/IABTechLab/adscert/pkg/adscert/discovery"
"github.com/IABTechLab/adscert/pkg/adscert/logger"
"github.com/IABTechLab/adscert/pkg/adscert/signatory"
"github.com/benbjohnson/clock"
)

var (
Expand All @@ -37,7 +36,6 @@ func main() {
signatoryApi := signatory.NewLocalAuthenticatedConnectionsSignatory(
*origin,
crypto_rand.Reader,
clock.New(),
discovery.NewDefaultDnsResolver(),
discovery.NewDefaultDomainStore(),
time.Duration(30*time.Second), // domain check interval
Expand Down
2 changes: 0 additions & 2 deletions examples/verifier-server/verifier-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/IABTechLab/adscert/pkg/adscert/logger"
"github.com/IABTechLab/adscert/pkg/adscert/metrics"
"github.com/IABTechLab/adscert/pkg/adscert/signatory"
"github.com/benbjohnson/clock"
"github.com/prometheus/client_golang/prometheus/promhttp"
)

Expand Down Expand Up @@ -46,7 +45,6 @@ func main() {
signatoryApi := signatory.NewLocalAuthenticatedConnectionsSignatory(
*origin,
crypto_rand.Reader,
clock.New(),
discovery.NewDefaultDnsResolver(),
discovery.NewDefaultDomainStore(),
time.Duration(30*time.Second), // domain check interval
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/IABTechLab/adscert
go 1.16

require (
github.com/benbjohnson/clock v1.3.0
github.com/google/go-cmp v0.5.9
github.com/google/tink/go v1.6.1
github.com/prometheus/client_golang v1.12.1
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/aws/aws-sdk-go v1.36.29/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
Expand Down
8 changes: 2 additions & 6 deletions internal/keyring/keyring_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,22 @@ package keyring

import (
"time"

"github.com/benbjohnson/clock"
)

type KeyringManager struct {
configList *AdsCertCallSignConfigList
clock clock.Clock
keyGenerator KeyGenerator
}

func NewKeyringManager(configList *AdsCertCallSignConfigList, clock clock.Clock, keyGenerator KeyGenerator) *KeyringManager {
func NewKeyringManager(configList *AdsCertCallSignConfigList, keyGenerator KeyGenerator) *KeyringManager {
return &KeyringManager{
configList: configList,
clock: clock,
keyGenerator: keyGenerator,
}
}

func (m *KeyringManager) AssignKeys() error {
actionTimestamp := m.clock.Now().UTC().Format(time.RFC3339)
actionTimestamp := time.Now().UTC().Format(time.RFC3339)
realms := m.configList.GetAllCallSignRealms()
for _, r := range realms {
if len(r.Keys) == 0 {
Expand Down
2 changes: 0 additions & 2 deletions internal/server/server_reference_implementation.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/IABTechLab/adscert/pkg/adscert/metrics"
"github.com/IABTechLab/adscert/pkg/adscert/server"
"github.com/IABTechLab/adscert/pkg/adscert/signatory"
"github.com/benbjohnson/clock"
"github.com/prometheus/client_golang/prometheus/promhttp"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
Expand All @@ -23,7 +22,6 @@ func SetUpAdsCertSignatoryServer(grpcServer *grpc.Server, adscertCallSign string
signatoryApi := signatory.NewLocalAuthenticatedConnectionsSignatory(
adscertCallSign,
crypto_rand.Reader,
clock.New(),
discovery.NewDefaultDnsResolver(),
discovery.NewDefaultDomainStore(),
domainCheckInterval,
Expand Down
10 changes: 3 additions & 7 deletions pkg/adscert/signatory/signatory_local_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ import (
"github.com/IABTechLab/adscert/pkg/adscert/api"
"github.com/IABTechLab/adscert/pkg/adscert/discovery"
"github.com/IABTechLab/adscert/pkg/adscert/metrics"
"github.com/benbjohnson/clock"
)

func NewLocalAuthenticatedConnectionsSignatory(
originCallsign string,
secureRandom io.Reader,
clock clock.Clock,
dnsResolver discovery.DNSResolver,
domainStore discovery.DomainStore,
domainCheckInterval time.Duration,
Expand All @@ -28,22 +26,20 @@ func NewLocalAuthenticatedConnectionsSignatory(
return &LocalAuthenticatedConnectionsSignatory{
originCallsign: originCallsign,
secureRandom: secureRandom,
clock: clock,
counterpartyManager: discovery.NewDefaultDomainIndexer(dnsResolver, domainStore, domainCheckInterval, domainRenewalInterval, base64PrivateKeys),
}
}

type LocalAuthenticatedConnectionsSignatory struct {
originCallsign string
secureRandom io.Reader
clock clock.Clock

counterpartyManager discovery.DomainIndexer
}

func (s *LocalAuthenticatedConnectionsSignatory) SignAuthenticatedConnection(request *api.AuthenticatedConnectionSignatureRequest) (*api.AuthenticatedConnectionSignatureResponse, error) {
var err error
startTime := s.clock.Now()
startTime := time.Now()
response := &api.AuthenticatedConnectionSignatureResponse{RequestInfo: request.RequestInfo}

if request.RequestInfo.InvokingDomain == "dryrun" {
Expand All @@ -59,7 +55,7 @@ func (s *LocalAuthenticatedConnectionsSignatory) SignAuthenticatedConnection(req
// add nonce and timestamp if not already provided in the request
// this is the typical case to keep the client's usage simple
if request.Timestamp == "" {
request.Timestamp = s.clock.Now().UTC().Format("060102T150405")
request.Timestamp = time.Now().UTC().Format("060102T150405")
}
if request.Nonce == "" {
if request.Nonce, err = s.generateNonce(); err != nil {
Expand Down Expand Up @@ -134,7 +130,7 @@ func (s *LocalAuthenticatedConnectionsSignatory) signSingleMessage(request *api.

func (s *LocalAuthenticatedConnectionsSignatory) VerifyAuthenticatedConnection(request *api.AuthenticatedConnectionVerificationRequest) (*api.AuthenticatedConnectionVerificationResponse, error) {

startTime := s.clock.Now()
startTime := time.Now()
response := &api.AuthenticatedConnectionVerificationResponse{}

for _, requestInfo := range request.RequestInfo {
Expand Down