Documentation
¶
Index ¶
- Constants
- func CborDecode(payload []byte, output interface{}) error
- func CborEncode(payload interface{}) ([]byte, error)
- func CheckMXRecords(domain string) (bool, error)
- func ConvertFromSmtpEmail(email *abi.Mail) (*types.SmtpEmailInput, error)
- func ConvertToSmtpEmail(email types.SmtpEmailInput) (*abi.Mail, error)
- func CreateMailioDIDDocument() (*mailiodid.Document, error)
- func DIDDocumentToUniqueID(message *types.DIDCommMessage, optionalSuffix string) (string, error)
- func DeepCopy(src, dest interface{}) error
- func DetectInlineContentType(filename string) bool
- func ExtractDIDMessageEndpoint(didDoc *did.Document) string
- func ExtractRootDomain(domain string) (string, error)
- func ExtractSmtpSendingDomain(domain string) (string, error)
- func FixAndDecodeURLBase64(base64String string) ([]byte, error)
- func GenerateEd25519KeyPair() (*string, *string, error)
- func GenerateNonce(n int) string
- func GenerateTXTRecord(domain string, publicKeyBase64 string) (*string, error)
- func GetDiskUsageFromDiskHandlers(address string) int64
- func GetTimestamp() int64
- func HexEncodeToString(str string) string
- func IsEd25519PublicKey(b64Key string) bool
- func IsNilOrEmpty(s *string) bool
- func IsNumber(s string) bool
- func IsSupportedSmtpDomain(domain string) bool
- func IsValidMailioAddress(address string) bool
- func ListSmtpDomains() []string
- func MailioDNSDiscover(ctx context.Context, domain string) (*types.Discovery, error)
- func MailioDNSParseTxtV1(txt string) (*types.Discovery, error)
- func ParseImageBytesToJPG(content []byte, mimeType string) (image.Image, error)
- func PublicKeyToMailioAddress(pubKeyRaw []byte) (string, error)
- func RawPublicKeyToMailioAddress(pubKey ed25519.PublicKey) (string, error)
- func ScrpyBase64ToMappingId(base64ScryptEmail string) (string, error)
- func ScryptEmail(email string) (string, error)
- func ServerSideHandshake(publicServerKey ed25519.PublicKey, privateServerKey ed25519.PrivateKey, ...) (*types.Handshake, error)
- func Sha256Hex(data []byte) string
- func Sign(message []byte, privateKey ed25519.PrivateKey) ([]byte, error)
- func SmtpMailToUniqueID(email *types.SmtpEmailInput, optionalSuffix string) (string, error)
- func StringToInt(str string) int
- func StripDownToRawEmailOrMailioAddress(address string) (string, error)
- func SumUpItemsFromFolderCountResponse(folders []string, response *types.CouchDBCountDistinctFromResponse) int
- func ValidationErrorToMessage(err error) string
- func Verify(message []byte, signature []byte, publicKeyBase64 string) (bool, error)
- func VerifyHandshake(handshake *types.Handshake, userPublicKeyEd25519Base64 string) (bool, error)
- type Data
- type MailioAddress
- type SafeFile
Constants ¶
const (
AddressLength = 20 // bytes
)
Variables ¶
This section is empty.
Functions ¶
func CborEncode ¶
Encode message in Cbor format
func CheckMXRecords ¶
func ConvertFromSmtpEmail ¶
func ConvertFromSmtpEmail(email *abi.Mail) (*types.SmtpEmailInput, error)
ConvertFromSmtpEmail converts the input email to the required format for the SMTP Mailio interface. It takes an email as a parameter and returns the converted email format or an error.
func ConvertToSmtpEmail ¶
func ConvertToSmtpEmail(email types.SmtpEmailInput) (*abi.Mail, error)
ConvertSMTP converts the input email to the required format for the SMTP Mailio interface. It takes an email as a parameter and returns the converted email format or an error.
param email - the email input to be converted return - converted email format or an error if conversion fails Errors: - "invalid email address" if the FROM email address is invalid (ErrInvalidFormat) - "no address" if any invalid addressess are provided for recipients (to, cc, bcc) (ErrInvalidRecipient)
func CreateMailioDIDDocument ¶
TODO! rename the CreateMailioDIDDocument (although it's functionality is ok, but the name is a bit misleading) CreateMailioDIDDocument creates a new mailio DID document (server DID)
func DIDDocumentToUniqueID ¶
func DIDDocumentToUniqueID(message *types.DIDCommMessage, optionalSuffix string) (string, error)
converts the DID document to unique ID
func DetectInlineContentType ¶
DetectInlineContentType checks if the file extension is for inline content
func ExtractDIDMessageEndpoint ¶
Extracts the message endpoint from DID document in case localhost/127.0.0.1 schema is http, otherwise default schema is https
func ExtractRootDomain ¶
func ExtractSmtpSendingDomain ¶
Extract the corresponding smtp sending domain for the given domain from the configuration
func FixAndDecodeURLBase64 ¶
func GenerateEd25519KeyPair ¶
Generated ed25519 signing key pair and returns base64 public key, private key returns publicKey, privateKey, error
func GenerateNonce ¶
Generates a random nonce of custom length in bytes method based on https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-go
func GenerateTXTRecord ¶
func GetDiskUsageFromDiskHandlers ¶
*
- GetDiskUsageFromDiskHandlers returns the total disk usage for the given address from all disk usage handlers
- @param address the address to get the disk usage for *
func GetTimestamp ¶
func GetTimestamp() int64
func IsEd25519PublicKey ¶
Check if a base64 string is an ed25519 public key.
func IsNilOrEmpty ¶
func IsSupportedSmtpDomain ¶
IsSupportedDomain checks if the domain is in the list of smtp server domains or mailio domains
func IsValidMailioAddress ¶
helper to check if the mailio address is valid
func ListSmtpDomains ¶
func ListSmtpDomains() []string
func MailioDNSDiscover ¶
DNS discovery of the domain. Returns Discovery object with the following fields: - Domain: domain name - IsMailio: true if the domain supports Mailio exchange protocol - PublicKeyType: type of the public key (currently only ed25519 is supported) - PublicKey: base64 encoded public key - Ips: IP addresses of the domain
func MailioDNSParseTxtV1 ¶
helper parsing function for MAILIO1 (version 1)
func ParseImageBytesToJPG ¶
ParseImageBytes parses the image bytes and returns the image.Image object
Supported mime types are "image/jpg", "image/jpeg", "image/png"
- @param content []byte
- @param mimeType string
- @return image.Image
- @return error
func ScrpyBase64ToMappingId ¶
Converting Scrypted base64 encoded email to mailio_mapping id
func ScryptEmail ¶
func ServerSideHandshake ¶
func ServerSideHandshake(publicServerKey ed25519.PublicKey, privateServerKey ed25519.PrivateKey, domain string) (*types.Handshake, error)
Handshake from the server side (this is usually used when user has no handshake for specific sender)
func Sign ¶
func Sign(message []byte, privateKey ed25519.PrivateKey) ([]byte, error)
Signing message using ed25519
func SmtpMailToUniqueID ¶
func SmtpMailToUniqueID(email *types.SmtpEmailInput, optionalSuffix string) (string, error)
func StripDownToRawEmailOrMailioAddress ¶
helper to strip down the email address to raw email or mailio address
func SumUpItemsFromFolderCountResponse ¶
func SumUpItemsFromFolderCountResponse(folders []string, response *types.CouchDBCountDistinctFromResponse) int
count the number of messages in all folders except sent
func ValidationErrorToMessage ¶
ValidationErrorToMessage converts a validator.ValidationErrors to a string
Types ¶
type MailioAddress ¶
type MailioAddress [AddressLength]byte
MailioAddress represents the 20 byte address (same as Ethereum account).
func BytesToAddress ¶
func BytesToAddress(b []byte) MailioAddress
BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.
func (*MailioAddress) SetBytes ¶
func (a *MailioAddress) SetBytes(b []byte)
SetBytes sets the address to the value of b. If b is larger than len(a), b will be cropped from the left.
type SafeFile ¶
type SafeFile struct {
// contains filtered or unexported fields
}
I/O thread-safe file operations