blob: cefa1ccc8fac6a109963b4b175e7cddcbd5ddb4d [file] [log] [blame]
package main
import (
"context"
"time"
"code.hackerspace.pl/hscloud/bgpwtf/cccampix/verifier/model"
"github.com/sethvargo/go-password/password"
)
type secretGen struct {
}
func newSecretGen() (processor, error) {
return &secretGen{}, nil
}
func (p *secretGen) Name() string {
return "SecretGen"
}
func (p *secretGen) NextRun(now time.Time) time.Time {
return now.Add(1 * time.Minute)
}
func gen() model.SessionConfig {
secret := password.MustGenerate(16, 4, 0, false, true)
return model.SessionConfig{
BGPSecret: secret,
}
}
func (p *secretGen) RunAll(ctx context.Context, m model.Model) error {
return m.ConfigureMissingSessions(ctx, gen)
}