Skip to content

Commit 0e4049b

Browse files
committed
Rewrite to TypeScript
1 parent df4d9b5 commit 0e4049b

16 files changed

Lines changed: 1171 additions & 160 deletions

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
[*.md]
14+
indent_size = 4
15+
# In Markdown a trailing double space is interpreted as <br>
16+
trim_trailing_whitespace = false
17+
max_line_length = off

.github/workflows/test.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@ on:
1010

1111
pull_request:
1212
branches:
13-
- main
13+
- master
1414
paths-ignore:
1515
- '**/*.md'
1616
- '.gitignore'
1717

1818
jobs:
19-
build:
19+
test:
2020
runs-on: ubuntu-latest
2121
steps:
22-
- uses: actions/checkout@v3
23-
- uses: actions/setup-node@v3
24-
- run: npm install
25-
- run: node resources.js
26-
- run: wget ${{ secrets.CERT_LINK }}
22+
- uses: actions/checkout@v4
23+
- uses: oven-sh/setup-bun@v1
24+
- run: bun install
25+
- run: bun type-check
26+
- run: bun ca-downloader
27+
- run: wget ${{ secrets.CERT_LINK }} -O cert.zip
2728
- run: unzip -P ${{ secrets.CERT_PASS }} cert.zip -d cert-files
28-
- run: node index.js cert-files | grep 'Revoked'
29+
- run: bun certcheck cert-files/cert.p12 --password ${{ secrets.CERT_PASS }} | grep -q "revoked"

.gitignore

Lines changed: 106 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,107 @@
1-
*.DS_Store
2-
CA-CER/
3-
CA-PEM/
4-
cert.p12
5-
pass.txt
6-
*.pem
1+
.envrc
2+
CA-PEM
3+
4+
# Dependencies
75
node_modules/
8-
cert-files
9-
pnpm-lock.yaml
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
10+
# Build output
11+
dist/
12+
*.tsbuildinfo
13+
14+
# Runtime data
15+
pids
16+
*.pid
17+
*.seed
18+
*.pid.lock
19+
20+
# Coverage directory used by tools like istanbul
21+
coverage/
22+
*.lcov
23+
24+
# nyc test coverage
25+
.nyc_output
26+
27+
# Grunt intermediate storage
28+
.grunt
29+
30+
# Bower dependency directory
31+
bower_components
32+
33+
# node-waf configuration
34+
.lock-wscript
35+
36+
# Compiled binary addons
37+
build/Release
38+
39+
# Dependency directories
40+
jspm_packages/
41+
42+
# TypeScript cache
43+
*.tsbuildinfo
44+
45+
# Optional npm cache directory
46+
.npm
47+
48+
# Optional eslint cache
49+
.eslintcache
50+
51+
# Microbundle cache
52+
.rpt2_cache/
53+
.rts2_cache_cjs/
54+
.rts2_cache_es/
55+
.rts2_cache_umd/
56+
57+
# Optional REPL history
58+
.node_repl_history
59+
60+
# Output of 'npm pack'
61+
*.tgz
62+
63+
# Yarn Integrity file
64+
.yarn-integrity
65+
66+
# dotenv environment variables file
67+
.env
68+
.env.test
69+
70+
# parcel-bundler cache
71+
.cache
72+
.parcel-cache
73+
74+
# Next.js build output
75+
.next
76+
77+
# Nuxt.js build / generate output
78+
.nuxt
79+
dist
80+
81+
# Gatsby files
82+
.cache/
83+
public
84+
85+
# Storybook build outputs
86+
.out
87+
.storybook-out
88+
89+
# Temporary folders
90+
tmp/
91+
temp/
92+
93+
# Editor directories and files
94+
.vscode/
95+
.idea/
96+
*.swp
97+
*.swo
98+
*~
99+
100+
# OS generated files
101+
.DS_Store
102+
.DS_Store?
103+
._*
104+
.Spotlight-V100
105+
.Trashes
106+
ehthumbs.db
107+
Thumbs.db

README.md

Lines changed: 136 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# CertCheck
2-
Node JS utility to check the signature of Apple P12 Certificates.
2+
Modern TypeScript utility to check the signature of Apple P12 Certificates using idiomatic TypeScript and modern APIs.
33

44
*Confirmed to work on macOS, Windows, and Linux.*
55

