@authzflow/core 0.0.0-stage → 0.1.0-beta.1

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.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +60 -2
  3. package/THIRD_PARTY_NOTICES.md +6340 -0
  4. package/dist/cache.d.ts +23 -0
  5. package/dist/cache.js +37 -0
  6. package/dist/change-consumer.d.ts +19 -0
  7. package/dist/change-consumer.js +61 -0
  8. package/dist/checked-reader-protocol.d.ts +53 -0
  9. package/dist/checked-reader-protocol.js +195 -0
  10. package/dist/checked-reader.d.ts +4 -0
  11. package/dist/checked-reader.js +6 -0
  12. package/dist/content-hash.d.ts +5 -0
  13. package/dist/content-hash.js +13 -0
  14. package/dist/group-indexeddb.d.ts +3 -0
  15. package/dist/group-indexeddb.js +37 -0
  16. package/dist/group-notifications.d.ts +6 -0
  17. package/dist/group-notifications.js +7 -0
  18. package/dist/group-sqlite.d.ts +4 -0
  19. package/dist/group-sqlite.js +40 -0
  20. package/dist/index.d.ts +79 -0
  21. package/dist/index.js +13 -0
  22. package/dist/indexeddb.d.ts +6 -0
  23. package/dist/indexeddb.js +75 -0
  24. package/dist/native-reader.d.ts +25 -0
  25. package/dist/native-reader.js +53 -0
  26. package/dist/replica-eligibility.d.ts +9 -0
  27. package/dist/replica-eligibility.js +5 -0
  28. package/dist/replicas.d.ts +14 -0
  29. package/dist/replicas.js +1 -0
  30. package/dist/resource-authority-driver.d.ts +111 -0
  31. package/dist/resource-authority-driver.js +508 -0
  32. package/dist/resource-authority.d.ts +4 -0
  33. package/dist/resource-authority.js +9 -0
  34. package/dist/resource-change-tracker-driver.d.ts +47 -0
  35. package/dist/resource-change-tracker-driver.js +109 -0
  36. package/dist/resource-change-tracker.d.ts +3 -0
  37. package/dist/resource-change-tracker.js +5 -0
  38. package/dist/resource-group-driver.d.ts +119 -0
  39. package/dist/resource-group-driver.js +370 -0
  40. package/dist/resource-group.d.ts +6 -0
  41. package/dist/resource-group.js +7 -0
  42. package/dist/runtime-driver.d.ts +17 -0
  43. package/dist/runtime-driver.js +205 -0
  44. package/dist/sqlite.d.ts +14 -0
  45. package/dist/sqlite.js +80 -0
  46. package/package.json +77 -4
  47. package/testing/content-hash-conformance.d.mts +5 -0
  48. package/testing/content-hash-conformance.mjs +15 -0
  49. package/testing/index.d.mts +3 -0
  50. package/testing/index.mjs +3 -0
  51. package/testing/replica-conformance.d.mts +10 -0
  52. package/testing/replica-conformance.mjs +20 -0
  53. package/testing/resource-authority-conformance.d.mts +2 -0
  54. package/testing/resource-authority-conformance.mjs +162 -0
  55. package/wasm/authzflow_wasm.d.ts +70 -0
  56. package/wasm/authzflow_wasm.js +461 -0
  57. package/wasm/authzflow_wasm_bg.wasm +0 -0
  58. package/wasm/authzflow_wasm_bg.wasm.d.ts +23 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Accelflow Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,61 @@
