NAME

Mail::DKIM2::MessageStore - Keep message snapshots keyed by Message-Instance

SYNOPSIS

use Mail::DKIM2::MessageStore;

my $store = Mail::DKIM2::MessageStore->new(
    directory => '/var/spool/dkim2/snapshots',
);
$store->store($mi_value, $message_data);     # on the way in
my $snapshot = $store->fetch($mi_value);     # on the way out
$store->remove($mi_value);

DESCRIPTION

A filesystem store used by the authentication_milter handlers. The inbound handler stores each message under its top Message-Instance value; when the message leaves again, modified by a list or a forwarder, the outbound handler fetches the snapshot and has Mail::DKIM2::MessageInstance compute a Recipe between the two. Keys are the SHA-256 of the unfolded value, under two-character prefix directories.

METHODS

new(directory => $path)

directory is required.

store($mi_value, $message_data)

Writes the snapshot, creating directories as needed. Returns the key.

fetch($mi_value)

The stored data, or undef.

remove($mi_value)

Deletes the snapshot. True if it existed.

rel_path_for_mi($mi_value)

The path of the snapshot relative to the directory.

AUTHOR

Bron Gondwana <brong@fastmailteam.com>

COPYRIGHT AND LICENSE

Copyright (c) 2025-2026 Fastmail Pty Ltd. This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.