@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.
@@ -0,0 +1,17 @@
1
+ -- Atomic single-use ledger for device assertions exchanged by hosted consumers.
2
+ -- The durable connector/session credential is host-owned and is not stored here.
3
+
4
+ CREATE TABLE device_assertion_replay (
5
+ tenant_id TEXT NOT NULL,
6
+ issuer TEXT NOT NULL,
7
+ product_id TEXT NOT NULL,
8
+ device_id TEXT NOT NULL,
9
+ audience TEXT NOT NULL,
10
+ jti TEXT NOT NULL,
11
+ expires_at TIMESTAMPTZ NOT NULL,
12
+ consumed_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
13
+ PRIMARY KEY (tenant_id, issuer, product_id, device_id, audience, jti)
14
+ );
15
+
16
+ CREATE INDEX device_assertion_replay_expiry_idx
17
+ ON device_assertion_replay (expires_at);
@@ -0,0 +1,10 @@
1
+ import type { DeviceAssertionReplayAuthority, DeviceAssertionReplayConsumeInput } from '@byok-sdk/core';
2
+ import type { Pool } from 'pg';
3
+ /** Durable atomic replay authority for hosted device-assertion exchange. */
4
+ export declare class PostgresDeviceAssertionReplayAuthority implements DeviceAssertionReplayAuthority {
5
+ #private;
6
+ constructor(pool: Pool);
7
+ consume(input: DeviceAssertionReplayConsumeInput): Promise<boolean>;
8
+ /** Bounded retention cleanup; callers choose cadence and batch size. */
9
+ deleteExpired(before: Date, limit: number): Promise<number>;
10
+ }
@@ -33,6 +33,7 @@ export { PostgresProofRequestReceiptStore } from './proof-receipts';
33
33
  export { PostgresTaskAttemptStore } from './task-attempts';
34
34
  export { PostgresActivityStore } from './activity';
35
35
  export { PostgresApprovalTimelineStore } from './approval-timeline';
36
+ export { PostgresDeviceAssertionReplayAuthority } from './device-assertion-replay';
36
37
  export { DEFAULT_MAX_ATTEMPTS, DEFAULT_PRESIGN_TTL_SECONDS, DEFAULT_RETRY_DELAY_MS, MAX_PRESIGN_TTL_SECONDS, MIN_PRESIGN_TTL_SECONDS, ObjectStoreRequestError, R2_BLOB_ERROR_CODES, R2BlobStoreError, R2CloudBlobStore, R2ObjectMaintenanceStore, } from './r2-blobs';
37
38
  export type { ObjectStoreFetch, R2BlobErrorCode, R2BlobStoreOptions } from './r2-blobs';
38
39
  export type { R2DeleteResult, R2ListedObject, R2ObjectMaintenance, R2ObjectMaintenanceOptions, R2ObjectPage, } from './r2-blobs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byok-sdk/cloud-dataplane",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "BYOK SDK hosted data plane: canonical Postgres + R2 stores, migrations, truth transactions, and maintenance",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -49,9 +49,9 @@
49
49
  "clean": "rm -rf dist"
50
50
  },
51
51
  "dependencies": {
52
- "@byok-sdk/cloud": "0.4.2",
53
- "@byok-sdk/core": "0.4.2",
54
- "@byok-sdk/protocol": "0.4.2",
52
+ "@byok-sdk/cloud": "0.5.0",
53
+ "@byok-sdk/core": "0.5.0",
54
+ "@byok-sdk/protocol": "0.5.0",
55
55
  "aws4fetch": "1.0.20",
56
56
  "fast-xml-parser": "^5.10.1",
57
57
  "pg": "^8.22.0"