Skip to content

Commit 55af7ca

Browse files
committed
update version
1 parent acb7563 commit 55af7ca

File tree

15 files changed

+392
-297
lines changed

15 files changed

+392
-297
lines changed

.github/workflows/deno.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,20 @@ on:
99

1010
jobs:
1111
publish:
12+
1213
runs-on: ubuntu-latest
1314
permissions:
14-
contents: read
15+
contents: write
1516
id-token: write # The OIDC ID token is used for authentication with JSR.
1617
steps:
17-
- uses: actions/checkout@v4
18-
- run: npx jsr publish --allow-dirty --allow-slow-types
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Deno
22+
uses: denoland/setup-deno@v2
23+
# uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31 # v1.1.2
24+
with:
25+
deno-version: v2.x
26+
27+
- name: Publish to JSR
28+
run: npx jsr publish --allow-dirty --allow-slow-types

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
/.vscode
1+
/.vscode
2+
./commit.sh
3+
./version.js
4+
./.gitignore
5+
./deno.lock

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) [2024] [AICONE]
3+
Copyright (c) [2025] [AICONE]
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

commit.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Error handling: catch any error and show a message
5+
trap 'echo "❌ An error occurred on line $LINENO. Exiting..."; exit 1;' ERR
6+
7+
# 1. Get version and message from arguments
8+
VERSION="$1"
9+
MESSAGE="$2"
10+
11+
# 2. Validate input
12+
if [ -z "$VERSION" ]; then
13+
echo "❌ Error: Please provide a version (e.g., ./version_release.sh 1.2.3 \"your message\")"
14+
exit 1
15+
fi
16+
17+
# Check if version format is correct
18+
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
19+
echo "❌ Error: Version must be in format major.minor.patch (e.g. 1.2.3)"
20+
exit 1
21+
fi
22+
23+
if [ -z "$MESSAGE" ]; then
24+
MESSAGE="release: v$VERSION"
25+
fi
26+
27+
# 3. Inject version into deno.json and .d.ts files
28+
echo "✍️ Injecting version into .d.ts files..."
29+
deno run --allow-read --allow-write version.js "$VERSION"
30+
31+
# 4. Git commit and push
32+
echo "📦 Committing and pushing changes..."
33+
git add .
34+
git commit -m "$MESSAGE"
35+
git push
36+
37+
echo "✅ Done! Version $VERSION released with commit message:"
38+
echo " \"$MESSAGE\""

deno.json

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
11
{
22
"name": "@tls/param",
3-
"version": "0.2.7",
3+
"version": "0.2.8",
44
"exports": "./src/mod.ts",
55
"publish": {
6-
"exclude": ["dist/"]
6+
"exclude": [
7+
"dist/"
8+
]
9+
},
10+
"tasks": {
11+
"test": "deno test",
12+
"lint": "deno lint"
713
},
814
"lint": {
9-
"include": ["src/"],
10-
"exclude": ["dist/", "src/encryptedexts.js"],
15+
"include": [
16+
"src/"
17+
],
18+
"exclude": [
19+
"dist/",
20+
"src/encryptedexts.js"
21+
],
1122
"rules": {
12-
"exclude": []
23+
"exclude": [
24+
"no-slow-types"
25+
]
1326
}
1427
},
1528
"imports": {
16-
"@aicone/byte": "jsr:@aicone/byte@^0.7.9",
29+
"@aicone/byte": "jsr:@aicone/byte@^0.8.6",
1730
"@std/assert": "jsr:@std/assert@^1.0.12",
18-
"@tls/enum": "jsr:@tls/enum@^0.9.3",
19-
"@tls/extension": "jsr:@tls/extension@^0.5.5"
31+
"@tls/enum": "jsr:@tls/enum@^0.9.7",
32+
"@tls/extension": "jsr:@tls/extension@^0.6.0",
33+
"@tls/parser": "jsr:@tls/parser@^0.0.3"
2034
}
21-
}
35+
}

deno.lock

Lines changed: 147 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# TLS 1.3 Parameter Structures (RFC 8446 - Section 4.3)
22

