check sign config /1
This commit is contained in:
38
dkim.go
38
dkim.go
@@ -1 +1,39 @@
|
|||||||
package dkim
|
package dkim
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// sigOptions represents signing options
|
||||||
|
type sigOptions struct {
|
||||||
|
PrivateKey string
|
||||||
|
Domain string
|
||||||
|
Selector string
|
||||||
|
Auid string
|
||||||
|
Canonicalization string
|
||||||
|
Algo string
|
||||||
|
Headers []string
|
||||||
|
Timestamp time.Time
|
||||||
|
Expiration time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSigOption returns new sigoption with some defaults value
|
||||||
|
func NewSigOptions() sigOptions {
|
||||||
|
return sigOptions{
|
||||||
|
Canonicalization: "simple/simple",
|
||||||
|
Algo: "rsa-sha256",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sign signs an email
|
||||||
|
func Sign(email *bytes.Reader, options sigOptions) (*bytes.Reader, error) {
|
||||||
|
// check config
|
||||||
|
|
||||||
|
// private key (not empty & TODO: valid)
|
||||||
|
if options.PrivateKey == "" {
|
||||||
|
return nil, ErrConfigNoPrivateKey
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user