The secure session needed to download tracks, ported from netmd-js's MDSession.
Negotiates a session key by sending an enabling key block and exchanging nonces, then encrypts and streams track data.
{:ok, session} = NetMD.Session.start(device)
{:ok, %{track: n}} = NetMD.Session.download_track(session, track)
:ok = NetMD.Session.close(session)
Summary
Functions
Forget the session key (errors ignored) and leave the secure session.
Download a track: set up the transfer, stream the encrypted packets, title the new track and commit it.
Enter the secure session and negotiate a session key.
Types
@type t() :: %NetMD.Session{device: NetMD.Device.t(), key: <<_::64>>}
An established secure session.
Functions
@spec close(t()) :: :ok | NetMD.Interface.error()
Forget the session key (errors ignored) and leave the secure session.
@spec download_track(t(), NetMD.Track.t(), keyword()) :: {:ok, %{track: non_neg_integer(), uuid: binary(), ccid: binary()}} | NetMD.Interface.error()
Download a track: set up the transfer, stream the encrypted packets, title the new track and commit it.
Options:
:disc_format- override the disc format byte derived from the track's wire format:progressand:settle_ms- seeNetMD.Interface.send_track/8
@spec start( NetMD.Device.t(), keyword() ) :: {:ok, t()} | NetMD.Interface.error()
Enter the secure session and negotiate a session key.
Accepts host_nonce: <<_::64>> for a deterministic exchange (tests);
the default is random.