@knock-dev/protocol
v0.1.0
Published
What a Wedgie signs for Knock: the EIP-712 messages, their digests, and P-256 key helpers
Readme
@knock-dev/protocol
What a Wedgie signs for Knock, in TypeScript. A Wedgie is a USB device bound to one human with World ID and named in ENS; it signs with a P-256 key that never leaves its secure chip. This package has the EIP-712 messages it signs (KnockHello, KnockEnroll, KnockBind and KnockPass), their digests, and the key helpers.
bun add @knock-dev/protocolimport { digest, verifySignature } from '@knock-dev/protocol'
// The KnockHello digest for a challenge, and whether the Wedgie's (r, s) is its key's signature over it
const d = digest('KnockHello', { challenge })
const ok = verifySignature(d, r, s, key) // key: compressed P-256, as ENS holds itA site doesn't need it to take knocks: @knock-dev/door-sdk gets the knock, and @knock-dev/verify, which builds on this package, checks it.
The protocol reference has each message, field by field. The test vectors, a published test key's signatures that the Wedgie's own tests check too, are in spec/vectors/v1.json.
MIT licensed.