6-
*Works with both enterprise and developer certificates.*
7-
8-
Includes tool to convert CER files to PEM. (See [**cer-to-pem.js**](https://github.com/JailbreaksApp/CertCheck/blob/master/cer-to-pem.js))
6+
*Works with enterprise, developer, and distribution certificates.*
97

108
## Contact
119
- [**Twitter** **(@iCrazeiOS)**](https://twitter.com/iCrazeiOS)
@@ -16,16 +14,141 @@ Includes tool to convert CER files to PEM. (See [**cer-to-pem.js**](https://gith
1614
- **BTC:** bc1q0ghuykcutljjyh3tcdjv88ek8zjzrtnk8zhuhy
1715

1816
## Requirements
19-
- Node JS (with `ocsp` & `node-forge` modules)
17+
- [Bun](https://bun.sh) (v1.0.0 or higher)
18+
- TypeScript (for development)
19+
20+
## Installation
21+
```bash
22+
# Install Bun (if not already installed)
23+
curl -fsSL https://bun.sh/install | bash
24+
25+
# Install dependencies (only if you want to develop, otherwise see the bunx command below)
26+
bun install
27+
```
2028

2129
## Usage
22-
**Standard usage:**
23-
- Have cert.p12 and pass.txt in the same directory as the script.
24-
- Run `node index.js`
2530

26-
**Specify directory:**
27-
- Have cert.p12 and pass.txt in a different directory than the script.
28-
- Run `node index.js "/path/to/directory"`
31+
## Give me quick copy-paste command I’m impatient
32+
33+
```bash
34+
bunx github:Olympta/CertCheck certcheck cert.p12 --password 123456
35+
```
36+
37+
No need to clone the repo.
38+
39+
### Using Package Scripts (Recommended)
40+
```bash
41+
# Main certificate checker
42+
bun certcheck cert.p12 --password yourpassword
43+
44+
# With JSON output
45+
bun certcheck cert.p12 --password yourpassword --json
46+
47+
# Short password flag
48+
bun certcheck cert.p12 -p yourpassword
49+
50+
# Download Apple CA certificates (run this first)
51+
bun ca-downloader
52+
```
53+
54+
### Direct Bun Execution
55+
```bash
56+
# Basic usage with P12 file and password
57+
bun certcheck cert.p12 --password yourpassword
58+
59+
# With JSON output
60+
bun certcheck cert.p12 --password yourpassword --json
61+
62+
# Short password flag
63+
bun certcheck cert.p12 -p yourpassword
64+
65+
# Absolute paths work too
66+
bun certcheck /path/to/cert.p12 --password yourpassword
67+
```
68+
69+
### Environment Variables
70+
```bash
71+
# Set environment variables
72+
export CERT_P12_PATH=cert.p12
73+
export CERT_P12_PASSWORD=yourpassword
74+
75+
# Run without arguments
76+
bun certcheck
77+
78+
# JSON output still works
79+
bun certcheck --json
80+
```
81+
82+
### Mixed Usage (CLI overrides environment variables)
83+
```bash
84+
# Environment variables as fallback
85+
CERT_P12_PATH=cert.p12 bun certcheck --password yourpassword
86+
CERT_P12_PASSWORD=yourpassword bun certcheck cert.p12
87+
88+
# CLI arguments always take priority
89+
CERT_P12_PATH=wrong.p12 CERT_P12_PASSWORD=wrongpass bun certcheck cert.p12 --password yourpassword
90+
```
91+
92+
### Download Apple CA Certificates
93+
```bash
94+
# Download and convert Apple CA certificates (run this first)
95+
bun ca-downloader
96+
```
97+
98+
## File Structure
99+
```
100+
src/
101+
├── index.ts # OCSP certificate revoke checker
102+
├── caDownloader.ts # Apple CA certificates downloader
103+
├── p12Utils.ts # P12 to PEM conversion utilities
104+
├── cerUtils.ts # CER to PEM converter class
105+
└── types/
106+
└── ocsp.d.ts # OCSP module type definitions
107+
```
108+
109+
## Development
110+
```bash
111+
# Install dependencies
112+
bun install
113+
114+
# Type check
115+
bun type-check
116+
117+
# Run main application
118+
bun certcheck cert.p12 --password yourpassword
119+
120+
# Download Apple CA certificates
121+
bun ca-downloader
122+
123+
# Development mode
124+
bun dev cert.p12 --password yourpassword
125+
bun dev:ca-downloader
126+
```
127+
128+
## Example Output
129+
130+
### Good Certificate
131+
```bash
132+
$ bun certcheck cert.p12 --password 123456
133+
Certificate Name: John Doe
134+
Certificate Status: good
135+
Certificate Expiration Date: Sat, 22 Aug 2026 18:21:48 GMT
136+
```
137+
138+
### Revoked Certificate
139+
```bash
140+
$ bun certcheck revoked.p12 --password 123456
141+
Certificate Name: Jane Smith
142+
Certificate Status: revoked
143+
Certificate Expiration Date: Thu, 23 Jul 2026 00:06:58 GMT
144+
Certificate Revocation Date: Mon, 25 Aug 2025 18:37:02 GMT
145+
```
146+
147+
### JSON Output
148+
```bash
149+
$ bun certcheck cert.p12 --password 123456 --json
150+
{"name":"John Doe","expirationDate":"Sat, 22 Aug 2026 18:21:48 GMT","status":"good"}
151+
```
29152

30-
**JSON output:**
31-
- Follow steps for other examples, but add `--json` to the end of the command. (MUST be after custom directory, if you are using one)
153+
## License
154+
MIT

bun.lock

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

0 commit comments

Comments
 (0)