Skip to content

Commit 241f59b

Browse files
committed
add get byte() for easier
1 parent 99368e8 commit 241f59b

17 files changed

+20
-3
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/enum",
3-
"version": "0.6.3",
3+
"version": "0.6.5",
44
"exports": "./src/mod.ts",
55
"publish": {
66
"exclude": ["dist/"]

src/cipher.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export class Cipher extends Enum {
1414
}
1515

1616
get Uint16() { return Uint8Array.of(0x13, +this) }
17+
get byte(){ return this.Uint16 }
1718
get length() { return 2 }
1819

1920
get hashLength() {

src/contentype.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export class ContentType extends Enum {
3535
get Uint8() {
3636
return Uint8.fromValue(+this)
3737
}
38+
get byte() { return this.Uint8 }
3839
get length(){ return 1 }
3940

4041
/**return 8 */

src/extensiontype.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ export class ExtensionType extends Enum {
205205
get Uint16() {
206206
return Uint16.fromValue(+this)
207207
}
208+
get byte() { return this.Uint16 }
208209

209210
/**
210211
* Bit 16

src/handshaketype.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ export class HandshakeType extends Enum {
107107
}
108108

109109
get Uint8() { return Uint8.fromValue(+this) }
110+
get byte() { return this.Uint8 }
110111
}
111112

112113
export class Handshake extends Uint8Array {

src/namedgroup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export class NamedGroup extends Enum {
6363
* @returns {Uint16} The Uint16 representation of the NamedGroup.
6464
*/
6565
get Uint16() { return Uint16.fromValue(+this); }
66+
get byte() { return this.Uint16 }
6667

6768
/**
6869
* Gets the key generation algorithm associated with the NamedGroup.

src/pskmode.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export class PskKeyExchangeMode extends Enum {
3434
get length() { return 1 }
3535

3636
get Uint8() { return Uint8Array.of(+this)}
37+
get byte() { return this.Uint8 }
3738

3839
}
3940

src/signaturescheme.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export class SignatureScheme extends Enum {
7676
* @returns {Uint16} The Uint16 representation of the SignatureScheme.
7777
*/
7878
get Uint16() { return Uint16.fromValue(+this); }
79+
get byte() { return this.Uint16 }
7980

8081
get algo() {
8182
switch (this) {

src/version.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export class Version extends Enum {
6969
get length(){ return 2 }
7070

7171
get Uint16() { return Uint16.fromValue(+this); }
72+
get byte(){ return this.Uint16 }
7273

7374
/**
7475
* Converts this Version instance to a ProtocolVersion.

type/cipher.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export class Cipher extends Enum {
3333
* @returns A `Uint8Array` containing the cipher suite identifier.
3434
*/
3535
get Uint16(): Uint8Array;
36+
get byte(): Uint8Array;
3637

3738
/**
3839
* Get hash length for respective cipher

0 commit comments

Comments
 (0)