@nanolink/signing-client 0.1.0 → 0.1.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 +43 -43
- package/package.json +36 -36
package/README.md
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
# @nanolink/signing-client
|
|
2
|
-
|
|
3
|
-
TypeScript npm package for interacting with a JWT signing service.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @nanolink/signing-client
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { SigningClient } from "@nanolink/signing-client";
|
|
15
|
-
|
|
16
|
-
const client = new SigningClient({ baseUrl: "http://localhost:8080" });
|
|
17
|
-
|
|
18
|
-
const health = await client.healthz();
|
|
19
|
-
const signed = await client.sign({
|
|
20
|
-
sub: "device-42",
|
|
21
|
-
kind: "access",
|
|
22
|
-
aud: ["api.example.com"],
|
|
23
|
-
ttl_seconds: 3600,
|
|
24
|
-
claims: { tid: "tenant-acme", ver: 3 }
|
|
25
|
-
});
|
|
26
|
-
const jwks = await client.getJwks();
|
|
27
|
-
const publicKeyPem = await client.getPublicKeyPem();
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## API
|
|
31
|
-
|
|
32
|
-
- `healthz()` -> `{ status: "ok" }`
|
|
33
|
-
- `sign(request)` -> `{ token: string }`
|
|
34
|
-
- `getJwks()` -> `{ keys: Jwk[] }`
|
|
35
|
-
- `getPublicKeyPem(kid?)` -> `string` (SPKI PEM public key)
|
|
36
|
-
|
|
37
|
-
## Error handling
|
|
38
|
-
|
|
39
|
-
All non-2xx responses throw `SigningClientError` with:
|
|
40
|
-
|
|
41
|
-
- `status`: HTTP status code
|
|
42
|
-
- `message`: error description from service or fallback text
|
|
43
|
-
- `body`: parsed JSON or raw response body (if available)
|
|
1
|
+
# @nanolink/signing-client
|
|
2
|
+
|
|
3
|
+
TypeScript npm package for interacting with a JWT signing service.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @nanolink/signing-client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { SigningClient } from "@nanolink/signing-client";
|
|
15
|
+
|
|
16
|
+
const client = new SigningClient({ baseUrl: "http://localhost:8080" });
|
|
17
|
+
|
|
18
|
+
const health = await client.healthz();
|
|
19
|
+
const signed = await client.sign({
|
|
20
|
+
sub: "device-42",
|
|
21
|
+
kind: "access",
|
|
22
|
+
aud: ["api.example.com"],
|
|
23
|
+
ttl_seconds: 3600,
|
|
24
|
+
claims: { tid: "tenant-acme", ver: 3 }
|
|
25
|
+
});
|
|
26
|
+
const jwks = await client.getJwks();
|
|
27
|
+
const publicKeyPem = await client.getPublicKeyPem();
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API
|
|
31
|
+
|
|
32
|
+
- `healthz()` -> `{ status: "ok" }`
|
|
33
|
+
- `sign(request)` -> `{ token: string }`
|
|
34
|
+
- `getJwks()` -> `{ keys: Jwk[] }`
|
|
35
|
+
- `getPublicKeyPem(kid?)` -> `string` (SPKI PEM public key)
|
|
36
|
+
|
|
37
|
+
## Error handling
|
|
38
|
+
|
|
39
|
+
All non-2xx responses throw `SigningClientError` with:
|
|
40
|
+
|
|
41
|
+
- `status`: HTTP status code
|
|
42
|
+
- `message`: error description from service or fallback text
|
|
43
|
+
- `body`: parsed JSON or raw response body (if available)
|
package/package.json
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@nanolink/signing-client",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "TypeScript Node.js client for the Signing Service API",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist"
|
|
10
|
-
],
|
|
11
|
-
"engines": {
|
|
12
|
-
"node": ">=18"
|
|
13
|
-
},
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc -p tsconfig.json",
|
|
16
|
-
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
17
|
-
"prebuild": "npm run clean",
|
|
18
|
-
"test": "node --test dist/**/*.test.js",
|
|
19
|
-
"test:src": "node --loader ts-node/esm --test src/**/*.test.ts"
|
|
20
|
-
},
|
|
21
|
-
"keywords": [
|
|
22
|
-
"jwt",
|
|
23
|
-
"jwks",
|
|
24
|
-
"signing",
|
|
25
|
-
"typescript",
|
|
26
|
-
"nodejs"
|
|
27
|
-
],
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"axios": "^1.8.4"
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@types/node": "^22.15.3",
|
|
33
|
-
"ts-node": "^10.9.2",
|
|
34
|
-
"typescript": "^5.8.3"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@nanolink/signing-client",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "TypeScript Node.js client for the Signing Service API",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
17
|
+
"prebuild": "npm run clean",
|
|
18
|
+
"test": "node --test dist/**/*.test.js",
|
|
19
|
+
"test:src": "node --loader ts-node/esm --test src/**/*.test.ts"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"jwt",
|
|
23
|
+
"jwks",
|
|
24
|
+
"signing",
|
|
25
|
+
"typescript",
|
|
26
|
+
"nodejs"
|
|
27
|
+
],
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"axios": "^1.8.4"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^22.15.3",
|
|
33
|
+
"ts-node": "^10.9.2",
|
|
34
|
+
"typescript": "^5.8.3"
|
|
35
|
+
}
|
|
36
|
+
}
|