33
This project provides JavaScript implementations for handling TLS 1.3 parameters as defined in [RFC 8446 Section 4.3](https://datatracker.ietf.org/doc/html/rfc8446#section-4.3). The code focuses on encoding, decoding, and managing the data structures involved in TLS 1.3, specifically for `CertificateRequest` and `EncryptedExtensions`.
4+
@version 0.2.8
45

56
## Features
67

src/certificatereq.js

Lines changed: 16 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,34 @@
11
//@ts-self-types="../type/certificatereq.d.ts"
22

33
import { Uint16, Extension } from "./dep.ts";
4-
import { parseExtension, parseItems } from "./utils.js";
4+
import { parseItems } from "./dep.ts";
5+
import { parseExtension } from "./encrypted.js";
56

6-
/* class Extensions extends Constrained {
7-
static from(array) {
8-
const copy = Uint8Array.from(array);
9-
const lengthOf = Uint16.from(copy.subarray(0, 2)).value;
10-
if (lengthOf < 2) throw RangeError(`Minimum length of extension is 2 bytes`)
11-
const extensions = [];
12-
for (let offset = 2; offset < lengthOf + 2;) {
13-
const extension = Extension.from(copy.subarray(offset))
14-
extensions.push(extension);
15-
offset += extension.length;
16-
}
17-
return new Extensions(...extensions)
18-
}
19-
constructor(...extensions) {
20-
super(2, 65535, ...extensions)
21-
this.extensions = extensions
22-
}
23-
}
24-
25-
class Certificate_request_context extends Constrained {
26-
static from(array) {
27-
const copy = Uint8Array.from(array);
28-
const lengthOf = copy.at(0);
29-
if (lengthOf == 0) return new Certificate_request_context
30-
const context = copy.subarray(1, 1 + lengthOf);
31-
return new Certificate_request_context(context);
32-
}
33-
constructor(opaque) {
34-
super(0, 255, opaque)
35-
this.opaque = opaque
36-
}
37-
} */
387
/**
8+
* ```
9+
* struct {
10+
opaque certificate_request_context<0..2^8-1>;
11+
Extension extensions<2..2^16-1>;
12+
} CertificateRequest;
13+
```
3914
* https://datatracker.ietf.org/doc/html/rfc8446#section-4.3.2
4015
*/
4116
export class CertificateRequest extends Uint8Array {
4217
#context
4318
#extensions
44-
static sanitize(array) {
45-
const lengthOf_1 = array.at(0);
19+
static sanitize(args) {
20+
const a0 = args[0];
21+
if(!(a0 instanceof Uint8Array))return
22+
const lengthOf_1 = a0.at(0);
4623
if (lengthOf_1 > 255) throw Error(`Context must less than 256 byte`)
47-
const lengthOf_2 = Uint16.from(array.subarray(1 + lengthOf_1)).value;
24+
const lengthOf_2 = Uint16.from(a0.subarray(1 + lengthOf_1)).value;
4825
if (lengthOf_2 > 65535) throw Error(`Extension must less than 65536`)
49-
const output = array.slice(0, lengthOf_1 + lengthOf_2 + 3)
50-
return [output]
26+
args[0] = a0.slice(0, lengthOf_1 + lengthOf_2 + 3)
27+
return
5128
}
5229
static from(array) { return new CertificateRequest(array) }
5330
constructor(...args) {
54-
args = (args[0] instanceof Uint8Array) ? CertificateRequest.sanitize(args[0]) : args
31+
CertificateRequest.sanitize(args)
5532
super(...args)
5633
}
5734
get context() {
@@ -68,20 +45,4 @@ export class CertificateRequest extends Uint8Array {
6845
}
6946
}
7047

71-
/* export class CertificateRequest_0 extends Struct {
72-
static from(array) {
73-
const copy = Uint8Array.from(array);
74-
const certificate_request_context = Certificate_request_context.from(copy);
75-
const extensions = Extensions.from(copy.subarray(certificate_request_context.length))
76-
return new CertificateRequest(certificate_request_context.opaque, ...extensions.extensions)
77-
}
78-
constructor(certificate_request_context, ...extension) {
79-
super(
80-
new Certificate_request_context(certificate_request_context),
81-
new Extensions(...extension)
82-
)
83-
}
84-
static extensions = Extensions
85-
static certificate_request_context = Certificate_request_context
86-
} */
8748

src/dep.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export * from "@tls/extension"
22
export * from "@tls/enum"
3-
export * from "@aicone/byte"
3+
export * from "@aicone/byte"
4+
export * from "@tls/parser"

0 commit comments

Comments
 (0)