payloadFor static method
The same payload as toJson, for a package whose enrollment does not exist yet.
A key package riding enroll:request is built before the atServer has
assigned an enrollment id, so there is no KeyPackage to build it from.
The id is not part of the payload anyway — the enrollment record carries
it, and fromPayload injects it back on read. suites defaults to what
keys can actually open; an overstated claim here can be repaired only by
the enrollment itself, since enroll:update reaches metadata and is
self-only.
Implementation
static Map<String, Object?> payloadFor({
required DateTime createdAt,
required List<PackageKey> keys,
List<String>? suites,
int v = currentVersion,
}) =>
{
'v': v,
'createdAt': createdAt.toUtc().toIso8601String(),
'keys': keys.map((k) => k.toJson()).toList(),
'suites': suites ??
SecretSharingAlgos.openableSuitesForAll(keys.map((k) => k.alg)),
};