@privos_ai/app-server 0.5.0 → 0.6.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 +169 -2
- package/dist/app-descriptor.d.ts.map +1 -1
- package/dist/app-descriptor.js +2 -0
- package/dist/app-descriptor.js.map +1 -1
- package/dist/auth/user-token.d.ts.map +1 -1
- package/dist/auth/user-token.js +21 -3
- package/dist/auth/user-token.js.map +1 -1
- package/dist/context/tool-call-context.d.ts +15 -2
- package/dist/context/tool-call-context.d.ts.map +1 -1
- package/dist/direct/express-router.d.ts +3 -0
- package/dist/direct/express-router.d.ts.map +1 -1
- package/dist/direct/express-router.js +70 -10
- package/dist/direct/express-router.js.map +1 -1
- package/dist/direct/http-ingress.js +1 -1
- package/dist/direct/http-ingress.js.map +1 -1
- package/dist/index.d.ts +16 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/relay/hub-user-token-actor.d.ts +62 -0
- package/dist/relay/hub-user-token-actor.d.ts.map +1 -0
- package/dist/relay/hub-user-token-actor.js +81 -0
- package/dist/relay/hub-user-token-actor.js.map +1 -0
- package/dist/relay/relay-client.d.ts +66 -11
- package/dist/relay/relay-client.d.ts.map +1 -1
- package/dist/relay/relay-client.js +134 -15
- package/dist/relay/relay-client.js.map +1 -1
- package/dist/relay/standalone-control.d.ts +45 -0
- package/dist/relay/standalone-control.d.ts.map +1 -0
- package/dist/relay/standalone-control.js +338 -0
- package/dist/relay/standalone-control.js.map +1 -0
- package/dist/relay/standalone-identity.d.ts +69 -0
- package/dist/relay/standalone-identity.d.ts.map +1 -0
- package/dist/relay/standalone-identity.js +204 -0
- package/dist/relay/standalone-identity.js.map +1 -0
- package/dist/relay/standalone-readiness.d.ts +33 -0
- package/dist/relay/standalone-readiness.d.ts.map +1 -0
- package/dist/relay/standalone-readiness.js +80 -0
- package/dist/relay/standalone-readiness.js.map +1 -0
- package/dist/runtime-mode.d.ts +25 -0
- package/dist/runtime-mode.d.ts.map +1 -0
- package/dist/runtime-mode.js +72 -0
- package/dist/runtime-mode.js.map +1 -0
- package/dist/runtime.d.ts +9 -5
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +9 -7
- package/dist/runtime.js.map +1 -1
- package/dist/workload/dispatch-assertion.d.ts +20 -8
- package/dist/workload/dispatch-assertion.d.ts.map +1 -1
- package/dist/workload/dispatch-assertion.js +30 -23
- package/dist/workload/dispatch-assertion.js.map +1 -1
- package/dist/workload/index.d.ts +3 -3
- package/dist/workload/index.d.ts.map +1 -1
- package/dist/workload/index.js +1 -1
- package/dist/workload/index.js.map +1 -1
- package/dist/workload/managed-ingress-authority.d.ts +26 -0
- package/dist/workload/managed-ingress-authority.d.ts.map +1 -0
- package/dist/workload/managed-ingress-authority.js +45 -0
- package/dist/workload/managed-ingress-authority.js.map +1 -0
- package/dist/workload/workload-identity.d.ts +26 -2
- package/dist/workload/workload-identity.d.ts.map +1 -1
- package/dist/workload/workload-identity.js +377 -19
- package/dist/workload/workload-identity.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { MCP_PROTOCOL_VERSION, MCP_UI_MIME } from './app-descriptor.js';
|
|
2
2
|
export type { AppDescriptor, AppPermissionDescriptor, AppPermissionRequirement, AppPermissionContext, AppPermissionExecutionContext, } from './app-descriptor.js';
|
|
3
3
|
export { buildInitializeResult, buildManifestJson, buildPairingMetadata, validateDescriptorCapabilities, validateDescriptorPermissions, } from './app-descriptor.js';
|
|
4
|
-
export type { VerifiedActor, IdentityState, ToolCallContext, } from './context/tool-call-context.js';
|
|
4
|
+
export type { VerifiedActor, VerifiedActorProvenance, IdentityState, ToolCallContext, } from './context/tool-call-context.js';
|
|
5
5
|
export type { AppAccessMode, PlatformContext } from './context/platform-context.js';
|
|
6
6
|
export { getPlatformContext, publicUrlFor } from './context/platform-context.js';
|
|
7
7
|
export type { IdentityEnforcementMode } from './context/identity-mode.js';
|
|
@@ -19,12 +19,22 @@ export type { DirectRouterOptions } from './direct/express-router.js';
|
|
|
19
19
|
export { createHttpIngressApp, startHttpIngress, resolveHttpIngressListen, } from './direct/http-ingress.js';
|
|
20
20
|
export type { HttpIngressAppOptions, HttpIngressListenOptions, HttpIngressHandle, ReadinessCheckResult, ResolveHttpIngressListenOptions, } from './direct/http-ingress.js';
|
|
21
21
|
export { pairOverWebSocket, pairFromDescriptor, connectRelay, } from './relay/relay-client.js';
|
|
22
|
-
export type { PairAppMeta, PairingResult, RelayClientOptions, RelayHandle, } from './relay/relay-client.js';
|
|
22
|
+
export type { PairAppMeta, PairingResult, PairOverWebSocketOptions, RelayClientOptions, RelayHandle, } from './relay/relay-client.js';
|
|
23
23
|
export { rawDataToText, MessageTooLargeError } from './relay/message-adapter.js';
|
|
24
|
-
export {
|
|
25
|
-
export type {
|
|
26
|
-
export {
|
|
27
|
-
export type {
|
|
24
|
+
export { DEFAULT_HUB_USER_TOKEN_JWKS_PATH, buildHubUserTokenAuthOptions, extractRelayUserTokenCredential, validateHubUserTokenOrigin, } from './relay/hub-user-token-actor.js';
|
|
25
|
+
export type { HubUserTokenAuthOptions } from './relay/hub-user-token-actor.js';
|
|
26
|
+
export { DEFAULT_STANDALONE_IDENTITY_FILE, StandaloneIdentityError, loadStandaloneIdentity, saveStandaloneIdentity, rotateStandaloneIdentity, standaloneIdentityFileExists, standaloneHubFingerprint, assertStandaloneIdentityShape, } from './relay/standalone-identity.js';
|
|
27
|
+
export type { StandaloneIdentityV2, LoadedStandaloneIdentity, StandaloneIdentityErrorCode, } from './relay/standalone-identity.js';
|
|
28
|
+
export { STANDALONE_SECRET_ROTATE_METHOD, STANDALONE_TRUST_ROTATE_METHOD, STANDALONE_CAPABILITIES_CHANGED_METHOD, StandaloneControlError, isStandaloneControlMethod, createStandaloneRelayIdentityController, loadStandaloneRelayIdentityController, } from './relay/standalone-control.js';
|
|
29
|
+
export type { StandaloneEffectiveCapabilities, StandaloneRelayIdentityController, StandaloneRelayIdentityControllerOptions, } from './relay/standalone-control.js';
|
|
30
|
+
export { checkManifestDigestDrift, createStandaloneReadinessCheck, } from './relay/standalone-readiness.js';
|
|
31
|
+
export type { StandaloneReadinessCheckOptions, StandaloneReadinessReason, StandaloneReadinessResult, } from './relay/standalone-readiness.js';
|
|
32
|
+
export { resolveRuntimeMode, RuntimeModeError } from './runtime-mode.js';
|
|
33
|
+
export type { RuntimeMode, RuntimeModeResolution, RuntimeModeErrorCode, ResolveRuntimeModeOptions, } from './runtime-mode.js';
|
|
34
|
+
export { DEFAULT_WORKLOAD_SOCKET, WorkloadIdentityClient, WorkloadIdentityError, WorkloadPermissionDeniedError, RoomBoundWorkloadClient, getWorkloadIdentityClient, } from './workload/workload-identity.js';
|
|
35
|
+
export type { EffectiveCapabilities, WorkloadBinding, WorkloadBrokerContext, WorkloadBrokerResponse, WorkloadFetchInit, RoomBoundWorkloadFetchInit, WorkloadIdentityClientOptions, WorkloadIdentityErrorCode, } from './workload/workload-identity.js';
|
|
36
|
+
export { BoundedRuntimeDispatchReplayConsumerV3, assertRuntimeDispatchRelayAffinityV3, assertRuntimeDispatchTrustConfigurationV3, extractRuntimeDispatchRelayEnvelopeV3, isExactRuntimeReadinessRpcV3, isUnsignedRuntimeReadinessRpcV3, parseRuntimeDispatchTrustV3Json, sha256RuntimeDispatchBodyV3, verifyClusterDispatchAssertionV3, verifyDispatchAssertion, verifyRuntimeDispatchAssertionV3, } from './workload/dispatch-assertion.js';
|
|
37
|
+
export type { RuntimeDispatchAffinityV3, RuntimeDispatchExecutionModeV3, RuntimeDispatchRelayAuthorizationV3, RuntimeDispatchRelayEnvelopeV3, RuntimeDispatchReplayConsumerV3, RuntimeDispatchReplayInputV3, RuntimeDispatchSecurityV3, RuntimeDispatchTrustHintV3, RuntimeDispatchTrustResolverV3, RuntimeDispatchTrustV3, VerifiedClusterDispatchAssertionV3, VerifiedDispatchActor, VerifiedDispatchAssertion, VerifiedRuntimeDispatchAssertionV3, VerifiedRuntimeAuthorizationV3, } from './workload/dispatch-assertion.js';
|
|
28
38
|
export { createPinnedPortalJwksResolverV3, createPublisherRuntimeTrustProvisioningRouterV3, SingleProcessFilePublisherRuntimeTrustStoreV3, } from './workload/publisher-runtime-trust.js';
|
|
29
39
|
export type { PublisherPortalJwksResolutionV3, PublisherPortalJwksResolverV3, PublisherRuntimeTrustActiveEvidenceV3, PublisherRuntimeTrustDurableStoreV3, PublisherRuntimeTrustEvidenceV3, PublisherRuntimeTrustOperationV3, PublisherRuntimeTrustPreparedEvidenceV3, PublisherRuntimeTrustProvisioningRequestV3, PublisherRuntimeTrustProvisioningRouterOptionsV3, PublisherRuntimeTrustStoreMutationV3, } from './workload/publisher-runtime-trust.js';
|
|
30
40
|
export { canonicalJson, canonicalJsonValue, lintManifest, lintManifestV2, sha256CanonicalJson, SUPPORTED_MANIFEST_SCHEMA_VERSIONS, } from './manifest-tools.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACxE,YAAY,EACX,aAAa,EACb,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,6BAA6B,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,8BAA8B,EAC9B,6BAA6B,GAC7B,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACX,aAAa,EACb,aAAa,EACb,eAAe,GACf,MAAM,gCAAgC,CAAC;AACxC,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACjF,YAAY,EAAE,uBAAuB,EAAE,MAA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uB,EACvB,gCAAgC,GAChC,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EACX,yBAAyB,EACzB,8BAA8B,EAC9B,mCAAmC,EACnC,8BAA8B,EAC9B,+BAA+B,EAC/B,4BAA4B,EAC5B,yBAAyB,EACzB,0BAA0B,EAC1B,8BAA8B,EAC9B,sBAAsB,EACtB,kCAAkC,EAClC,qBAAqB,EACrB,yBAAyB,EACzB,kCAAkC,EAClC,8BAA8B,GAC9B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,gCAAgC,EAChC,+CAA+C,EAC/C,6CAA6C,GAC7C,MAAM,uCAAuC,CAAC;AAC/C,YAAY,EACX,+BAA+B,EAC/B,6BAA6B,EAC7B,qCAAqC,EACrC,mCAAmC,EACnC,+BAA+B,EAC/B,gCAAgC,EAChC,uCAAuC,EACvC,0CAA0C,EAC1C,gDAAgD,EAChD,oCAAoC,GACpC,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACN,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,kCAAkC,GAClC,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,8 +11,13 @@ export { createDirectRouter } from './direct/express-router.js';
|
|
|
11
11
|
export { createHttpIngressApp, startHttpIngress, resolveHttpIngressListen, } from './direct/http-ingress.js';
|
|
12
12
|
export { pairOverWebSocket, pairFromDescriptor, connectRelay, } from './relay/relay-client.js';
|
|
13
13
|
export { rawDataToText, MessageTooLargeError } from './relay/message-adapter.js';
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
14
|
+
export { DEFAULT_HUB_USER_TOKEN_JWKS_PATH, buildHubUserTokenAuthOptions, extractRelayUserTokenCredential, validateHubUserTokenOrigin, } from './relay/hub-user-token-actor.js';
|
|
15
|
+
export { DEFAULT_STANDALONE_IDENTITY_FILE, StandaloneIdentityError, loadStandaloneIdentity, saveStandaloneIdentity, rotateStandaloneIdentity, standaloneIdentityFileExists, standaloneHubFingerprint, assertStandaloneIdentityShape, } from './relay/standalone-identity.js';
|
|
16
|
+
export { STANDALONE_SECRET_ROTATE_METHOD, STANDALONE_TRUST_ROTATE_METHOD, STANDALONE_CAPABILITIES_CHANGED_METHOD, StandaloneControlError, isStandaloneControlMethod, createStandaloneRelayIdentityController, loadStandaloneRelayIdentityController, } from './relay/standalone-control.js';
|
|
17
|
+
export { checkManifestDigestDrift, createStandaloneReadinessCheck, } from './relay/standalone-readiness.js';
|
|
18
|
+
export { resolveRuntimeMode, RuntimeModeError } from './runtime-mode.js';
|
|
19
|
+
export { DEFAULT_WORKLOAD_SOCKET, WorkloadIdentityClient, WorkloadIdentityError, WorkloadPermissionDeniedError, RoomBoundWorkloadClient, getWorkloadIdentityClient, } from './workload/workload-identity.js';
|
|
20
|
+
export { BoundedRuntimeDispatchReplayConsumerV3, assertRuntimeDispatchRelayAffinityV3, assertRuntimeDispatchTrustConfigurationV3, extractRuntimeDispatchRelayEnvelopeV3, isExactRuntimeReadinessRpcV3, isUnsignedRuntimeReadinessRpcV3, parseRuntimeDispatchTrustV3Json, sha256RuntimeDispatchBodyV3, verifyClusterDispatchAssertionV3, verifyDispatchAssertion, verifyRuntimeDispatchAssertionV3, } from './workload/dispatch-assertion.js';
|
|
16
21
|
export { createPinnedPortalJwksResolverV3, createPublisherRuntimeTrustProvisioningRouterV3, SingleProcessFilePublisherRuntimeTrustStoreV3, } from './workload/publisher-runtime-trust.js';
|
|
17
22
|
export { canonicalJson, canonicalJsonValue, lintManifest, lintManifestV2, sha256CanonicalJson, SUPPORTED_MANIFEST_SCHEMA_VERSIONS, } from './manifest-tools.js';
|
|
18
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB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Relay transport.
|
|
3
|
+
*
|
|
4
|
+
* Protocol-v3 runtime dispatch (`SELF_HOSTED_LOCAL` / `PUBLISHER_HOSTED`) has
|
|
5
|
+
* no room for an `actor` claim inside the signed dispatch assertion — only
|
|
6
|
+
* the managed-Cluster assertion variant carries one
|
|
7
|
+
* (`dispatch-assertion.ts` `CLUSTER_DISPATCH_V3_OPTIONAL_KEYS`). Instead, the
|
|
8
|
+
* Hub sends caller identity for these apps as a SEPARATE short-lived RS256
|
|
9
|
+
* JWT at `params._meta.privosUser.userToken`, verifiable against the Hub's
|
|
10
|
+
* published JWKS (`/.well-known/mcp-apps/jwks.json`).
|
|
11
|
+
*
|
|
12
|
+
* The plain `userId` / `username` / `roomId` fields that ride alongside the
|
|
13
|
+
* token are NOT proof of anything — only the signed token is. This module
|
|
14
|
+
* never builds a `VerifiedActor` from those plain fields; `userId` is passed
|
|
15
|
+
* through only as `assertedUserId`, which `verifyUserToken` cross-checks
|
|
16
|
+
* against the verified token's `sub` and REJECTS on mismatch — it never
|
|
17
|
+
* substitutes for verification.
|
|
18
|
+
*/
|
|
19
|
+
import type { AuthOptions, CallerCredential } from '../auth/user-token.js';
|
|
20
|
+
import type { RelayCallerAuthSurface } from '../runtime.js';
|
|
21
|
+
/** Path the Hub serves its MCP-app user-token JWKS at (`mcp-user-token-jwks.ts`). */
|
|
22
|
+
export declare const DEFAULT_HUB_USER_TOKEN_JWKS_PATH = "/.well-known/mcp-apps/jwks.json";
|
|
23
|
+
/**
|
|
24
|
+
* Validate and normalize a Hub origin used only for user-token JWKS
|
|
25
|
+
* verification. Always a caller-supplied, config-time value (Relay
|
|
26
|
+
* `RelayClientOptions.privosUrl`, or a Direct/Cluster workload broker's
|
|
27
|
+
* `hubOrigin`) — an inbound WebSocket/HTTP message field must never reach
|
|
28
|
+
* this function.
|
|
29
|
+
*/
|
|
30
|
+
export declare function validateHubUserTokenOrigin(origin: string): string;
|
|
31
|
+
export interface HubUserTokenAuthOptions {
|
|
32
|
+
/** Config-time Hub origin — see {@link validateHubUserTokenOrigin}. */
|
|
33
|
+
hubOrigin: string;
|
|
34
|
+
/** This app's own `mcpAppId` — checked against the token's `aud` claim. */
|
|
35
|
+
audience: string | readonly string[] | (() => string | readonly string[]);
|
|
36
|
+
/** Default {@link DEFAULT_HUB_USER_TOKEN_JWKS_PATH}. */
|
|
37
|
+
jwksPath?: string;
|
|
38
|
+
issuer?: string | readonly string[];
|
|
39
|
+
clockToleranceSeconds?: number;
|
|
40
|
+
jwksCacheTtlMs?: number;
|
|
41
|
+
fetchTimeoutMs?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Builds `AuthOptions` for verifying a Hub-signed user token against the Hub
|
|
45
|
+
* JWKS. Production-plaintext-HTTP refusal, JWKS-fetch timeout bounding, and
|
|
46
|
+
* unknown-`kid` refetch-once-then-fail all live in the shared
|
|
47
|
+
* `auth/user-token.ts` verifier this feeds — this function only assembles
|
|
48
|
+
* the pointer at the correct, trusted origin.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildHubUserTokenAuthOptions(input: HubUserTokenAuthOptions): AuthOptions;
|
|
51
|
+
/**
|
|
52
|
+
* Built-in Relay `CallerCredentialExtractor` for the Hub-signed user token.
|
|
53
|
+
* Reads only the signed `userToken`; `userId` rides along as
|
|
54
|
+
* `assertedUserId`, cross-checked (never trusted on its own) by
|
|
55
|
+
* `verifyUserToken` against the token's verified `sub`.
|
|
56
|
+
*
|
|
57
|
+
* Returns `undefined` — never throws — when `_meta.privosUser` is absent or
|
|
58
|
+
* malformed, so a caller with no usable token degrades to
|
|
59
|
+
* `identityState: 'missing'` (fail closed) rather than failing dispatch.
|
|
60
|
+
*/
|
|
61
|
+
export declare function extractRelayUserTokenCredential(surface: RelayCallerAuthSurface): CallerCredential | undefined;
|
|
62
|
+
//# sourceMappingURL=hub-user-token-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-user-token-actor.d.ts","sourceRoot":"","sources":["../../src/relay/hub-user-token-actor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE5D,qFAAqF;AACrF,eAAO,MAAM,gCAAgC,oCAAoC,CAAC;AAelF;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAWjE;AAED,MAAM,WAAW,uBAAuB;IACvC,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,CAAC,MAAM,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC,CAAC;IAC1E,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IACpC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,uBAAuB,GAAG,WAAW,CAWxF;AAMD;;;;;;;;;GASG;AACH,wBAAgB,+BAA+B,CAC9C,OAAO,EAAE,sBAAsB,GAC7B,gBAAgB,GAAG,SAAS,CAgB9B"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** Path the Hub serves its MCP-app user-token JWKS at (`mcp-user-token-jwks.ts`). */
|
|
2
|
+
export const DEFAULT_HUB_USER_TOKEN_JWKS_PATH = '/.well-known/mcp-apps/jwks.json';
|
|
3
|
+
/** Mirrors the Hub JWKS route's own `Cache-Control: max-age=300`. */
|
|
4
|
+
const DEFAULT_JWKS_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
5
|
+
/**
|
|
6
|
+
* The Hub mints these tokens with a 5-minute TTL and no built-in future-skew
|
|
7
|
+
* budget beyond clock drift — 5s mirrors the dispatch-assertion verifier's
|
|
8
|
+
* own default skew (`dispatch-assertion.ts` `clockSkewSeconds`), not the
|
|
9
|
+
* generic 30s default `verifyUserToken` uses for other callers.
|
|
10
|
+
*/
|
|
11
|
+
const DEFAULT_CLOCK_TOLERANCE_SECONDS = 5;
|
|
12
|
+
const DEFAULT_FETCH_TIMEOUT_MS = 5_000;
|
|
13
|
+
/**
|
|
14
|
+
* Validate and normalize a Hub origin used only for user-token JWKS
|
|
15
|
+
* verification. Always a caller-supplied, config-time value (Relay
|
|
16
|
+
* `RelayClientOptions.privosUrl`, or a Direct/Cluster workload broker's
|
|
17
|
+
* `hubOrigin`) — an inbound WebSocket/HTTP message field must never reach
|
|
18
|
+
* this function.
|
|
19
|
+
*/
|
|
20
|
+
export function validateHubUserTokenOrigin(origin) {
|
|
21
|
+
let url;
|
|
22
|
+
try {
|
|
23
|
+
url = new URL(origin);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
throw new Error('Invalid Hub origin for user-token JWKS verification.');
|
|
27
|
+
}
|
|
28
|
+
if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password || url.search || url.hash) {
|
|
29
|
+
throw new Error('Invalid Hub origin for user-token JWKS verification.');
|
|
30
|
+
}
|
|
31
|
+
return url.origin;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Builds `AuthOptions` for verifying a Hub-signed user token against the Hub
|
|
35
|
+
* JWKS. Production-plaintext-HTTP refusal, JWKS-fetch timeout bounding, and
|
|
36
|
+
* unknown-`kid` refetch-once-then-fail all live in the shared
|
|
37
|
+
* `auth/user-token.ts` verifier this feeds — this function only assembles
|
|
38
|
+
* the pointer at the correct, trusted origin.
|
|
39
|
+
*/
|
|
40
|
+
export function buildHubUserTokenAuthOptions(input) {
|
|
41
|
+
const origin = validateHubUserTokenOrigin(input.hubOrigin);
|
|
42
|
+
const jwksUrl = new URL(input.jwksPath ?? DEFAULT_HUB_USER_TOKEN_JWKS_PATH, origin);
|
|
43
|
+
return {
|
|
44
|
+
jwksUrl,
|
|
45
|
+
audience: input.audience,
|
|
46
|
+
...(input.issuer !== undefined ? { issuer: input.issuer } : {}),
|
|
47
|
+
clockToleranceSeconds: input.clockToleranceSeconds ?? DEFAULT_CLOCK_TOLERANCE_SECONDS,
|
|
48
|
+
jwksCacheTtlMs: input.jwksCacheTtlMs ?? DEFAULT_JWKS_CACHE_TTL_MS,
|
|
49
|
+
fetchTimeoutMs: input.fetchTimeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function isRecord(value) {
|
|
53
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Built-in Relay `CallerCredentialExtractor` for the Hub-signed user token.
|
|
57
|
+
* Reads only the signed `userToken`; `userId` rides along as
|
|
58
|
+
* `assertedUserId`, cross-checked (never trusted on its own) by
|
|
59
|
+
* `verifyUserToken` against the token's verified `sub`.
|
|
60
|
+
*
|
|
61
|
+
* Returns `undefined` — never throws — when `_meta.privosUser` is absent or
|
|
62
|
+
* malformed, so a caller with no usable token degrades to
|
|
63
|
+
* `identityState: 'missing'` (fail closed) rather than failing dispatch.
|
|
64
|
+
*/
|
|
65
|
+
export function extractRelayUserTokenCredential(surface) {
|
|
66
|
+
const meta = surface._meta;
|
|
67
|
+
if (!isRecord(meta) || !Object.prototype.hasOwnProperty.call(meta, 'privosUser')) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
const privosUser = meta.privosUser;
|
|
71
|
+
if (!isRecord(privosUser) || typeof privosUser.userToken !== 'string' || !privosUser.userToken) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const assertedUserId = typeof privosUser.userId === 'string' && privosUser.userId ? privosUser.userId : undefined;
|
|
75
|
+
return {
|
|
76
|
+
token: privosUser.userToken,
|
|
77
|
+
...(assertedUserId !== undefined ? { assertedUserId } : {}),
|
|
78
|
+
source: 'relay-metadata',
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=hub-user-token-actor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-user-token-actor.js","sourceRoot":"","sources":["../../src/relay/hub-user-token-actor.ts"],"names":[],"mappings":"AAqBA,qFAAqF;AACrF,MAAM,CAAC,MAAM,gCAAgC,GAAG,iCAAiC,CAAC;AAElF,qEAAqE;AACrE,MAAM,yBAAyB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAE1C,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B,CAAC,MAAc;IACxD,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACJ,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACR,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QAC3G,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,CAAC;AACnB,CAAC;AAeD;;;;;;GAMG;AACH,MAAM,UAAU,4BAA4B,CAAC,KAA8B;IAC1E,MAAM,MAAM,GAAG,0BAA0B,CAAC,KAAK,CAAC,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,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5F,OAAO;QACN,KAAK,EAAE,UAAU,CAAC,SAAS;QAC3B,GAAG,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,MAAM,EAAE,gBAAgB;KACxB,CAAC;AACH,CAAC"}
|
|
@@ -2,7 +2,8 @@ import WebSocket from 'ws';
|
|
|
2
2
|
import { type AppDescriptor, type AppPermissionDescriptor } from '../app-descriptor.js';
|
|
3
3
|
import type { AuthOptions } from '../auth/user-token.js';
|
|
4
4
|
import { AppServerRuntime, type AppErrorMapper, type AppMcpHandler, type AppServerRuntimeOptions, type CallerCredentialExtractor, type RelayCallerAuthSurface, type RuntimeLimits, type UiResourceProvider } from '../runtime.js';
|
|
5
|
-
import { type
|
|
5
|
+
import { type StandaloneRelayIdentityController } from './standalone-control.js';
|
|
6
|
+
import { type RuntimeDispatchSecurityV3, type RuntimeDispatchTrustV3 } from '../workload/dispatch-assertion.js';
|
|
6
7
|
export interface PairAppMeta {
|
|
7
8
|
name: string;
|
|
8
9
|
description?: string;
|
|
@@ -16,11 +17,35 @@ export interface PairingResult {
|
|
|
16
17
|
clientId: string;
|
|
17
18
|
clientSecret: string;
|
|
18
19
|
mcpAppId?: string;
|
|
20
|
+
/** Present only when the Hub replied with pairing payload v2 (Hub dispatch trust bootstrap). */
|
|
21
|
+
pairingVersion?: 2;
|
|
22
|
+
trust?: RuntimeDispatchTrustV3;
|
|
23
|
+
/** `SHA256:<hubKid>` — print/compare out-of-band, SSH-host-key style. */
|
|
24
|
+
fingerprint?: string;
|
|
25
|
+
/** Absolute path the standalone identity file was written to, when persisted. */
|
|
26
|
+
identityFilePath?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface PairOverWebSocketOptions {
|
|
29
|
+
timeoutMs?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Persist a v2 pairing result as a standalone identity file. Default `true`
|
|
32
|
+
* — set `false` only when the caller manages persistence itself.
|
|
33
|
+
*/
|
|
34
|
+
persistIdentityFile?: boolean;
|
|
35
|
+
/** Overrides `PRIVOS_STANDALONE_IDENTITY_FILE` / the SDK default. */
|
|
36
|
+
identityFilePath?: string;
|
|
37
|
+
/** Receives the fingerprint line for out-of-band operator verification; defaults to `console.log`. */
|
|
38
|
+
onFingerprint?: (fingerprint: string) => void;
|
|
19
39
|
}
|
|
20
40
|
export interface RelayClientOptions {
|
|
21
41
|
privosUrl: string;
|
|
22
|
-
|
|
23
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Required unless `standaloneIdentity` is given, in which case live
|
|
44
|
+
* credentials are read from the controller on every token request
|
|
45
|
+
* (rotation-safe) and these are ignored.
|
|
46
|
+
*/
|
|
47
|
+
clientId?: string;
|
|
48
|
+
clientSecret?: string;
|
|
24
49
|
descriptor: AppDescriptor | (() => AppDescriptor | Promise<AppDescriptor>);
|
|
25
50
|
handler: AppMcpHandler;
|
|
26
51
|
ui?: UiResourceProvider;
|
|
@@ -40,25 +65,55 @@ export interface RelayClientOptions {
|
|
|
40
65
|
fetchImpl?: typeof fetch;
|
|
41
66
|
WebSocketImpl?: typeof WebSocket;
|
|
42
67
|
runtime?: AppServerRuntime;
|
|
43
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Explicit required final-boundary authorization for protocol-v3 publisher
|
|
70
|
+
* Relay traffic. Ignored when `standaloneIdentity` is given — its pinned
|
|
71
|
+
* trust is used instead, kept live across trust rotation.
|
|
72
|
+
*/
|
|
44
73
|
runtimeDispatchV3?: RuntimeDispatchSecurityV3;
|
|
74
|
+
/**
|
|
75
|
+
* Standalone-production identity source (phase 3 pairing). When set, this
|
|
76
|
+
* is the sole source of Relay OAuth credentials and dispatch trust —
|
|
77
|
+
* `clientId` / `clientSecret` / `runtimeDispatchV3` are ignored — and
|
|
78
|
+
* `notifications/privos.standalone*` control messages (secret rotation,
|
|
79
|
+
* trust rotation, capabilities push) are handled automatically.
|
|
80
|
+
*/
|
|
81
|
+
standaloneIdentity?: StandaloneRelayIdentityController;
|
|
82
|
+
/**
|
|
83
|
+
* Verify the Hub-signed RS256 user token carried at `_meta.privosUser` and
|
|
84
|
+
* populate `context.actor` for protocol-v3 runtime dispatch
|
|
85
|
+
* (`SELF_HOSTED_LOCAL` / `PUBLISHER_HOSTED`) — the assertion itself has no
|
|
86
|
+
* `actor` claim on this path, so this is the only signed source of caller
|
|
87
|
+
* identity Relay apps have. Default `'auto'`: wired in automatically using
|
|
88
|
+
* `privosUrl` as the Hub origin and this app's own `mcpAppId` as audience
|
|
89
|
+
* whenever `standaloneIdentity` is set, or `runtimeDispatchV3.trust` is a
|
|
90
|
+
* static (non-resolver) trust record — and only when the caller has not
|
|
91
|
+
* already supplied `auth` / `extractCallerCredential`. Set `'disabled'` to
|
|
92
|
+
* opt out entirely.
|
|
93
|
+
*/
|
|
94
|
+
hubUserTokenAuth?: 'auto' | 'disabled';
|
|
45
95
|
}
|
|
46
96
|
export interface RelayHandle {
|
|
47
97
|
/** Stop reconnecting and close the active socket. */
|
|
48
98
|
stop(): Promise<void>;
|
|
49
99
|
/** Resolves when the first successful connection opens (or rejects if stopped first). */
|
|
50
100
|
whenConnected(): Promise<void>;
|
|
101
|
+
/** True only while the current WebSocket is open past the authenticated handshake. */
|
|
102
|
+
isConnected(): boolean;
|
|
51
103
|
}
|
|
52
104
|
/**
|
|
53
105
|
* Pair with Privos using a one-time pairing URL.
|
|
54
|
-
*
|
|
106
|
+
*
|
|
107
|
+
* A v1 Hub response (no `pairingVersion`) behaves exactly as before: credentials
|
|
108
|
+
* are returned only, and the caller is responsible for saving them. A v2 Hub
|
|
109
|
+
* response additionally carries Hub dispatch trust; by default this function
|
|
110
|
+
* validates it and persists ONE standalone identity file (mode `0600`, `wx` on
|
|
111
|
+
* create — same discipline as the Hub's own identity file), then prints the
|
|
112
|
+
* Hub fingerprint for out-of-band operator verification. Set
|
|
113
|
+
* `persistIdentityFile: false` to opt out and handle persistence yourself.
|
|
55
114
|
*/
|
|
56
|
-
export declare function pairOverWebSocket(pairUrl: string, appMeta: PairAppMeta, WebSocketImpl?: typeof WebSocket, options?:
|
|
57
|
-
|
|
58
|
-
}): Promise<PairingResult>;
|
|
59
|
-
export declare function pairFromDescriptor(pairUrl: string, descriptor: AppDescriptor, WebSocketImpl?: typeof WebSocket, options?: {
|
|
60
|
-
timeoutMs?: number;
|
|
61
|
-
}): Promise<PairingResult>;
|
|
115
|
+
export declare function pairOverWebSocket(pairUrl: string, appMeta: PairAppMeta, WebSocketImpl?: typeof WebSocket, options?: PairOverWebSocketOptions): Promise<PairingResult>;
|
|
116
|
+
export declare function pairFromDescriptor(pairUrl: string, descriptor: AppDescriptor, WebSocketImpl?: typeof WebSocket, options?: PairOverWebSocketOptions): Promise<PairingResult>;
|
|
62
117
|
/**
|
|
63
118
|
* Connect to PrivOS relay WebSocket with exponential backoff, token refresh,
|
|
64
119
|
* single reconnect timer, and explicit stop().
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-client.d.ts","sourceRoot":"","sources":["../../src/relay/relay-client.ts"],"names":[],"mappings":"AAAA,OAAO,SAA2B,MAAM,IAAI,CAAC;AAE7C,OAAO,EAEN,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"relay-client.d.ts","sourceRoot":"","sources":["../../src/relay/relay-client.ts"],"names":[],"mappings":"AAAA,OAAO,SAA2B,MAAM,IAAI,CAAC;AAE7C,OAAO,EAEN,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAWzD,OAAO,EACN,gBAAgB,EAIhB,KAAK,cAAc,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