@opendatalabs/personal-server-ts-core 0.0.1-canary.01ca694 → 0.0.1-canary.052d47e
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/dist/api/index.d.ts +282 -9
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +867 -163
- package/dist/api/index.js.map +1 -1
- package/dist/auth/request.d.ts.map +1 -1
- package/dist/auth/request.js.map +1 -1
- package/dist/client.d.ts +8 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +21 -3
- package/dist/client.js.map +1 -1
- package/dist/contracts/binary.d.ts +12 -0
- package/dist/contracts/binary.d.ts.map +1 -1
- package/dist/contracts/binary.js +31 -0
- package/dist/contracts/binary.js.map +1 -1
- package/dist/contracts/data.d.ts +51 -5
- package/dist/contracts/data.d.ts.map +1 -1
- package/dist/contracts/data.js +166 -30
- package/dist/contracts/data.js.map +1 -1
- package/dist/contracts/grants.d.ts +7 -5
- package/dist/contracts/grants.d.ts.map +1 -1
- package/dist/contracts/grants.js +60 -37
- package/dist/contracts/grants.js.map +1 -1
- package/dist/contracts/index.d.ts +1 -1
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +1 -1
- package/dist/contracts/index.js.map +1 -1
- package/dist/derivatives/api.d.ts +48 -0
- package/dist/derivatives/api.d.ts.map +1 -0
- package/dist/derivatives/api.js +366 -0
- package/dist/derivatives/api.js.map +1 -0
- package/dist/derivatives/compute.d.ts +106 -0
- package/dist/derivatives/compute.d.ts.map +1 -0
- package/dist/derivatives/compute.js +414 -0
- package/dist/derivatives/compute.js.map +1 -0
- package/dist/derivatives/e2ee/aad.d.ts +22 -0
- package/dist/derivatives/e2ee/aad.d.ts.map +1 -0
- package/dist/derivatives/e2ee/aad.js +32 -0
- package/dist/derivatives/e2ee/aad.js.map +1 -0
- package/dist/derivatives/e2ee/attestation.d.ts +134 -0
- package/dist/derivatives/e2ee/attestation.d.ts.map +1 -0
- package/dist/derivatives/e2ee/attestation.js +248 -0
- package/dist/derivatives/e2ee/attestation.js.map +1 -0
- package/dist/derivatives/e2ee/index.d.ts +6 -0
- package/dist/derivatives/e2ee/index.d.ts.map +1 -0
- package/dist/derivatives/e2ee/index.js +6 -0
- package/dist/derivatives/e2ee/index.js.map +1 -0
- package/dist/derivatives/e2ee/jcs.d.ts +17 -0
- package/dist/derivatives/e2ee/jcs.d.ts.map +1 -0
- package/dist/derivatives/e2ee/jcs.js +55 -0
- package/dist/derivatives/e2ee/jcs.js.map +1 -0
- package/dist/derivatives/e2ee/phala.d.ts +62 -0
- package/dist/derivatives/e2ee/phala.d.ts.map +1 -0
- package/dist/derivatives/e2ee/phala.js +168 -0
- package/dist/derivatives/e2ee/phala.js.map +1 -0
- package/dist/derivatives/e2ee/suite.d.ts +56 -0
- package/dist/derivatives/e2ee/suite.d.ts.map +1 -0
- package/dist/derivatives/e2ee/suite.js +164 -0
- package/dist/derivatives/e2ee/suite.js.map +1 -0
- package/dist/derivatives/index.d.ts +10 -0
- package/dist/derivatives/index.d.ts.map +1 -0
- package/dist/derivatives/index.js +10 -0
- package/dist/derivatives/index.js.map +1 -0
- package/dist/derivatives/inference.d.ts +151 -0
- package/dist/derivatives/inference.d.ts.map +1 -0
- package/dist/derivatives/inference.js +262 -0
- package/dist/derivatives/inference.js.map +1 -0
- package/dist/derivatives/prompt.d.ts +64 -0
- package/dist/derivatives/prompt.d.ts.map +1 -0
- package/dist/derivatives/prompt.js +193 -0
- package/dist/derivatives/prompt.js.map +1 -0
- package/dist/derivatives/registration.d.ts +54 -0
- package/dist/derivatives/registration.d.ts.map +1 -0
- package/dist/derivatives/registration.js +180 -0
- package/dist/derivatives/registration.js.map +1 -0
- package/dist/derivatives/scheduler.d.ts +84 -0
- package/dist/derivatives/scheduler.d.ts.map +1 -0
- package/dist/derivatives/scheduler.js +257 -0
- package/dist/derivatives/scheduler.js.map +1 -0
- package/dist/derivatives/store.d.ts +14 -0
- package/dist/derivatives/store.d.ts.map +1 -0
- package/dist/derivatives/store.js +77 -0
- package/dist/derivatives/store.js.map +1 -0
- package/dist/derivatives/types.d.ts +92 -0
- package/dist/derivatives/types.d.ts.map +1 -0
- package/dist/derivatives/types.js +27 -0
- package/dist/derivatives/types.js.map +1 -0
- package/dist/errors/catalog.d.ts +75 -0
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/catalog.js +104 -0
- package/dist/errors/catalog.js.map +1 -1
- package/dist/grants/index.d.ts +2 -1
- package/dist/grants/index.d.ts.map +1 -1
- package/dist/grants/index.js +1 -1
- package/dist/grants/index.js.map +1 -1
- package/dist/keys/index.d.ts +1 -0
- package/dist/keys/index.d.ts.map +1 -1
- package/dist/keys/index.js +1 -1
- package/dist/keys/index.js.map +1 -1
- package/dist/keys/public-only-account.d.ts +8 -0
- package/dist/keys/public-only-account.d.ts.map +1 -0
- package/dist/keys/public-only-account.js +21 -0
- package/dist/keys/public-only-account.js.map +1 -0
- package/dist/keys/server-account.d.ts +2 -2
- package/dist/keys/server-account.d.ts.map +1 -1
- package/dist/lineage/attestation.d.ts +42 -0
- package/dist/lineage/attestation.d.ts.map +1 -0
- package/dist/lineage/attestation.js +25 -0
- package/dist/lineage/attestation.js.map +1 -0
- package/dist/lineage/gateway.d.ts +105 -0
- package/dist/lineage/gateway.d.ts.map +1 -0
- package/dist/lineage/gateway.js +242 -0
- package/dist/lineage/gateway.js.map +1 -0
- package/dist/lineage/index.d.ts +5 -0
- package/dist/lineage/index.d.ts.map +1 -0
- package/dist/lineage/index.js +5 -0
- package/dist/lineage/index.js.map +1 -0
- package/dist/lineage/lineage.d.ts +141 -0
- package/dist/lineage/lineage.d.ts.map +1 -0
- package/dist/lineage/lineage.js +255 -0
- package/dist/lineage/lineage.js.map +1 -0
- package/dist/logging/access-log.d.ts +10 -1
- package/dist/logging/access-log.d.ts.map +1 -1
- package/dist/mcp/activity.d.ts.map +1 -1
- package/dist/mcp/activity.js.map +1 -1
- package/dist/mcp/connection-api.d.ts.map +1 -1
- package/dist/mcp/connection-api.js +0 -1
- package/dist/mcp/connection-api.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/read-client.d.ts +61 -1
- package/dist/mcp/read-client.d.ts.map +1 -1
- package/dist/mcp/read-client.js +397 -42
- package/dist/mcp/read-client.js.map +1 -1
- package/dist/mcp/resources.d.ts +37 -0
- package/dist/mcp/resources.d.ts.map +1 -0
- package/dist/mcp/resources.js +114 -0
- package/dist/mcp/resources.js.map +1 -0
- package/dist/mcp/search/index.d.ts.map +1 -1
- package/dist/mcp/search/index.js +108 -21
- package/dist/mcp/search/index.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +27 -9
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts +160 -0
- package/dist/mcp/session.d.ts.map +1 -0
- package/dist/mcp/session.js +243 -0
- package/dist/mcp/session.js.map +1 -0
- package/dist/mcp/tools.d.ts +29 -3
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +515 -48
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/payment/index.d.ts +2 -0
- package/dist/payment/index.d.ts.map +1 -0
- package/dist/payment/index.js +2 -0
- package/dist/payment/index.js.map +1 -0
- package/dist/payment/x402.d.ts +155 -0
- package/dist/payment/x402.d.ts.map +1 -0
- package/dist/payment/x402.js +402 -0
- package/dist/payment/x402.js.map +1 -0
- package/dist/policy/data-read.d.ts +18 -2
- package/dist/policy/data-read.d.ts.map +1 -1
- package/dist/policy/data-read.js +80 -49
- package/dist/policy/data-read.js.map +1 -1
- package/dist/policy/data-write.d.ts +69 -0
- package/dist/policy/data-write.d.ts.map +1 -0
- package/dist/policy/data-write.js +131 -0
- package/dist/policy/data-write.js.map +1 -0
- package/dist/policy/index.d.ts +3 -1
- package/dist/policy/index.d.ts.map +1 -1
- package/dist/policy/index.js +3 -1
- package/dist/policy/index.js.map +1 -1
- package/dist/policy/signed-artifacts.d.ts +17 -0
- package/dist/policy/signed-artifacts.d.ts.map +1 -0
- package/dist/policy/signed-artifacts.js +110 -0
- package/dist/policy/signed-artifacts.js.map +1 -0
- package/dist/ports/index.d.ts +159 -32
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js +6 -5
- package/dist/ports/index.js.map +1 -1
- package/dist/schemas/server-config.d.ts +49 -4
- package/dist/schemas/server-config.d.ts.map +1 -1
- package/dist/schemas/server-config.js +95 -13
- package/dist/schemas/server-config.js.map +1 -1
- package/dist/signing/index.d.ts +2 -2
- package/dist/signing/index.d.ts.map +1 -1
- package/dist/signing/index.js +1 -1
- package/dist/signing/index.js.map +1 -1
- package/dist/signing/request-signer.d.ts +2 -0
- package/dist/signing/request-signer.d.ts.map +1 -1
- package/dist/signing/request-signer.js +1 -0
- package/dist/signing/request-signer.js.map +1 -1
- package/dist/signing/signer.d.ts +27 -25
- package/dist/signing/signer.d.ts.map +1 -1
- package/dist/signing/signer.js +27 -51
- package/dist/signing/signer.js.map +1 -1
- package/dist/storage/adapters/index.d.ts +1 -1
- package/dist/storage/adapters/index.d.ts.map +1 -1
- package/dist/storage/adapters/index.js +1 -1
- package/dist/storage/adapters/index.js.map +1 -1
- package/dist/storage/adapters/interface.d.ts +10 -0
- package/dist/storage/adapters/interface.d.ts.map +1 -1
- package/dist/storage/adapters/sdk.d.ts +11 -1
- package/dist/storage/adapters/sdk.d.ts.map +1 -1
- package/dist/storage/adapters/sdk.js +38 -3
- package/dist/storage/adapters/sdk.js.map +1 -1
- package/dist/storage/adapters/vana.d.ts +3 -0
- package/dist/storage/adapters/vana.d.ts.map +1 -1
- package/dist/storage/adapters/vana.js +95 -2
- package/dist/storage/adapters/vana.js.map +1 -1
- package/dist/storage/blocks/errors.d.ts.map +1 -1
- package/dist/storage/blocks/errors.js.map +1 -1
- package/dist/storage/blocks/index.d.ts +2 -0
- package/dist/storage/blocks/index.d.ts.map +1 -1
- package/dist/storage/blocks/index.js +2 -0
- package/dist/storage/blocks/index.js.map +1 -1
- package/dist/storage/blocks/select.d.ts +29 -0
- package/dist/storage/blocks/select.d.ts.map +1 -0
- package/dist/storage/blocks/select.js +120 -0
- package/dist/storage/blocks/select.js.map +1 -0
- package/dist/storage/blocks/types.d.ts +7 -0
- package/dist/storage/blocks/types.d.ts.map +1 -1
- package/dist/storage/index/manager.d.ts +30 -2
- package/dist/storage/index/manager.d.ts.map +1 -1
- package/dist/storage/index/schema.d.ts +1 -1
- package/dist/storage/index/schema.js +1 -1
- package/dist/storage/index/types.d.ts +6 -1
- package/dist/storage/index/types.d.ts.map +1 -1
- package/dist/sync/data-point-feed.d.ts +35 -0
- package/dist/sync/data-point-feed.d.ts.map +1 -0
- package/dist/sync/data-point-feed.js +122 -0
- package/dist/sync/data-point-feed.js.map +1 -0
- package/dist/sync/data-point-id.d.ts +7 -0
- package/dist/sync/data-point-id.d.ts.map +1 -0
- package/dist/sync/data-point-id.js +16 -0
- package/dist/sync/data-point-id.js.map +1 -0
- package/dist/sync/delete-data-port.d.ts +50 -0
- package/dist/sync/delete-data-port.d.ts.map +1 -0
- package/dist/sync/delete-data-port.js +244 -0
- package/dist/sync/delete-data-port.js.map +1 -0
- package/dist/sync/engine/sync-manager.d.ts +16 -4
- package/dist/sync/engine/sync-manager.d.ts.map +1 -1
- package/dist/sync/engine/sync-manager.js +93 -32
- package/dist/sync/engine/sync-manager.js.map +1 -1
- package/dist/sync/index.d.ts +7 -0
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +7 -0
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/issues.d.ts.map +1 -1
- package/dist/sync/issues.js +21 -3
- package/dist/sync/issues.js.map +1 -1
- package/dist/sync/pending-blob-deletions.d.ts +29 -0
- package/dist/sync/pending-blob-deletions.d.ts.map +1 -0
- package/dist/sync/pending-blob-deletions.js +116 -0
- package/dist/sync/pending-blob-deletions.js.map +1 -0
- package/dist/sync/retry-memory.d.ts +33 -0
- package/dist/sync/retry-memory.d.ts.map +1 -0
- package/dist/sync/retry-memory.js +68 -0
- package/dist/sync/retry-memory.js.map +1 -0
- package/dist/sync/scope-deletions.d.ts +155 -0
- package/dist/sync/scope-deletions.d.ts.map +1 -0
- package/dist/sync/scope-deletions.js +225 -0
- package/dist/sync/scope-deletions.js.map +1 -0
- package/dist/sync/tombstone.d.ts +27 -0
- package/dist/sync/tombstone.d.ts.map +1 -0
- package/dist/sync/tombstone.js +28 -0
- package/dist/sync/tombstone.js.map +1 -0
- package/dist/sync/workers/delete.d.ts +152 -31
- package/dist/sync/workers/delete.d.ts.map +1 -1
- package/dist/sync/workers/delete.js +457 -55
- package/dist/sync/workers/delete.js.map +1 -1
- package/dist/sync/workers/download.d.ts +108 -27
- package/dist/sync/workers/download.d.ts.map +1 -1
- package/dist/sync/workers/download.js +321 -126
- package/dist/sync/workers/download.js.map +1 -1
- package/dist/sync/workers/upload.d.ts +65 -10
- package/dist/sync/workers/upload.d.ts.map +1 -1
- package/dist/sync/workers/upload.js +371 -42
- package/dist/sync/workers/upload.js.map +1 -1
- package/dist/test-utils/e2ee-fixtures.d.ts +94 -0
- package/dist/test-utils/e2ee-fixtures.d.ts.map +1 -0
- package/dist/test-utils/e2ee-fixtures.js +116 -0
- package/dist/test-utils/e2ee-fixtures.js.map +1 -0
- package/dist/test-utils/e2ee-gateway.d.ts +61 -0
- package/dist/test-utils/e2ee-gateway.d.ts.map +1 -0
- package/dist/test-utils/e2ee-gateway.js +248 -0
- package/dist/test-utils/e2ee-gateway.js.map +1 -0
- package/dist/test-utils/index.d.ts +3 -0
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/index.js +3 -0
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/memory-storage.d.ts +12 -0
- package/dist/test-utils/memory-storage.d.ts.map +1 -0
- package/dist/test-utils/memory-storage.js +146 -0
- package/dist/test-utils/memory-storage.js.map +1 -0
- package/dist/test-utils/wallet.d.ts +6 -0
- package/dist/test-utils/wallet.d.ts.map +1 -1
- package/dist/test-utils/wallet.js +46 -0
- package/dist/test-utils/wallet.js.map +1 -1
- package/dist/write/attribution.d.ts +185 -0
- package/dist/write/attribution.d.ts.map +1 -0
- package/dist/write/attribution.js +450 -0
- package/dist/write/attribution.js.map +1 -0
- package/dist/write/authorize.d.ts +77 -0
- package/dist/write/authorize.d.ts.map +1 -0
- package/dist/write/authorize.js +109 -0
- package/dist/write/authorize.js.map +1 -0
- package/dist/write/index.d.ts +5 -0
- package/dist/write/index.d.ts.map +1 -0
- package/dist/write/index.js +5 -0
- package/dist/write/index.js.map +1 -0
- package/dist/write/route.d.ts +61 -0
- package/dist/write/route.d.ts.map +1 -0
- package/dist/write/route.js +132 -0
- package/dist/write/route.js.map +1 -0
- package/dist/write/session.d.ts +96 -0
- package/dist/write/session.d.ts.map +1 -0
- package/dist/write/session.js +136 -0
- package/dist/write/session.js.map +1 -0
- package/package.json +19 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorize.js","sourceRoot":"","sources":["../../src/write/authorize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,qBAAqB,GAEtB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EACL,qBAAqB,GAGtB,MAAM,cAAc,CAAC;AA2CtB,gEAAgE;AAChE,MAAM,UAAU,uBAAuB,CAAC,OAAgB;IACtD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACpD,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IAChD,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AK,CAAC,EAAE;gBACjB,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,GAAG,EAAE,IAAI,CAAC,GAAG;aACd,CAAC,CAAC;YACH,OAAO;gBACL,OAAO,EAAE,OAAO,CAAC,cAAc;gBAC/B,OAAO,EAAE,KAAK,CAAC,EAAE;gBACjB,WAAW,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE;gBAC/B,WAAW;gBACX,YAAY;aACb,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,qBAAqB,CAAC,OAAO;YACjC,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;YAC3C,IAAI,CAAC,OAAO;gBAAE,OAAO,SAAS,CAAC;YAC/B,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,uBAAuB,CAAC;gBACrD,OAAO;gBACP,cAAc,EAAE,OAAO,CAAC,cAAc;gBACtC,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,GAAG,EAAE,IAAI,CAAC,GAAG;aACd,CAAC,CAAC;YACH,OAAO;gBACL,OAAO,EAAE,OAAO,CAAC,cAAc;gBAC/B,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,YAAY;aACb,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createInMemoryWriteProofReplayStore, createInMemoryWriteSessionStore, createWriteSession, hashWriteSessionToken, type CreateWriteSessionInput, type CreateWriteSessionOptions, type CreateWriteSessionResult, type WriteProofReplayStore, type WriteSessionRecord, type WriteSessionStore, } from "./session.js";
|
|
2
|
+
export { createWriteSessionAuthorization, writeServerNotConfigured, writeSessionBearerToken, type WriteSessionAuthorization, type WriteSessionAuthorizationDeps, } from "./authorize.js";
|
|
3
|
+
export { handleWriteSessionRequest, type HandleWriteSessionRequestDeps, type WriteSessionResponseBody, type WriteSessionRouteLogger, } from "./route.js";
|
|
4
|
+
export { WRITE_SIGNATURE_HEADER, WRITER_ATTRIBUTION_KEY, binaryWriteSignedBytes, hasReservedWriterKey, stampWriterAttribution, verifyStoredWriterAttribution, verifyWriterAttribution, WriterAttributionVerificationError, type BinaryWriteSignedBytesInput, type StoredWriterAttributionVerification, type VerifiedWriterAttribution, type VerifyStoredWriterAttributionOptions, type VerifyWriterAttributionInput, type WriterAttribution, } from "./attribution.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/write/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,+BAA+B,EAC/B,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,GACnC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,6BAA6B,EAC7B,uBAAuB,EACvB,kCAAkC,EAClC,KAAK,2BAA2B,EAChC,KAAK,mCAAmC,EACxC,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EACzC,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createInMemoryWriteProofReplayStore, createInMemoryWriteSessionStore, createWriteSession, hashWriteSessionToken, } from "./session.js";
|
|
2
|
+
export { createWriteSessionAuthorization, writeServerNotConfigured, writeSessionBearerToken, } from "./authorize.js";
|
|
3
|
+
export { handleWriteSessionRequest, } from "./route.js";
|
|
4
|
+
export { WRITE_SIGNATURE_HEADER, WRITER_ATTRIBUTION_KEY, binaryWriteSignedBytes, hasReservedWriterKey, stampWriterAttribution, verifyStoredWriterAttribution, verifyWriterAttribution, WriterAttributionVerificationError, } from "./attribution.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/write/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,+BAA+B,EAC/B,kBAAkB,EAClB,qBAAqB,GAOtB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,+BAA+B,EAC/B,wBAAwB,EACxB,uBAAuB,GAGxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,yBAAyB,GAI1B,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,6BAA6B,EAC7B,uBAAuB,EACvB,kCAAkC,GAOnC,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The write-session handshake, as a runtime-agnostic request handler.
|
|
3
|
+
*
|
|
4
|
+
* `POST /v1/write/session`: a registered builder proves control of its key and
|
|
5
|
+
* of a write-grant with a Web3Signed proof (the same handshake shape as the
|
|
6
|
+
* self-signing MCP session) and gets a short-lived bearer token. That token
|
|
7
|
+
* then gates delegated writes on the EXISTING ingest endpoint
|
|
8
|
+
* (`POST /v1/data/:scope`) and the derivative question routes. The Personal
|
|
9
|
+
* Server keeps signing AddData as the owner; the builder never holds the owner
|
|
10
|
+
* key.
|
|
11
|
+
*
|
|
12
|
+
* This lived in the Node server as a Hono route (packages/server/src/routes/
|
|
13
|
+
* write-session.ts) and reached for `node:crypto` for two things: a sha-256 of
|
|
14
|
+
* the proof header, and 32 random bytes for the token. Both have Web Crypto
|
|
15
|
+
* equivalents, so the handshake is expressed here over plain `Request` /
|
|
16
|
+
* `Response` and BOTH builds mount the same handler — the Node route is a Hono
|
|
17
|
+
* wrapper around it, and the browser runtime dispatches to it directly. There
|
|
18
|
+
* is one implementation of who may open a write session.
|
|
19
|
+
*/
|
|
20
|
+
import type { SessionTokenVerifierPort } from "../auth/index.js";
|
|
21
|
+
import type { AuthSessionVerifierPort, GrantVerifierPort } from "../ports/index.js";
|
|
22
|
+
import { type WriteProofReplayStore, type WriteSessionStore } from "./session.js";
|
|
23
|
+
export interface WriteSessionRouteLogger {
|
|
24
|
+
info?(payload: Record<string, unknown>, message: string): void;
|
|
25
|
+
error?(payload: Record<string, unknown>, message: string): void;
|
|
26
|
+
}
|
|
27
|
+
export interface HandleWriteSessionRequestDeps {
|
|
28
|
+
serverOrigin: string | (() => string);
|
|
29
|
+
serverOwner?: `0x${string}`;
|
|
30
|
+
/**
|
|
31
|
+
* The store the redeeming routes read from. One store is wired into the
|
|
32
|
+
* handshake and into the API auth adapter; see createApp / the PS-Lite
|
|
33
|
+
* runtime.
|
|
34
|
+
*/
|
|
35
|
+
sessionStore: WriteSessionStore;
|
|
36
|
+
/** Replay guard for the HANDSHAKE proof (distinct from per-write proofs). */
|
|
37
|
+
replayStore?: WriteProofReplayStore;
|
|
38
|
+
authSessionVerifier: AuthSessionVerifierPort;
|
|
39
|
+
grantVerifier: GrantVerifierPort;
|
|
40
|
+
devToken?: string;
|
|
41
|
+
accessToken?: string;
|
|
42
|
+
tokenStore?: SessionTokenVerifierPort;
|
|
43
|
+
/** Overridable for tests; defaults to `vana_write_` + 32 random bytes. */
|
|
44
|
+
randomToken?: () => string;
|
|
45
|
+
ttlMs?: number;
|
|
46
|
+
now?: () => number;
|
|
47
|
+
logger?: WriteSessionRouteLogger;
|
|
48
|
+
}
|
|
49
|
+
export interface WriteSessionResponseBody {
|
|
50
|
+
access_token: string;
|
|
51
|
+
token_type: "Bearer";
|
|
52
|
+
expires_in: number;
|
|
53
|
+
/** Write patterns, `write:` prefix stripped. */
|
|
54
|
+
scope: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Handle one `POST /v1/write/session` request. The caller has already matched
|
|
58
|
+
* the method and path; anything reaching here is treated as the handshake.
|
|
59
|
+
*/
|
|
60
|
+
export declare function handleWriteSessionRequest(request: Request, deps: HandleWriteSessionRequestDeps): Promise<Response>;
|
|
61
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/write/route.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAGjE,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/D,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjE;AAED,MAAM,WAAW,6BAA6B;IAC5C,YAAY,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC;IACtC,WAAW,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;IAC5B;;;;OAIG;IACH,YAAY,EAAE,iBAAiB,CAAC;IAChC,6EAA6E;IAC7E,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,aAAa,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,wBAAwB,CAAC;IACtC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,uBAAuB,CAAC;CAClC;AAED,MAAM,WAAW,wBAAwB;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,QAAQ,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;CACf;AA2CD;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,QAAQ,CAAC,CA4GnB"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The write-session handshake, as a runtime-agnostic request handler.
|
|
3
|
+
*
|
|
4
|
+
* `POST /v1/write/session`: a registered builder proves control of its key and
|
|
5
|
+
* of a write-grant with a Web3Signed proof (the same handshake shape as the
|
|
6
|
+
* self-signing MCP session) and gets a short-lived bearer token. That token
|
|
7
|
+
* then gates delegated writes on the EXISTING ingest endpoint
|
|
8
|
+
* (`POST /v1/data/:scope`) and the derivative question routes. The Personal
|
|
9
|
+
* Server keeps signing AddData as the owner; the builder never holds the owner
|
|
10
|
+
* key.
|
|
11
|
+
*
|
|
12
|
+
* This lived in the Node server as a Hono route (packages/server/src/routes/
|
|
13
|
+
* write-session.ts) and reached for `node:crypto` for two things: a sha-256 of
|
|
14
|
+
* the proof header, and 32 random bytes for the token. Both have Web Crypto
|
|
15
|
+
* equivalents, so the handshake is expressed here over plain `Request` /
|
|
16
|
+
* `Response` and BOTH builds mount the same handler — the Node route is a Hono
|
|
17
|
+
* wrapper around it, and the browser runtime dispatches to it directly. There
|
|
18
|
+
* is one implementation of who may open a write session.
|
|
19
|
+
*/
|
|
20
|
+
import { authenticateRequest } from "../auth/index.js";
|
|
21
|
+
import { ProtocolError } from "../errors/catalog.js";
|
|
22
|
+
import { hashConnectionToken } from "../mcp/connection-api.js";
|
|
23
|
+
import { createWriteSession, } from "./session.js";
|
|
24
|
+
function jsonError(status, errorCode, message) {
|
|
25
|
+
return { error: { code: status, errorCode, message } };
|
|
26
|
+
}
|
|
27
|
+
function jsonResponse(body, status) {
|
|
28
|
+
return new Response(JSON.stringify(body), {
|
|
29
|
+
status,
|
|
30
|
+
headers: { "Content-Type": "application/json" },
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Only ProtocolErrors are client-facing. Anything else (gateway, store,
|
|
35
|
+
* runtime failures) is logged with its cause and answered generically so
|
|
36
|
+
* internal details never reach the caller. Same mapping as the core data
|
|
37
|
+
* handler.
|
|
38
|
+
*/
|
|
39
|
+
function internalError(logger, err, stage) {
|
|
40
|
+
logger?.error?.({ err, stage }, "Write session handshake failed with an unexpected error");
|
|
41
|
+
return jsonResponse(jsonError(500, "INTERNAL_ERROR", "Internal server error"), 500);
|
|
42
|
+
}
|
|
43
|
+
function defaultRandomToken() {
|
|
44
|
+
const bytes = new Uint8Array(32);
|
|
45
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
46
|
+
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
47
|
+
return `vana_write_${hex}`;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Handle one `POST /v1/write/session` request. The caller has already matched
|
|
51
|
+
* the method and path; anything reaching here is treated as the handshake.
|
|
52
|
+
*/
|
|
53
|
+
export async function handleWriteSessionRequest(request, deps) {
|
|
54
|
+
// Fail closed: minting a session requires this server's owner to bind the
|
|
55
|
+
// grant to (createWriteSession rejects wrong-owner grants).
|
|
56
|
+
if (!deps.serverOwner) {
|
|
57
|
+
return jsonResponse(jsonError(500, "SERVER_NOT_CONFIGURED", "Server owner is not configured"), 500);
|
|
58
|
+
}
|
|
59
|
+
let authResult;
|
|
60
|
+
try {
|
|
61
|
+
authResult = await authenticateRequest({
|
|
62
|
+
request,
|
|
63
|
+
serverOrigin: deps.serverOrigin,
|
|
64
|
+
devToken: deps.devToken,
|
|
65
|
+
accessToken: deps.accessToken,
|
|
66
|
+
sessionTokenVerifier: deps.tokenStore,
|
|
67
|
+
serverOwner: deps.serverOwner,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
if (!(err instanceof ProtocolError)) {
|
|
72
|
+
return internalError(deps.logger, err, "authenticate");
|
|
73
|
+
}
|
|
74
|
+
return jsonResponse(jsonError(401, "WRITE_SESSION_AUTH_FAILED", err.message), 401);
|
|
75
|
+
}
|
|
76
|
+
// A bearer credential (dev token, control-plane token, CLI session) proves
|
|
77
|
+
// nothing about the builder's key, so it can never open a write session.
|
|
78
|
+
if (authResult.mechanism !== "web3-signed") {
|
|
79
|
+
return jsonResponse(jsonError(401, "WRITE_SESSION_PROOF_REQUIRED", "POST /v1/write/session requires a Web3Signed proof signed by the builder key"), 401);
|
|
80
|
+
}
|
|
81
|
+
const grantId = authResult.auth.payload.grantId;
|
|
82
|
+
if (!grantId) {
|
|
83
|
+
return jsonResponse(jsonError(400, "GRANT_ID_REQUIRED", "The Web3Signed proof must carry a grantId (the write-grant issued to the builder)"), 400);
|
|
84
|
+
}
|
|
85
|
+
// Replay guard: bind to a digest of the exact proof header, remembered
|
|
86
|
+
// until the proof's own expiry (a replay only matters while still valid).
|
|
87
|
+
const proofHeader = request.headers.get("authorization") ?? "";
|
|
88
|
+
const proofId = await hashConnectionToken(proofHeader);
|
|
89
|
+
const expSec = authResult.auth.payload.exp;
|
|
90
|
+
const expiresAtMs = (typeof expSec === "number"
|
|
91
|
+
? expSec
|
|
92
|
+
: Math.floor(Date.now() / 1000) + 300) * 1000;
|
|
93
|
+
try {
|
|
94
|
+
const session = await createWriteSession({
|
|
95
|
+
builderAddress: authResult.auth.signer,
|
|
96
|
+
grantId,
|
|
97
|
+
proof: { id: proofId, expiresAtMs },
|
|
98
|
+
}, {
|
|
99
|
+
store: deps.sessionStore,
|
|
100
|
+
authSessionVerifier: deps.authSessionVerifier,
|
|
101
|
+
grantVerifier: deps.grantVerifier,
|
|
102
|
+
serverOwner: deps.serverOwner,
|
|
103
|
+
randomToken: deps.randomToken ?? defaultRandomToken,
|
|
104
|
+
...(deps.ttlMs === undefined ? {} : { ttlMs: deps.ttlMs }),
|
|
105
|
+
...(deps.now === undefined ? {} : { now: deps.now }),
|
|
106
|
+
...(deps.replayStore === undefined
|
|
107
|
+
? {}
|
|
108
|
+
: { replayStore: deps.replayStore }),
|
|
109
|
+
});
|
|
110
|
+
deps.logger?.info?.({
|
|
111
|
+
builder: authResult.auth.signer,
|
|
112
|
+
grantId: session.grantId,
|
|
113
|
+
writeScopes: session.writeScopes,
|
|
114
|
+
}, "Write session minted");
|
|
115
|
+
const body = {
|
|
116
|
+
access_token: session.accessToken,
|
|
117
|
+
token_type: "Bearer",
|
|
118
|
+
expires_in: session.expiresInSeconds,
|
|
119
|
+
// Write patterns, prefix stripped — what POST /v1/data/:scope will
|
|
120
|
+
// accept under this token.
|
|
121
|
+
scope: session.writeScopes.join(" "),
|
|
122
|
+
};
|
|
123
|
+
return jsonResponse(body, 200);
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
if (err instanceof ProtocolError) {
|
|
127
|
+
return jsonResponse(err.toJSON(), err.code);
|
|
128
|
+
}
|
|
129
|
+
return internalError(deps.logger, err, "create-session");
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=route.js.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,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;YACpD,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS;gBAChC,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;SACvC,CACF,CAAC;QACF,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CACjB;YACE,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM;YAC/B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC,EACD,sBAAsB,CACvB,CAAC;QACF,MAAM,IAAI,GAA6B;YACrC,YAAY,EAAE,OAAO,CAAC,WAAW;YACjC,UAAU,EAAE,QAAQ;YACpB,UAAU,EAAE,OAAO,CAAC,gBAAgB;YACpC,mEAAmE;YACnE,2BAA2B;YAC3B,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;SACrC,CAAC;QACF,OAAO,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACjC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,GAAG,YAAY,aAAa,EAAE,CAAC;YACjC,OAAO,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write API session (server-signed delegated writes, v1).
|
|
3
|
+
*
|
|
4
|
+
* A registered builder that holds its OWN key and a WRITE-grant proves control
|
|
5
|
+
* of that key ONCE — a Web3Signed handshake to `POST /v1/write/session` — and
|
|
6
|
+
* the PS mints a short-lived bearer token bound to `{ builderAddress, grantId }`
|
|
7
|
+
* (the grant's `write:`-prefixed scope entries define what it may write).
|
|
8
|
+
* Writes then present that token on the EXISTING ingest endpoint
|
|
9
|
+
* (`POST /v1/data/:scope`); each write authorizes as the builder via
|
|
10
|
+
* `verifyDataWritePolicy` and the PS ingests / encrypts / uploads / registers
|
|
11
|
+
* through the normal owner path — the PS signs AddData as the owner exactly as
|
|
12
|
+
* it does today, and the builder never holds the owner key.
|
|
13
|
+
*
|
|
14
|
+
* Deliberately the same handshake shape as the self-signing MCP session
|
|
15
|
+
* (mcp/session.ts): prove key control once, short-lived bearer after. The
|
|
16
|
+
* session token is authorization only; per-write builder ATTRIBUTION is a
|
|
17
|
+
* separate signed proof (see ./attribution.ts).
|
|
18
|
+
*/
|
|
19
|
+
import { hashConnectionToken } from "../mcp/connection-api.js";
|
|
20
|
+
import { createInMemoryMcpProofReplayStore, type McpProofReplayStore } from "../mcp/session.js";
|
|
21
|
+
import type { AuthSessionVerifierPort, GrantVerifierPort } from "../ports/index.js";
|
|
22
|
+
export type WriteProofReplayStore = McpProofReplayStore;
|
|
23
|
+
export declare const createInMemoryWriteProofReplayStore: typeof createInMemoryMcpProofReplayStore;
|
|
24
|
+
export declare const hashWriteSessionToken: typeof hashConnectionToken;
|
|
25
|
+
export interface WriteSessionRecord {
|
|
26
|
+
/** SHA-256 hex of the raw session token. Only the hash is stored. */
|
|
27
|
+
tokenHash: string;
|
|
28
|
+
/** The builder's address (recovered from the handshake proof). */
|
|
29
|
+
builderAddress: `0x${string}`;
|
|
30
|
+
/** The write-grant id the builder was issued (grantee == builder). */
|
|
31
|
+
grantId: string;
|
|
32
|
+
/** The grant's write patterns at handshake time (prefix stripped). */
|
|
33
|
+
writeScopes: string[];
|
|
34
|
+
createdAt: string;
|
|
35
|
+
expiresAtMs: number;
|
|
36
|
+
}
|
|
37
|
+
export interface WriteSessionStore {
|
|
38
|
+
create(record: WriteSessionRecord): Promise<void>;
|
|
39
|
+
/** Returns a live (non-expired) session, or null. */
|
|
40
|
+
getByTokenHash(tokenHash: string): Promise<WriteSessionRecord | null>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* KNOWN LIMITATION: in-memory only, same trade-off as the MCP session store —
|
|
44
|
+
* a process restart drops live tokens and the builder must re-handshake.
|
|
45
|
+
* Acceptable for today's single-instance Personal Server; persist via the
|
|
46
|
+
* host's state store before multi-instance.
|
|
47
|
+
*/
|
|
48
|
+
export declare function createInMemoryWriteSessionStore(): WriteSessionStore;
|
|
49
|
+
export interface CreateWriteSessionInput {
|
|
50
|
+
builderAddress: `0x${string}`;
|
|
51
|
+
grantId: string;
|
|
52
|
+
/**
|
|
53
|
+
* Handshake-proof replay guard. When supplied together with a `replayStore`,
|
|
54
|
+
* a proof id already seen (and still live) is rejected instead of minting a
|
|
55
|
+
* fresh token. `expiresAtMs` bounds how long the id is remembered (the
|
|
56
|
+
* proof's own expiry).
|
|
57
|
+
*/
|
|
58
|
+
proof?: {
|
|
59
|
+
id: string;
|
|
60
|
+
expiresAtMs: number;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export interface CreateWriteSessionOptions {
|
|
64
|
+
store: WriteSessionStore;
|
|
65
|
+
authSessionVerifier: AuthSessionVerifierPort;
|
|
66
|
+
grantVerifier: GrantVerifierPort;
|
|
67
|
+
/**
|
|
68
|
+
* This server's owner address. The grant's grantor MUST equal it — mirrors
|
|
69
|
+
* `verifyDataWritePolicy`'s ownership binding, applied at handshake so a
|
|
70
|
+
* wrong-owner grant fails with a clear error instead of minting a token
|
|
71
|
+
* whose every write would 403.
|
|
72
|
+
*/
|
|
73
|
+
serverOwner: `0x${string}`;
|
|
74
|
+
randomToken: () => string;
|
|
75
|
+
ttlMs?: number;
|
|
76
|
+
now?: () => number;
|
|
77
|
+
/** Optional replay guard for the handshake proof (see `input.proof`). */
|
|
78
|
+
replayStore?: WriteProofReplayStore;
|
|
79
|
+
}
|
|
80
|
+
export interface CreateWriteSessionResult {
|
|
81
|
+
accessToken: string;
|
|
82
|
+
expiresInSeconds: number;
|
|
83
|
+
grantId: string;
|
|
84
|
+
/** Write patterns (prefix stripped) the session may write into. */
|
|
85
|
+
writeScopes: string[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Validate the handshake identity and mint a write-session token. Same
|
|
89
|
+
* division of labor as createMcpSession: the handshake does the minimal
|
|
90
|
+
* checks that give a clear error (builder registered, grant exists + not
|
|
91
|
+
* revoked + carries write scopes, grantee == builder, grantor == owner);
|
|
92
|
+
* per-scope / expiry enforcement stays authoritative at write time, where
|
|
93
|
+
* `verifyDataWritePolicy` runs against the live grant on every POST.
|
|
94
|
+
*/
|
|
95
|
+
export declare function createWriteSession(input: CreateWriteSessionInput, options: CreateWriteSessionOptions): Promise<CreateWriteSessionResult>;
|
|
96
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/write/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,iCAAiC,EACjC,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAc3B,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AACxD,eAAO,MAAM,mCAAmC,0CACb,CAAC;AACpC,eAAO,MAAM,qBAAqB,4BAAsB,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IACjC,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,cAAc,EAAE,KAAK,MAAM,EAAE,CAAC;IAC9B,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,WAAW,EAAE,MAAM,EA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
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Write API session (server-signed delegated writes, v1).
|
|
3
|
+
*
|
|
4
|
+
* A registered builder that holds its OWN key and a WRITE-grant proves control
|
|
5
|
+
* of that key ONCE — a Web3Signed handshake to `POST /v1/write/session` — and
|
|
6
|
+
* the PS mints a short-lived bearer token bound to `{ builderAddress, grantId }`
|
|
7
|
+
* (the grant's `write:`-prefixed scope entries define what it may write).
|
|
8
|
+
* Writes then present that token on the EXISTING ingest endpoint
|
|
9
|
+
* (`POST /v1/data/:scope`); each write authorizes as the builder via
|
|
10
|
+
* `verifyDataWritePolicy` and the PS ingests / encrypts / uploads / registers
|
|
11
|
+
* through the normal owner path — the PS signs AddData as the owner exactly as
|
|
12
|
+
* it does today, and the builder never holds the owner key.
|
|
13
|
+
*
|
|
14
|
+
* Deliberately the same handshake shape as the self-signing MCP session
|
|
15
|
+
* (mcp/session.ts): prove key control once, short-lived bearer after. The
|
|
16
|
+
* session token is authorization only; per-write builder ATTRIBUTION is a
|
|
17
|
+
* separate signed proof (see ./attribution.ts).
|
|
18
|
+
*/
|
|
19
|
+
import { hashConnectionToken } from "../mcp/connection-api.js";
|
|
20
|
+
import { createInMemoryMcpProofReplayStore, } from "../mcp/session.js";
|
|
21
|
+
import { writeScopePatterns } from "../policy/data-write.js";
|
|
22
|
+
import { GrantOwnerMismatchError, GrantRequiredError, GrantRevokedError, InvalidSignatureError, ProtocolError, ScopeMismatchError, UnregisteredBuilderError, } from "../errors/catalog.js";
|
|
23
|
+
export const createInMemoryWriteProofReplayStore = createInMemoryMcpProofReplayStore;
|
|
24
|
+
export const hashWriteSessionToken = hashConnectionToken;
|
|
25
|
+
/**
|
|
26
|
+
* KNOWN LIMITATION: in-memory only, same trade-off as the MCP session store —
|
|
27
|
+
* a process restart drops live tokens and the builder must re-handshake.
|
|
28
|
+
* Acceptable for today's single-instance Personal Server; persist via the
|
|
29
|
+
* host's state store before multi-instance.
|
|
30
|
+
*/
|
|
31
|
+
export function createInMemoryWriteSessionStore() {
|
|
32
|
+
const byHash = new Map();
|
|
33
|
+
return {
|
|
34
|
+
async create(record) {
|
|
35
|
+
byHash.set(record.tokenHash, record);
|
|
36
|
+
},
|
|
37
|
+
async getByTokenHash(tokenHash) {
|
|
38
|
+
const record = byHash.get(tokenHash);
|
|
39
|
+
if (!record)
|
|
40
|
+
return null;
|
|
41
|
+
if (record.expiresAtMs <= Date.now()) {
|
|
42
|
+
byHash.delete(tokenHash);
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return record;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const DEFAULT_SESSION_TTL_MS = 60 * 60 * 1000;
|
|
50
|
+
/**
|
|
51
|
+
* Validate the handshake identity and mint a write-session token. Same
|
|
52
|
+
* division of labor as createMcpSession: the handshake does the minimal
|
|
53
|
+
* checks that give a clear error (builder registered, grant exists + not
|
|
54
|
+
* revoked + carries write scopes, grantee == builder, grantor == owner);
|
|
55
|
+
* per-scope / expiry enforcement stays authoritative at write time, where
|
|
56
|
+
* `verifyDataWritePolicy` runs against the live grant on every POST.
|
|
57
|
+
*/
|
|
58
|
+
export async function createWriteSession(input, options) {
|
|
59
|
+
const builder = await options.authSessionVerifier.getBuilder(input.builderAddress);
|
|
60
|
+
if (!builder)
|
|
61
|
+
throw new UnregisteredBuilderError();
|
|
62
|
+
const grant = await options.grantVerifier.getGrant(input.grantId);
|
|
63
|
+
if (!grant) {
|
|
64
|
+
throw new GrantRequiredError({
|
|
65
|
+
reason: "Grant not found",
|
|
66
|
+
grantId: input.grantId,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
if (grant.revokedAt !== null) {
|
|
70
|
+
throw new GrantRevokedError({ grantId: grant.id });
|
|
71
|
+
}
|
|
72
|
+
const patterns = writeScopePatterns(grant.scopes ?? []);
|
|
73
|
+
if (patterns.length === 0) {
|
|
74
|
+
throw new ScopeMismatchError({
|
|
75
|
+
reason: "Grant has no write scopes (write-grant entries use the write: prefix)",
|
|
76
|
+
grantedScopes: grant.scopes ?? [],
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (builder.id.toLowerCase() !== grant.granteeId.toLowerCase()) {
|
|
80
|
+
throw new InvalidSignatureError({
|
|
81
|
+
reason: "Handshake signer is not the grant builder",
|
|
82
|
+
expected: grant.granteeId,
|
|
83
|
+
actual: input.builderAddress,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
// Ownership binding — fail closed on a grantor-less grant: gateway
|
|
87
|
+
// responses are untrusted runtime data, despite their type.
|
|
88
|
+
if (!grant.grantorAddress ||
|
|
89
|
+
grant.grantorAddress.toLowerCase() !== options.serverOwner.toLowerCase()) {
|
|
90
|
+
throw new GrantOwnerMismatchError({
|
|
91
|
+
grantId: grant.id,
|
|
92
|
+
expected: options.serverOwner,
|
|
93
|
+
actual: grant.grantorAddress ?? null,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
// Prepare the token first (deterministic, can't meaningfully fail) so the
|
|
97
|
+
// only fallible step after consuming the proof is persistence.
|
|
98
|
+
const token = options.randomToken();
|
|
99
|
+
const tokenHash = await hashWriteSessionToken(token);
|
|
100
|
+
const ttlMs = options.ttlMs ?? DEFAULT_SESSION_TTL_MS;
|
|
101
|
+
const nowMs = options.now?.() ?? Date.now();
|
|
102
|
+
// Replay guard: a still-valid handshake proof must mint at most one token.
|
|
103
|
+
// Same consume/rollback discipline as createMcpSession.
|
|
104
|
+
const usingReplayGuard = Boolean(input.proof && options.replayStore);
|
|
105
|
+
if (input.proof && options.replayStore) {
|
|
106
|
+
const replayed = await options.replayStore.consume(input.proof.id, input.proof.expiresAtMs);
|
|
107
|
+
if (replayed) {
|
|
108
|
+
throw new ProtocolError(401, "WRITE_SESSION_PROOF_REPLAY", "Handshake proof already used; sign a fresh proof");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
await options.store.create({
|
|
113
|
+
tokenHash,
|
|
114
|
+
builderAddress: input.builderAddress,
|
|
115
|
+
grantId: grant.id,
|
|
116
|
+
writeScopes: patterns,
|
|
117
|
+
createdAt: new Date(nowMs).toISOString(),
|
|
118
|
+
expiresAtMs: nowMs + ttlMs,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
// Persistence failed — release the reservation so a legitimate retry with
|
|
123
|
+
// the same still-valid proof isn't rejected as a replay.
|
|
124
|
+
if (usingReplayGuard && input.proof && options.replayStore?.release) {
|
|
125
|
+
await options.replayStore.release(input.proof.id);
|
|
126
|
+
}
|
|
127
|
+
throw err;
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
accessToken: token,
|
|
131
|
+
expiresInSeconds: Math.floor(ttlMs / 1000),
|
|
132
|
+
grantId: grant.id,
|
|
133
|
+
writeScopes: patterns,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/write/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,iCAAiC,GAElC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAK7D,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAM9B,MAAM,CAAC,MAAM,mCAAmC,GAC9C,iCAAiC,CAAC;AACpC,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;AAqBzD;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B;IAC7C,MAAM,MAAM,GAAG,IAAI,GAAG,EAA8B,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|
|
1
1
|
{
|
|
2
2
|
"name": "@opendatalabs/personal-server-ts-core",
|
|
3
|
-
"version": "0.0.1-canary.
|
|
3
|
+
"version": "0.0.1-canary.052d47e",
|
|
4
4
|
"description": "Protocol logic for the Vana Personal Server — auth, grants, scopes, storage, keys",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -80,6 +80,14 @@
|
|
|
80
80
|
"types": "./dist/policy/index.d.ts",
|
|
81
81
|
"import": "./dist/policy/index.js"
|
|
82
82
|
},
|
|
83
|
+
"./lineage": {
|
|
84
|
+
"types": "./dist/lineage/index.d.ts",
|
|
85
|
+
"import": "./dist/lineage/index.js"
|
|
86
|
+
},
|
|
87
|
+
"./derivatives": {
|
|
88
|
+
"types": "./dist/derivatives/index.d.ts",
|
|
89
|
+
"import": "./dist/derivatives/index.js"
|
|
90
|
+
},
|
|
83
91
|
"./ports": {
|
|
84
92
|
"types": "./dist/ports/index.d.ts",
|
|
85
93
|
"import": "./dist/ports/index.js"
|
|
@@ -119,6 +127,14 @@
|
|
|
119
127
|
"./test-utils": {
|
|
120
128
|
"types": "./dist/test-utils/index.d.ts",
|
|
121
129
|
"import": "./dist/test-utils/index.js"
|
|
130
|
+
},
|
|
131
|
+
"./payment": {
|
|
132
|
+
"types": "./dist/payment/index.d.ts",
|
|
133
|
+
"import": "./dist/payment/index.js"
|
|
134
|
+
},
|
|
135
|
+
"./write": {
|
|
136
|
+
"types": "./dist/write/index.d.ts",
|
|
137
|
+
"import": "./dist/write/index.js"
|
|
122
138
|
}
|
|
123
139
|
},
|
|
124
140
|
"scripts": {
|
|
@@ -126,10 +142,10 @@
|
|
|
126
142
|
},
|
|
127
143
|
"dependencies": {
|
|
128
144
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
129
|
-
"@opendatalabs/vana-sdk": "
|
|
145
|
+
"@opendatalabs/vana-sdk": "3.22.0-pr.207.0a5d07b",
|
|
130
146
|
"minisearch": "^7.2.0",
|
|
131
147
|
"unpdf": "^1.6.2",
|
|
132
|
-
"viem": "^2.
|
|
148
|
+
"viem": "^2.54.2",
|
|
133
149
|
"zod": "^4.4.3"
|
|
134
150
|
}
|
|
135
151
|
}
|