@333eco/origin-verify 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +6 -0
  2. package/index.mjs +6 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -32,6 +32,12 @@ Four states. Each stands alone and none implies another.
32
32
 
33
33
  **What a record does not say:** who imagined the work, or that one person holds one account. Without a signer's reveal it says *the operator witnessed this claim at this time and cannot later remove it*. With the reveal, *a passkey whose public key is given here signed exactly this claim*.
34
34
 
35
+ **Version-3 records** name their press, inside the log's signature: `press: { key: "passkey" }`, or for a key held by the B-PoH app
36
+ `{ key: "b-poh", unlock, shown }` (how it was unlocked; whose screen showed the words). A revealed press must carry the origin its
37
+ press allows: a press made in the app's own screen (`shown: "app"`) one of the trust file's `appOrigins` — none is listed yet, so such
38
+ a reveal is refused until the app ships — and every other press sign.333.eco's, including an app key pressed through the phone's
39
+ passkey sheet, whose origin the browser writes. Version-2 records read exactly as before.
40
+
35
41
  ## Finding a file after its metadata is gone
36
42
 
37
43
  | field | what it is | survives |
package/index.mjs CHANGED
@@ -163,7 +163,12 @@ export async function checkReveal(entry, opening, trust) {
163
163
  if (toB64u(challenge) !== entry.claimCommitment) return fail("the challenge does not bind this claim");
164
164
  let cd;
165
165
  try { cd = JSON.parse(text(raw.clientDataJSON)); } catch { return fail("bad client data"); }
166
- if (cd.type !== "webauthn.get" || cd.origin !== trust.webOrigin || cd.challenge !== entry.claimCommitment) return fail("the assertion was made elsewhere or for something else");
166
+ // Version 3: the record names its press, inside the log's signature. A press made in the B-PoH app's own screen (shown "app")
167
+ // carries an app origin the trust file must list; every other press carries sign.333.eco's — a passkey, every version-2 record,
168
+ // and an app key pressed through the phone's passkey sheet (shown "site"), whose origin the browser writes.
169
+ const appPress = entry.v >= 3 && entry.press?.key === "b-poh" && entry.press?.shown === "app";
170
+ const originOk = appPress ? Array.isArray(trust.appOrigins) && trust.appOrigins.includes(cd.origin) : cd.origin === trust.webOrigin;
171
+ if (cd.type !== "webauthn.get" || !originOk || cd.challenge !== entry.claimCommitment) return fail("the assertion was made elsewhere or for something else");
167
172
  const auth = raw.authenticatorData;
168
173
  if (auth.length < 37 || !eq(auth.subarray(0, 32), sha256(utf8(trust.rpId)))) return fail("the assertion names another site");
169
174
  if ((auth[32] & 0x05) !== 0x05) return fail("the passkey's owner was not present and verified");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@333eco/origin-verify",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Checks a B-Origin record with no help from its operator: signatures, its place in the public log, witness cosignatures, RFC 3161 tokens, OpenTimestamps proofs against Bitcoin, and a signer's reveal. Browser or Node, no runtime dependencies.",
5
5
  "license": "CC0-1.0 OR Apache-2.0",
6
6
  "author": "Thon Ly",