Skip to content

Commit f6d7db6

Browse files
committed
add tlsInnerPlaintext() to Handshake class
1 parent a290324 commit f6d7db6

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

deno.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tls/enum",
3-
"version": "0.4.7",
3+
"version": "0.4.8",
44
"exports": "./src/mod.ts",
55
"publish": {
66
"exclude": ["dist/"]
@@ -17,6 +17,6 @@
1717
"@noble/hashes": "npm:@noble/hashes@^1.6.1",
1818
"@peculiar/x509": "npm:@peculiar/x509@^1.12.3",
1919
"@std/assert": "jsr:@std/assert@^1.0.2",
20-
"@tls/struct": "jsr:@tls/struct@^0.3.2"
20+
"@tls/struct": "jsr:@tls/struct@^0.3.6"
2121
}
2222
}

src/handshaketype.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// @ts-self-types="../type/handshaketype.d.ts"
33
import { Enum } from "./enum.js";
44
import { Struct, Uint24, Uint8 } from "./dep.ts";
5+
import { ContentType } from "./contentype.js"
56

67
/**
78
* Represents TLS 1.3 Handshake message types as defined in RFC 8446 Section 4
@@ -128,6 +129,9 @@ export class Handshake extends Uint8Array {
128129
this.items = struct.items
129130
}
130131
get byte(){ return Uint8Array.from(this)}
132+
tlsInnerPlaintext(numZeros){
133+
return ContentType.APPLICATION_DATA.tlsInnerPlaintext(this, numZeros)
134+
}
131135
}
132136

133137
// npx -p typescript tsc ./src/handshaketype.js --declaration --allowJs --emitDeclarationOnly --lib ESNext --outDir ./dist

type/handshaketype.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,12 @@ export declare class Handshake extends Uint8Array {
128128
constructor(msg_type: HandshakeType, message: Uint8Array);
129129
/** return Uint8Array */
130130
get byte(): Uint8Array
131+
132+
/**
133+
* Generates TLS inner plaintext by processing the current context with specified padding.
134+
*
135+
* @param {number} numZeros - The number of zero bytes to use as padding in the TLS inner plaintext.
136+
* @returns {Uint8Array} The formatted TLS inner plaintext data.
137+
*/
138+
tlsInnerPlaintext(numZeros: number): Uint8Array;
131139
}

0 commit comments

Comments
 (0)