@inixiative/signet 0.12.1 → 0.12.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 +6 -4
- package/package.json +2 -2
- package/src/client.ts +4 -2
- package/src/files.ts +1 -1
- package/src/proof.ts +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# @inixiative/signet
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Part of [inixiative](https://www.inixiative.com), technology for cooperation. See [all the projects](https://github.com/inixiative).
|
|
4
|
+
|
|
5
|
+
Pass-through execution with tracking and audit. A Signet is how anything uses an integration through Kingdom: a revocable pass on the owner's terms. Kingdom decides who may grant and use one with [`@inixiative/permissions`](https://github.com/inixiative/permissions); a grant's lens is [json-rules](https://github.com/inixiative/json-rules). This package presents Kingdom Signets.
|
|
4
6
|
|
|
5
7
|
A **Signet** is Kingdom's only grant for using an integration. It names the resources, operations, lens and limits, and it can be revoked. Its grantee is a user or an integration, for example a paired Foundry or a machine's local Archive. The grantee presents it with an access token plus a DPoP proof signed by its device key (RFC 9449).
|
|
6
8
|
|
|
7
|
-
This package is the one implementation of that protocol, shared by Kingdom (which verifies) and Archive, Foundry and
|
|
9
|
+
This package is the one implementation of that protocol, shared by Kingdom (which verifies) and Archive, Foundry, Oracle and KCP (which present):
|
|
8
10
|
|
|
9
11
|
- `contracts`: the wire schemas: keys, grants (operation picks, lens layers, terms), proposals, pairing requests, delivered credentials, `describe` and `execute`, and the conversation frames.
|
|
10
12
|
- `proof`: create and verify DPoP proofs (ES256, nonce-bound, access-token-bound).
|
|
@@ -16,7 +18,7 @@ This package is the one implementation of that protocol, shared by Kingdom (whic
|
|
|
16
18
|
- a **person or their agent** acts as themselves with a Kingdom API token plus a proof from its key: `requestSignet` asks for a Signet on an integration (a `signetRequest` Inquiry, approved at once when the caller manages the integration), `awaitSignet` polls `collectSignet` until it is approved, and `enrollSignet` enrolls the key on a Signet an owner granted directly (`owner/grant`). `saveCollectedSignet` writes either result next to the key;
|
|
17
19
|
- `installation`: the layout every installation shares, under one root per product (a Foundry's `kingdom/`, `~/.kcp`): one directory per Kingdom host with its key and one file per Signet (`installationPaths`, `installationDirectory`, `signetCredentialFile`, `heldCredentials`), `privateDirectory`, and `defaultInstallationName(product)`. `listedSignets`, `heldSignetFile` and `withdrawRegistration` read and act on it. `holdPersonSignets` enrolls the key on Signets issued to a person, under the same per-directory `withHoldLock` as `holdInstallationSignets`, so a person login and an installation sync never enroll over each other;
|
|
18
20
|
- `SignetHolders`, a cache of each held Signet's `access/describe` (with its `holder`), keyed by credential file or by the caller's own `keyOf`, refreshed after `stale()`;
|
|
19
|
-
- `SignetClient`, which renews its access token and signs each call: `describe`, `execute`, task settlement, and the run actions a Foundry uses for inference (`resolveRun`, `delegateRun`, `renewRun`, `revokeRun`), and for a subscription run `releaseSubscription` and `
|
|
21
|
+
- `SignetClient`, which renews its access token and signs each call: `describe`, `execute`, task settlement, and the run actions a Foundry uses for inference (`resolveRun`, `delegateRun`, `renewRun`, `revokeRun`), and for a subscription run `releaseSubscription`, `reportSubscriptionLimits` and `reportCredentialRejected` (the provider rejected the login a release handed out).
|
|
20
22
|
|
|
21
23
|
```ts
|
|
22
24
|
import { holdInstallationSignets, InstallationSocket, pairInstallation, SignetClient } from '@inixiative/signet';
|
|
@@ -106,7 +108,7 @@ socket.start();
|
|
|
106
108
|
await signet.execute({
|
|
107
109
|
integrationId,
|
|
108
110
|
operation: 'thread.prompt',
|
|
109
|
-
input: { resourceId, threadId, postId:
|
|
111
|
+
input: { resourceId, threadId, postId: Bun.randomUUIDv7(), text: 'The role you wanted opened' },
|
|
110
112
|
});
|
|
111
113
|
```
|
|
112
114
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inixiative/signet",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.3",
|
|
4
4
|
"description": "Present Kingdom Signets: the wire contracts, DPoP proofs, device pairing and a renewing client shared by Kingdom, Archive, Foundry and Oracle.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@asteasolutions/zod-to-openapi": "^9.1.0",
|
|
37
37
|
"@biomejs/biome": "2.5.2",
|
|
38
|
-
"@inixiative/config": "^0.5.
|
|
38
|
+
"@inixiative/config": "^0.5.188",
|
|
39
39
|
"@inixiative/json-rules": "^3.16.0",
|
|
40
40
|
"@types/bun": "1.4.4",
|
|
41
41
|
"lefthook": "2.1.9",
|
package/src/client.ts
CHANGED
|
@@ -500,7 +500,8 @@ export type SignetAction =
|
|
|
500
500
|
| 'renewRun'
|
|
501
501
|
| 'revokeRun'
|
|
502
502
|
| 'releaseSubscription'
|
|
503
|
-
| 'reportSubscriptionLimits'
|
|
503
|
+
| 'reportSubscriptionLimits'
|
|
504
|
+
| 'reportCredentialRejected';
|
|
504
505
|
const signetActions: SignetAction[] = [
|
|
505
506
|
'describe',
|
|
506
507
|
'execute',
|
|
@@ -513,6 +514,7 @@ const signetActions: SignetAction[] = [
|
|
|
513
514
|
'revokeRun',
|
|
514
515
|
'releaseSubscription',
|
|
515
516
|
'reportSubscriptionLimits',
|
|
517
|
+
'reportCredentialRejected',
|
|
516
518
|
];
|
|
517
519
|
|
|
518
520
|
/** Presents one enrolled Signet: renews its access token and signs each call with the device key. */
|
|
@@ -641,7 +643,7 @@ export class SignetClient {
|
|
|
641
643
|
return accessResultSchema.parse(
|
|
642
644
|
await this.post(
|
|
643
645
|
'execute',
|
|
644
|
-
{ ...request, signetId: this.signetId, requestId:
|
|
646
|
+
{ ...request, signetId: this.signetId, requestId: Bun.randomUUIDv7() },
|
|
645
647
|
undefined,
|
|
646
648
|
options,
|
|
647
649
|
),
|
package/src/files.ts
CHANGED
|
@@ -32,7 +32,7 @@ export async function writePrivateJson(path: string, value: unknown): Promise<vo
|
|
|
32
32
|
(process.getuid && parent.uid !== process.getuid())
|
|
33
33
|
)
|
|
34
34
|
throw Error('Signet credential directory must be owned and private (0700)');
|
|
35
|
-
const temporary = join(dirname(path), `.credential-${
|
|
35
|
+
const temporary = join(dirname(path), `.credential-${Bun.randomUUIDv7()}`);
|
|
36
36
|
try {
|
|
37
37
|
await writeFile(temporary, JSON.stringify(value), { mode: 0o600, flag: 'wx' });
|
|
38
38
|
await rename(temporary, path);
|
package/src/proof.ts
CHANGED
|
@@ -76,7 +76,7 @@ export const createSignetProof = async (input: {
|
|
|
76
76
|
jwk: publicClientKeySchema.parse(input.publicKey),
|
|
77
77
|
})
|
|
78
78
|
.setIssuedAt()
|
|
79
|
-
.setJti(input.proofId ??
|
|
79
|
+
.setJti(input.proofId ?? Bun.randomUUIDv7())
|
|
80
80
|
.sign(await importJWK(input.privateKey, 'ES256'));
|
|
81
81
|
|
|
82
82
|
export const keyThumbprint = (key: unknown) =>
|