@duct-sdk/sdk 0.5.12 → 0.5.13
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/CHANGELOG.md +8 -0
- package/TOKEN_SPEC.md +6 -0
- package/dist/cli/index.js +6 -0
- package/dist/core/config.d.ts +69 -0
- package/dist/core/config.js +21 -1
- package/dist/core/hosted-upstream-check.d.ts +3 -0
- package/dist/core/hosted-upstream-check.js +35 -0
- package/dist/core/sdk-entrypoint.test.d.ts +1 -0
- package/dist/core/sdk-entrypoint.test.js +8 -0
- package/dist/core/token.conformance.test.d.ts +1 -0
- package/dist/core/token.conformance.test.js +43 -0
- package/dist/core/types.d.ts +25 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +15 -0
- package/fixtures/token-conformance-vectors.json +26 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog — @duct-sdk/sdk
|
|
2
2
|
|
|
3
|
+
## [0.5.13] — 2026-07-26
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- **Manifest `approval.stepUp` and `operatorNotifications`** schema defaults.
|
|
7
|
+
- **Token conformance vectors** (`fixtures/token-conformance-vectors.json`) and drift test.
|
|
8
|
+
- **`duct checkup` hosted-private upstream** detection for local `apiBaseUrl` against hosted profiles.
|
|
9
|
+
- **Root export guard** — `DuctSdkWrongEntrypointError` when React is not installed.
|
|
10
|
+
|
|
3
11
|
## [0.5.12] — 2026-07-25
|
|
4
12
|
|
|
5
13
|
### Added
|
package/TOKEN_SPEC.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Language-agnostic contract for verifying Duct tokens in any backend. This document is the source of truth for integrators who do not use the TypeScript SDK.
|
|
4
4
|
|
|
5
|
+
**Conformance:** [`fixtures/token-conformance-vectors.json`](./fixtures/token-conformance-vectors.json) plus `token.conformance.test.ts` in the SDK package.
|
|
6
|
+
|
|
7
|
+
**Clock skew:** allow ±60s on `exp`/`iat` unless your deployment documents otherwise.
|
|
8
|
+
|
|
9
|
+
**Rejection rules (HS256 delegated/deeplink):** reject `alg: none`, wrong `iss`/`aud`, expired `exp`, and missing required claims.
|
|
10
|
+
|
|
5
11
|
> **Production recommendation:** use **Ed25519 / JWKS** for delegated tokens, deeplinks, and outcome receipts where offline verification matters. **HS256 with a shared `DUCT_SECRET_KEY`** remains supported for local development and migration — never ship the symmetric secret to third-party verifiers.
|
|
6
12
|
|
|
7
13
|
---
|
package/dist/cli/index.js
CHANGED
|
@@ -803,6 +803,12 @@ program
|
|
|
803
803
|
outputPaths,
|
|
804
804
|
authDetection,
|
|
805
805
|
});
|
|
806
|
+
const apiUrl = config.product?.apiBaseUrl ?? config.product?.baseUrl ?? '';
|
|
807
|
+
const { shouldWarnHostedPrivateUpstream, hostedPrivateUpstreamMessage } = await import('../core/hosted-upstream-check.js');
|
|
808
|
+
if (apiUrl && shouldWarnHostedPrivateUpstream(apiUrl)) {
|
|
809
|
+
console.log(chalk.red(` ✗ ${hostedPrivateUpstreamMessage(apiUrl)}\n`));
|
|
810
|
+
process.exit(1);
|
|
811
|
+
}
|
|
806
812
|
printIntegrationAuditIssues(auditIssues);
|
|
807
813
|
if (integrationAuditFailed(auditIssues)) {
|
|
808
814
|
console.log(chalk.red(" ✗ Integration audit found blocking issues\n"));
|
package/dist/core/config.d.ts
CHANGED
|
@@ -573,14 +573,57 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
573
573
|
consentCallback: z.ZodOptional<z.ZodString>;
|
|
574
574
|
identityUrl: z.ZodOptional<z.ZodString>;
|
|
575
575
|
secret: z.ZodOptional<z.ZodString>;
|
|
576
|
+
deeplinkCallback: z.ZodOptional<z.ZodString>;
|
|
577
|
+
eventStream: z.ZodOptional<z.ZodString>;
|
|
576
578
|
}, "strip", z.ZodTypeAny, {
|
|
577
579
|
consentCallback?: string | undefined;
|
|
578
580
|
identityUrl?: string | undefined;
|
|
579
581
|
secret?: string | undefined;
|
|
582
|
+
deeplinkCallback?: string | undefined;
|
|
583
|
+
eventStream?: string | undefined;
|
|
580
584
|
}, {
|
|
581
585
|
consentCallback?: string | undefined;
|
|
582
586
|
identityUrl?: string | undefined;
|
|
583
587
|
secret?: string | undefined;
|
|
588
|
+
deeplinkCallback?: string | undefined;
|
|
589
|
+
eventStream?: string | undefined;
|
|
590
|
+
}>>;
|
|
591
|
+
approval: z.ZodOptional<z.ZodObject<{
|
|
592
|
+
stepUp: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
593
|
+
minSensitivity: z.ZodDefault<z.ZodOptional<z.ZodEnum<["none", "low", "medium", "high", "critical"]>>>;
|
|
594
|
+
requireForSideEffects: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
595
|
+
sideEffectsMinSensitivity: z.ZodDefault<z.ZodOptional<z.ZodEnum<["none", "low", "medium", "high", "critical"]>>>;
|
|
596
|
+
}, "strip", z.ZodTypeAny, {
|
|
597
|
+
minSensitivity: "none" | "low" | "medium" | "high" | "critical";
|
|
598
|
+
requireForSideEffects: boolean;
|
|
599
|
+
sideEffectsMinSensitivity: "none" | "low" | "medium" | "high" | "critical";
|
|
600
|
+
}, {
|
|
601
|
+
minSensitivity?: "none" | "low" | "medium" | "high" | "critical" | undefined;
|
|
602
|
+
requireForSideEffects?: boolean | undefined;
|
|
603
|
+
sideEffectsMinSensitivity?: "none" | "low" | "medium" | "high" | "critical" | undefined;
|
|
604
|
+
}>>>;
|
|
605
|
+
}, "strip", z.ZodTypeAny, {
|
|
606
|
+
stepUp: {
|
|
607
|
+
minSensitivity: "none" | "low" | "medium" | "high" | "critical";
|
|
608
|
+
requireForSideEffects: boolean;
|
|
609
|
+
sideEffectsMinSensitivity: "none" | "low" | "medium" | "high" | "critical";
|
|
610
|
+
};
|
|
611
|
+
}, {
|
|
612
|
+
stepUp?: {
|
|
613
|
+
minSensitivity?: "none" | "low" | "medium" | "high" | "critical" | undefined;
|
|
614
|
+
requireForSideEffects?: boolean | undefined;
|
|
615
|
+
sideEffectsMinSensitivity?: "none" | "low" | "medium" | "high" | "critical" | undefined;
|
|
616
|
+
} | undefined;
|
|
617
|
+
}>>;
|
|
618
|
+
operatorNotifications: z.ZodOptional<z.ZodObject<{
|
|
619
|
+
approverEmails: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
620
|
+
confirmationReminderLeadMinutes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
621
|
+
}, "strip", z.ZodTypeAny, {
|
|
622
|
+
approverEmails: string[];
|
|
623
|
+
confirmationReminderLeadMinutes?: number | null | undefined;
|
|
624
|
+
}, {
|
|
625
|
+
approverEmails?: string[] | undefined;
|
|
626
|
+
confirmationReminderLeadMinutes?: number | null | undefined;
|
|
584
627
|
}>>;
|
|
585
628
|
}, "strip", z.ZodTypeAny, {
|
|
586
629
|
auth: {
|
|
@@ -751,6 +794,19 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
751
794
|
consentCallback?: string | undefined;
|
|
752
795
|
identityUrl?: string | undefined;
|
|
753
796
|
secret?: string | undefined;
|
|
797
|
+
deeplinkCallback?: string | undefined;
|
|
798
|
+
eventStream?: string | undefined;
|
|
799
|
+
} | undefined;
|
|
800
|
+
approval?: {
|
|
801
|
+
stepUp: {
|
|
802
|
+
minSensitivity: "none" | "low" | "medium" | "high" | "critical";
|
|
803
|
+
requireForSideEffects: boolean;
|
|
804
|
+
sideEffectsMinSensitivity: "none" | "low" | "medium" | "high" | "critical";
|
|
805
|
+
};
|
|
806
|
+
} | undefined;
|
|
807
|
+
operatorNotifications?: {
|
|
808
|
+
approverEmails: string[];
|
|
809
|
+
confirmationReminderLeadMinutes?: number | null | undefined;
|
|
754
810
|
} | undefined;
|
|
755
811
|
}, {
|
|
756
812
|
auth: {
|
|
@@ -921,6 +977,19 @@ export declare const DuctConfigSchema: z.ZodObject<{
|
|
|
921
977
|
consentCallback?: string | undefined;
|
|
922
978
|
identityUrl?: string | undefined;
|
|
923
979
|
secret?: string | undefined;
|
|
980
|
+
deeplinkCallback?: string | undefined;
|
|
981
|
+
eventStream?: string | undefined;
|
|
982
|
+
} | undefined;
|
|
983
|
+
approval?: {
|
|
984
|
+
stepUp?: {
|
|
985
|
+
minSensitivity?: "none" | "low" | "medium" | "high" | "critical" | undefined;
|
|
986
|
+
requireForSideEffects?: boolean | undefined;
|
|
987
|
+
sideEffectsMinSensitivity?: "none" | "low" | "medium" | "high" | "critical" | undefined;
|
|
988
|
+
} | undefined;
|
|
989
|
+
} | undefined;
|
|
990
|
+
operatorNotifications?: {
|
|
991
|
+
approverEmails?: string[] | undefined;
|
|
992
|
+
confirmationReminderLeadMinutes?: number | null | undefined;
|
|
924
993
|
} | undefined;
|
|
925
994
|
}>;
|
|
926
995
|
export type ValidatedDuctConfig = z.infer<typeof DuctConfigSchema>;
|
package/dist/core/config.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// @duct/sdk — Config Definition and Validation
|
|
3
3
|
// ============================================================
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import { ActionManifestSchema, iso8601Schema, } from "@duct-sdk/contracts";
|
|
5
|
+
import { ActionManifestSchema, iso8601Schema, SensitivityLevelSchema, } from "@duct-sdk/contracts";
|
|
6
6
|
export { ActionManifestSchema, ManifestActionSchema, SensitivityLevelSchema, ErrorEnvelopeSchema, ConfirmationStateSchema, } from "@duct-sdk/contracts";
|
|
7
7
|
// ----------------------------------------------------------------
|
|
8
8
|
// Zod Schemas
|
|
@@ -132,6 +132,24 @@ const WebhooksConfigSchema = z.object({
|
|
|
132
132
|
consentCallback: z.string().url().optional(),
|
|
133
133
|
identityUrl: z.string().url().optional(),
|
|
134
134
|
secret: z.string().optional(),
|
|
135
|
+
deeplinkCallback: z.string().url().optional(),
|
|
136
|
+
eventStream: z.string().url().optional(),
|
|
137
|
+
});
|
|
138
|
+
const ApprovalStepUpConfigSchema = z.object({
|
|
139
|
+
minSensitivity: SensitivityLevelSchema.optional().default('high'),
|
|
140
|
+
requireForSideEffects: z.boolean().optional().default(true),
|
|
141
|
+
sideEffectsMinSensitivity: SensitivityLevelSchema.optional().default('medium'),
|
|
142
|
+
});
|
|
143
|
+
const ApprovalConfigSchema = z.object({
|
|
144
|
+
stepUp: ApprovalStepUpConfigSchema.optional().default({
|
|
145
|
+
minSensitivity: 'high',
|
|
146
|
+
requireForSideEffects: true,
|
|
147
|
+
sideEffectsMinSensitivity: 'medium',
|
|
148
|
+
}),
|
|
149
|
+
});
|
|
150
|
+
const OperatorNotificationsConfigSchema = z.object({
|
|
151
|
+
approverEmails: z.array(z.string().email()).optional().default([]),
|
|
152
|
+
confirmationReminderLeadMinutes: z.number().int().positive().nullable().optional(),
|
|
135
153
|
});
|
|
136
154
|
const WidgetConfigSchema = z.object({
|
|
137
155
|
primaryColor: z.string().optional(),
|
|
@@ -189,6 +207,8 @@ export const DuctConfigSchema = z.object({
|
|
|
189
207
|
registry_visibility: z.enum(['public', 'private']).optional().default('private'),
|
|
190
208
|
intershell_enabled: z.boolean().optional().default(false),
|
|
191
209
|
webhooks: WebhooksConfigSchema.optional(),
|
|
210
|
+
approval: ApprovalConfigSchema.optional(),
|
|
211
|
+
operatorNotifications: OperatorNotificationsConfigSchema.optional(),
|
|
192
212
|
});
|
|
193
213
|
function zodIssuesToValidationIssues(errors) {
|
|
194
214
|
return errors.map((e) => ({
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isLocalDuctProfile, isLocalhostUrl } from './endpoint-guard.js';
|
|
2
|
+
const PRIVATE_HOST_PATTERNS = [
|
|
3
|
+
/^10\./,
|
|
4
|
+
/^192\.168\./,
|
|
5
|
+
/^172\.(1[6-9]|2\d|3[0-1])\./,
|
|
6
|
+
/^127\./,
|
|
7
|
+
/^0\./,
|
|
8
|
+
/^169\.254\./,
|
|
9
|
+
];
|
|
10
|
+
export function isPrivateOrLocalProductUrl(url) {
|
|
11
|
+
if (!url.trim())
|
|
12
|
+
return false;
|
|
13
|
+
if (isLocalhostUrl(url))
|
|
14
|
+
return true;
|
|
15
|
+
try {
|
|
16
|
+
const host = new URL(url).hostname.toLowerCase();
|
|
17
|
+
return PRIVATE_HOST_PATTERNS.some((re) => re.test(host));
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function hostedPrivateUpstreamMessage(apiUrl) {
|
|
24
|
+
return (`Product API URL ${apiUrl} points at a private or local address while using hosted Duct. ` +
|
|
25
|
+
'Hosted Duct cannot reach your machine directly. Expose your dev API with an HTTP tunnel, ' +
|
|
26
|
+
'set product.apiBaseUrl to the public tunnel URL, and run checkup again. ' +
|
|
27
|
+
'See /docs/local-development-hosted');
|
|
28
|
+
}
|
|
29
|
+
export function shouldWarnHostedPrivateUpstream(apiUrl) {
|
|
30
|
+
if (isLocalDuctProfile())
|
|
31
|
+
return false;
|
|
32
|
+
if ((process.env.DUCT_ALLOW_LOCALHOST ?? '').trim().toLowerCase() === 'true')
|
|
33
|
+
return false;
|
|
34
|
+
return isPrivateOrLocalProductUrl(apiUrl);
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { describe, it } from 'node:test';
|
|
2
|
+
import assert from 'node:assert/strict';
|
|
3
|
+
describe('sdk entrypoints', () => {
|
|
4
|
+
it('server entry loads without requiring the root React bundle', async () => {
|
|
5
|
+
const mod = await import('../server.js');
|
|
6
|
+
assert.equal(typeof mod.verifyDuctToken, 'function');
|
|
7
|
+
});
|
|
8
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { describe, it } from "node:test";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { generateDuctToken, verifyDuctToken, generateDeeplinkToken, verifyDeeplinkToken, } from "./token.js";
|
|
7
|
+
const fixturePath = path.join(path.dirname(fileURLToPath(import.meta.url)), "../../fixtures/token-conformance-vectors.json");
|
|
8
|
+
describe("token conformance vectors", () => {
|
|
9
|
+
it("matches fixture mint + verify for delegated and deeplink", async () => {
|
|
10
|
+
const raw = JSON.parse(await readFile(fixturePath, "utf8"));
|
|
11
|
+
const { token } = await generateDuctToken({
|
|
12
|
+
secretKey: raw.secret,
|
|
13
|
+
shellId: raw.shellId,
|
|
14
|
+
userSession: { id: "user_42", email: "user@example.com" },
|
|
15
|
+
expirySeconds: 300,
|
|
16
|
+
allowedActions: ["get_orders"],
|
|
17
|
+
});
|
|
18
|
+
const delegated = await verifyDuctToken(token, {
|
|
19
|
+
secretKey: raw.secret,
|
|
20
|
+
expectedShellId: raw.shellId,
|
|
21
|
+
});
|
|
22
|
+
assert.equal(delegated.valid, true);
|
|
23
|
+
const deeplink = await generateDeeplinkToken({
|
|
24
|
+
secretKey: raw.secret,
|
|
25
|
+
shellId: raw.shellId,
|
|
26
|
+
deeplinkId: "view_order",
|
|
27
|
+
state: { orderId: "99" },
|
|
28
|
+
expirySeconds: 300,
|
|
29
|
+
});
|
|
30
|
+
const dl = await verifyDeeplinkToken(deeplink.token, {
|
|
31
|
+
secretKey: raw.secret,
|
|
32
|
+
expectedShellId: raw.shellId,
|
|
33
|
+
});
|
|
34
|
+
assert.equal(dl.valid, true);
|
|
35
|
+
for (const bad of raw.reject) {
|
|
36
|
+
const result = await verifyDuctToken(bad.token, {
|
|
37
|
+
secretKey: raw.secret,
|
|
38
|
+
expectedShellId: raw.shellId,
|
|
39
|
+
});
|
|
40
|
+
assert.equal(result.valid, false, `expected reject for ${bad.id}`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
});
|
package/dist/core/types.d.ts
CHANGED
|
@@ -476,6 +476,25 @@ export interface DataModelEntity {
|
|
|
476
476
|
export interface DataModel {
|
|
477
477
|
entities: DataModelEntity[];
|
|
478
478
|
}
|
|
479
|
+
/** Human approval policy — step-up password re-entry before operator approves. */
|
|
480
|
+
export interface ApprovalStepUpConfig {
|
|
481
|
+
/** Minimum sensitivity that always requires step-up (default high → high + critical). */
|
|
482
|
+
minSensitivity?: SensitivityLevel;
|
|
483
|
+
/** When true, side-effect actions can require step-up per sideEffectsMinSensitivity. */
|
|
484
|
+
requireForSideEffects?: boolean;
|
|
485
|
+
/** Side-effect actions at or above this level require step-up (default medium). */
|
|
486
|
+
sideEffectsMinSensitivity?: SensitivityLevel;
|
|
487
|
+
}
|
|
488
|
+
export interface ApprovalConfig {
|
|
489
|
+
stepUp?: ApprovalStepUpConfig;
|
|
490
|
+
}
|
|
491
|
+
/** Operator notifications for pending confirmations (dashboard-configured). */
|
|
492
|
+
export interface OperatorNotificationsConfig {
|
|
493
|
+
/** Email addresses to notify when a confirmation is created. */
|
|
494
|
+
approverEmails?: string[];
|
|
495
|
+
/** Minutes before expiry to send one reminder; omit or null = off. */
|
|
496
|
+
confirmationReminderLeadMinutes?: number | null;
|
|
497
|
+
}
|
|
479
498
|
export interface DuctConfig {
|
|
480
499
|
/** Shell ID assigned by Duct cloud */
|
|
481
500
|
shellId: string;
|
|
@@ -505,6 +524,10 @@ export interface DuctConfig {
|
|
|
505
524
|
intershell_enabled?: boolean;
|
|
506
525
|
/** Identity/consent webhook wiring — required for cross-shell protected actions. */
|
|
507
526
|
webhooks?: WebhooksConfig;
|
|
527
|
+
/** Gateway approval policy (step-up thresholds). */
|
|
528
|
+
approval?: ApprovalConfig;
|
|
529
|
+
/** Pending-confirmation operator notifications. */
|
|
530
|
+
operatorNotifications?: OperatorNotificationsConfig;
|
|
508
531
|
}
|
|
509
532
|
/**
|
|
510
533
|
* Identity/consent webhook wiring for this shell. Read dynamically from manifest JSON
|
|
@@ -519,6 +542,8 @@ export interface WebhooksConfig {
|
|
|
519
542
|
identityUrl?: string;
|
|
520
543
|
/** Shared webhook signing secret (whsec_…) used to verify identity vouches + signed callbacks. */
|
|
521
544
|
secret?: string;
|
|
545
|
+
deeplinkCallback?: string;
|
|
546
|
+
eventStream?: string;
|
|
522
547
|
}
|
|
523
548
|
export interface ShellManifest {
|
|
524
549
|
shellId: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export declare class DuctSdkWrongEntrypointError extends Error {
|
|
2
|
+
readonly name = "DuctSdkWrongEntrypointError";
|
|
3
|
+
constructor();
|
|
4
|
+
}
|
|
1
5
|
export { defineDuctConfig, DuctConfigSchema, crossValidateDuctConfig, ManifestActionSchema, ActionManifestSchema, SensitivityLevelSchema, ErrorEnvelopeSchema, ConfirmationStateSchema, } from "./core/config.js";
|
|
2
6
|
export type { ValidatedDuctConfig, ManifestAction, ErrorEnvelope, ConfirmationState } from "./core/config.js";
|
|
3
7
|
export { generateDuctToken, verifyDuctToken, generateDeeplinkToken, verifyDeeplinkToken, createDevReplayStore, InMemoryReplayStore, RedisReplayStore, } from "./core/token.js";
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,21 @@
|
|
|
5
5
|
// instead. The root export includes React adapters which crash
|
|
6
6
|
// runtimes where React is not installed (e.g. plain Express).
|
|
7
7
|
// ============================================================
|
|
8
|
+
import { createRequire } from 'node:module';
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
export class DuctSdkWrongEntrypointError extends Error {
|
|
11
|
+
name = 'DuctSdkWrongEntrypointError';
|
|
12
|
+
constructor() {
|
|
13
|
+
super('Import @duct-sdk/sdk/server in Node.js backends (Express, Fastify, etc.). ' +
|
|
14
|
+
'The package root export includes React adapters and requires react/react-dom.');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
require.resolve('react');
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
throw new DuctSdkWrongEntrypointError();
|
|
22
|
+
}
|
|
8
23
|
// Core config
|
|
9
24
|
export { defineDuctConfig, DuctConfigSchema, crossValidateDuctConfig, ManifestActionSchema, ActionManifestSchema, SensitivityLevelSchema, ErrorEnvelopeSchema, ConfirmationStateSchema, } from "./core/config.js";
|
|
10
25
|
// Token utilities
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"secret": "conformance-test-secret-32chars!!",
|
|
4
|
+
"shellId": "shell_conformance_test",
|
|
5
|
+
"delegated": {
|
|
6
|
+
"mint": {
|
|
7
|
+
"userSession": { "id": "user_42", "email": "user@example.com" },
|
|
8
|
+
"expirySeconds": 300,
|
|
9
|
+
"allowedActions": ["get_orders"]
|
|
10
|
+
},
|
|
11
|
+
"verify": {
|
|
12
|
+
"expectedShellId": "shell_conformance_test"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"deeplink": {
|
|
16
|
+
"mint": {
|
|
17
|
+
"deeplinkId": "view_order",
|
|
18
|
+
"state": { "orderId": "99" },
|
|
19
|
+
"expirySeconds": 300
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"reject": [
|
|
23
|
+
{ "id": "wrong_iss", "description": "issuer does not match shell", "token": "eyJhbGciOiJIUzI1NiJ9.eyJ0eXBlIjoiZHVjdF9kZWxlZ2F0ZWQiLCJpc3MiOiJzaGVsbF93cm9uZyIsInN1YiI6InVzZXJfNDIiLCJzZXNzaW9uIjp7fSwiaWF0IjoxNzAwMDAwMDAwLCJleHAiOjQxMDI0NDQ4MDB9.invalid" },
|
|
24
|
+
{ "id": "alg_none", "description": "alg none must be rejected", "token": "eyJhbGciOiJub25lIn0.eyJ0eXBlIjoiZHVjdF9kZWxlZ2F0ZWQifQ." }
|
|
25
|
+
]
|
|
26
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duct-sdk/sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Duct SDK — manifest, CLI, and embed components for permissioned human and agent access to your product APIs.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"files": [
|
|
68
68
|
"dist",
|
|
69
69
|
"assets",
|
|
70
|
+
"fixtures",
|
|
70
71
|
"README.md",
|
|
71
72
|
"CHANGELOG.md",
|
|
72
73
|
"TOKEN_SPEC.md"
|