Electronic signatures on logbook entries (AC 120-78B chapter 2)

- Sign an entry: review exactly what's certified, choose a current
  certificate (eligibility checked: pilot only for preventive maintenance,
  inspections need their result and time), re-enter the password or sign
  in again with SSO (prompt=login, within 5 minutes), and confirm the
  "Certified by" statement (43.9 return to service, 43.11(a)(5) for
  inspections, preventive maintenance for pilots)
- The signature stores signer, certificate, statement, UTC time, how they
  authenticated, IP/browser, a SHA-256 fingerprint of the entry's content
  and a readable snapshot; an HMAC seal covers the signature record. Status
  shows Valid / Superseded / Altered since signing. The signer is emailed
- Signed entries (and their sub-components) can't be edited or deleted;
  a correction entry, once signed, supersedes the original (kept)
- Owners invite an outside mechanic by email to sign one entry: one-time,
  14-day link; they create or use their own account and certificate and
  see only that entry
- Admins can disable accounts (signed out, can't sign in or sign; past
  signatures kept); users with signatures can't be deleted
- Printouts show the electronic signature and fingerprint; archives carry
  signatures (marked imported, with their origin) and corrections

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-07 13:12:04 -05:00
1 parent 7caa213e7a
commit d719f663bc
47 files changed
+1059 -17

No files matched your search