1
- # Temporary Holding Version
1
+ # @authzflow/core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ MIT-licensed beta authorization-state runtime maintained by Accelflow Inc. Ships prebuilt Rust/Wasm, ESM JavaScript, TypeScript declarations and a checked reader. npm consumers need no Rust compiler.
4
+
5
+ ```js
6
+ import { createRuntime, createCheckedReader } from '@authzflow/core';
7
+ ```
8
+
9
+ The host supplies verified sessions, clocks, an atomic durable checkpoint store, an authenticated complete-check transport, and exact content/hash callbacks. Default diagnostics are disabled. Never treat a local checkpoint or client-provided metadata as authority.
10
+
11
+ See https://github.com/Accelflow/AuthzFlow/blob/main/docs-public/getting-started.md for installation and the executable example, and https://github.com/Accelflow/AuthzFlow/blob/main/docs-public/adapters.md for the full callback contract. Node 22/24, ESM, TypeScript 5.9+ and modern secure-context WebAssembly browsers are initial targets.
12
+
13
+ Offline permissions expire at their original bounded deadline and are lost across reader/process restarts. Server-side revocation cannot instantly reach disconnected clients. Already returned plaintext, raw store bypasses, multi-owner coordination and stream recovery are outside beta guarantees.
14
+
15
+ LICENSE and THIRD_PARTY_NOTICES.md are included; the latter contains dependency and Rust standard-library attributions and license texts. Security reporting: https://github.com/Accelflow/AuthzFlow/security/advisories/new .
16
+
17
+ Additional entrypoints: `@authzflow/core/replicas` provides editor-independent purge eligibility and completion types; `@authzflow/core/content-hash` connects explicit client/server projections to SHA-256; `@authzflow/core/testing` is an optional Node external-journal conformance suite. Hosts retain transaction, dirty-state, identity and encryption ownership. A blocked purge preserves denial and unsent changes and is not physical deletion completion.
18
+
19
+ React Native hosts use `createNativeCheckedReader` from
20
+ `@authzflow/core/native-reader` with a synchronous native JSON port. Authorization
21
+ and checkpoint transitions execute the same Rust `authzflow-core::OwnedRuntime`
22
+ as Wasm. The C ABI lives in `crates/authzflow-native`; it contains no policy engine.
23
+ The native and Wasm entries share TypeScript protocol/host orchestration.
24
+ Hosts supply prebuilt iOS/Android libraries, a native bridge, durable CAS storage,
25
+ trusted session/clock/entropy and JSON-only content. Missing/incompatible native
26
+ libraries fail closed; there is no TypeScript authorization fallback.
27
+
28
+ ### Reading an existing offline grant without renewing it
29
+
30
+ `createCheckedReader(...).readCachedWithPermit()` uses the live Rust authority
31
+ from an earlier successful full check. It performs no server request and never
32
+ renews a deadline. It requires the same session context, boot, durable revision,
33
+ content hash and an unexpired `offline_ttl` grant. Cold start and `online_only`
34
+ do not supply that grant. A different cached value is rejected without destroying
35
+ the valid grant for the original content. Session/clock/revision failures fence it.
36
+ Hosts can use this for secondary cache projections; normal screen revalidation
37
+ continues to call `readWithPermit()`. It cannot turn a cached checkpoint into permission.
38
+
39
+ ### Optional Resource Group integration
40
+
41
+ The opt-in `resource-group` entrypoint aggregates invalidations for related
42
+ Resources. `createResourceGroupCoordinator` uses Rust protocol v2;
43
+ `createNativeResourceGroupCoordinator` in `native-reader` uses the same Rust
44
+ transitions. Attach it through the Resource authority's `groups` option and pass
45
+ `resourceGroupId` on each Resource input. Do not enable the legacy `changes`
46
+ option on that same authority.
47
+
48
+ `group-sqlite`, `group-indexeddb`, and `group-notifications` provide shared-store
49
+ and wakeup adapters. The host must retain session checks and atomic, term-fenced
50
+ purge. Group registration, shared state and notifications never grant content;
51
+ each reader retains its own fresh-check permit. Cold start cannot inherit another
52
+ tab's permit. Close the authority before closing its host-owned coordinator.
53
+
54
+ `readCachedManyWithPermit` checks up to 64 cached Resource inputs (4 MiB aggregate)
55
+ without HTTP checks or deadline renewal. It returns ordered per-item results and
56
+ rechecks shared fences before delivery. It does not load missing permits or make
57
+ an entire search index readable offline.
58
+
59
+ Versioned source contracts live under `contracts/`. Browser-tab and independent
60
+ SQLite-process contracts are tested; each product still needs its own integration
61
+ acceptance and revision-fenced purge implementation.