@opendatalabs/personal-server-ts-core 0.0.1-canary.00328bf
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 +408 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +1257 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/raw-envelope.d.ts +3 -0
- package/dist/api/raw-envelope.d.ts.map +1 -0
- package/dist/api/raw-envelope.js +215 -0
- package/dist/api/raw-envelope.js.map +1 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +2 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/request.d.ts +28 -0
- package/dist/auth/request.d.ts.map +1 -0
- package/dist/auth/request.js +106 -0
- package/dist/auth/request.js.map +1 -0
- package/dist/client.d.ts +233 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +243 -0
- package/dist/client.js.map +1 -0
- package/dist/config/defaults.d.ts +12 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +12 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/paths.d.ts +9 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +14 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/contracts/access-logs.d.ts +8 -0
- package/dist/contracts/access-logs.d.ts.map +1 -0
- package/dist/contracts/access-logs.js +7 -0
- package/dist/contracts/access-logs.js.map +1 -0
- package/dist/contracts/auth-device.d.ts +70 -0
- package/dist/contracts/auth-device.d.ts.map +1 -0
- package/dist/contracts/auth-device.js +163 -0
- package/dist/contracts/auth-device.js.map +1 -0
- package/dist/contracts/binary.d.ts +66 -0
- package/dist/contracts/binary.d.ts.map +1 -0
- package/dist/contracts/binary.js +123 -0
- package/dist/contracts/binary.js.map +1 -0
- package/dist/contracts/config.d.ts +5 -0
- package/dist/contracts/config.d.ts.map +1 -0
- package/dist/contracts/config.js +30 -0
- package/dist/contracts/config.js.map +1 -0
- package/dist/contracts/data.d.ts +165 -0
- package/dist/contracts/data.d.ts.map +1 -0
- package/dist/contracts/data.js +371 -0
- package/dist/contracts/data.js.map +1 -0
- package/dist/contracts/grants.d.ts +45 -0
- package/dist/contracts/grants.d.ts.map +1 -0
- package/dist/contracts/grants.js +177 -0
- package/dist/contracts/grants.js.map +1 -0
- package/dist/contracts/http.d.ts +21 -0
- package/dist/contracts/http.d.ts.map +1 -0
- package/dist/contracts/http.js +49 -0
- package/dist/contracts/http.js.map +1 -0
- package/dist/contracts/index.d.ts +16 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +10 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/oauth.d.ts +38 -0
- package/dist/contracts/oauth.d.ts.map +1 -0
- package/dist/contracts/oauth.js +130 -0
- package/dist/contracts/oauth.js.map +1 -0
- package/dist/contracts/sync.d.ts +10 -0
- package/dist/contracts/sync.d.ts.map +1 -0
- package/dist/contracts/sync.js +35 -0
- package/dist/contracts/sync.js.map +1 -0
- package/dist/derivatives/answer-shape.d.ts +83 -0
- package/dist/derivatives/answer-shape.d.ts.map +1 -0
- package/dist/derivatives/answer-shape.js +320 -0
- package/dist/derivatives/answer-shape.js.map +1 -0
- package/dist/derivatives/api.d.ts +48 -0
- package/dist/derivatives/api.d.ts.map +1 -0
- package/dist/derivatives/api.js +374 -0
- package/dist/derivatives/api.js.map +1 -0
- package/dist/derivatives/compute.d.ts +112 -0
- package/dist/derivatives/compute.d.ts.map +1 -0
- package/dist/derivatives/compute.js +476 -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 +11 -0
- package/dist/derivatives/index.d.ts.map +1 -0
- package/dist/derivatives/index.js +11 -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 +99 -0
- package/dist/derivatives/prompt.d.ts.map +1 -0
- package/dist/derivatives/prompt.js +281 -0
- package/dist/derivatives/prompt.js.map +1 -0
- package/dist/derivatives/registration.d.ts +56 -0
- package/dist/derivatives/registration.d.ts.map +1 -0
- package/dist/derivatives/registration.js +187 -0
- package/dist/derivatives/registration.js.map +1 -0
- package/dist/derivatives/scheduler.d.ts +114 -0
- package/dist/derivatives/scheduler.d.ts.map +1 -0
- package/dist/derivatives/scheduler.js +331 -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 +79 -0
- package/dist/derivatives/store.js.map +1 -0
- package/dist/derivatives/types.d.ts +102 -0
- package/dist/derivatives/types.d.ts.map +1 -0
- package/dist/derivatives/types.js +29 -0
- package/dist/derivatives/types.js.map +1 -0
- package/dist/errors/catalog.d.ts +125 -0
- package/dist/errors/catalog.d.ts.map +1 -0
- package/dist/errors/catalog.js +198 -0
- package/dist/errors/catalog.js.map +1 -0
- package/dist/errors/pdpp-catalog.d.ts +36 -0
- package/dist/errors/pdpp-catalog.d.ts.map +1 -0
- package/dist/errors/pdpp-catalog.js +82 -0
- package/dist/errors/pdpp-catalog.js.map +1 -0
- package/dist/grants/index.d.ts +5 -0
- package/dist/grants/index.d.ts.map +1 -0
- package/dist/grants/index.js +6 -0
- package/dist/grants/index.js.map +1 -0
- package/dist/grants/pdpp-binding-store.d.ts +58 -0
- package/dist/grants/pdpp-binding-store.d.ts.map +1 -0
- package/dist/grants/pdpp-binding-store.js +97 -0
- package/dist/grants/pdpp-binding-store.js.map +1 -0
- package/dist/grants/pdpp-binding.d.ts +179 -0
- package/dist/grants/pdpp-binding.d.ts.map +1 -0
- package/dist/grants/pdpp-binding.js +214 -0
- package/dist/grants/pdpp-binding.js.map +1 -0
- package/dist/keys/index.d.ts +3 -0
- package/dist/keys/index.d.ts.map +1 -0
- package/dist/keys/index.js +2 -0
- package/dist/keys/index.js.map +1 -0
- 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 +24 -0
- package/dist/keys/server-account.d.ts.map +1 -0
- package/dist/keys/server-account.js +2 -0
- package/dist/keys/server-account.js.map +1 -0
- 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/logger/index.d.ts +9 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +5 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logging/access-log.d.ts +23 -0
- package/dist/logging/access-log.d.ts.map +1 -0
- package/dist/logging/access-log.js +2 -0
- package/dist/logging/access-log.js.map +1 -0
- package/dist/logging/access-reader.d.ts +14 -0
- package/dist/logging/access-reader.d.ts.map +1 -0
- package/dist/logging/access-reader.js +2 -0
- package/dist/logging/access-reader.js.map +1 -0
- package/dist/mcp/activity.d.ts +68 -0
- package/dist/mcp/activity.d.ts.map +1 -0
- package/dist/mcp/activity.js +111 -0
- package/dist/mcp/activity.js.map +1 -0
- package/dist/mcp/builder-registration.d.ts +24 -0
- package/dist/mcp/builder-registration.d.ts.map +1 -0
- package/dist/mcp/builder-registration.js +89 -0
- package/dist/mcp/builder-registration.js.map +1 -0
- package/dist/mcp/connection-api.d.ts +201 -0
- package/dist/mcp/connection-api.d.ts.map +1 -0
- package/dist/mcp/connection-api.js +506 -0
- package/dist/mcp/connection-api.js.map +1 -0
- package/dist/mcp/grantee.d.ts +52 -0
- package/dist/mcp/grantee.d.ts.map +1 -0
- package/dist/mcp/grantee.js +91 -0
- package/dist/mcp/grantee.js.map +1 -0
- package/dist/mcp/index.d.ts +12 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +12 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/read-client.d.ts +176 -0
- package/dist/mcp/read-client.d.ts.map +1 -0
- package/dist/mcp/read-client.js +579 -0
- package/dist/mcp/read-client.js.map +1 -0
- 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 +34 -0
- package/dist/mcp/search/index.d.ts.map +1 -0
- package/dist/mcp/search/index.js +156 -0
- package/dist/mcp/search/index.js.map +1 -0
- package/dist/mcp/server.d.ts +72 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +447 -0
- package/dist/mcp/server.js.map +1 -0
- 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/store.d.ts +13 -0
- package/dist/mcp/store.d.ts.map +1 -0
- package/dist/mcp/store.js +119 -0
- package/dist/mcp/store.js.map +1 -0
- package/dist/mcp/token-expiry.d.ts +38 -0
- package/dist/mcp/token-expiry.d.ts.map +1 -0
- package/dist/mcp/token-expiry.js +55 -0
- package/dist/mcp/token-expiry.js.map +1 -0
- package/dist/mcp/tools.d.ts +95 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +1381 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/mcp/types.d.ts +135 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +24 -0
- package/dist/mcp/types.js.map +1 -0
- 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/pdpp/approval.d.ts +182 -0
- package/dist/pdpp/approval.d.ts.map +1 -0
- package/dist/pdpp/approval.js +337 -0
- package/dist/pdpp/approval.js.map +1 -0
- package/dist/pdpp/client-identity.d.ts +88 -0
- package/dist/pdpp/client-identity.d.ts.map +1 -0
- package/dist/pdpp/client-identity.js +183 -0
- package/dist/pdpp/client-identity.js.map +1 -0
- package/dist/pdpp/client-metadata.d.ts +95 -0
- package/dist/pdpp/client-metadata.d.ts.map +1 -0
- package/dist/pdpp/client-metadata.js +96 -0
- package/dist/pdpp/client-metadata.js.map +1 -0
- package/dist/pdpp/declaration.d.ts +118 -0
- package/dist/pdpp/declaration.d.ts.map +1 -0
- package/dist/pdpp/declaration.js +549 -0
- package/dist/pdpp/declaration.js.map +1 -0
- package/dist/pdpp/index.d.ts +35 -0
- package/dist/pdpp/index.d.ts.map +1 -0
- package/dist/pdpp/index.js +22 -0
- package/dist/pdpp/index.js.map +1 -0
- package/dist/pdpp/issuance.d.ts +91 -0
- package/dist/pdpp/issuance.d.ts.map +1 -0
- package/dist/pdpp/issuance.js +124 -0
- package/dist/pdpp/issuance.js.map +1 -0
- package/dist/pdpp/pkce.d.ts +53 -0
- package/dist/pdpp/pkce.d.ts.map +1 -0
- package/dist/pdpp/pkce.js +109 -0
- package/dist/pdpp/pkce.js.map +1 -0
- package/dist/pdpp/redirect.d.ts +60 -0
- package/dist/pdpp/redirect.d.ts.map +1 -0
- package/dist/pdpp/redirect.js +125 -0
- package/dist/pdpp/redirect.js.map +1 -0
- package/dist/pdpp/resolve.d.ts +53 -0
- package/dist/pdpp/resolve.d.ts.map +1 -0
- package/dist/pdpp/resolve.js +218 -0
- package/dist/pdpp/resolve.js.map +1 -0
- package/dist/pdpp/review.d.ts +155 -0
- package/dist/pdpp/review.d.ts.map +1 -0
- package/dist/pdpp/review.js +142 -0
- package/dist/pdpp/review.js.map +1 -0
- package/dist/pdpp/selection.d.ts +43 -0
- package/dist/pdpp/selection.d.ts.map +1 -0
- package/dist/pdpp/selection.js +211 -0
- package/dist/pdpp/selection.js.map +1 -0
- package/dist/pdpp/store.d.ts +204 -0
- package/dist/pdpp/store.d.ts.map +1 -0
- package/dist/pdpp/store.js +501 -0
- package/dist/pdpp/store.js.map +1 -0
- package/dist/pdpp/tokens.d.ts +149 -0
- package/dist/pdpp/tokens.d.ts.map +1 -0
- package/dist/pdpp/tokens.js +387 -0
- package/dist/pdpp/tokens.js.map +1 -0
- package/dist/pdpp/types.d.ts +258 -0
- package/dist/pdpp/types.d.ts.map +1 -0
- package/dist/pdpp/types.js +40 -0
- package/dist/pdpp/types.js.map +1 -0
- package/dist/pdpp-version.d.ts +28 -0
- package/dist/pdpp-version.d.ts.map +1 -0
- package/dist/pdpp-version.js +28 -0
- package/dist/pdpp-version.js.map +1 -0
- package/dist/policy/data-read.d.ts +56 -0
- package/dist/policy/data-read.d.ts.map +1 -0
- package/dist/policy/data-read.js +176 -0
- package/dist/policy/data-read.js.map +1 -0
- 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 +4 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +4 -0
- package/dist/policy/index.js.map +1 -0
- 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 +243 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +7 -0
- package/dist/ports/index.js.map +1 -0
- package/dist/ports/pdpp-auth.d.ts +103 -0
- package/dist/ports/pdpp-auth.d.ts.map +1 -0
- package/dist/ports/pdpp-auth.js +37 -0
- package/dist/ports/pdpp-auth.js.map +1 -0
- package/dist/ports/pdpp-auth.test-utils.d.ts +9 -0
- package/dist/ports/pdpp-auth.test-utils.d.ts.map +1 -0
- package/dist/ports/pdpp-auth.test-utils.js +18 -0
- package/dist/ports/pdpp-auth.test-utils.js.map +1 -0
- package/dist/schemas/server-config.d.ts +190 -0
- package/dist/schemas/server-config.d.ts.map +1 -0
- package/dist/schemas/server-config.js +282 -0
- package/dist/schemas/server-config.js.map +1 -0
- package/dist/signing/index.d.ts +3 -0
- package/dist/signing/index.d.ts.map +1 -0
- package/dist/signing/index.js +3 -0
- package/dist/signing/index.js.map +1 -0
- package/dist/signing/request-signer.d.ts +20 -0
- package/dist/signing/request-signer.d.ts.map +1 -0
- package/dist/signing/request-signer.js +23 -0
- package/dist/signing/request-signer.js.map +1 -0
- package/dist/signing/signer.d.ts +40 -0
- package/dist/signing/signer.d.ts.map +1 -0
- package/dist/signing/signer.js +56 -0
- package/dist/signing/signer.js.map +1 -0
- package/dist/storage/adapters/index.d.ts +4 -0
- package/dist/storage/adapters/index.d.ts.map +1 -0
- package/dist/storage/adapters/index.js +3 -0
- package/dist/storage/adapters/index.js.map +1 -0
- package/dist/storage/adapters/interface.d.ts +57 -0
- package/dist/storage/adapters/interface.d.ts.map +1 -0
- package/dist/storage/adapters/interface.js +2 -0
- package/dist/storage/adapters/interface.js.map +1 -0
- package/dist/storage/adapters/sdk.d.ts +23 -0
- package/dist/storage/adapters/sdk.d.ts.map +1 -0
- package/dist/storage/adapters/sdk.js +73 -0
- package/dist/storage/adapters/sdk.js.map +1 -0
- package/dist/storage/adapters/vana.d.ts +12 -0
- package/dist/storage/adapters/vana.d.ts.map +1 -0
- package/dist/storage/adapters/vana.js +111 -0
- package/dist/storage/adapters/vana.js.map +1 -0
- package/dist/storage/blocks/build.d.ts +20 -0
- package/dist/storage/blocks/build.d.ts.map +1 -0
- package/dist/storage/blocks/build.js +378 -0
- package/dist/storage/blocks/build.js.map +1 -0
- package/dist/storage/blocks/cursor.d.ts +33 -0
- package/dist/storage/blocks/cursor.d.ts.map +1 -0
- package/dist/storage/blocks/cursor.js +142 -0
- package/dist/storage/blocks/cursor.js.map +1 -0
- package/dist/storage/blocks/errors.d.ts +6 -0
- package/dist/storage/blocks/errors.d.ts.map +1 -0
- package/dist/storage/blocks/errors.js +9 -0
- package/dist/storage/blocks/errors.js.map +1 -0
- package/dist/storage/blocks/index.d.ts +6 -0
- package/dist/storage/blocks/index.d.ts.map +1 -0
- package/dist/storage/blocks/index.js +5 -0
- package/dist/storage/blocks/index.js.map +1 -0
- 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 +56 -0
- package/dist/storage/blocks/types.d.ts.map +1 -0
- package/dist/storage/blocks/types.js +2 -0
- package/dist/storage/blocks/types.js.map +1 -0
- package/dist/storage/hierarchy/index.d.ts +3 -0
- package/dist/storage/hierarchy/index.d.ts.map +1 -0
- package/dist/storage/hierarchy/index.js +2 -0
- package/dist/storage/hierarchy/index.js.map +1 -0
- package/dist/storage/hierarchy/manager.d.ts +9 -0
- package/dist/storage/hierarchy/manager.d.ts.map +1 -0
- package/dist/storage/hierarchy/manager.js +2 -0
- package/dist/storage/hierarchy/manager.js.map +1 -0
- package/dist/storage/hierarchy/paths.d.ts +11 -0
- package/dist/storage/hierarchy/paths.d.ts.map +1 -0
- package/dist/storage/hierarchy/paths.js +43 -0
- package/dist/storage/hierarchy/paths.js.map +1 -0
- package/dist/storage/index/index.d.ts +3 -0
- package/dist/storage/index/index.d.ts.map +1 -0
- package/dist/storage/index/index.js +2 -0
- package/dist/storage/index/index.js.map +1 -0
- package/dist/storage/index/manager.d.ts +63 -0
- package/dist/storage/index/manager.d.ts.map +1 -0
- package/dist/storage/index/manager.js +2 -0
- package/dist/storage/index/manager.js.map +1 -0
- package/dist/storage/index/schema.d.ts +2 -0
- package/dist/storage/index/schema.d.ts.map +1 -0
- package/dist/storage/index/schema.js +2 -0
- package/dist/storage/index/schema.js.map +1 -0
- package/dist/storage/index/types.d.ts +37 -0
- package/dist/storage/index/types.d.ts.map +1 -0
- package/dist/storage/index/types.js +2 -0
- package/dist/storage/index/types.js.map +1 -0
- package/dist/storage/pdpp-records/cursor.d.ts +27 -0
- package/dist/storage/pdpp-records/cursor.d.ts.map +1 -0
- package/dist/storage/pdpp-records/cursor.js +49 -0
- package/dist/storage/pdpp-records/cursor.js.map +1 -0
- package/dist/storage/pdpp-records/enforcement.d.ts +37 -0
- package/dist/storage/pdpp-records/enforcement.d.ts.map +1 -0
- package/dist/storage/pdpp-records/enforcement.js +79 -0
- package/dist/storage/pdpp-records/enforcement.js.map +1 -0
- package/dist/storage/pdpp-records/index.d.ts +8 -0
- package/dist/storage/pdpp-records/index.d.ts.map +1 -0
- package/dist/storage/pdpp-records/index.js +8 -0
- package/dist/storage/pdpp-records/index.js.map +1 -0
- package/dist/storage/pdpp-records/interface.d.ts +49 -0
- package/dist/storage/pdpp-records/interface.d.ts.map +1 -0
- package/dist/storage/pdpp-records/interface.js +2 -0
- package/dist/storage/pdpp-records/interface.js.map +1 -0
- package/dist/storage/pdpp-records/memory-store.d.ts +9 -0
- package/dist/storage/pdpp-records/memory-store.d.ts.map +1 -0
- package/dist/storage/pdpp-records/memory-store.js +0 -0
- package/dist/storage/pdpp-records/memory-store.js.map +1 -0
- package/dist/storage/pdpp-records/record-key.d.ts +52 -0
- package/dist/storage/pdpp-records/record-key.d.ts.map +1 -0
- package/dist/storage/pdpp-records/record-key.js +97 -0
- package/dist/storage/pdpp-records/record-key.js.map +1 -0
- package/dist/storage/pdpp-records/stream-declaration.d.ts +43 -0
- package/dist/storage/pdpp-records/stream-declaration.d.ts.map +1 -0
- package/dist/storage/pdpp-records/stream-declaration.js +17 -0
- package/dist/storage/pdpp-records/stream-declaration.js.map +1 -0
- package/dist/storage/pdpp-records/types.d.ts +93 -0
- package/dist/storage/pdpp-records/types.d.ts.map +1 -0
- package/dist/storage/pdpp-records/types.js +17 -0
- package/dist/storage/pdpp-records/types.js.map +1 -0
- package/dist/storage/preview.d.ts +12 -0
- package/dist/storage/preview.d.ts.map +1 -0
- package/dist/storage/preview.js +239 -0
- package/dist/storage/preview.js.map +1 -0
- package/dist/sync/cursor.d.ts +10 -0
- package/dist/sync/cursor.d.ts.map +1 -0
- package/dist/sync/cursor.js +2 -0
- package/dist/sync/cursor.js.map +1 -0
- 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 +58 -0
- package/dist/sync/engine/sync-manager.d.ts.map +1 -0
- package/dist/sync/engine/sync-manager.js +285 -0
- package/dist/sync/engine/sync-manager.js.map +1 -0
- package/dist/sync/index.d.ts +15 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +14 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/issues.d.ts +55 -0
- package/dist/sync/issues.d.ts.map +1 -0
- package/dist/sync/issues.js +168 -0
- package/dist/sync/issues.js.map +1 -0
- package/dist/sync/pdpp-import.d.ts +192 -0
- package/dist/sync/pdpp-import.d.ts.map +1 -0
- package/dist/sync/pdpp-import.js +422 -0
- package/dist/sync/pdpp-import.js.map +1 -0
- 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/types.d.ts +27 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/sync/types.js +2 -0
- package/dist/sync/types.js.map +1 -0
- package/dist/sync/workers/delete.d.ts +163 -0
- package/dist/sync/workers/delete.d.ts.map +1 -0
- package/dist/sync/workers/delete.js +474 -0
- package/dist/sync/workers/delete.js.map +1 -0
- package/dist/sync/workers/download.d.ts +159 -0
- package/dist/sync/workers/download.d.ts.map +1 -0
- package/dist/sync/workers/download.js +731 -0
- package/dist/sync/workers/download.js.map +1 -0
- package/dist/sync/workers/upload.d.ts +98 -0
- package/dist/sync/workers/upload.d.ts.map +1 -0
- package/dist/sync/workers/upload.js +412 -0
- package/dist/sync/workers/upload.js.map +1 -0
- 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 +5 -0
- package/dist/test-utils/index.d.ts.map +1 -0
- package/dist/test-utils/index.js +5 -0
- package/dist/test-utils/index.js.map +1 -0
- 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 +47 -0
- package/dist/test-utils/wallet.d.ts.map +1 -0
- package/dist/test-utils/wallet.js +98 -0
- package/dist/test-utils/wallet.js.map +1 -0
- 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 +175 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PDPP Core §7 grant issuance.
|
|
3
|
+
*
|
|
4
|
+
* Issuance is the moment every request-only convenience becomes a frozen fact.
|
|
5
|
+
* The guard that matters most here is staleness: §7 requires the AS to reject
|
|
6
|
+
* approval if instance eligibility or the reviewed revision changed between
|
|
7
|
+
* the owner seeing the review surface and the approval landing.
|
|
8
|
+
*
|
|
9
|
+
* We enforce that by recomputing the review digest from what we are about to
|
|
10
|
+
* issue and comparing it to the digest the owner approved. Any drift — a newly
|
|
11
|
+
* connected instance changing an auto-resolved handle, a re-fetched
|
|
12
|
+
* declaration, an edited field list — moves the digest and kills the approval.
|
|
13
|
+
* This is a re-derivation, not a stored-value comparison, so it catches drift
|
|
14
|
+
* in inputs that were never persisted alongside the approval.
|
|
15
|
+
*/
|
|
16
|
+
import { computeReviewDigest, type RequesterIdentity } from "./review.js";
|
|
17
|
+
import { type InstanceInventory } from "./resolve.js";
|
|
18
|
+
import { type DeclarationSnapshot, type Grant, type SelectionRequest } from "./types.js";
|
|
19
|
+
export type IssuanceFailureCode =
|
|
20
|
+
/** The reviewed revision or instance eligibility moved before approval. */
|
|
21
|
+
"stale_approval"
|
|
22
|
+
/** purpose/ai_training without explicit affirmative consent. */
|
|
23
|
+
| "ai_training_consent_required" | "resolution_failed" | "access_denied";
|
|
24
|
+
export interface IssuanceFailure {
|
|
25
|
+
code: IssuanceFailureCode;
|
|
26
|
+
message: string;
|
|
27
|
+
}
|
|
28
|
+
export type IssuanceResult = {
|
|
29
|
+
ok: true;
|
|
30
|
+
grant: Grant;
|
|
31
|
+
consentEvidence: ConsentEvidence;
|
|
32
|
+
} | {
|
|
33
|
+
ok: false;
|
|
34
|
+
failure: IssuanceFailure;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Retained consent evidence. §6 requires the normalized exact client claims,
|
|
38
|
+
* with attribution, to be bound into the final approval artifact and preserved
|
|
39
|
+
* here — while staying outside the grant, introspection, and RS enforcement.
|
|
40
|
+
* Keeping them in a separate structure from `Grant` is what makes that
|
|
41
|
+
* separation structural rather than a convention someone can forget.
|
|
42
|
+
*/
|
|
43
|
+
export interface ConsentEvidence {
|
|
44
|
+
review_digest: string;
|
|
45
|
+
approved_at: string;
|
|
46
|
+
/** The exact snapshot identity consent was given against. */
|
|
47
|
+
declaration: {
|
|
48
|
+
source_id: string;
|
|
49
|
+
version: string;
|
|
50
|
+
digest: string;
|
|
51
|
+
};
|
|
52
|
+
client_claims?: {
|
|
53
|
+
attributed_to: string;
|
|
54
|
+
commitments: string[];
|
|
55
|
+
};
|
|
56
|
+
/** Recorded only for purpose codes that require it. */
|
|
57
|
+
explicit_ai_training_consent?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface IssueGrantInput {
|
|
60
|
+
subjectId: string;
|
|
61
|
+
request: SelectionRequest;
|
|
62
|
+
/** The retained snapshot — the same one validation and review ran against. */
|
|
63
|
+
snapshot: DeclarationSnapshot;
|
|
64
|
+
/** Instance inventory as of *now*, re-read at approval time on purpose. */
|
|
65
|
+
inventory: InstanceInventory;
|
|
66
|
+
requester: RequesterIdentity;
|
|
67
|
+
/** The digest the owner actually approved. */
|
|
68
|
+
approvedReviewDigest: string;
|
|
69
|
+
/**
|
|
70
|
+
* Explicit affirmative consent for `purpose/ai_training`. Required only for
|
|
71
|
+
* that code (§6 AI training consent); ignored otherwise.
|
|
72
|
+
*/
|
|
73
|
+
explicitAiTrainingConsent?: boolean;
|
|
74
|
+
/** AS-policy grant expiry. Absent means the grant never expires. */
|
|
75
|
+
expiresAt?: string;
|
|
76
|
+
streamDescriptions?: Record<string, string>;
|
|
77
|
+
now?: Date;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Resolve, re-verify the approval, and issue.
|
|
81
|
+
*
|
|
82
|
+
* Deliberately re-runs resolution against the *current* inventory rather than
|
|
83
|
+
* trusting the streams captured at review time. If the owner connected or
|
|
84
|
+
* disconnected an instance while the consent screen was open, resolution now
|
|
85
|
+
* produces different handles, the recomputed digest diverges, and we reject.
|
|
86
|
+
* Trusting the review-time streams would issue a grant the owner never saw.
|
|
87
|
+
*/
|
|
88
|
+
export declare function issueGrant(input: IssueGrantInput): IssuanceResult;
|
|
89
|
+
/** Re-export so callers get the digest helper from the issuance seam. */
|
|
90
|
+
export { computeReviewDigest };
|
|
91
|
+
//# sourceMappingURL=issuance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issuance.d.ts","sourceRoot":"","sources":["../../src/pdpp/issuance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAEL,mBAAmB,EAEnB,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAGL,KAAK,mBAAmB,EACxB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C,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAMD;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,cAAc,CAwGjE;AAED,yEAAyE;AACzE,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PDPP Core §7 grant issuance.
|
|
3
|
+
*
|
|
4
|
+
* Issuance is the moment every request-only convenience becomes a frozen fact.
|
|
5
|
+
* The guard that matters most here is staleness: §7 requires the AS to reject
|
|
6
|
+
* approval if instance eligibility or the reviewed revision changed between
|
|
7
|
+
* the owner seeing the review surface and the approval landing.
|
|
8
|
+
*
|
|
9
|
+
* We enforce that by recomputing the review digest from what we are about to
|
|
10
|
+
* issue and comparing it to the digest the owner approved. Any drift — a newly
|
|
11
|
+
* connected instance changing an auto-resolved handle, a re-fetched
|
|
12
|
+
* declaration, an edited field list — moves the digest and kills the approval.
|
|
13
|
+
* This is a re-derivation, not a stored-value comparison, so it catches drift
|
|
14
|
+
* in inputs that were never persisted alongside the approval.
|
|
15
|
+
*/
|
|
16
|
+
import { randomBytes } from "node:crypto";
|
|
17
|
+
import { buildConsentReview, computeReviewDigest, normalizeClientClaims, } from "./review.js";
|
|
18
|
+
import { resolveSelection } from "./resolve.js";
|
|
19
|
+
import { AI_TRAINING_PURPOSE, PDPP_GRANT_VERSION, } from "./types.js";
|
|
20
|
+
function newGrantId() {
|
|
21
|
+
return `grt_${randomBytes(12).toString("hex")}`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Resolve, re-verify the approval, and issue.
|
|
25
|
+
*
|
|
26
|
+
* Deliberately re-runs resolution against the *current* inventory rather than
|
|
27
|
+
* trusting the streams captured at review time. If the owner connected or
|
|
28
|
+
* disconnected an instance while the consent screen was open, resolution now
|
|
29
|
+
* produces different handles, the recomputed digest diverges, and we reject.
|
|
30
|
+
* Trusting the review-time streams would issue a grant the owner never saw.
|
|
31
|
+
*/
|
|
32
|
+
export function issueGrant(input) {
|
|
33
|
+
const now = input.now ?? new Date();
|
|
34
|
+
if (input.request.purpose_code === AI_TRAINING_PURPOSE &&
|
|
35
|
+
input.explicitAiTrainingConsent !== true) {
|
|
36
|
+
return {
|
|
37
|
+
ok: false,
|
|
38
|
+
failure: {
|
|
39
|
+
code: "ai_training_consent_required",
|
|
40
|
+
message: "purpose/ai_training requires explicit affirmative consent before a grant may be issued",
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const resolution = resolveSelection(input.request, input.snapshot, input.inventory);
|
|
45
|
+
if (!resolution.ok) {
|
|
46
|
+
return {
|
|
47
|
+
ok: false,
|
|
48
|
+
failure: {
|
|
49
|
+
code: "resolution_failed",
|
|
50
|
+
message: resolution.failure.message,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// Re-derive the review the owner would see from what we are about to issue.
|
|
55
|
+
const review = buildConsentReview({
|
|
56
|
+
subjectId: input.subjectId,
|
|
57
|
+
request: input.request,
|
|
58
|
+
snapshot: input.snapshot,
|
|
59
|
+
resolvedStreams: resolution.streams,
|
|
60
|
+
requester: input.requester,
|
|
61
|
+
expiresAt: input.expiresAt,
|
|
62
|
+
streamDescriptions: input.streamDescriptions,
|
|
63
|
+
});
|
|
64
|
+
if (review.review_digest !== input.approvedReviewDigest) {
|
|
65
|
+
return {
|
|
66
|
+
ok: false,
|
|
67
|
+
failure: {
|
|
68
|
+
code: "stale_approval",
|
|
69
|
+
message: "the reviewed selection or instance eligibility changed before approval; a new review is required",
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const grant = {
|
|
74
|
+
version: PDPP_GRANT_VERSION,
|
|
75
|
+
grant_id: newGrantId(),
|
|
76
|
+
issued_at: now.toISOString(),
|
|
77
|
+
subject: { id: input.subjectId },
|
|
78
|
+
client: {
|
|
79
|
+
client_id: input.requester.client_id,
|
|
80
|
+
// §7: retained client_display is the AS-resolved identity, not raw
|
|
81
|
+
// inline input. `requester.display` already went through resolution.
|
|
82
|
+
...(input.requester.display && {
|
|
83
|
+
client_display: input.requester.display,
|
|
84
|
+
}),
|
|
85
|
+
},
|
|
86
|
+
// Provenance comes from the accepted declaration, never from the request.
|
|
87
|
+
source: { kind: input.snapshot.source_kind, id: input.snapshot.source_id },
|
|
88
|
+
source_declaration: { version: input.snapshot.version },
|
|
89
|
+
purpose_code: input.request.purpose_code,
|
|
90
|
+
...(input.request.purpose_description && {
|
|
91
|
+
purpose_description: input.request.purpose_description,
|
|
92
|
+
}),
|
|
93
|
+
access_mode: input.request.access_mode,
|
|
94
|
+
streams: resolution.streams,
|
|
95
|
+
...(input.request.selection_preset && {
|
|
96
|
+
selection_preset: input.request.selection_preset,
|
|
97
|
+
}),
|
|
98
|
+
...(input.request.retention && { retention: input.request.retention }),
|
|
99
|
+
...(input.expiresAt && { expires_at: input.expiresAt }),
|
|
100
|
+
};
|
|
101
|
+
const normalizedClaims = normalizeClientClaims(input.request.client_claims);
|
|
102
|
+
const consentEvidence = {
|
|
103
|
+
review_digest: review.review_digest,
|
|
104
|
+
approved_at: now.toISOString(),
|
|
105
|
+
declaration: {
|
|
106
|
+
source_id: input.snapshot.source_id,
|
|
107
|
+
version: input.snapshot.version,
|
|
108
|
+
digest: input.snapshot.digest,
|
|
109
|
+
},
|
|
110
|
+
...(normalizedClaims && {
|
|
111
|
+
client_claims: {
|
|
112
|
+
attributed_to: input.requester.display_name,
|
|
113
|
+
commitments: normalizedClaims,
|
|
114
|
+
},
|
|
115
|
+
}),
|
|
116
|
+
...(input.request.purpose_code === AI_TRAINING_PURPOSE && {
|
|
117
|
+
explicit_ai_training_consent: true,
|
|
118
|
+
}),
|
|
119
|
+
};
|
|
120
|
+
return { ok: true, grant, consentEvidence };
|
|
121
|
+
}
|
|
122
|
+
/** Re-export so callers get the digest helper from the issuance seam. */
|
|
123
|
+
export { computeReviewDigest };
|
|
124
|
+
//# sourceMappingURL=issuance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issuance.js","sourceRoot":"","sources":["../../src/pdpp/issuance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,GAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAA0B,MAAM,cAAc,CAAC;AACxE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,GAInB,MAAM,YAAY,CAAC;AAyDpB,SAAS,UAAU;IACjB,OAAO,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AAClD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC;IAEpC,IACE,KAAK,CAAC,OAAO,CAAC,YAAY,KAAK,mBAAmB;QAClD,KAAK,CAAC,yBAAyB,KAAK,IAAI,EACxC,CAAC;QACD,OAAO;YACL,EAAE,EAAE,KAAK;YACT,OAAO,EAAE;gBACP,IAAI,EAAE,8BAA8B;gBACpC,OAAO,EACL,wFAAwF;aAC3F;SACF,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,gBAAgB,CACjC,KAAK,CAAC,OAAO,EACb,KAAK,CAAC,QAAQ,EACd,KAAK,CAAC,SAAS,CAChB,CAAC;IACF,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;QACnB,OAAO;YACL,EAAE,EAAE,KAAK;YACT,OAAO,EAAE;gBACP,IAAI,EAAE,mBAAmB;gBACzB,OAAO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AAI,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;AAC9C,CAAC;AAED,yEAAyE;AACzE,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PKCE (RFC 7636) for the PDPP authorization-code flow.
|
|
3
|
+
*
|
|
4
|
+
* PDPP clients are public clients: a browser app or a desktop tool holds no
|
|
5
|
+
* client secret, so `client_id` + `redirect_uri` alone do not prove that the
|
|
6
|
+
* party redeeming a code is the party that requested it. An attacker who
|
|
7
|
+
* intercepts the code — a malicious app registered on the same custom URI
|
|
8
|
+
* scheme, a leaked Referer, a shoulder-surfed loopback redirect — can redeem
|
|
9
|
+
* it and receive a grant-bound token. RFC 7636 §1 describes exactly this.
|
|
10
|
+
*
|
|
11
|
+
* PKCE closes it: the client sends a challenge up front and must present the
|
|
12
|
+
* verifier at redemption. The AS binds the two. An intercepted code is useless
|
|
13
|
+
* without the verifier, which never leaves the requesting client.
|
|
14
|
+
*
|
|
15
|
+
* Only S256 is supported. `plain` is in RFC 7636 for constrained clients that
|
|
16
|
+
* cannot compute SHA-256, and it defeats the purpose here: an attacker who
|
|
17
|
+
* sees the challenge in the authorization request has the verifier. RFC 7636
|
|
18
|
+
* §4.2 says a server MUST support S256 and clients MUST use it where they can;
|
|
19
|
+
* for a protocol carrying personal data there is no reason to accept the weak
|
|
20
|
+
* mode, so this AS declines `plain` explicitly rather than silently.
|
|
21
|
+
*/
|
|
22
|
+
/** The only challenge method this AS accepts. */
|
|
23
|
+
export declare const PKCE_METHOD_S256 = "S256";
|
|
24
|
+
/**
|
|
25
|
+
* base64url per RFC 7636 §appendix A: standard base64 with `+/` mapped to
|
|
26
|
+
* `-_` and padding stripped. Node's `base64url` encoding already does this.
|
|
27
|
+
*/
|
|
28
|
+
export declare function computeS256Challenge(verifier: string): string;
|
|
29
|
+
export type PkceFailureCode = "missing_verifier" | "invalid_verifier" | "unsupported_method" | "missing_challenge";
|
|
30
|
+
export interface PkceFailure {
|
|
31
|
+
code: PkceFailureCode;
|
|
32
|
+
message: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Validate a challenge at authorization time.
|
|
36
|
+
*
|
|
37
|
+
* Rejecting an unsupported method here, rather than at redemption, means a
|
|
38
|
+
* client learns its flow is unusable before the owner is asked to consent to
|
|
39
|
+
* anything — failing after consent would waste a real human decision.
|
|
40
|
+
*/
|
|
41
|
+
export declare function validateCodeChallenge(challenge: string | undefined, method: string | undefined, options: {
|
|
42
|
+
required: boolean;
|
|
43
|
+
}): PkceFailure | null;
|
|
44
|
+
/**
|
|
45
|
+
* Verify a presented verifier against the stored challenge at redemption.
|
|
46
|
+
*
|
|
47
|
+
* The comparison is constant-time. A challenge is not a secret in the way a
|
|
48
|
+
* password is — it is already public in the authorization request — but the
|
|
49
|
+
* verifier is, and an early-exit comparison over attacker-chosen input is a
|
|
50
|
+
* habit worth not forming in an authorization server.
|
|
51
|
+
*/
|
|
52
|
+
export declare function verifyCodeVerifier(verifier: string | undefined, storedChallenge: string | null, storedMethod: string | null): PkceFailure | null;
|
|
53
|
+
//# sourceMappingURL=pkce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkce.d.ts","sourceRoot":"","sources":["../../src/pdpp/pkce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,iDAAiD;AACjD,eAAO,MAAM,gBAAgB,SAAS,CAAC;AAKvC;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,MAAM,MAAM,eAAe,GACvB,kBAAkB,GAClB,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,CAAC;AAExB,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,GAC7B,WAAW,GAAG,IAAI,CAoBpB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,GAC1B,WAAW,GAAG,IAAI,CA8CpB"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PKCE (RFC 7636) for the PDPP authorization-code flow.
|
|
3
|
+
*
|
|
4
|
+
* PDPP clients are public clients: a browser app or a desktop tool holds no
|
|
5
|
+
* client secret, so `client_id` + `redirect_uri` alone do not prove that the
|
|
6
|
+
* party redeeming a code is the party that requested it. An attacker who
|
|
7
|
+
* intercepts the code — a malicious app registered on the same custom URI
|
|
8
|
+
* scheme, a leaked Referer, a shoulder-surfed loopback redirect — can redeem
|
|
9
|
+
* it and receive a grant-bound token. RFC 7636 §1 describes exactly this.
|
|
10
|
+
*
|
|
11
|
+
* PKCE closes it: the client sends a challenge up front and must present the
|
|
12
|
+
* verifier at redemption. The AS binds the two. An intercepted code is useless
|
|
13
|
+
* without the verifier, which never leaves the requesting client.
|
|
14
|
+
*
|
|
15
|
+
* Only S256 is supported. `plain` is in RFC 7636 for constrained clients that
|
|
16
|
+
* cannot compute SHA-256, and it defeats the purpose here: an attacker who
|
|
17
|
+
* sees the challenge in the authorization request has the verifier. RFC 7636
|
|
18
|
+
* §4.2 says a server MUST support S256 and clients MUST use it where they can;
|
|
19
|
+
* for a protocol carrying personal data there is no reason to accept the weak
|
|
20
|
+
* mode, so this AS declines `plain` explicitly rather than silently.
|
|
21
|
+
*/
|
|
22
|
+
import { createHash, timingSafeEqual } from "node:crypto";
|
|
23
|
+
/** The only challenge method this AS accepts. */
|
|
24
|
+
export const PKCE_METHOD_S256 = "S256";
|
|
25
|
+
/** RFC 7636 §4.1: the verifier is 43–128 characters of unreserved ASCII. */
|
|
26
|
+
const VERIFIER_RE = /^[A-Za-z0-9\-._~]{43,128}$/;
|
|
27
|
+
/**
|
|
28
|
+
* base64url per RFC 7636 §appendix A: standard base64 with `+/` mapped to
|
|
29
|
+
* `-_` and padding stripped. Node's `base64url` encoding already does this.
|
|
30
|
+
*/
|
|
31
|
+
export function computeS256Challenge(verifier) {
|
|
32
|
+
return createHash("sha256").update(verifier, "ascii").digest("base64url");
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Validate a challenge at authorization time.
|
|
36
|
+
*
|
|
37
|
+
* Rejecting an unsupported method here, rather than at redemption, means a
|
|
38
|
+
* client learns its flow is unusable before the owner is asked to consent to
|
|
39
|
+
* anything — failing after consent would waste a real human decision.
|
|
40
|
+
*/
|
|
41
|
+
export function validateCodeChallenge(challenge, method, options) {
|
|
42
|
+
if (challenge === undefined || challenge.length === 0) {
|
|
43
|
+
if (!options.required)
|
|
44
|
+
return null;
|
|
45
|
+
return {
|
|
46
|
+
code: "missing_challenge",
|
|
47
|
+
message: "code_challenge is required for the authorization code flow",
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// An absent method defaults to `plain` under RFC 7636 §4.3. We do not accept
|
|
51
|
+
// plain, so an omitted method is an explicit error rather than a silent
|
|
52
|
+
// downgrade to the mode we refuse.
|
|
53
|
+
if (method !== PKCE_METHOD_S256) {
|
|
54
|
+
return {
|
|
55
|
+
code: "unsupported_method",
|
|
56
|
+
message: `code_challenge_method must be ${PKCE_METHOD_S256}; 'plain' is not accepted`,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Verify a presented verifier against the stored challenge at redemption.
|
|
63
|
+
*
|
|
64
|
+
* The comparison is constant-time. A challenge is not a secret in the way a
|
|
65
|
+
* password is — it is already public in the authorization request — but the
|
|
66
|
+
* verifier is, and an early-exit comparison over attacker-chosen input is a
|
|
67
|
+
* habit worth not forming in an authorization server.
|
|
68
|
+
*/
|
|
69
|
+
export function verifyCodeVerifier(verifier, storedChallenge, storedMethod) {
|
|
70
|
+
if (storedChallenge === null || storedChallenge.length === 0) {
|
|
71
|
+
// The code was issued without PKCE. Whether that is allowed is the
|
|
72
|
+
// authorization endpoint's decision (see `validateCodeChallenge`); by the
|
|
73
|
+
// time a code exists, there is nothing to verify against.
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
if (storedMethod !== PKCE_METHOD_S256) {
|
|
77
|
+
// A stored non-S256 method means the code was minted by a path that did
|
|
78
|
+
// not enforce the method check. Fail closed rather than honouring it.
|
|
79
|
+
return {
|
|
80
|
+
code: "unsupported_method",
|
|
81
|
+
message: "authorization code carries an unsupported code_challenge_method",
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
if (verifier === undefined || verifier.length === 0) {
|
|
85
|
+
return {
|
|
86
|
+
code: "missing_verifier",
|
|
87
|
+
message: "code_verifier is required to redeem this authorization code",
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (!VERIFIER_RE.test(verifier)) {
|
|
91
|
+
// Enforcing the shape stops a trivially-guessable short verifier from
|
|
92
|
+
// being accepted just because it happens to hash correctly.
|
|
93
|
+
return {
|
|
94
|
+
code: "invalid_verifier",
|
|
95
|
+
message: "code_verifier must be 43-128 characters of [A-Za-z0-9-._~] (RFC 7636 §4.1)",
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const computed = computeS256Challenge(verifier);
|
|
99
|
+
const a = Buffer.from(computed, "utf8");
|
|
100
|
+
const b = Buffer.from(storedChallenge, "utf8");
|
|
101
|
+
if (a.length !== b.length || !timingSafeEqual(a, b)) {
|
|
102
|
+
return {
|
|
103
|
+
code: "invalid_verifier",
|
|
104
|
+
message: "code_verifier does not match the code_challenge",
|
|
105
|
+
};
|
|
106
|
+
}
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ization code travels to the client in this redirect. If the AS
|
|
5
|
+
* honours whatever `redirect_uri` a caller supplies, the attack is direct: an
|
|
6
|
+
* attacker opens an authorization session pointing at their own host, the
|
|
7
|
+
* owner sees a consent screen that looks entirely legitimate (it is — the AS
|
|
8
|
+
* generated it), approves, and the code is delivered to the attacker.
|
|
9
|
+
*
|
|
10
|
+
* **PKCE does not mitigate this.** PKCE binds the code to whoever chose the
|
|
11
|
+
* challenge, and in this attack that is the attacker. They hold the matching
|
|
12
|
+
* verifier, so they redeem the stolen code and receive a grant-bound token
|
|
13
|
+
* over the owner's personal data. Code interception and code *misdelivery* are
|
|
14
|
+
* different problems; §10.6 is the one that covers misdelivery.
|
|
15
|
+
*
|
|
16
|
+
* Validation is by exact match against the client's registered redirect URIs.
|
|
17
|
+
* RFC 6749 §3.1.2.2 requires registration, and §3.1.2.3 allows fuzzier
|
|
18
|
+
* matching only for clients that registered a full URI — we do not take that
|
|
19
|
+
* latitude. Prefix or subdomain matching is where open-redirect bugs live: a
|
|
20
|
+
* registered `https://app.example.com/cb` "matching"
|
|
21
|
+
* `https://app.example.com.evil.test/cb` or `https://app.example.com/cb/../x`
|
|
22
|
+
* is the classic failure. Exact string equality after normalization has no
|
|
23
|
+
* such edge, and the cost is that a client registers each callback it uses.
|
|
24
|
+
*/
|
|
25
|
+
export type RedirectFailureCode = "unregistered_redirect_uri" | "insecure_redirect_uri" | "malformed_redirect_uri" | "no_registered_redirect_uris";
|
|
26
|
+
export interface RedirectFailure {
|
|
27
|
+
code: RedirectFailureCode;
|
|
28
|
+
message: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Registered metadata for a client, as the deployment holds it.
|
|
32
|
+
*
|
|
33
|
+
* `redirect_uris` is required and non-empty for the code flow: a client with
|
|
34
|
+
* no registered callback cannot safely receive a code, and defaulting to
|
|
35
|
+
* "accept anything" would reintroduce exactly the hole this module closes.
|
|
36
|
+
*/
|
|
37
|
+
export interface RegisteredRedirectPolicy {
|
|
38
|
+
client_id: string;
|
|
39
|
+
redirect_uris: string[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Validate a requested redirect URI against the client's registered set.
|
|
43
|
+
*
|
|
44
|
+
* Returns null when the URI is acceptable. Every rejection is deliberately
|
|
45
|
+
* the same shape, so a caller probing for registered URIs learns only that
|
|
46
|
+
* theirs was not one.
|
|
47
|
+
*/
|
|
48
|
+
export declare function validateRedirectUri(requested: string | undefined, policy: RegisteredRedirectPolicy | null): RedirectFailure | null;
|
|
49
|
+
/**
|
|
50
|
+
* Whether a redirect failure may be reported *by redirecting*.
|
|
51
|
+
*
|
|
52
|
+
* RFC 6749 §4.1.2.1 is explicit: when the redirect URI is invalid or
|
|
53
|
+
* unregistered, the AS MUST NOT automatically redirect the user-agent to it.
|
|
54
|
+
* Doing so would turn the authorization endpoint into an open redirector and
|
|
55
|
+
* would hand the attacker the error response they were fishing for. Every
|
|
56
|
+
* failure from `validateRedirectUri` is therefore reported directly to the
|
|
57
|
+
* caller and never as a redirect.
|
|
58
|
+
*/
|
|
59
|
+
export declare const REDIRECT_FAILURES_ARE_NEVER_REDIRECTED: true;
|
|
60
|
+
//# sourceMappingURL=redirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../src/pdpp/redirect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,MAAM,MAAM,mBAAmB,GAC3B,2BAA2B,GAC3B,uBAAuB,GACvB,wBAAwB,GACxB,6BAA6B,CAAC;AAElC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAmBD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,wBAAwB,GAAG,IAAI,GACtC,eAAe,GAAG,IAAI,CAqExB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,sCAAsC,EAAG,IAAa,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redirect URI validation (RFC 6749 §3.1.2, §10.6; RFC 8252 §7.3).
|
|
3
|
+
*
|
|
4
|
+
* The authorization code travels to the client in this redirect. If the AS
|
|
5
|
+
* honours whatever `redirect_uri` a caller supplies, the attack is direct: an
|
|
6
|
+
* attacker opens an authorization session pointing at their own host, the
|
|
7
|
+
* owner sees a consent screen that looks entirely legitimate (it is — the AS
|
|
8
|
+
* generated it), approves, and the code is delivered to the attacker.
|
|
9
|
+
*
|
|
10
|
+
* **PKCE does not mitigate this.** PKCE binds the code to whoever chose the
|
|
11
|
+
* challenge, and in this attack that is the attacker. They hold the matching
|
|
12
|
+
* verifier, so they redeem the stolen code and receive a grant-bound token
|
|
13
|
+
* over the owner's personal data. Code interception and code *misdelivery* are
|
|
14
|
+
* different problems; §10.6 is the one that covers misdelivery.
|
|
15
|
+
*
|
|
16
|
+
* Validation is by exact match against the client's registered redirect URIs.
|
|
17
|
+
* RFC 6749 §3.1.2.2 requires registration, and §3.1.2.3 allows fuzzier
|
|
18
|
+
* matching only for clients that registered a full URI — we do not take that
|
|
19
|
+
* latitude. Prefix or subdomain matching is where open-redirect bugs live: a
|
|
20
|
+
* registered `https://app.example.com/cb` "matching"
|
|
21
|
+
* `https://app.example.com.evil.test/cb` or `https://app.example.com/cb/../x`
|
|
22
|
+
* is the classic failure. Exact string equality after normalization has no
|
|
23
|
+
* such edge, and the cost is that a client registers each callback it uses.
|
|
24
|
+
*/
|
|
25
|
+
/** Loopback hosts, where RFC 8252 §7.3 permits plain http for native apps. */
|
|
26
|
+
const LOOPBACK_HOSTS = new Set(["127.0.0.1", "[::1]", "::1", "localhost"]);
|
|
27
|
+
/**
|
|
28
|
+
* Normalize for comparison without loosening the match.
|
|
29
|
+
*
|
|
30
|
+
* `URL` resolves dot-segments and lowercases scheme and host, so
|
|
31
|
+
* `https://App.Example.com/cb/../cb` and `https://app.example.com/cb` compare
|
|
32
|
+
* equal — that is canonicalization, not fuzzy matching. Query and fragment are
|
|
33
|
+
* preserved, because a registered URI that carries a query is a different
|
|
34
|
+
* endpoint from one that does not.
|
|
35
|
+
*/
|
|
36
|
+
function normalize(raw) {
|
|
37
|
+
try {
|
|
38
|
+
return new URL(raw);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Validate a requested redirect URI against the client's registered set.
|
|
46
|
+
*
|
|
47
|
+
* Returns null when the URI is acceptable. Every rejection is deliberately
|
|
48
|
+
* the same shape, so a caller probing for registered URIs learns only that
|
|
49
|
+
* theirs was not one.
|
|
50
|
+
*/
|
|
51
|
+
export function validateRedirectUri(requested, policy) {
|
|
52
|
+
if (!requested || requested.length === 0) {
|
|
53
|
+
return {
|
|
54
|
+
code: "malformed_redirect_uri",
|
|
55
|
+
message: "redirect_uri is required",
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const url = normalize(requested);
|
|
59
|
+
if (!url) {
|
|
60
|
+
return {
|
|
61
|
+
code: "malformed_redirect_uri",
|
|
62
|
+
message: "redirect_uri is not a valid absolute URI",
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// RFC 6749 §3.1.2: the endpoint URI MUST NOT include a fragment. A fragment
|
|
66
|
+
// is also how a target gets smuggled past a naive prefix check.
|
|
67
|
+
if (url.hash.length > 0) {
|
|
68
|
+
return {
|
|
69
|
+
code: "malformed_redirect_uri",
|
|
70
|
+
message: "redirect_uri must not include a fragment component",
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// Scheme gate before anything else. `javascript:` and `data:` are the
|
|
74
|
+
// XSS-on-redirect shapes; everything non-http(s) is refused outright rather
|
|
75
|
+
// than enumerated, so a scheme nobody thought of is refused by default.
|
|
76
|
+
const isLoopback = LOOPBACK_HOSTS.has(url.hostname);
|
|
77
|
+
if (url.protocol === "http:") {
|
|
78
|
+
// RFC 8252 §7.3: loopback http is the native-app redirect, and is fine.
|
|
79
|
+
if (!isLoopback) {
|
|
80
|
+
return {
|
|
81
|
+
code: "insecure_redirect_uri",
|
|
82
|
+
message: "redirect_uri must use https except for loopback addresses",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else if (url.protocol !== "https:") {
|
|
87
|
+
return {
|
|
88
|
+
code: "insecure_redirect_uri",
|
|
89
|
+
message: `redirect_uri scheme '${url.protocol}' is not permitted`,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
if (!policy || policy.redirect_uris.length === 0) {
|
|
93
|
+
// No registration means no safe target. Failing closed here is the whole
|
|
94
|
+
// point: an AS that falls back to "trust the request" when it has no
|
|
95
|
+
// policy has no policy.
|
|
96
|
+
return {
|
|
97
|
+
code: "no_registered_redirect_uris",
|
|
98
|
+
message: "client has no registered redirect URIs; register one before requesting authorization",
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// Exact match after canonicalization. No prefix, no subdomain, no wildcard.
|
|
102
|
+
const matched = policy.redirect_uris.some((candidate) => {
|
|
103
|
+
const registered = normalize(candidate);
|
|
104
|
+
return registered !== null && registered.toString() === url.toString();
|
|
105
|
+
});
|
|
106
|
+
if (!matched) {
|
|
107
|
+
return {
|
|
108
|
+
code: "unregistered_redirect_uri",
|
|
109
|
+
message: "redirect_uri does not exactly match a registered redirect URI",
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Whether a redirect failure may be reported *by redirecting*.
|
|
116
|
+
*
|
|
117
|
+
* RFC 6749 §4.1.2.1 is explicit: when the redirect URI is invalid or
|
|
118
|
+
* unregistered, the AS MUST NOT automatically redirect the user-agent to it.
|
|
119
|
+
* Doing so would turn the authorization endpoint into an open redirector and
|
|
120
|
+
* would hand the attacker the error response they were fishing for. Every
|
|
121
|
+
* failure from `validateRedirectUri` is therefore reported directly to the
|
|
122
|
+
* caller and never as a redirect.
|
|
123
|
+
*/
|
|
124
|
+
export const REDIRECT_FAILURES_ARE_NEVER_REDIRECTED = true;
|
|
125
|
+
//# sourceMappingURL=redirect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../src/pdpp/redirect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,8EAA8E;AAC9E,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;AAyB3E;;;;;;;;GAQG;AACH,SAAS,SAAS,CAAC,GAAW;IAC5B,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAA6B,EAC7B,MAAuC;IAEvC,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO;YACL,IAAI,EAAE,wBAAwB;YAC9B,OAAO,EAAE,0BAA0B;SACpC,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO;YACL,IAAI,EAAE,wBAAwB;YAC9B,OAAO,EAAE,0CAA0C;SACpD,CAAC;IACJ,CAAC;IAED,4EAA4E;IAC5E,gEAAgE;IAChE,IAAI,GAAG,CAAC,IAAI,CAA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,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,IAAa,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PDPP Core §6→§7 resolution: turn a validated selection request into the
|
|
3
|
+
* explicit grant facts that get frozen at issuance.
|
|
4
|
+
*
|
|
5
|
+
* Every request-only convenience dies here. Wildcards and presets expand to
|
|
6
|
+
* concrete stream rows, views resolve to field lists, omitted fields become
|
|
7
|
+
* the declaration's full field set, omitted instance handles resolve against
|
|
8
|
+
* the owner's connection inventory, and `time_range` freezes against the
|
|
9
|
+
* declaration's `consent_time_field`. §7 is explicit that none of these
|
|
10
|
+
* conveniences are continuing authority in the grant — the RS must never have
|
|
11
|
+
* to resolve anything, which is also what the AS→RS contract promises.
|
|
12
|
+
*
|
|
13
|
+
* Resolution runs against the same retained snapshot `selection.ts` validated
|
|
14
|
+
* against. Passing a newer declaration here is the bug §9 AS item 16 exists to
|
|
15
|
+
* prevent: it would let a later declaration widen an in-flight authorization.
|
|
16
|
+
*/
|
|
17
|
+
import { type DeclarationSnapshot, type SelectionRequest, type StreamGrant } from "./types.js";
|
|
18
|
+
/**
|
|
19
|
+
* The owner's connected instances for a source, as the AS knows them at
|
|
20
|
+
* resolution time. §6 is strict that omitting `instance_ids` never means
|
|
21
|
+
* fan-in: the AS resolves exactly one eligible handle or requires an explicit
|
|
22
|
+
* owner choice.
|
|
23
|
+
*/
|
|
24
|
+
export interface InstanceInventory {
|
|
25
|
+
/** Eligible opaque handles for a given stream, in the owner's connection state. */
|
|
26
|
+
eligibleFor(streamName: string): string[];
|
|
27
|
+
}
|
|
28
|
+
export type ResolutionFailureCode = "unknown_stream" | "unknown_instance" | "instance_choice_required" | "no_eligible_instance" | "unknown_view" | "empty_field_set";
|
|
29
|
+
export interface ResolutionFailure {
|
|
30
|
+
code: ResolutionFailureCode;
|
|
31
|
+
message: string;
|
|
32
|
+
/** The stream that could not be resolved, when the failure is stream-scoped. */
|
|
33
|
+
stream?: string;
|
|
34
|
+
/** For `instance_choice_required`: the handles the owner must choose between. */
|
|
35
|
+
candidates?: string[];
|
|
36
|
+
}
|
|
37
|
+
export type ResolutionResult = {
|
|
38
|
+
ok: true;
|
|
39
|
+
streams: StreamGrant[];
|
|
40
|
+
} | {
|
|
41
|
+
ok: false;
|
|
42
|
+
failure: ResolutionFailure;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Resolve every enforcement axis for a validated selection request.
|
|
46
|
+
*
|
|
47
|
+
* Call this before showing the final approval surface: §7 requires the
|
|
48
|
+
* approval artifact to contain the exact resolved instance handles, stream
|
|
49
|
+
* names, fields, resources, and temporal bounds, which only exist once this
|
|
50
|
+
* has run.
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveSelection(request: SelectionRequest, snapshot: DeclarationSnapshot, inventory: InstanceInventory): ResolutionResult;
|
|
53
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/pdpp/resolve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,KAAK,mBAAmB,EAExB,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAGjB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC3C;AAED,MAAM,MAAM,qBAAqB,GAC7B,gBAAgB,GAChB,kBAAkB,GAClB,0BAA0B,GAC1B,sBAAsB,GACtB,cAAc,GACd,iBAAiB,CAAC;AAEtB,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,WAAW,EAAE,CAAA;CAAE,GACpC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,iBAAiB,CAAA;CAAE,CAAC;AA6N9C;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,iBAAiB,GAC3B,gBAAgB,CA0BlB"}
|