Skip to content

Commit 0c25249

Browse files
committed
Improved Bytewords and BIP-39 entry guidance messages.
1 parent 925286c commit 0c25249

8 files changed

Lines changed: 160 additions & 112 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ _For related Threat Modeling, see the [Seed Tool Manual](https://github.com/Bloc
5151

5252
* THIS IS A RELEASE CANDIDATE
5353
* Fixed: Output descriptor was not being included in the QR code on Seed backup printed pages.
54+
* Improved layout of Seed Backup print page. Now makes more efficient use of page space and allows significantly longer notes to be printed without truncation.
5455

5556
### 1.6 (76)
5657

SeedTool.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@
110110
79C73B19261FEB2100B47D85 /* SSKRSharePage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79C73B18261FEB2100B47D85 /* SSKRSharePage.swift */; };
111111
79CBB262284AE79100EBE0DE /* NoSeedSelected.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79CBB261284AE79100EBE0DE /* NoSeedSelected.swift */; };
112112
79CC47AB2675A9B000C433AE /* Cloud.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79CC47AA2675A9B000C433AE /* Cloud.swift */; };
113+
79CD94DA2B6E2D2D00182007 /* BackupPageLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79CD94D92B6E2D2D00182007 /* BackupPageLabel.swift */; };
114+
79CD94DC2B6E304100182007 /* BackupPageNoteSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79CD94DB2B6E304100182007 /* BackupPageNoteSection.swift */; };
115+
79CD94DE2B6E31E200182007 /* BackupPageSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79CD94DD2B6E31E200182007 /* BackupPageSection.swift */; };
113116
79CDDB8825C0E47400E801F2 /* KeyExportDerivationPreset.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79CDDB8725C0E47400E801F2 /* KeyExportDerivationPreset.swift */; };
114117
79CDDB8A25C0E49300E801F2 /* KeyExportModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79CDDB8925C0E49300E801F2 /* KeyExportModel.swift */; };
115118
79DDBA6B25D5311E0028EDF4 /* SwiftUIPrint in Frameworks */ = {isa = PBXBuildFile; productRef = 79DDBA6A25D5311E0028EDF4 /* SwiftUIPrint */; };
@@ -253,6 +256,9 @@
253256
79C73B18261FEB2100B47D85 /* SSKRSharePage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SSKRSharePage.swift; sourceTree = "<group>"; };
254257
79CBB261284AE79100EBE0DE /* NoSeedSelected.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoSeedSelected.swift; sourceTree = "<group>"; };
255258
79CC47AA2675A9B000C433AE /* Cloud.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cloud.swift; sourceTree = "<group>"; };
259+
79CD94D92B6E2D2D00182007 /* BackupPageLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackupPageLabel.swift; sourceTree = "<group>"; };
260+
79CD94DB2B6E304100182007 /* BackupPageNoteSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackupPageNoteSection.swift; sourceTree = "<group>"; };
261+
79CD94DD2B6E31E200182007 /* BackupPageSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackupPageSection.swift; sourceTree = "<group>"; };
256262
79CDDB8725C0E47400E801F2 /* KeyExportDerivationPreset.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyExportDerivationPreset.swift; sourceTree = "<group>"; };
257263
79CDDB8925C0E49300E801F2 /* KeyExportModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyExportModel.swift; sourceTree = "<group>"; };
258264
79CDDB9325C1710800E801F2 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
@@ -371,6 +377,9 @@
371377
03852CB12582FEA700A116B0 /* SetupNewSeed.swift */,
372378
03852CCC2584829900A116B0 /* SeedProducer.swift */,
373379
79E27B7E25CBB17400B5AD74 /* SeedBackupPage.swift */,
380+
79CD94DD2B6E31E200182007 /* BackupPageSection.swift */,
381+
79CD94DB2B6E304100182007 /* BackupPageNoteSection.swift */,
382+
79CD94D92B6E2D2D00182007 /* BackupPageLabel.swift */,
374383
);
375384
path = Seeds;
376385
sourceTree = "<group>";
@@ -696,6 +705,7 @@
696705
7942BEF12594113400906FA4 /* ImportChildView.swift in Sources */,
697706
79CDDB8A25C0E49300E801F2 /* KeyExportModel.swift in Sources */,
698707
79C071DD27B2351C001F2F40 /* SSKRPrintSetup.swift in Sources */,
708+
79CD94DA2B6E2D2D00182007 /* BackupPageLabel.swift in Sources */,
699709
0335E692257CA83600A009D3 /* DieToken.swift in Sources */,
700710
79F63EBF26F70BEC0075CC97 /* PrivateKeyBackupPage.swift in Sources */,
701711
79241076283C3B9F00611B9F /* AppUtilsExtensions.swift in Sources */,
@@ -743,6 +753,7 @@
743753
7984C97F27B6007400B52080 /* SSKRSharesView.swift in Sources */,
744754
03852CCD2584829900A116B0 /* SeedProducer.swift in Sources */,
745755
037474C3258085B600211084 /* EntropyStrength.swift in Sources */,
756+
79CD94DC2B6E304100182007 /* BackupPageNoteSection.swift in Sources */,
746757
793DD7FE27D60D160042FB2B /* RequestNote.swift in Sources */,
747758
79F38EFE25D6412B0056409C /* BackupPage.swift in Sources */,
748759
0374757A2581D60400211084 /* Saveable.swift in Sources */,
@@ -764,6 +775,7 @@
764775
79F38F0025D642CE0056409C /* KeyBackupPage.swift in Sources */,
765776
0397285C257C543E008B9B29 /* EntropyView.swift in Sources */,
766777
0335E695257CB09900A009D3 /* KeypadButtonStyle.swift in Sources */,
778+
79CD94DE2B6E31E200182007 /* BackupPageSection.swift in Sources */,
767779
790BD27E26AFEDF700B6607C /* AppChapter.swift in Sources */,
768780
7988693B25BA9FCA0099E8BF /* ModelHDKey.swift in Sources */,
769781
79C071E127B2F0DD001F2F40 /* SSKRSummaryPage.swift in Sources */,

