@ai-ecoverse/slicc-jerk 0.7.0 → 0.8.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.
- package/README.md +22 -0
- package/bin/jerk.wasm +0 -0
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -125,8 +125,30 @@ When seven asks a linked slicc CLI for a token (link stream `jerk`, slicc-cli's
|
|
|
125
125
|
- `npm run lint`: slicc lint, rustfmt and clippy.
|
|
126
126
|
- `npm test`: builds jerk and runs `test/integration/`.
|
|
127
127
|
- `npm run build:wasm`: writes `bin/jerk.wasm`.
|
|
128
|
+
- `npm run build:oauth-wasm`: builds `@ai-ecoverse/jerk-oauth` into `dist/jerk-oauth/`.
|
|
128
129
|
- `npm run test:unit`: the gitignored unit tests in `test/unit/`, with coverage through `cargo-llvm-cov`.
|
|
129
130
|
|
|
130
131
|
## License
|
|
131
132
|
|
|
132
133
|
Apache-2.0
|
|
134
|
+
|
|
135
|
+
## `@ai-ecoverse/jerk-oauth` (npm)
|
|
136
|
+
|
|
137
|
+
Pure OAuth helpers compiled from `crates/jerk-oauth` to WebAssembly (`wasm32-unknown-unknown`, wasm-bindgen `web` target). bios uses it for route (b) sign-ins, and the vault uses it for grant refresh.
|
|
138
|
+
|
|
139
|
+
The package is ESM with `.wasm` and `.d.ts`. The caller does every fetch, opens every popup and supplies the clock and the random bytes. There is no I/O.
|
|
140
|
+
|
|
141
|
+
### API
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
import init, { initSync, parseConfig, beginSignIn, completeSignIn,
|
|
145
|
+
parseTokenResponse, refreshRequest, scopesSatisfied, shouldBackoff } from '@ai-ecoverse/jerk-oauth';
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
- **`parseConfig(tomlOrJson)`** — returns `{ ok, config?, errors? }`. Accepts TOML (the `[oauth]` block) or JSON.
|
|
149
|
+
- **`beginSignIn(configJson, scope, nowSecs, random32, random16)`** — returns `{ authorizeUrl, state, expectedNonce?, pending }`. `pending` is opaque JSON the caller keeps in memory.
|
|
150
|
+
- **`completeSignIn(configJson, pendingJson, capturedUrl)`** — returns `{ kind: "exchange", url, body }` (for PKCE) or `{ kind: "token", token, expiresAt?, scope? }` (implicit). Throws `{ kind: "error", code, message }` on state mismatch or IdP error.
|
|
151
|
+
- **`parseTokenResponse(configJson, body, nowSecs)`** — returns `{ accessToken, refreshToken?, expiresAt?, scope? }`.
|
|
152
|
+
- **`refreshRequest(configJson, refreshToken)`** — returns `{ url, body }`.
|
|
153
|
+
- **`scopesSatisfied(granted, requested)`** — boolean.
|
|
154
|
+
- **`shouldBackoff(lastFailureSecs, nowSecs)`** — boolean (5-minute window).
|
package/bin/jerk.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-ecoverse/slicc-jerk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Get, list, create and drop OAuth tokens across operating systems and inside SLICC, by dispatching to each provider's own CLI",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@ai-ecoverse/slicc-jerk-darwin-arm64": "0.
|
|
31
|
-
"@ai-ecoverse/slicc-jerk-darwin-x64": "0.
|
|
32
|
-
"@ai-ecoverse/slicc-jerk-linux-arm64": "0.
|
|
33
|
-
"@ai-ecoverse/slicc-jerk-linux-x64": "0.
|
|
34
|
-
"@ai-ecoverse/slicc-jerk-win32-arm64": "0.
|
|
35
|
-
"@ai-ecoverse/slicc-jerk-win32-x64": "0.
|
|
30
|
+
"@ai-ecoverse/slicc-jerk-darwin-arm64": "0.8.1",
|
|
31
|
+
"@ai-ecoverse/slicc-jerk-darwin-x64": "0.8.1",
|
|
32
|
+
"@ai-ecoverse/slicc-jerk-linux-arm64": "0.8.1",
|
|
33
|
+
"@ai-ecoverse/slicc-jerk-linux-x64": "0.8.1",
|
|
34
|
+
"@ai-ecoverse/slicc-jerk-win32-arm64": "0.8.1",
|
|
35
|
+
"@ai-ecoverse/slicc-jerk-win32-x64": "0.8.1"
|
|
36
36
|
}
|
|
37
37
|
}
|