msc {
# Options
hscale="1.5", wordwraparcs=1;
# Define the actors
User, Email, Server, Database;
# Title note
User note Database [
label="Describes the process of registering a new attendee",
textbgcolor="aqua"];
# Define the messages
User->Server [label="New Attendee w/ email"];
Server=>Server [label="Verify email safety"];
--- [label="If email unsafe, return bad email response"];
Server->User [label="Bad Email",
linecolor="red"];
--- [label="Otherwise issue a new challenge"];
Server->Database [label="Create new challenge pair"];
Server->User [label="Send challenge id"];
Server->Email [label="Send challenge code", arcskip=1];
|||;
Email->User [label="Share challenge code", arcskip=1];
|||;
User->Server [label="Attendee info w/ code & id"];
Server->Database [label="Verify challenge code & id"];
Server=>Server [label="Validate data"];
--- [label="If code expired or invalid, return bad auth response"];
Server->User [label="Bad Auth",
linecolor="red"];
--- [label="Otherwise, create the new attendee"];
Server->Database [label="Create attendee"];
Server->User [label="New attendee ID"];
}