From d3f8e980a009edcd743e3d7184ad220e2f48b515 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Depierrepont=20aka=20Toorop?= Date: Sat, 2 May 2015 20:11:15 +0200 Subject: [PATCH] check sign config /1 --- dkim.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/dkim.go b/dkim.go index 8eb14f0..d98f347 100644 --- a/dkim.go +++ b/dkim.go @@ -1 +1,39 @@ 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 +}