1- import { Uint8 , TLSPlaintext } from "../src/dep.ts" ;
1+ import { Uint8 } from "../src/dep.ts" ;
22import { Enum } from "../src/enum.js" ;
33import { Version } from "../src/version.js" ;
44
@@ -25,33 +25,93 @@ export class ContentType extends Enum {
2525
2626 /**
2727 * Checks the given octet and returns a valid ContentType instance.
28- *
28+ *
2929 * @param {Uint8Array } octet - A single-octet Uint8Array to evaluate.
3030 * @returns {ContentType } The corresponding ContentType or throws an error if invalid.
3131 */
3232 static from ( octet : Uint8Array ) : ContentType ;
3333
3434 /**
3535 * Returns the Uint8 representation of the ContentType.
36- *
36+ *
3737 * @readonly
3838 * @type {Uint8 }
3939 */
4040 get Uint8 ( ) : Uint8 ;
4141
4242 /**
4343 * Returns the bit size of the ContentType.
44- *
44+ *
4545 * @readonly
4646 * @type {8 }
4747 */
4848 get bit ( ) : 8 ;
4949
5050 /**
5151 * Creates a `TLSPlaintext` instance using the ContentType, TLS version, and fragment.
52- *
52+ *
5353 * @param {Uint8Array } fragment - The plaintext fragment to include.
5454 * @returns {TLSPlaintext } A TLSPlaintext object created with the specified parameters.
5555 */
5656 tlsPlainText ( fragment : Uint8Array ) : TLSPlaintext ;
5757}
58+
59+ /**
60+ * Represents a TLS plaintext record as a specialized `Uint8Array`.
61+ */
62+ export class TLSPlaintext extends Uint8Array {
63+ /**
64+ * Parses a given array into a `TLSPlaintext` instance.
65+ *
66+ * @param {Uint8Array } array - The input byte array.
67+ * @returns {TLSPlaintext } A new `TLSPlaintext` instance created from the array.
68+ */
69+ static from ( array : Uint8Array ) : TLSPlaintext ;
70+
71+ /**
72+ * Creates a `TLSPlaintext` instance from specific type, version, and fragment.
73+ *
74+ * @param {ContentType } type - The content type of the plaintext.
75+ * @param {Version } version - The protocol version.
76+ * @param {Uint8Array } fragment - The fragment data.
77+ * @returns {TLSPlaintext } A new `TLSPlaintext` instance.
78+ */
79+ static createFrom (
80+ type : ContentType ,
81+ version : Version ,
82+ fragment : Uint8Array ,
83+ ) : TLSPlaintext ;
84+
85+ /**
86+ * Constructs a new `TLSPlaintext` instance.
87+ *
88+ * @param {ContentType } type - The content type.
89+ * @param {Version } version - The protocol version.
90+ * @param {Uint8Array } fragment - The fragment data.
91+ */
92+ constructor ( type : ContentType , version : Version , fragment : Uint8Array ) ;
93+
94+ /**
95+ * The content type of the TLS plaintext record.
96+ * @type {ContentType }
97+ */
98+ readonly type : ContentType ;
99+
100+ /**
101+ * The protocol version of the TLS plaintext record.
102+ * @type {Version }
103+ */
104+ readonly version : Version ;
105+
106+ /**
107+ * The fragment data of the TLS plaintext record.
108+ * @type {Uint8Array }
109+ */
110+ readonly fragment : Uint8Array ;
111+
112+ /**
113+ * The underlying `Struct` instance representing the TLS plaintext record.
114+ * @type {[Uint8Array,Uint8Array,Uint8Array] }
115+ */
116+ readonly items : [ Uint8Array , Uint8Array , Uint8Array ] ;
117+ }
0 commit comments