@byok-sdk/cloud-dataplane 0.4.2 → 0.5.0
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 +7 -0
- package/dist/index.js +50 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +50 -1
- package/dist/runtime.js.map +1 -1
- package/dist/sql/0008_device_assertion_replay.sql +17 -0
- package/dist/stores/device-assertion-replay.d.ts +10 -0
- package/dist/stores/index.d.ts +1 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -15,6 +15,13 @@ partial bundle for them to run. `createPostgresCloudMaintenance` is the third,
|
|
|
15
15
|
host-only operational composition; it is deliberately outside both port
|
|
16
16
|
inventories.
|
|
17
17
|
|
|
18
|
+
`PostgresDeviceAssertionReplayAuthority` is a separate online security
|
|
19
|
+
authority for connector-binding exchanges. Its unique key makes consumption an
|
|
20
|
+
atomic `INSERT ... ON CONFLICT DO NOTHING` decision, and bounded expiry cleanup
|
|
21
|
+
keeps the short-lived ledger finite. It is intentionally not a `CloudStores`
|
|
22
|
+
member: hosts opt into assertion exchange explicitly, while connector sessions
|
|
23
|
+
and provider credentials stay outside this package.
|
|
24
|
+
|
|
18
25
|
`PostgresTruthCommitter` is the S6 transaction authority rather than another
|
|
19
26
|
raw store bundle. It owns the one transaction that couples proof receipt,
|
|
20
27
|
terminal/snapshot preconditions, committed object checks, object references,
|
package/dist/index.js
CHANGED
|
@@ -1387,6 +1387,55 @@ var PostgresApprovalTimelineStore = class {
|
|
|
1387
1387
|
}
|
|
1388
1388
|
};
|
|
1389
1389
|
|
|
1390
|
+
// src/stores/device-assertion-replay.ts
|
|
1391
|
+
var PostgresDeviceAssertionReplayAuthority = class {
|
|
1392
|
+
#pool;
|
|
1393
|
+
constructor(pool) {
|
|
1394
|
+
this.#pool = pool;
|
|
1395
|
+
}
|
|
1396
|
+
async consume(input) {
|
|
1397
|
+
if (!Number.isFinite(Date.parse(input.expiresAt))) {
|
|
1398
|
+
throw new Error("device assertion replay expiry is invalid");
|
|
1399
|
+
}
|
|
1400
|
+
const result = await this.#pool.query(
|
|
1401
|
+
`INSERT INTO device_assertion_replay (
|
|
1402
|
+
tenant_id, issuer, product_id, device_id, audience, jti, expires_at
|
|
1403
|
+
)
|
|
1404
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
|
1405
|
+
ON CONFLICT (tenant_id, issuer, product_id, device_id, audience, jti) DO NOTHING
|
|
1406
|
+
RETURNING jti`,
|
|
1407
|
+
[
|
|
1408
|
+
input.tenantId,
|
|
1409
|
+
input.issuer,
|
|
1410
|
+
input.productId,
|
|
1411
|
+
input.deviceId,
|
|
1412
|
+
input.audience,
|
|
1413
|
+
input.jti,
|
|
1414
|
+
input.expiresAt
|
|
1415
|
+
]
|
|
1416
|
+
);
|
|
1417
|
+
return result.rowCount === 1;
|
|
1418
|
+
}
|
|
1419
|
+
/** Bounded retention cleanup; callers choose cadence and batch size. */
|
|
1420
|
+
async deleteExpired(before, limit) {
|
|
1421
|
+
if (!Number.isFinite(before.getTime()) || !Number.isSafeInteger(limit) || limit <= 0) {
|
|
1422
|
+
throw new Error("device assertion replay cleanup bounds are invalid");
|
|
1423
|
+
}
|
|
1424
|
+
const result = await this.#pool.query(
|
|
1425
|
+
`DELETE FROM device_assertion_replay
|
|
1426
|
+
WHERE ctid IN (
|
|
1427
|
+
SELECT ctid
|
|
1428
|
+
FROM device_assertion_replay
|
|
1429
|
+
WHERE expires_at <= $1
|
|
1430
|
+
ORDER BY expires_at
|
|
1431
|
+
LIMIT $2
|
|
1432
|
+
)`,
|
|
1433
|
+
[before.toISOString(), limit]
|
|
1434
|
+
);
|
|
1435
|
+
return result.rowCount ?? 0;
|
|
1436
|
+
}
|
|
1437
|
+
};
|
|
1438
|
+
|
|
1390
1439
|
// src/stores/index.ts
|
|
1391
1440
|
function createPostgresCloudStores(options) {
|
|
1392
1441
|
const { pool, clock, crypto } = options;
|
|
@@ -4415,6 +4464,6 @@ function deadLetterMissing(ref) {
|
|
|
4415
4464
|
);
|
|
4416
4465
|
}
|
|
4417
4466
|
|
|
4418
|
-
export { CLOUD_CLEANUP_ERROR_CODES, CloudCleanupError, DEFAULT_MAX_ATTEMPTS, DEFAULT_PRESIGN_TTL_SECONDS, DEFAULT_RETRY_DELAY_MS, MAX_PRESIGN_TTL_SECONDS, MIN_PRESIGN_TTL_SECONDS, MigrationChecksumMismatchError, MigrationFilenameError, ObjectStoreRequestError, PostgresActivityStore, PostgresApprovalTimelineStore, PostgresBoardStore, PostgresCloudCleanup, PostgresDeviceDirectory, PostgresInboundDedupStore, PostgresMailboxStore, PostgresNonceStore, PostgresObjectStore, PostgresPairingCodeStore, PostgresPresenceStore, PostgresProofRequestReceiptStore, PostgresQuotaStore, PostgresRequestReceiptStore, PostgresSkillPackStore, PostgresTaskAttemptStore, PostgresTruthCommitter, PostgresTruthStore, R2BlobStoreError, R2CloudBlobStore, R2ObjectMaintenanceStore, R2_BLOB_ERROR_CODES, createByokPool, createPostgresCloudMaintenance, createPostgresCloudStores, createPostgresCoreStores, migrate, migrationsDir, readMigrationFiles };
|
|
4467
|
+
export { CLOUD_CLEANUP_ERROR_CODES, CloudCleanupError, DEFAULT_MAX_ATTEMPTS, DEFAULT_PRESIGN_TTL_SECONDS, DEFAULT_RETRY_DELAY_MS, MAX_PRESIGN_TTL_SECONDS, MIN_PRESIGN_TTL_SECONDS, MigrationChecksumMismatchError, MigrationFilenameError, ObjectStoreRequestError, PostgresActivityStore, PostgresApprovalTimelineStore, PostgresBoardStore, PostgresCloudCleanup, PostgresDeviceAssertionReplayAuthority, PostgresDeviceDirectory, PostgresInboundDedupStore, PostgresMailboxStore, PostgresNonceStore, PostgresObjectStore, PostgresPairingCodeStore, PostgresPresenceStore, PostgresProofRequestReceiptStore, PostgresQuotaStore, PostgresRequestReceiptStore, PostgresSkillPackStore, PostgresTaskAttemptStore, PostgresTruthCommitter, PostgresTruthStore, R2BlobStoreError, R2CloudBlobStore, R2ObjectMaintenanceStore, R2_BLOB_ERROR_CODES, createByokPool, createPostgresCloudMaintenance, createPostgresCloudStores, createPostgresCoreStores, migrate, migrationsDir, readMigrationFiles };
|
|
4419
4468
|
//# sourceMappingURL=index.js.map
|
|
4420
4469
|
//# sourceMappingURL=index.js.map
|