Debian Codegraph @

pkg/detectors/stripe/stripe_detector.go

raw symbols SCIP
1 package stripe
2
3 import (
4 "github.com/DefangLabs/secret-detector/pkg/detectors/helpers"
5 "github.com/DefangLabs/secret-detector/pkg/secrets"
6 )
7
8 const (
9 Name = "stripe"
10 secretType = "Stripe API key"
11
12 // Stripe standard API Key begins with sk_live_
13 // Stripe restricted API Key begins with rk_live_
14 // More information: https://stripe.com/docs/keys
15 apiKeyRegex = `[rs]k_(live|test)_[0-9a-zA-Z]{24}`
16 )
17
18 func init() {
19 secrets.GetDetectorFactory().Register(Name, NewDetector)
20 }
21
22 // detector for Stripe API keys - https://stripe.com/
23 type detector struct {
24 secrets.Detector
25 }
26
27 func NewDetector(config ...string) secrets.Detector {
28 return &detector{
29 Detector: helpers.NewRegexDetectorBuilder(secretType, apiKeyRegex).Build(),
30 }
31 }