Expand description
The key-agreement primitive kind: two-party Diffie–Hellman-style
agreement, producing keying material as a derive-input rather than as
bytes.
This kind has no secret-free half to split off (compare signature’s
-verify/-sign interfaces): every operation involves the secret key,
and the public key exists to be exchanged. There is deliberately no way
to derive a public-key from a secret-key: the public half is
available where it is guaranteed to exist — generate-key returns the
pair, and an imported secret’s JWK carries its public coordinate — while
a provider may hold a secret it can use but not read (see README.md,
“Design notes”).
Security:
agreecombines two key resources, so mixing algorithms (an X25519 secret with an ECDH public) is representable — the one place in the package where misuse is checked rather than unrepresentable, because an operation takes two capabilities. The check is the W3C Web Cryptography API’s own: an algorithm mismatch — including a curve mismatch between two ECDH keys — failserror.invalid-key.
Structs§
- Agreement
KeyOptions - Mint-time policy for agreement secret keys, following the
package-wide options contract (see
README.md). The derive grants are the W3C Web Cryptography API’s usage pair for agreement keys, and flow to everyderive-inputthe key’sagreemints.extractablegates the secret-key exports (export-key-jwk/-pkcs8and theto-wrap-input-*functions); platform key storage honors it too (thesigning-keyprecedent). - Public
Key - A public key: exchangeable, secret-free.
- Secret
Key - A secret key.
agreeis one-shot on the immutable key; the derivation state lives in thederive-inputit returns.