a
This commit is contained in:
@@ -327,13 +327,18 @@ func Verify(message []byte) (domain string, err error) {
|
||||
}
|
||||
|
||||
// DNSRecord returns the DKIM TXT record string for publishing.
|
||||
func DNSRecord(selector, domain, publicKeyPEM string) string {
|
||||
// algo must be "rsa2048" or "ed25519"; any other value defaults to "rsa".
|
||||
func DNSRecord(selector, domain, publicKeyPEM, algo string) string {
|
||||
block, _ := pem.Decode([]byte(publicKeyPEM))
|
||||
var p string
|
||||
if block != nil {
|
||||
p = base64.StdEncoding.EncodeToString(block.Bytes)
|
||||
}
|
||||
return fmt.Sprintf("%s._domainkey.%s. IN TXT \"v=DKIM1; k=rsa; p=%s\"", selector, domain, p)
|
||||
k := "rsa"
|
||||
if algo == "ed25519" {
|
||||
k = "ed25519"
|
||||
}
|
||||
return fmt.Sprintf("%s._domainkey.%s. IN TXT \"v=DKIM1; k=%s; p=%s\"", selector, domain, k, p)
|
||||
}
|
||||
|
||||
// SPFRecord returns the recommended SPF TXT record for a domain.
|
||||
|
||||
Reference in New Issue
Block a user