Skip to content

Commit a2f058e

Browse files
committed
add jsDoc and //@ts-self-types... to offeredpsks.js
1 parent a07509b commit a2f058e

File tree

3 files changed

+59
-6
lines changed

3 files changed

+59
-6
lines changed

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tls/extension",
3-
"version": "0.4.8",
3+
"version": "0.4.9",
44
"exports": "./src/mod.ts",
55
"publish": {
66
"exclude": ["dist/"]

src/offeredpsks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//@ts-self-types="../type/offeredpsks.d.ts"
12
import { Byte, parseItems, Uint16, Uint32 } from "./dep.ts";
23

34
/**

type/offeredpsks.d.ts

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
import { Byte } from "../src/dep.ts";
22

33
/**
4-
* Represents a Pre-Shared Key Binder Entry.
54
* ```
65
* opaque PskBinderEntry<32..255>;
76
* ```
7+
* binders: A series of HMAC values, one for each value in the
8+
identities list and in the same order, computed as described
9+
below.
10+
computed as an HMAC
11+
over a transcript hash (see Section 4.4.1) containing a partial
12+
ClientHello up to and including the PreSharedKeyExtension.identities
13+
field. That is, it includes all of the ClientHello but not the
14+
binders list itself. The length fields for the message (including
15+
the overall length, the length of the extensions block, and the
16+
length of the "pre_shared_key" extension) are all set as if binders
17+
of the correct lengths were present.
18+
The PskBinderEntry is computed in the same way as the Finished
19+
message (Section 4.4.4) but with the BaseKey being the binder_key
20+
derived via the key schedule from the corresponding PSK which is
21+
being offered (see Section 7.1).
822
*/
923
export class PskBinderEntry extends Byte {
1024

@@ -30,7 +44,21 @@ export class PskBinderEntry extends Byte {
3044
}
3145

3246
/**
33-
* Represents a PSK Identity structure.
47+
* ```
48+
* struct {
49+
opaque identity<1..2^16-1>;
50+
uint32 obfuscated_ticket_age;
51+
} PskIdentity;
52+
```
53+
identity: A label for a key. For instance, a ticket (as defined in
54+
Appendix B.3.4) or a label for a pre-shared key established
55+
externally. Ticket in newSessionTicket send after finished handshake
56+
by server.
57+
obfuscated_ticket_age: An obfuscated version of the age of the key.
58+
Section 4.2.11.1 describes how to form this value for identities
59+
established via the NewSessionTicket message. For identities
60+
established externally, an obfuscated_ticket_age of 0 SHOULD be
61+
used, and servers MUST ignore the value.
3462
*/
3563
export class PskIdentity extends Uint8Array {
3664
/**
@@ -62,7 +90,13 @@ export class PskIdentity extends Uint8Array {
6290
}
6391

6492
/**
65-
* Represents a list of PSK identities.
93+
* ```
94+
* PskIdentity identities<7..2^16-1>;
95+
* ```
96+
* identities: A list of the identities that the client is willing to
97+
negotiate with the server. If sent alongside the "early_data"
98+
extension (see Section 4.2.10), the first identity is the one used
99+
for 0-RTT data.
66100
*/
67101
export class Identities extends Uint8Array {
68102
/**
@@ -93,7 +127,12 @@ export class Identities extends Uint8Array {
93127
}
94128

95129
/**
96-
* Represents a list of PSK binder entries.
130+
* ```
131+
* PskBinderEntry binders<33..2^16-1>;
132+
* ```
133+
* binders: A series of HMAC values, one for each value in the
134+
identities list and in the same order, computed as described
135+
below.
97136
*/
98137
export class Binders extends Uint8Array {
99138
/**
@@ -124,7 +163,20 @@ export class Binders extends Uint8Array {
124163
}
125164

126165
/**
127-
* Represents the `OfferedPsks` structure, which contains PSK identities and binders.
166+
* ```
167+
* struct {
168+
PskIdentity identities<7..2^16-1>;
169+
PskBinderEntry binders<33..2^16-1>;
170+
} OfferedPsks;
171+
```
172+
identities: A list of the identities that the client is willing to
173+
negotiate with the server. If sent alongside the "early_data"
174+
extension (see Section 4.2.10), the first identity is the one used
175+
for 0-RTT data.
176+
177+
binders: A series of HMAC values, one for each value in the
178+
identities list and in the same order, computed as described
179+
below.
128180
*/
129181
export class OfferedPsks extends Uint8Array {
130182
/**

0 commit comments

Comments
 (0)