Skip to content

Commit 38ae08d

Browse files
committed
remove @tls/crypto
1 parent 14ee56e commit 38ae08d

File tree

6 files changed

+44
-25
lines changed

6 files changed

+44
-25
lines changed

deno.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tls/enum",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"exports": "./src/mod.ts",
55
"publish": {
66
"exclude": ["dist/"]
@@ -17,7 +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/crypto": "jsr:@tls/crypto@^0.0.9",
2120
"@tls/struct": "jsr:@tls/struct@^0.3.2"
2221
}
2322
}

src/contentype.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ export class TLSCiphertext extends Uint8Array {
115115
struct.set(lengthOf,3);
116116
struct.set(encrypted_record, 5);
117117
super(struct)
118+
this.header = struct.subarray(0,5);
119+
this.encrypted_record = encrypted_record
118120
}
119121
}
120122

src/dep.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ export * as utils from "@noble/curves/abstract/utils"
88
export { HexaDecimal } from "@tls/struct"
99
export * as x509 from "@peculiar/x509"
1010
export * from "@noble/hashes/sha2"
11-
export * from "@tls/crypto"
11+
1212

src/signaturescheme.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import { Constrained, Struct, Uint16 } from "./dep.ts";
55
import { Enum } from "./enum.js";
66
import { sha256 } from "@noble/hashes/sha256"
7-
import { hkdfExpandLabel } from "./dep.ts"
87
import { HandshakeType } from "./handshaketype.js";
98

109
/**
@@ -162,8 +161,8 @@ async function signatureFrom(clientHelloMsg, serverHelloMsg, encryptedExtensions
162161
return signature
163162
}
164163

165-
export async function finished(serverHS_secret, certificateVerifyMsg) {
166-
const finishedKey = hkdfExpandLabel(serverHS_secret, 'finished', new Uint8Array, 32);
164+
export async function finished(finishedKey, certificateVerifyMsg) {
165+
//const finishedKey = hkdfExpandLabel(serverHS_secret, 'finished', new Uint8Array, 32);
167166
const finishedKeyCrypto = await crypto.subtle.importKey(
168167
"raw",
169168
finishedKey,

type/contentype.d.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,22 +157,32 @@ export class TLSInnerPlaintext extends Uint8Array {
157157
}
158158

159159
/**
160-
* Represents a TLSCiphertext structure in the TLS 1.3 protocol.
161-
* This class extends `Uint8Array` to encapsulate TLSCiphertext data.
160+
* Represents a TLSCiphertext structure in a TLS handshake.
161+
* Extends `Uint8Array` to include additional TLS-specific data and methods.
162162
*/
163-
export class TLSCiphertext extends Uint8Array {
163+
export declare class TLSCiphertext extends Uint8Array {
164164
/**
165-
* Creates a TLSCiphertext instance from a given array.
166-
*
167-
* @param {Uint8Array } array - The input array to parse.
168-
* @returns {TLSCiphertext} A new instance of TLSCiphertext.
165+
* Constructs a new `TLSCiphertext` instance from an existing array.
166+
*
167+
* @param array - The array containing the ciphertext data.
168+
* @returns A new instance of `TLSCiphertext`.
169169
*/
170-
static from(array: Uint8Array): TLSCiphertext;
170+
static from(array: Uint8Array | number[]): TLSCiphertext;
171171

172172
/**
173-
* Constructs a TLSCiphertext structure.
174-
*
175-
* @param {Uint8Array} encrypted_record - The encrypted record bytes.
173+
* Constructs a `TLSCiphertext` instance.
174+
*
175+
* @param encrypted_record - The encrypted record data.
176176
*/
177177
constructor(encrypted_record: Uint8Array);
178+
179+
/**
180+
* The header portion of the TLSCiphertext.
181+
*/
182+
header: Uint8Array;
183+
184+
/**
185+
* The encrypted record data within the TLSCiphertext.
186+
*/
187+
encrypted_record: Uint8Array;
178188
}

type/signaturescheme.d.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ export function signatureFrom(
161161
/**
162162
* Verifies and generates the HMAC for the given data.
163163
*
164-
* @param {Uint8Array} serverHS_secret - The server handshake secret used for key derivation.
164+
* @param {Uint8Array} finishedKey - The key used to compute the finished message..
165165
* @param {object} certificateVerifyMsg - The certificate verify message object.
166166
* @param {Uint8Array} certificateVerifyMsg.message.transcriptHash - The transcript hash from the message.
167167
* @returns {Promise<Uint8Array>} A promise that resolves to the verify_data HMAC value as a Uint8Array.
168168
*/
169169
export declare function finished(
170-
serverHS_secret: Uint8Array,
170+
finishedKey: Uint8Array,
171171
certificateVerifyMsg: {
172172
message: {
173173
transcriptHash: Uint8Array;
@@ -176,13 +176,22 @@ export declare function finished(
176176
): Promise<Uint8Array>;
177177

178178
/**
179-
* Represents the Finished message as a Uint8Array.
179+
* Represents the output of the `finished` function.
180180
*/
181-
export declare class Finished extends Uint8Array {
181+
export declare class Finished {
182182
/**
183-
* Creates a Finished message instance.
184-
*
185-
* @param {Uint8Array} verify_data - The verify_data HMAC value.
183+
* Constructs a Finished instance.
184+
* @param verifyData - The computed verify data.
186185
*/
187-
constructor(verify_data: Uint8Array);
186+
constructor(verifyData: ArrayBuffer);
187+
188+
/**
189+
* The computed verify data.
190+
*/
191+
verifyData: ArrayBuffer;
192+
193+
/**
194+
* The hash of the handshake transcript.
195+
*/
196+
transcriptHash: ArrayBuffer;
188197
}

0 commit comments

Comments
 (0)