-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now explaining session tickets, and using plurals better
- Loading branch information
Showing
7 changed files
with
158 additions
and
79 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Bytes } from '../util/bytes'; | ||
import { log } from '../presentation/log'; | ||
import { highlightBytes } from '../presentation/highlights'; | ||
import { LogColours } from '../presentation/appearance'; | ||
|
||
export function parseSessionTicket(record: Uint8Array) { | ||
if (chatty) { | ||
const ticket = new Bytes(record); | ||
ticket.expectUint8(0x04, 'session ticket message ([RFC 8846 §4.6.1](https://datatracker.ietf.org/doc/html/rfc8446#section-4.6.1))'); | ||
|
||
const [endTicketRecord] = ticket.expectLengthUint24('session ticket message'); | ||
|
||
const ticketSeconds = ticket.readUint32(); | ||
ticket.comment(`ticket lifetime in seconds: ${ticketSeconds} = ${ticketSeconds / 3600} hours`) | ||
|
||
ticket.readUint32('ticket age add'); | ||
|
||
const [endTicketNonce, ticketNonceRemaining] = ticket.expectLengthUint8('ticket nonce'); | ||
ticket.readBytes(ticketNonceRemaining()); | ||
ticket.comment('ticket nonce'); | ||
endTicketNonce(); | ||
|
||
const [endTicket, ticketRemaining] = ticket.expectLengthUint16('ticket'); | ||
ticket.readBytes(ticketRemaining()); | ||
ticket.comment('ticket'); | ||
endTicket(); | ||
|
||
const [endTicketExts, ticketExtsRemaining] = ticket.expectLengthUint16('ticket extensions'); | ||
if (ticketExtsRemaining() > 0) { | ||
ticket.readBytes(ticketExtsRemaining()); | ||
ticket.comment('ticket extensions (ignored)'); | ||
} | ||
endTicketExts(); | ||
|
||
endTicketRecord(); | ||
log(...highlightBytes(ticket.commentedString(), LogColours.server)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters