A choreography is a tree. Leaves name configured components; sequence, choice, and pick decide how those leaves become a flow.
Put steps in order
sequence requires every child in order.
const choreography = sequence("email", "password", "otp");
Offer different routes
choice presents alternatives. A branch may contain another sequence.
const choreography = choice(
"webauthn",
sequence("email", "password", "otp"),
);
The client receives a choice prompt, reads the available branches from dance.choices, and selects one with dance.choose(name).
Require any number of steps
pick(count, ...components) is an ordered selection: the person chooses count different branches, one after another.
const choreography = pick(2, "password", "totp", "webauthn");
This is useful when policy requires a number of enrolled proofs while allowing the identity to choose which ones to use.
Name explicit leaves
String arguments are converted to component nodes for convenience. component("email") creates the same explicit leaf when code benefits from the full shape.
The utilities simplify, walk, peek, and isEquals inspect choreography trees. They are exported from the main package alongside the four constructors.