auth = auth-size || enc-auth-body
auth-size = size of enc-auth-body, encoded as a big-endian 16-bit integer
auth-vsn = 4
auth-body = [sig, initiator-pubk, initiator-nonce, auth-vsn, ...]
enc-auth-body = ecies.encrypt(recipient-pubk, auth-body || auth-padding, auth-size)
auth-padding = arbitrary data
Looking at various implementations, it seems like sig is:
sig = secp256k1.sign(ephemeral-privkey , shared-secret ^ initiator-nonce)
and shared-secret is:
shared-secret = ecdh.agree(privkey, remote-pubk)