usertypes

package
v3.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressModeToVault

func AddressModeToVault(mode AddressMode) vault.AddressMode

func GetAddrID

func GetAddrID(apiAddrs map[string]proton.Address, email string) (string, error)

GetAddrID returns the address ID for the given email address.

func GetAddrIdx

func GetAddrIdx(apiAddrs map[string]proton.Address, idx int) (proton.Address, error)

GetAddrIdx returns the address with the given index.

func GetPrimaryAddr

func GetPrimaryAddr(apiAddrs map[string]proton.Address) (proton.Address, error)

func GroupBy

func GroupBy[Key comparable, Value any](items []Value, key func(Value) Key) map[Key]Value

GroupBy returns a map of the given slice grouped by the given key. Duplicate keys are overwritten.

func MapTo

func MapTo[From, To any](from []From) []To

MapTo converts the slice to the given type. This is not runtime safe, so make sure the slice is of the correct type! (This is a workaround for the fact that slices cannot be converted to other types generically).

func NewProtonAPIScheduler

func NewProtonAPIScheduler(panicHandler async.PanicHandler) proton.Scheduler

func SanitizeEmail

func SanitizeEmail(email string) string

func WithAddrKR

func WithAddrKR(apiUser proton.User, apiAddr proton.Address, keyPass []byte, fn func(userKR, addrKR *crypto.KeyRing) error) error

func WithAddrKRs

func WithAddrKRs(apiUser proton.User, apiAddr map[string]proton.Address, keyPass []byte, fn func(*crypto.KeyRing, map[string]*crypto.KeyRing) error) error

Types

type AddressMode

type AddressMode int
const (
	AddressModeCombined AddressMode = iota
	AddressModeSplit
)

func VaultToAddressMode

func VaultToAddressMode(mode vault.AddressMode) AddressMode

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL