castrum 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/castrum.linux-x64-gnu.node +0 -0
- package/dist/index.d.ts +239 -5
- package/dist/index.js +3852 -3375
- package/docs/ARCHITECTURE.md +11 -9
- package/docs/BENCHMARKS.md +70 -38
- package/docs/CASE_STUDY.md +10 -7
- package/docs/ENVIRONMENT.md +16 -1
- package/docs/FFI_BUN_GUIDE.md +18 -10
- package/docs/GETTING_STARTED.md +5 -4
- package/docs/HOW_TO_ADD_AN_OP.md +180 -0
- package/docs/INGRESS-ROUTER.md +3 -2
- package/docs/INGRESS.md +6 -3
- package/docs/NATIVE-ROUTE.md +28 -4
- package/docs/REPO_MAP.md +60 -30
- package/docs/adr/0001-two-wire-formats.md +1 -1
- package/docs/ai/LOCAL_DEV.md +81 -0
- package/docs/ai/TREE.md +1070 -0
- package/package.json +24 -23
- package/src/ingress/decode/result-base.ts +10 -2
- package/src/ingress/handlers.ts +45 -290
- package/src/ingress/headers/security.ts +41 -0
- package/src/ingress/index.ts +12 -148
- package/src/ingress/native-route.ts +182 -0
- package/src/ingress/packing/gather-raw-headers.ts +26 -2
- package/src/ingress/packing/route-wire.ts +197 -0
- package/src/ingress/packing/select-headers.ts +8 -1
- package/src/ingress/path-matcher.ts +115 -0
- package/src/ingress/response/baked-response.ts +302 -0
- package/src/ingress/router.ts +42 -2
- package/src/ingress/routes/common.ts +9 -1
- package/src/ingress/routes/json-write.ts +21 -18
- package/src/ingress/routes/native.ts +130 -0
- package/src/ingress/server-node.ts +1 -1
- package/src/ingress/server.ts +38 -99
- package/src/ingress/sync.ts +151 -0
- package/src/ingress/types.ts +9 -0
- package/src/native/ffi/build/codecs.ts +736 -0
- package/src/native/ffi/build/compress.ts +248 -0
- package/src/native/ffi/build/instances.ts +598 -0
- package/src/native/ffi/build/parse.ts +539 -0
- package/src/native/ffi/build/util.ts +140 -0
- package/src/native/ffi/build.ts +94 -0
- package/src/native/ffi/selftest.ts +11 -718
- package/src/native/ffi/types.ts +25 -0
- package/src/native/ffi.ts +36 -1320
- package/src/native/types/instances.ts +5 -0
- package/src/rust-ffi/packed.ts +38 -0
- package/src/rust-ffi/scalar/factories.ts +4 -0
package/src/native/ffi/types.ts
CHANGED
|
@@ -88,12 +88,37 @@ export interface BunFFI {
|
|
|
88
88
|
/** Precompiled `AcceptNegotiator` → best supported encoding (opaque `inner`
|
|
89
89
|
* handle); `null` = identity. */
|
|
90
90
|
acceptNegotiatorNegotiate(inner: number, header: Uint8Array): string | null
|
|
91
|
+
/** Precompiled `AcceptNegotiator` → best supported encoding with SERVER-
|
|
92
|
+
* preference tie-breaking (RFC 7231 server semantics, opaque `inner` handle);
|
|
93
|
+
* `null` = identity. */
|
|
94
|
+
acceptNegotiatorNegotiateServer(inner: number, header: Uint8Array): string | null
|
|
91
95
|
/** Precompiled `JwtSigner` → compact token from pre-serialized claim JSON
|
|
92
96
|
* (opaque `inner` handle); throws on invalid claims / null handle. */
|
|
93
97
|
jwtSignerSign(inner: number, claimsJson: Uint8Array, nowSeconds: number): Uint8Array
|
|
94
98
|
/** Precompiled `JwtSigner` → claims JSON bytes (opaque `inner` handle);
|
|
95
99
|
* `null` = invalid signature / expired / malformed. */
|
|
96
100
|
jwtSignerVerify(inner: number, token: Uint8Array, nowSeconds: number): Uint8Array | null
|
|
101
|
+
/** Ed25519 keypair generation → `{ privateKey, publicKey }` (PKCS#8 v1 DER
|
|
102
|
+
* private + SPKI DER public bytes); throws on CSPRNG failure. */
|
|
103
|
+
ed25519GenerateKeypair(): { privateKey: Uint8Array; publicKey: Uint8Array }
|
|
104
|
+
/** Ed25519 sign → 64-byte signature; throws on invalid private key. */
|
|
105
|
+
ed25519Sign(msg: Uint8Array, privateKey: Uint8Array): Uint8Array
|
|
106
|
+
/** Ed25519 verify → whether `signature` is valid for `msg` under `publicKey`. */
|
|
107
|
+
ed25519Verify(msg: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean
|
|
108
|
+
/** EdDSA (Ed25519) JWT sign → compact token; `null` = invalid claims/private
|
|
109
|
+
* key. `ttl <= 0` = no `iat`/`exp` injection. */
|
|
110
|
+
jwtEdDSASign(
|
|
111
|
+
claimsJson: Uint8Array,
|
|
112
|
+
privateKey: Uint8Array,
|
|
113
|
+
ttl: number,
|
|
114
|
+
nowSeconds: number,
|
|
115
|
+
): string | null
|
|
116
|
+
/** EdDSA (Ed25519) JWT verify → claims JSON string; `null` = invalid. */
|
|
117
|
+
jwtEdDSAVerify(
|
|
118
|
+
token: Uint8Array,
|
|
119
|
+
publicKey: Uint8Array,
|
|
120
|
+
nowSeconds: number,
|
|
121
|
+
): string | null
|
|
97
122
|
/** Compiled `TemplateRenderer` → UTF-8 bytes from a pre-serialized JSON
|
|
98
123
|
* context (opaque `inner` handle); throws on invalid context / render error. */
|
|
99
124
|
templateRender(inner: number, contextJson: Uint8Array): Uint8Array
|