-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate.html
More file actions
208 lines (187 loc) · 8.68 KB
/
Copy pathcreate.html
File metadata and controls
208 lines (187 loc) · 8.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<title>frame</title>
<link rel="icon" href="/favicon.ico" sizes="any" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@700&family=Space+Grotesk:wght@400;500;600;700&family=Space+Mono:wght@700&display=swap" rel="stylesheet" />
<style>
* { box-sizing: border-box; }
html, body { margin: 0; background: #ffffff; min-height: 100%; }
body {
color: #000000;
-webkit-font-smoothing: antialiased;
font-family: 'Space Grotesk', sans-serif;
display: flex;
align-items: flex-start;
justify-content: center;
padding: max(64px, calc(env(safe-area-inset-top, 0px) + 52px)) max(16px, env(safe-area-inset-right, 0px)) max(48px, calc(env(safe-area-inset-bottom, 0px) + 28px)) max(16px, env(safe-area-inset-left, 0px));
}
.home-link { color: inherit; text-decoration: none; }
.brand {
position: fixed; top: max(8px, env(safe-area-inset-top, 0px)); left: max(8px, env(safe-area-inset-left, 0px)); margin: 0; z-index: 6;
font-family: 'Chakra Petch', sans-serif; font-weight: 700; color: #000000;
font-size: clamp(18px, 5vw, 40px); letter-spacing: 0.08em; line-height: 1;
}
.panel { width: min(100%, 460px); }
.title {
font-family: 'Chakra Petch', sans-serif; font-weight: 700;
letter-spacing: 0.03em; font-size: clamp(1.5rem, 6vw, 2.1rem);
margin: 0; text-align: center;
}
.subtitle {
color: #666666; font-weight: 500; text-align: center;
margin: 8px 0 0; font-size: clamp(0.95rem, 3.2vw, 1.05rem);
}
.divider { width: 100%; height: 0; border-top: 1.5px solid #000000; margin: clamp(16px, 3vh, 22px) 0; }
.field-label {
font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
font-size: 0.72rem; color: #888888; margin: clamp(16px, 3vh, 22px) 0 8px;
}
.idbox, .keybox {
border: 1.5px solid #000000; padding: 14px 16px;
font-family: 'Space Mono', monospace; font-weight: 700;
word-break: break-all; text-align: center;
}
.idbox { font-size: clamp(1.3rem, 6vw, 1.9rem); letter-spacing: 0.04em; }
.keybox { font-size: clamp(1rem, 4.4vw, 1.35rem); letter-spacing: 0.12em; }
.warn {
background: #ffcdd6;
color: #c1121f;
font-weight: 700;
line-height: 1.4;
padding: 14px 16px;
margin: clamp(16px, 3vh, 22px) 0 4px;
font-size: clamp(0.9rem, 3.2vw, 1rem);
border: 1.5px solid #c1121f;
}
.btn {
display: block; width: 100%; box-sizing: border-box;
padding: clamp(13px, 2.6vh, 17px) 18px; margin-top: clamp(22px, 4vh, 30px);
background: #ffffff; color: #000000; border: 1.5px solid #000000;
text-align: center; text-decoration: none;
font-family: 'Space Grotesk', sans-serif; font-weight: 600;
letter-spacing: 0.02em; font-size: clamp(1rem, 3.6vw, 1.15rem); cursor: pointer;
transition: background 0.15s ease, color 0.15s ease;
}
.btn.primary { background: #000000; color: #ffffff; }
.btn:hover { background: #000000; color: #ffffff; }
.btn.primary:hover { background: #ffffff; color: #000000; }
.pin {
display: block; width: 100%; text-align: center;
border: 1.5px solid #000000; padding: 16px;
font-family: 'Space Mono', monospace; font-weight: 700;
font-size: clamp(1.6rem, 8vw, 2.4rem); letter-spacing: 0.5em;
text-indent: 0.5em; background: #ffffff; color: #000000;
}
.pin:focus { outline: 2px solid #000000; outline-offset: 2px; }
.hint { text-align: center; color: #888888; font-size: 0.85rem; margin-top: 10px; min-height: 1.1em; }
.hint.err { color: #c1121f; font-weight: 600; }
.corner {
position: fixed; width: clamp(28px, 6vw, 56px); height: clamp(28px, 6vw, 56px);
border-color: #000000; border-style: solid; border-width: 0; pointer-events: none;
}
.corner.tl { top: env(safe-area-inset-top, 0px); left: env(safe-area-inset-left, 0px); border-top-width: 2.5px; border-left-width: 2.5px; }
.corner.tr { top: env(safe-area-inset-top, 0px); right: env(safe-area-inset-right, 0px); border-top-width: 2.5px; border-right-width: 2.5px; }
.corner.bl { bottom: env(safe-area-inset-bottom, 0px); left: env(safe-area-inset-left, 0px); border-bottom-width: 2.5px; border-left-width: 2.5px; }
.corner.br { bottom: env(safe-area-inset-bottom, 0px); right: env(safe-area-inset-right, 0px); border-bottom-width: 2.5px; border-right-width: 2.5px; }
/* mobile: safe-area, overflow, touch */
html { overflow-x: hidden; }
@media (max-width: 480px) {
.row { grid-template-columns: minmax(72px, 34%) 1fr !important; }
}
@media (min-height: 720px) {
body { align-items: center; }
}
/* auth mobile */
</style>
</head>
<body>
<span class="corner tl"></span>
<span class="corner tr"></span>
<span class="corner bl"></span>
<span class="corner br"></span>
<h1 class="brand"><a class="home-link" href="/">FRAME</a></h1>
<main class="panel">
<section id="step-identity">
<h2 class="title">Your identity</h2>
<p class="subtitle">A new frame identity has been created.</p>
<div class="divider"></div>
<div class="field-label">frame identity</div>
<div class="idbox" id="frameId">generating…</div>
<div class="warn" id="warnBox">Write all of this down and store it in a safe place.<br /><br />This is what lets you import / authenticate your identity to a new device.</div>
<div class="field-label">Recovery Key</div>
<div class="keybox" id="recoveryKey">00000000000000000</div>
<button class="btn primary" id="beginBtn" type="button">Begin using FRAME</button>
</section>
<section id="step-password" hidden>
<h2 class="title">Set a Passcode</h2>
<p class="subtitle">Create a 5-digit passcode for this device.</p>
<div class="divider"></div>
<form id="pwForm" novalidate>
<input class="pin" id="pin" type="password" inputmode="numeric" pattern="[0-9]*" maxlength="5" autocomplete="new-password" aria-label="5-digit passcode" />
<div class="hint" id="pinHint">Enter 5 digits.</div>
<button class="btn primary" id="saveBtn" type="submit">Continue</button>
</form>
</section>
</main>
<script src="/frame.js"></script>
<script>
(function () {
var idBox = document.getElementById("frameId");
var recBox = document.getElementById("recoveryKey");
var beginBtn = document.getElementById("beginBtn");
// Generate a real cryptographic identity (Ed25519, P-256 fallback).
var identity = null;
idBox.textContent = "generating\u2026";
beginBtn.disabled = true;
FRAME.buildIdentity(null).then(function (obj) {
identity = obj;
idBox.textContent = obj.frameId;
recBox.textContent = obj.recoveryKey;
beginBtn.disabled = false;
});
var stepIdentity = document.getElementById("step-identity");
var stepPassword = document.getElementById("step-password");
var pin = document.getElementById("pin");
var pinHint = document.getElementById("pinHint");
beginBtn.addEventListener("click", function () {
if (!identity) return;
stepIdentity.hidden = true;
stepPassword.hidden = false;
setTimeout(function () { pin.focus(); }, 50);
});
pin.addEventListener("input", function () {
pin.value = pin.value.replace(/\D/g, "").slice(0, 5);
pinHint.classList.remove("err");
pinHint.textContent = "Enter 5 digits.";
});
document.getElementById("pwForm").addEventListener("submit", function (e) {
e.preventDefault();
if (pin.value.length !== 5) {
pinHint.classList.add("err");
pinHint.textContent = "Passcode must be exactly 5 digits.";
pin.focus();
return;
}
FRAME.hashPasscode(pin.value).then(function (h) {
identity.passcode = h;
FRAME.addIdentity(identity);
FRAME.setActiveId(identity.frameId);
FRAME.markUnlocked(identity.frameId);
window.location.href = "/dapps.html";
}).catch(function () {
pinHint.classList.add("err");
pinHint.textContent = "Could not save passcode.";
});
});
})();
</script>
</body>
</html>