Repository Public
1// The printable recovery kit: one page, black on white, no app chrome. Printed with NSPrintOperation on macOS and2// UIPrintInteractionController on iOS; never written to disk by the app.3import SwiftUI45struct RecoveryKitSheet: View {6 let recoveryKey: String7 let handle: String8 let server: String910 private var groups: [String] { Array(recoveryKey.split(separator: "-").map(String.init).dropFirst()) }1112 var body: some View {13 VStack(alignment: .leading, spacing: 18) {14 HStack(spacing: 10) {15 KeyholeShape().fill(Color.black).frame(width: 14, height: 20)16 Text("SP Vault — Recovery kit").font(.system(size: 22, weight: .semibold, design: .serif))17 }18 Rectangle().fill(Color.black).frame(height: 1)19 Grid(alignment: .leading, horizontalSpacing: 16, verticalSpacing: 6) {20 GridRow { Text("Account").foregroundStyle(.gray); Text(handle).fontWeight(.semibold) }21 GridRow { Text("Server").foregroundStyle(.gray); Text(server) }22 GridRow { Text("Printed").foregroundStyle(.gray); Text(Date().formatted(date: .long, time: .omitted)) }23 }24 .font(.system(size: 12))25 Text("Recovery key").font(.system(size: 11, weight: .semibold)).kerning(1).foregroundStyle(.gray)26 VStack(alignment: .leading, spacing: 12) {27 Text("SPV1").font(.system(size: 15, weight: .bold, design: .monospaced))28 LazyVGrid(columns: Array(repeating: GridItem(.flexible(), alignment: .leading), count: 5), alignment: .leading, spacing: 12) {29 ForEach(Array(groups.enumerated()), id: \.offset) { i, g in30 VStack(alignment: .leading, spacing: 1) {31 Text("\(i + 1)").font(.system(size: 8, design: .monospaced)).foregroundStyle(.gray)32 Text(g).font(.system(size: 17, weight: .bold, design: .monospaced)).kerning(1.5)33 }34 }35 }36 }37 .padding(16)38 .overlay(RoundedRectangle(cornerRadius: 8).strokeBorder(Color.black, lineWidth: 1.5))39 VStack(alignment: .leading, spacing: 8) {40 Text("How to use it").font(.system(size: 13, weight: .semibold))41 Text("On a new device, open SP Vault, choose “Recover with recovery key”, enter the account name and the key above (SPV1 followed by the 14 groups, in order).")42 Text("Keep this page away from your devices, in a place only you can reach. Anyone who holds it can open the vault. Without a trusted device or this key the vault cannot be recovered by anyone — including the server operator.")43 Text("If this page may have been seen, issue a new recovery key in Settings; this one then stops working.")44 }45 .font(.system(size: 11.5)).fixedSize(horizontal: false, vertical: true)46 Spacer(minLength: 0)47 }48 .foregroundStyle(Color.black)49 .padding(28)50 .background(Color.white)51 }52}53