Skip to content

Commit 604a00b

Browse files
committed
initial commit
1 parent e2680df commit 604a00b

22 files changed

Lines changed: 3537 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
8+
jobs:
9+
test-build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup pnpm
17+
uses: pnpm/action-setup@v4
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
cache: pnpm
24+
25+
- name: Install
26+
run: pnpm install --frozen-lockfile
27+
28+
- name: Typecheck
29+
run: pnpm typecheck
30+
31+
- name: Test
32+
run: pnpm test
33+
34+
- name: Build
35+
run: pnpm build

.github/workflows/publish.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: publish
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
publish:
10+
if: github.event_name == 'workflow_dispatch' || github.event.release.prerelease == false
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
id-token: write
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup pnpm
21+
uses: pnpm/action-setup@v4
22+
23+
- name: Setup Node
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 20
27+
registry-url: https://registry.npmjs.org
28+
cache: pnpm
29+
30+
- name: Install
31+
run: pnpm install --frozen-lockfile
32+
33+
- name: Typecheck
34+
run: pnpm typecheck
35+
36+
- name: Test
37+
run: pnpm test
38+
39+
- name: Build
40+
run: pnpm build
41+
42+
- name: Publish
43+
run: npm publish --provenance --access public
44+
env:
45+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,11 @@ dist
137137
# Vite logs files
138138
vite.config.js.timestamp-*
139139
vite.config.ts.timestamp-*
140+
141+
# macOS
142+
.DS_Store
143+
**/.DS_Store
144+
145+
# Cloudflare local state
146+
.wrangler/
147+
.mf/

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# @agecheck/core
2+
3+
[![CI](https://github.com/agecheck/agecheck-core/actions/workflows/ci.yml/badge.svg)](https://github.com/agecheck/agecheck-core/actions/workflows/ci.yml)
4+
[![Publish](https://github.com/agecheck/agecheck-core/actions/workflows/publish.yml/badge.svg)](https://github.com/agecheck/agecheck-core/actions/workflows/publish.yml)
5+
6+
`@agecheck/core` is the security-critical core used by AgeCheck SDK adapters.
7+
8+
It contains:
9+
10+
- token verification (`verifyAgeToken`)
11+
- gate policy (`isGateRequired`)
12+
- signed verification cookie helpers
13+
- typed domain errors and models
14+
15+
Most hostmasters should use `@agecheck/node` directly. Consume `@agecheck/core` only if you are building a framework adapter or platform integration.
16+
17+
## Install
18+
19+
```bash
20+
pnpm add @agecheck/core
21+
```
22+
23+
## Quality gates
24+
25+
```bash
26+
pnpm typecheck
27+
pnpm test
28+
pnpm build
29+
```
30+
31+
## Notes
32+
33+
- Runtime requirement: Node 20+
34+
- Module format: ESM + CJS output from `dist/`
35+
- Versioning and release policy: `/docs/VERSIONING.md`

docs/VERSIONING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Versioning and Release Policy
2+
3+
## SemVer policy
4+
5+
`@agecheck/core` follows Semantic Versioning.
6+
7+
- `MAJOR`: breaking API or behavior changes
8+
- `MINOR`: backward-compatible feature additions
9+
- `PATCH`: backward-compatible fixes and hardening
10+
11+
## Security-sensitive change policy
12+
13+
Any change that affects verification semantics, issuer trust defaults, cookie format, or session binding behavior must include:
14+
15+
- explicit changelog note
16+
- test coverage for happy + failure paths
17+
- review confirmation before publish
18+
19+
## Release checklist
20+
21+
1. `pnpm install --frozen-lockfile`
22+
2. `pnpm typecheck`
23+
3. `pnpm test`
24+
4. `pnpm build`
25+
5. bump version
26+
6. tag release
27+
7. publish from CI workflow

package.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "@agecheck/core",
3+
"version": "0.1.1",
4+
"description": "Core verification, policy, and cookie logic for AgeCheck SDKs.",
5+
"license": "Apache-2.0",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/agecheck/agecheck-core"
9+
},
10+
"type": "module",
11+
"main": "./dist/index.cjs",
12+
"module": "./dist/index.js",
13+
"types": "./dist/index.d.ts",
14+
"exports": {
15+
".": {
16+
"types": "./dist/index.d.ts",
17+
"import": "./dist/index.js",
18+
"require": "./dist/index.cjs"
19+
}
20+
},
21+
"publishConfig": {
22+
"access": "public"
23+
},
24+
"files": [
25+
"dist",
26+
"README.md",
27+
"LICENSE"
28+
],
29+
"engines": {
30+
"node": ">=20"
31+
},
32+
"scripts": {
33+
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
34+
"test": "vitest run",
35+
"test:watch": "vitest",
36+
"typecheck": "tsc --noEmit"
37+
},
38+
"dependencies": {
39+
"jose": "^5.9.6"
40+
},
41+
"devDependencies": {
42+
"@types/node": "^24.5.2",
43+
"tsup": "^8.5.0",
44+
"typescript": "^5.9.2",
45+
"vitest": "^2.1.8"
46+
},
47+
"packageManager": "pnpm@10.29.2"
48+
}

0 commit comments

Comments
 (0)