@@ -0,0 +1,19 @@
<%# Everything a signature covers, as the signer reviews it (AC 120-78B 2.2.4). %>
<dl class="grid gap-x-4 gap-y-1 text-sm sm:grid-cols-[10rem_1fr]">
<dt class="text-slate-500">Aircraft</dt><dd><%= entry.aircraft.tail_number %> <%= [ entry.aircraft.make, entry.aircraft.model ].compact_blank.join(" ") %><%= " · S/N #{entry.aircraft.serial_number}" if entry.aircraft.serial_number.present? %></dd>
<dt class="text-slate-500">Date</dt><dd><%= fmt_date(entry.date) %></dd>
<dt class="text-slate-500">Logbook</dt><dd><%= LogbookEntry::LOG_TYPES[entry.log_type] %> · <%= LogbookEntry::ENTRY_TYPES[entry.entry_type] %></dd>
<dt class="text-slate-500">Airframe total time</dt><dd><%= hours(entry.aircraft_hours_at_entry) %> (<%= entry.aircraft.time_basis %>)</dd>
<% if (c = entry.component) %>
<dt class="text-slate-500"><%= c.component_type&.name %></dt>
<dd><%= c.manufacturer %> <%= c.model %><%= " · S/N #{c.serial_number}" if c.serial_number.present? %> · <%= hours(entry.component_hours_at_entry) %> total, <%= hours(entry.component_since_overhaul_at_entry) %> <%= c.since_overhaul_abbreviation %></dd>
<% end %>
<% entry.parts.each do |part| %>
<dt class="text-slate-500"><%= part.component.component_type&.name %></dt>
<dd><%= part.component.manufacturer %> <%= part.component.model %><%= " · S/N #{part.component.serial_number}" if part.component.serial_number.present? %> · <%= hours(part.hours_at_entry) %> total, <%= hours(part.since_overhaul_at_entry) %> <%= part.component.since_overhaul_abbreviation.downcase %></dd>
<% end %>
<% if entry.inspection_result %><dt class="text-slate-500">Result</dt><dd><%= entry.inspection_result_label %></dd><% end %>
<% if entry.signoff_location.present? %><dt class="text-slate-500">Location</dt><dd><%= entry.signoff_location %></dd><% end %>
<% if entry.supersedes %><dt class="text-slate-500">Corrects</dt><dd>The <%= entry.supersedes.date %> entry</dd><% end %>
</dl>
<div class="mt-3 whitespace-pre-wrap rounded bg-slate-50 p-3 font-mono text-sm"><%= entry.text %></div>
+7
View File
@@ -1,5 +1,12 @@
<%= form_with model: [aircraft, entry], class: "card card-body space-y-4 max-w-3xl", data: { controller: "entry-template signer component-times", component_times_aircraft_hours_value: aircraft.current_hours.to_f } do |f| %>
<%= f.errors_summary %>
<% if entry.supersedes %>
<%= f.hidden_field :supersedes_id %>
<p class="rounded-md bg-amber-50 px-3 py-2 text-sm text-amber-900 ring-1 ring-amber-200">
Correcting the signed <%= link_to "#{entry.supersedes.date} entry", aircraft_logbook_entry_path(aircraft, entry.supersedes), class: "link" %>.
Change what's wrong, save, then sign it: the original's signature is then marked superseded (it's kept, not deleted).
</p>
<% end %>
<% templates = entry.new_record? ? LogbookTemplate.ordered.to_a : [] %>
<% if templates.any? %>
<div>
@@ -0,0 +1,14 @@
<%# The signature block on an entry's page. %>
<% sig = entry.signature %>
<% box, title = { valid: [ "bg-emerald-50 ring-emerald-200", "text-emerald-900" ], superseded: [ "bg-amber-50 ring-amber-200", "text-amber-900" ],
altered: [ "bg-red-50 ring-red-200", "text-red-900" ] }.fetch(sig.imported? ? :valid : sig.status) %>
<div class="rounded-md p-3 text-sm ring-1 <%= box %>">
<div class="font-medium <%= title %>"><%= EntrySignature::LABEL %> <%= sig.signer_name %>, <%= sig.certificate_label %> <%= sig.certificate_number %></div>
<div class="text-slate-700">Signed electronically <%= sig.signed_at.utc.strftime("%Y-%m-%d %H:%M UTC") %><%= " (#{EntrySignature::AUTH_METHODS[sig.auth_method]})" if EntrySignature::AUTH_METHODS[sig.auth_method] %></div>
<div class="mt-1 italic text-slate-700">“<%= sig.statement %>”</div>
<div class="mt-1 text-xs text-slate-500">
Status: <strong><%= sig.imported? ? "Signed on #{sig.origin} (imported)" : sig.status_label %></strong>
· Fingerprint <span class="font-mono"><%= sig.content_digest.first(16) %>…</span>
<% if entry.superseded_by %> · Corrected by <%= link_to "the #{entry.superseded_by.date} entry", aircraft_logbook_entry_path(entry.aircraft, entry.superseded_by), class: "link" %><% end %>
</div>
</div>
+2 -1
View File
@@ -31,7 +31,8 @@
<td class="max-w-xl"><%= e.text.truncate(220) %> <%= "📄" if e.document %>
<% unless e.verified? %><span class="badge-orange" title="Transcribed by Claude<%= " (#{e.transcription_confidence} confidence)" if e.transcription_confidence %>; check it against the scan">Unverified</span><% end %></td>
<td class="text-xs text-slate-500"><%= e.signoff_person %><%= " ##{e.signoff_certificate_number}" if e.signoff_certificate_number %><% if e.signoff_location.present? %><br><%= e.signoff_location %><% end %>
<% if (missing = e.missing_record_items).any? %><br><span class="badge-orange" title="Missing: <%= missing.to_sentence %>">Incomplete</span><% end %></td>
<% if e.signature %><br><span class="<%= e.superseded? ? 'badge-orange' : 'badge-green' %>" title="Signed electronically by <%= e.signature.signer_name %>"><%= e.superseded? ? "Superseded" : "Signed" %></span>
<% elsif (missing = e.missing_record_items).any? %><br><span class="badge-orange" title="Missing: <%= missing.to_sentence %>">Incomplete</span><% end %></td>
</tr>
<% end %>
</tbody>
+13 -1
View File
@@ -4,10 +4,22 @@
<h2 class="card-title"><%= LogbookEntry::LOG_TYPES[@entry.log_type] %> log — <%= fmt_date(@entry.date) %></h2>
<div class="flex gap-2">
<%= link_to "Print for logbook", new_aircraft_logbook_print_path(@aircraft, ids: [ @entry.id ]), class: "btn-secondary btn-sm" %>
<% if owner? %><%= link_to "Edit", edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "btn-secondary btn-sm" %><% end %>
<% if @entry.signed? %>
<% if owner? && !@entry.superseded? && !@entry.superseded_by %><%= link_to "Correct this entry", new_aircraft_logbook_entry_path(@aircraft, supersedes: @entry.id), class: "btn-secondary btn-sm" %><% end %>
<% else %>
<%= link_to "Sign", new_aircraft_logbook_entry_signature_path(@aircraft, @entry), class: "btn-primary btn-sm" %>
<% if owner? %>
<%= link_to "Ask someone to sign", new_aircraft_logbook_entry_signing_invitation_path(@aircraft, @entry), class: "btn-secondary btn-sm" %>
<%= link_to "Edit", edit_aircraft_logbook_entry_path(@aircraft, @entry), class: "btn-secondary btn-sm" %>
<% end %>
<% end %>
</div>
</div>
<div class="card-body space-y-3">
<% if @entry.signed? %><%= render "logbook_entries/signature", entry: @entry %>
<% elsif LogbookEntry::RECORD_TYPES.include?(@entry.entry_type) %>
<p class="rounded-md bg-slate-50 px-3 py-2 text-sm text-slate-600 ring-1 ring-slate-200">Not signed electronically.<%= " Pending correction of the #{@entry.supersedes.date} entry." if @entry.supersedes %> Sign it here, or print it and sign the paper copy.</p>
<% end %>
<% unless @entry.verified? %>
<div class="flex flex-wrap items-center justify-between gap-2 rounded-md bg-amber-50 px-3 py-2 text-sm text-amber-900 ring-1 ring-amber-200">
<span>Transcribed by Claude<%= " (#{@entry.transcription_confidence} confidence)" if @entry.transcription_confidence %> and not yet checked. Compare it with the scan<%= @entry.document ? "" : " or the paper logbook" %> before relying on it.</span>