|
| 1 | +import { Uint8, TLSPlaintext } from "../src/dep.ts"; |
| 2 | +import { Enum } from "../src/enum.js"; |
| 3 | +import { Version } from "../src/version.js"; |
| 4 | + |
1 | 5 | /** |
2 | | - * The higher-level protocol used to process the enclosed |
3 | | - fragment |
| 6 | + * Represents the higher-level protocol used to process the enclosed fragment. |
| 7 | + * Defined in RFC 8446 Section 5.1. |
4 | 8 | * @see https://datatracker.ietf.org/doc/html/rfc8446#section-5.1 |
5 | | - * @export |
6 | | - * @extends {Enum} |
7 | 9 | */ |
8 | 10 | export class ContentType extends Enum { |
9 | | - static INVALID: ContentType; |
10 | | - static CHANGE_CIPHER_SPEC: ContentType; |
11 | | - static ALERT: ContentType; |
12 | | - static HANDSHAKE: ContentType; |
13 | | - static APPLICATION_DATA: ContentType; |
14 | | - /** |
15 | | - * check octet and return valid ContentType |
16 | | - * |
17 | | - * @static |
18 | | - * @param {Uint8Array} octet |
19 | | - * @returns {ContentType } |
20 | | - */ |
21 | | - static from(octet: Uint8Array): ContentType; |
22 | | - /**return 8 */ |
23 | | - get bit(): number; |
24 | | - |
25 | | - /**return Uint8 */ |
26 | | - get Uint8(): Uint8 |
| 11 | + /** Represents an invalid ContentType (value 0). */ |
| 12 | + static INVALID: ContentType; |
| 13 | + |
| 14 | + /** Represents the ChangeCipherSpec ContentType (value 20). */ |
| 15 | + static CHANGE_CIPHER_SPEC: ContentType; |
| 16 | + |
| 17 | + /** Represents the Alert ContentType (value 21). */ |
| 18 | + static ALERT: ContentType; |
| 19 | + |
| 20 | + /** Represents the Handshake ContentType (value 22). */ |
| 21 | + static HANDSHAKE: ContentType; |
| 22 | + |
| 23 | + /** Represents the ApplicationData ContentType (value 23). */ |
| 24 | + static APPLICATION_DATA: ContentType; |
| 25 | + |
| 26 | + /** |
| 27 | + * Checks the given octet and returns a valid ContentType instance. |
| 28 | + * |
| 29 | + * @param {Uint8Array} octet - A single-octet Uint8Array to evaluate. |
| 30 | + * @returns {ContentType} The corresponding ContentType or throws an error if invalid. |
| 31 | + */ |
| 32 | + static from(octet: Uint8Array): ContentType; |
| 33 | + |
| 34 | + /** |
| 35 | + * Returns the Uint8 representation of the ContentType. |
| 36 | + * |
| 37 | + * @readonly |
| 38 | + * @type {Uint8} |
| 39 | + */ |
| 40 | + get Uint8(): Uint8; |
| 41 | + |
| 42 | + /** |
| 43 | + * Returns the bit size of the ContentType. |
| 44 | + * |
| 45 | + * @readonly |
| 46 | + * @type {8} |
| 47 | + */ |
| 48 | + get bit(): 8; |
| 49 | + |
| 50 | + /** |
| 51 | + * Creates a `TLSPlaintext` instance using the ContentType, TLS version, and fragment. |
| 52 | + * |
| 53 | + * @param {Uint8Array} fragment - The plaintext fragment to include. |
| 54 | + * @returns {TLSPlaintext} A TLSPlaintext object created with the specified parameters. |
| 55 | + */ |
| 56 | + tlsPlainText(fragment: Uint8Array): TLSPlaintext; |
27 | 57 | } |
28 | | -import { Uint8 } from "../src/dep.ts"; |
29 | | -import { Enum } from "../src/enum.js"; |
|
0 commit comments