MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / GetDKIMKeyInternal

Method GetDKIMKeyInternal

internal/identity/store.go:587–606  ·  view source on GitHub ↗

GetDKIMKeyInternal returns the stored selector + private key bytes for a domain. The "Internal" suffix is load-bearing: this function does NOT scope by user — it takes a domain name and returns whoever owns that domain's signing key. ONLY call from server-internal codepaths where the domain has alre

(ctx context.Context, domain string)

Source from the content-addressed store, hash-verified

585// treat this as "skip signing" and fall back to whatever the
586// relay-level fallback does.
587func (s *Store) GetDKIMKeyInternal(ctx context.Context, domain string) (string, []byte, error) {
588 norm := normalizeDomain(domain)
589 var selector string
590 var privKey []byte
591 err := s.pool.QueryRow(ctx,
592 `SELECT COALESCE(dkim_selector, ''), dkim_private_key FROM domains WHERE domain = $1`,
593 norm,
594 ).Scan(&selector, &privKey)
595 if errors.Is(err, pgx.ErrNoRows) {
596 return "", nil, nil
597 }
598 if err != nil {
599 return "", nil, fmt.Errorf("dkim key lookup: %w", err)
600 }
601 der, err := s.unsealDKIM(privKey, norm)
602 if err != nil {
603 return "", nil, fmt.Errorf("dkim key unseal: %w", err)
604 }
605 return selector, der, nil
606}
607
608// --- Sender identity (decision 4 / Slice 4) ---
609//

Implementers 1

Storeinternal/identity/store.go

Calls 4

unsealDKIMMethod · 0.95
normalizeDomainFunction · 0.85
ScanMethod · 0.80
QueryRowMethod · 0.80