SeedTool/Model/BackupPage.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct BackupPage<Subject, Footer>: View where Subject: ObjectIdentifiable, Foot
2727
}
2828

2929
var body: some View {
30-
VStack(alignment: .leading, spacing: 10) {
30+
VStack(alignment: .leading, spacing: 12) {
3131
HStack(spacing: 0.25 * pointsPerInch) {
3232
identity
3333
Spacer()
@@ -37,7 +37,7 @@ struct BackupPage<Subject, Footer>: View where Subject: ObjectIdentifiable, Foot
3737

3838
if didLimit {
3939
Caution("Some metadata was elided to fit into the QR code. Try making your notes field smaller.")
40-
.font(.system(size: 12))
40+
.font(.system(size: 8))
4141
}
4242

4343
footer
@@ -75,14 +75,14 @@ struct PrintingQRCodeView: View {
7575

7676
import WolfLorem
7777

78-
struct BackupPage_Previews: PreviewProvider {
79-
static let seed: ModelSeed = { Lorem.seed() }()
80-
static let privateHDKey: ModelHDKey = { try! ModelHDKey(seed: seed) }()
81-
82-
static var previews: some View {
83-
BackupPage(subject: seed, footer: EmptyView())
84-
.previewLayout(.fixed(width: 8.5 * pointsPerInch, height: 11 * pointsPerInch))
85-
}
78+
fileprivate let seed: ModelSeed = { Lorem.seed() }()
79+
fileprivate let privateHDKey: ModelHDKey = { try! ModelHDKey(seed: seed) }()
80+
81+
#Preview(
82+
traits: .fixedLayout(width: 8.5 * pointsPerInch, height: 11 * pointsPerInch)
83+
) {
84+
BackupPage(subject: seed, footer: EmptyView())
85+
.lightMode()
8686
}
8787

8888
#endif

SeedTool/SSKR/SSKRSummaryPage.swift

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ struct SSKRSummaryPage: View, Printable {
7171

7272
if includeNotes {
7373
BackupPageNoteSection(note: sskr.seed.note)
74+
.layoutPriority(-1)
7475
}
7576

7677
Spacer()
@@ -120,20 +121,15 @@ struct SSKRSummaryPage: View, Printable {
120121

121122
import WolfLorem
122123

123-
struct SSKRSummaryPage_Previews: PreviewProvider {
124-
static let model = Lorem.model()
125-
static let seed = model.seeds.first!
126-
// static let sskrModel = SSKRPreset.modelTwoOfThreeOfTwoOfThree
127-
static let sskrModel = SSKRPreset.modelTwoOfThreeOfTwoOfThree
128-
static let sskr = SSKRGenerator(seed: seed, sskrModel: sskrModel)
129-
static var previews: some View {
130-
VStack {
131-
SSKRSummaryPage(sskr: sskr, includeNotes: true)
132-
// .environmentObject(model)
133-
}
134-
.previewLayout(.fixed(width: 72*8.5, height: 72*11))
135-
// .darkMode()
136-
}
124+
fileprivate let seed = Lorem.seed()
125+
fileprivate let sskrModel = SSKRPreset.modelTwoOfThreeOfTwoOfThree
126+
fileprivate let sskr = SSKRGenerator(seed: seed, sskrModel: sskrModel)
127+
128+
#Preview(
129+
traits: .fixedLayout(width: pointsPerInch * 8.5, height: pointsPerInch * 11)
130+
) {
131+
SSKRSummaryPage(sskr: sskr, includeNotes: true)
132+
.lightMode()
137133
}
138134

139135
#endif
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import SwiftUI
2+
3+
struct BackupPageLabel: View {
4+
let title: Text
5+
let icon: Image
6+
7+
var body: some View {
8+
Label(title: { title }, icon: { icon })
9+
.font(.system(size: 16, weight: .bold))
10+
}
11+
}
12+
13+
#if DEBUG
14+
15+
#Preview(
16+
traits: .fixedLayout(width: 500, height: 500)
17+
) {
18+
BackupPageLabel(title: Text("Title"), icon: Image.bitcoin)
19+
.padding()
20+
.lightMode()
21+
}
22+
23+
#endif
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import SwiftUI
2+
3+
struct BackupPageNoteSection: View {
4+
let note: String
5+
6+
var body: some View {
7+
BackupPageSection(title: Text("Notes"), icon: Image.note) {
8+
Text(note)
9+
.font(.system(size: backupPageTextFontSize))
10+
.minimumScaleFactor(0.3)
11+
}
12+
}
13+
}
14+
15+
#if DEBUG
16+
17+
import WolfLorem
18+
19+
#Preview(
20+
traits: .fixedLayout(width: 500, height: 500)
21+
) {
22+
BackupPageNoteSection(note: Lorem.paragraph())
23+
.padding()
24+
.lightMode()
25+
}
26+
27+
#endif
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import SwiftUI
2+
import WolfBase
3+
4+
struct BackupPageSection<Content>: View where Content: View {
5+
let title: Text
6+
let icon: Image
7+
let content: () -> Content
8+
9+
init(title: Text, icon: Image, @ViewBuilder content: @escaping () -> Content) {
10+
self.title = title
11+
self.icon = icon
12+
self.content = content
13+
}
14+
15+
var body: some View {
16+
VStack(alignment: .leading, spacing: 5) {
17+
BackupPageLabel(title: title, icon: icon)
18+
content()
19+
}
20+
}
21+
}
22+
23+
#if DEBUG
24+
25+
import WolfLorem
26+
27+
#Preview(
28+
traits: .fixedLayout(width: pointsPerInch * 8.5, height: pointsPerInch * 11.5)
29+
) {
30+
BackupPageSection(title: Text(Lorem.title()), icon: Image.bitcoin) {
31+
Text(Lorem.paragraph())
32+
}
33+
.padding()
34+
.lightMode()
35+
}
36+
37+
#endif

0 commit comments

Comments
 (0)