Expand description
Transport-free APDU conversations and caller-owned operations.
This crate is the wire-format foundation of the CanoKey host library. It
provides encoders and parsers for command and response APDUs (apdu),
bounded definite-length BER TLV codecs (tlv), typed protocol errors
with command context (error), and the owned, caller-driven
Operation state machine (operation) that drives an exchange of
complete APDUs step by step. There is no I/O, transport trait, runtime,
threading, or mutable global state: the library builds bytes and parses
bytes, and the caller performs every transmit.
Most applications should not depend on this crate directly; the canokey
facade crate re-exports everything needed to talk to a device. Depend on
canokey-protocol when you are building a new applet binding on top of the
operation model, or when you need the APDU/TLV codecs for other low-level
work. The item-level examples in apdu, tlv, and operation are
runnable offline and show the intended usage.
Full API contracts (ownership, execution rules, error taxonomy) live in
docs/design/api-design.md in the repository.
Re-exports§
pub use apdu::ApduEncoding;pub use apdu::ApduHeader;pub use apdu::CommandApdu;pub use apdu::ExpectedLength;pub use apdu::ResponseApdu;pub use apdu::StatusWord;pub use error::Error;pub use error::ErrorKind;pub use error::Phase;pub use error::SecretReference;pub use operation::ExchangeOptions;pub use operation::Operation;pub use operation::OperationLimits;pub use operation::OperationOptions;pub use operation::OperationState;pub use operation::Step;
Modules§
- apdu
- Physical command and response APDU codecs. Physical ISO 7816 APDU encoding and borrowed response parsing.
- error
- Typed protocol errors and command context. Structured protocol failures, independent of transport and binding errors.
- operation
- Caller-driven operations, resource limits, and conversation policies. Owned operations and bounded logical-command conversations.
- tlv
- Bounded definite-length BER TLV codecs. Bounded, definite-length BER TLV; no map conversion discards duplicate tags.
Structs§
- Secret
Bytes - Owned sensitive bytes. Debug is redacted; the allocation is zeroized on drop.