ontrackd 0.0.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +14 -0
- package/README.md +126 -2
- package/dist/cli/build.d.ts +1 -0
- package/dist/cli/build.js +172 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/cloud.d.ts +20 -0
- package/dist/cli/cloud.js +395 -0
- package/dist/cli/cloud.js.map +1 -0
- package/dist/cli/feedback.d.ts +4 -0
- package/dist/cli/feedback.js +90 -0
- package/dist/cli/feedback.js.map +1 -0
- package/dist/cli/hugo.d.ts +1 -0
- package/dist/cli/hugo.js +396 -0
- package/dist/cli/hugo.js.map +1 -0
- package/dist/cli/init.d.ts +8 -0
- package/dist/cli/init.js +346 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/invite.d.ts +2 -0
- package/dist/cli/invite.js +65 -0
- package/dist/cli/invite.js.map +1 -0
- package/dist/cli/link.d.ts +20 -0
- package/dist/cli/link.js +287 -0
- package/dist/cli/link.js.map +1 -0
- package/dist/cli/pull.d.ts +31 -0
- package/dist/cli/pull.js +273 -0
- package/dist/cli/pull.js.map +1 -0
- package/dist/cli/push.d.ts +9 -0
- package/dist/cli/push.js +57 -0
- package/dist/cli/push.js.map +1 -0
- package/dist/cli/remote.d.ts +1 -0
- package/dist/cli/remote.js +114 -0
- package/dist/cli/remote.js.map +1 -0
- package/dist/cli/serve.d.ts +1 -0
- package/dist/cli/serve.js +178 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/sidecar.d.ts +9 -0
- package/dist/cli/sidecar.js +23 -0
- package/dist/cli/sidecar.js.map +1 -0
- package/dist/core/anchorId.d.ts +42 -0
- package/dist/core/anchorId.js +50 -0
- package/dist/core/anchorId.js.map +1 -0
- package/dist/core/apiKind.d.ts +42 -0
- package/dist/core/apiKind.js +83 -0
- package/dist/core/apiKind.js.map +1 -0
- package/dist/core/astroAnchors.d.ts +39 -0
- package/dist/core/astroAnchors.js +217 -0
- package/dist/core/astroAnchors.js.map +1 -0
- package/dist/core/attachmentTypes.d.ts +74 -0
- package/dist/core/attachmentTypes.js +199 -0
- package/dist/core/attachmentTypes.js.map +1 -0
- package/dist/core/elementHints.d.ts +40 -0
- package/dist/core/elementHints.js +116 -0
- package/dist/core/elementHints.js.map +1 -0
- package/dist/core/exportTaskDoc.d.ts +81 -0
- package/dist/core/exportTaskDoc.js +828 -0
- package/dist/core/exportTaskDoc.js.map +1 -0
- package/dist/core/feedbackTypes.d.ts +241 -0
- package/dist/core/feedbackTypes.js +2 -0
- package/dist/core/feedbackTypes.js.map +1 -0
- package/dist/core/fingerprint.d.ts +12 -0
- package/dist/core/fingerprint.js +24 -0
- package/dist/core/fingerprint.js.map +1 -0
- package/dist/core/htmlAnchors.d.ts +18 -0
- package/dist/core/htmlAnchors.js +157 -0
- package/dist/core/htmlAnchors.js.map +1 -0
- package/dist/core/imageSniff.d.ts +7 -0
- package/dist/core/imageSniff.js +12 -0
- package/dist/core/imageSniff.js.map +1 -0
- package/dist/core/ordering.d.ts +16 -0
- package/dist/core/ordering.js +10 -0
- package/dist/core/ordering.js.map +1 -0
- package/dist/core/oxcAst.d.ts +39 -0
- package/dist/core/oxcAst.js +147 -0
- package/dist/core/oxcAst.js.map +1 -0
- package/dist/core/pageUrl.d.ts +10 -0
- package/dist/core/pageUrl.js +27 -0
- package/dist/core/pageUrl.js.map +1 -0
- package/dist/core/participants.d.ts +14 -0
- package/dist/core/participants.js +38 -0
- package/dist/core/participants.js.map +1 -0
- package/dist/core/ports.d.ts +86 -0
- package/dist/core/ports.js +2 -0
- package/dist/core/ports.js.map +1 -0
- package/dist/core/projectSecret.d.ts +9 -0
- package/dist/core/projectSecret.js +57 -0
- package/dist/core/projectSecret.js.map +1 -0
- package/dist/core/recipe.d.ts +117 -0
- package/dist/core/recipe.js +181 -0
- package/dist/core/recipe.js.map +1 -0
- package/dist/core/recordingSummary.d.ts +12 -0
- package/dist/core/recordingSummary.js +150 -0
- package/dist/core/recordingSummary.js.map +1 -0
- package/dist/core/resolveAnchors.d.ts +70 -0
- package/dist/core/resolveAnchors.js +101 -0
- package/dist/core/resolveAnchors.js.map +1 -0
- package/dist/core/scriptImport.d.ts +10 -0
- package/dist/core/scriptImport.js +18 -0
- package/dist/core/scriptImport.js.map +1 -0
- package/dist/core/sourceAnchors.d.ts +62 -0
- package/dist/core/sourceAnchors.js +82 -0
- package/dist/core/sourceAnchors.js.map +1 -0
- package/dist/core/sourceContext.d.ts +62 -0
- package/dist/core/sourceContext.js +182 -0
- package/dist/core/sourceContext.js.map +1 -0
- package/dist/core/sourcePath.d.ts +2 -0
- package/dist/core/sourcePath.js +11 -0
- package/dist/core/sourcePath.js.map +1 -0
- package/dist/core/staleness.d.ts +118 -0
- package/dist/core/staleness.js +155 -0
- package/dist/core/staleness.js.map +1 -0
- package/dist/core/styleOrigin.d.ts +98 -0
- package/dist/core/styleOrigin.js +142 -0
- package/dist/core/styleOrigin.js.map +1 -0
- package/dist/core/svelteAnchors.d.ts +18 -0
- package/dist/core/svelteAnchors.js +125 -0
- package/dist/core/svelteAnchors.js.map +1 -0
- package/dist/core/taskFiles.d.ts +31 -0
- package/dist/core/taskFiles.js +55 -0
- package/dist/core/taskFiles.js.map +1 -0
- package/dist/core/untrusted.d.ts +57 -0
- package/dist/core/untrusted.js +268 -0
- package/dist/core/untrusted.js.map +1 -0
- package/dist/core/vueAnchors.d.ts +21 -0
- package/dist/core/vueAnchors.js +130 -0
- package/dist/core/vueAnchors.js.map +1 -0
- package/dist/expo/app/Avatar.d.ts +6 -0
- package/dist/expo/app/Avatar.js +12 -0
- package/dist/expo/app/Avatar.js.map +1 -0
- package/dist/expo/app/Bars.d.ts +9 -0
- package/dist/expo/app/Bars.js +38 -0
- package/dist/expo/app/Bars.js.map +1 -0
- package/dist/expo/app/CommentThreadSheet.d.ts +35 -0
- package/dist/expo/app/CommentThreadSheet.js +200 -0
- package/dist/expo/app/CommentThreadSheet.js.map +1 -0
- package/dist/expo/app/CommentsSheet.d.ts +22 -0
- package/dist/expo/app/CommentsSheet.js +76 -0
- package/dist/expo/app/CommentsSheet.js.map +1 -0
- package/dist/expo/app/Files.d.ts +16 -0
- package/dist/expo/app/Files.js +62 -0
- package/dist/expo/app/Files.js.map +1 -0
- package/dist/expo/app/Highlight.d.ts +5 -0
- package/dist/expo/app/Highlight.js +12 -0
- package/dist/expo/app/Highlight.js.map +1 -0
- package/dist/expo/app/Icon.d.ts +9 -0
- package/dist/expo/app/Icon.js +22 -0
- package/dist/expo/app/Icon.js.map +1 -0
- package/dist/expo/app/MarkerPins.d.ts +10 -0
- package/dist/expo/app/MarkerPins.js +70 -0
- package/dist/expo/app/MarkerPins.js.map +1 -0
- package/dist/expo/app/Provider.d.ts +13 -0
- package/dist/expo/app/Provider.js +597 -0
- package/dist/expo/app/Provider.js.map +1 -0
- package/dist/expo/app/Sheet.d.ts +53 -0
- package/dist/expo/app/Sheet.js +106 -0
- package/dist/expo/app/Sheet.js.map +1 -0
- package/dist/expo/app/Toolbar.d.ts +26 -0
- package/dist/expo/app/Toolbar.js +71 -0
- package/dist/expo/app/Toolbar.js.map +1 -0
- package/dist/expo/app/adapter.d.ts +55 -0
- package/dist/expo/app/adapter.js +145 -0
- package/dist/expo/app/adapter.js.map +1 -0
- package/dist/expo/app/api.d.ts +68 -0
- package/dist/expo/app/api.js +86 -0
- package/dist/expo/app/api.js.map +1 -0
- package/dist/expo/app/assets/attach.png +0 -0
- package/dist/expo/app/assets/close.png +0 -0
- package/dist/expo/app/assets/comment.png +0 -0
- package/dist/expo/app/assets/edit.png +0 -0
- package/dist/expo/app/assets/file.png +0 -0
- package/dist/expo/app/assets/narrow.png +0 -0
- package/dist/expo/app/assets/panel.png +0 -0
- package/dist/expo/app/assets/pins.png +0 -0
- package/dist/expo/app/assets/pinsOff.png +0 -0
- package/dist/expo/app/assets/remove.png +0 -0
- package/dist/expo/app/assets/reopen.png +0 -0
- package/dist/expo/app/assets/resolve.png +0 -0
- package/dist/expo/app/assets/send.png +0 -0
- package/dist/expo/app/assets/widen.png +0 -0
- package/dist/expo/app/attachments.d.ts +93 -0
- package/dist/expo/app/attachments.js +181 -0
- package/dist/expo/app/attachments.js.map +1 -0
- package/dist/expo/app/cloudApi.d.ts +63 -0
- package/dist/expo/app/cloudApi.js +330 -0
- package/dist/expo/app/cloudApi.js.map +1 -0
- package/dist/expo/app/cloudAuth.d.ts +20 -0
- package/dist/expo/app/cloudAuth.js +71 -0
- package/dist/expo/app/cloudAuth.js.map +1 -0
- package/dist/expo/app/cloudHttp.d.ts +20 -0
- package/dist/expo/app/cloudHttp.js +46 -0
- package/dist/expo/app/cloudHttp.js.map +1 -0
- package/dist/expo/app/cloudSession.d.ts +30 -0
- package/dist/expo/app/cloudSession.js +72 -0
- package/dist/expo/app/cloudSession.js.map +1 -0
- package/dist/expo/app/comments.d.ts +20 -0
- package/dist/expo/app/comments.js +131 -0
- package/dist/expo/app/comments.js.map +1 -0
- package/dist/expo/app/devMenuNone.d.ts +5 -0
- package/dist/expo/app/devMenuNone.js +3 -0
- package/dist/expo/app/devMenuNone.js.map +1 -0
- package/dist/expo/app/devServerNone.d.ts +4 -0
- package/dist/expo/app/devServerNone.js +4 -0
- package/dist/expo/app/devServerNone.js.map +1 -0
- package/dist/expo/app/embeddedConfig.d.ts +1 -0
- package/dist/expo/app/embeddedConfig.js +12 -0
- package/dist/expo/app/embeddedConfig.js.map +1 -0
- package/dist/expo/app/embeddedConfigCloud.d.ts +2 -0
- package/dist/expo/app/embeddedConfigCloud.js +8 -0
- package/dist/expo/app/embeddedConfigCloud.js.map +1 -0
- package/dist/expo/app/embeddedConfigNone.d.ts +2 -0
- package/dist/expo/app/embeddedConfigNone.js +3 -0
- package/dist/expo/app/embeddedConfigNone.js.map +1 -0
- package/dist/expo/app/expo.d.ts +4 -0
- package/dist/expo/app/expo.js +35 -0
- package/dist/expo/app/expo.js.map +1 -0
- package/dist/expo/app/expoGo.d.ts +4 -0
- package/dist/expo/app/expoGo.js +33 -0
- package/dist/expo/app/expoGo.js.map +1 -0
- package/dist/expo/app/expoPickers.d.ts +11 -0
- package/dist/expo/app/expoPickers.js +91 -0
- package/dist/expo/app/expoPickers.js.map +1 -0
- package/dist/expo/app/expoRandom.d.ts +6 -0
- package/dist/expo/app/expoRandom.js +21 -0
- package/dist/expo/app/expoRandom.js.map +1 -0
- package/dist/expo/app/idle.d.ts +4 -0
- package/dist/expo/app/idle.js +7 -0
- package/dist/expo/app/idle.js.map +1 -0
- package/dist/expo/app/index.d.ts +3 -0
- package/dist/expo/app/index.js +3 -0
- package/dist/expo/app/index.js.map +1 -0
- package/dist/expo/app/interactions.d.ts +38 -0
- package/dist/expo/app/interactions.js +40 -0
- package/dist/expo/app/interactions.js.map +1 -0
- package/dist/expo/app/markers.d.ts +28 -0
- package/dist/expo/app/markers.js +187 -0
- package/dist/expo/app/markers.js.map +1 -0
- package/dist/expo/app/movedAnchors.d.ts +46 -0
- package/dist/expo/app/movedAnchors.js +39 -0
- package/dist/expo/app/movedAnchors.js.map +1 -0
- package/dist/expo/app/native.d.ts +12 -0
- package/dist/expo/app/native.js +78 -0
- package/dist/expo/app/native.js.map +1 -0
- package/dist/expo/app/panel.d.ts +27 -0
- package/dist/expo/app/panel.js +37 -0
- package/dist/expo/app/panel.js.map +1 -0
- package/dist/expo/app/payload.d.ts +43 -0
- package/dist/expo/app/payload.js +22 -0
- package/dist/expo/app/payload.js.map +1 -0
- package/dist/expo/app/pick.d.ts +14 -0
- package/dist/expo/app/pick.js +124 -0
- package/dist/expo/app/pick.js.map +1 -0
- package/dist/expo/app/pickerNone.d.ts +1 -0
- package/dist/expo/app/pickerNone.js +2 -0
- package/dist/expo/app/pickerNone.js.map +1 -0
- package/dist/expo/app/placement.d.ts +53 -0
- package/dist/expo/app/placement.js +100 -0
- package/dist/expo/app/placement.js.map +1 -0
- package/dist/expo/app/random.d.ts +13 -0
- package/dist/expo/app/random.js +56 -0
- package/dist/expo/app/random.js.map +1 -0
- package/dist/expo/app/reactNative.d.ts +2 -0
- package/dist/expo/app/reactNative.js +3 -0
- package/dist/expo/app/reactNative.js.map +1 -0
- package/dist/expo/app/runtimeConfig.d.ts +30 -0
- package/dist/expo/app/runtimeConfig.js +104 -0
- package/dist/expo/app/runtimeConfig.js.map +1 -0
- package/dist/expo/app/sheetMotion.d.ts +22 -0
- package/dist/expo/app/sheetMotion.js +39 -0
- package/dist/expo/app/sheetMotion.js.map +1 -0
- package/dist/expo/app/signIn.d.ts +32 -0
- package/dist/expo/app/signIn.js +28 -0
- package/dist/expo/app/signIn.js.map +1 -0
- package/dist/expo/app/state.d.ts +45 -0
- package/dist/expo/app/state.js +32 -0
- package/dist/expo/app/state.js.map +1 -0
- package/dist/expo/app/theme.d.ts +15 -0
- package/dist/expo/app/theme.js +9 -0
- package/dist/expo/app/theme.js.map +1 -0
- package/dist/expo/app/types.d.ts +87 -0
- package/dist/expo/app/types.js +2 -0
- package/dist/expo/app/types.js.map +1 -0
- package/dist/expo/app/useCloudReviewer.d.ts +75 -0
- package/dist/expo/app/useCloudReviewer.js +211 -0
- package/dist/expo/app/useCloudReviewer.js.map +1 -0
- package/dist/expo/app/useComments.d.ts +64 -0
- package/dist/expo/app/useComments.js +156 -0
- package/dist/expo/app/useComments.js.map +1 -0
- package/dist/expo/app/useUploads.d.ts +32 -0
- package/dist/expo/app/useUploads.js +106 -0
- package/dist/expo/app/useUploads.js.map +1 -0
- package/dist/expo/expoGoMetro.cjs +83 -0
- package/dist/expo/expoMetro.cjs +86 -0
- package/dist/expo/metro.cjs +304 -0
- package/dist/expo/metroBuild.d.ts +22 -0
- package/dist/expo/metroBuild.js +169 -0
- package/dist/expo/metroBuild.js.map +1 -0
- package/dist/expo/middleware.d.ts +11 -0
- package/dist/expo/middleware.js +26 -0
- package/dist/expo/middleware.js.map +1 -0
- package/dist/expo/mode.d.ts +20 -0
- package/dist/expo/mode.js +37 -0
- package/dist/expo/mode.js.map +1 -0
- package/dist/expo/publicConfig.d.ts +37 -0
- package/dist/expo/publicConfig.js +87 -0
- package/dist/expo/publicConfig.js.map +1 -0
- package/dist/expo/transform.d.ts +22 -0
- package/dist/expo/transform.js +38 -0
- package/dist/expo/transform.js.map +1 -0
- package/dist/expo/transformer.cjs +73 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/integration/apiRoutes.d.ts +2 -0
- package/dist/integration/apiRoutes.js +3 -0
- package/dist/integration/apiRoutes.js.map +1 -0
- package/dist/integration/buildCredentials.d.ts +12 -0
- package/dist/integration/buildCredentials.js +97 -0
- package/dist/integration/buildCredentials.js.map +1 -0
- package/dist/integration/buildSession.d.ts +8 -0
- package/dist/integration/buildSession.js +96 -0
- package/dist/integration/buildSession.js.map +1 -0
- package/dist/integration/bundleCheck.d.ts +43 -0
- package/dist/integration/bundleCheck.js +111 -0
- package/dist/integration/bundleCheck.js.map +1 -0
- package/dist/integration/commentPull.d.ts +134 -0
- package/dist/integration/commentPull.js +260 -0
- package/dist/integration/commentPull.js.map +1 -0
- package/dist/integration/configuredApi.d.ts +7 -0
- package/dist/integration/configuredApi.js +24 -0
- package/dist/integration/configuredApi.js.map +1 -0
- package/dist/integration/devCloud.d.ts +27 -0
- package/dist/integration/devCloud.js +56 -0
- package/dist/integration/devCloud.js.map +1 -0
- package/dist/integration/devReviewLinks.d.ts +2 -0
- package/dist/integration/devReviewLinks.js +10 -0
- package/dist/integration/devReviewLinks.js.map +1 -0
- package/dist/integration/gitBranch.d.ts +19 -0
- package/dist/integration/gitBranch.js +56 -0
- package/dist/integration/gitBranch.js.map +1 -0
- package/dist/integration/importPlan.d.ts +19 -0
- package/dist/integration/importPlan.js +90 -0
- package/dist/integration/importPlan.js.map +1 -0
- package/dist/integration/index.d.ts +14 -0
- package/dist/integration/index.js +13 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/manifest.d.ts +120 -0
- package/dist/integration/manifest.js +147 -0
- package/dist/integration/manifest.js.map +1 -0
- package/dist/integration/manifestParts.d.ts +29 -0
- package/dist/integration/manifestParts.js +65 -0
- package/dist/integration/manifestParts.js.map +1 -0
- package/dist/integration/manifestSink.d.ts +75 -0
- package/dist/integration/manifestSink.js +157 -0
- package/dist/integration/manifestSink.js.map +1 -0
- package/dist/integration/manifestUpload.d.ts +64 -0
- package/dist/integration/manifestUpload.js +177 -0
- package/dist/integration/manifestUpload.js.map +1 -0
- package/dist/integration/middleware.d.ts +55 -0
- package/dist/integration/middleware.js +379 -0
- package/dist/integration/middleware.js.map +1 -0
- package/dist/integration/nextStyles.d.ts +4 -0
- package/dist/integration/nextStyles.js +121 -0
- package/dist/integration/nextStyles.js.map +1 -0
- package/dist/integration/requestGuards.d.ts +71 -0
- package/dist/integration/requestGuards.js +255 -0
- package/dist/integration/requestGuards.js.map +1 -0
- package/dist/integration/sharedBuild.d.ts +71 -0
- package/dist/integration/sharedBuild.js +105 -0
- package/dist/integration/sharedBuild.js.map +1 -0
- package/dist/integration/sharedInject.d.ts +88 -0
- package/dist/integration/sharedInject.js +164 -0
- package/dist/integration/sharedInject.js.map +1 -0
- package/dist/integration/sidecarProcess.d.ts +26 -0
- package/dist/integration/sidecarProcess.js +137 -0
- package/dist/integration/sidecarProcess.js.map +1 -0
- package/dist/integration/styleCollector.d.ts +49 -0
- package/dist/integration/styleCollector.js +220 -0
- package/dist/integration/styleCollector.js.map +1 -0
- package/dist/integration/transform.d.ts +24 -0
- package/dist/integration/transform.js +36 -0
- package/dist/integration/transform.js.map +1 -0
- package/dist/integration/tunnelClient.d.ts +44 -0
- package/dist/integration/tunnelClient.js +148 -0
- package/dist/integration/tunnelClient.js.map +1 -0
- package/dist/integration/tunnelProtocol.d.ts +152 -0
- package/dist/integration/tunnelProtocol.js +110 -0
- package/dist/integration/tunnelProtocol.js.map +1 -0
- package/dist/mcp/cli.d.ts +2 -0
- package/dist/mcp/cli.js +327 -0
- package/dist/mcp/cli.js.map +1 -0
- package/dist/mcp/cloudRefresh.d.ts +36 -0
- package/dist/mcp/cloudRefresh.js +52 -0
- package/dist/mcp/cloudRefresh.js.map +1 -0
- package/dist/mcp/context.d.ts +7 -0
- package/dist/mcp/context.js +18 -0
- package/dist/mcp/context.js.map +1 -0
- package/dist/mcp/files.d.ts +66 -0
- package/dist/mcp/files.js +157 -0
- package/dist/mcp/files.js.map +1 -0
- package/dist/mcp/search.d.ts +3 -0
- package/dist/mcp/search.js +9 -0
- package/dist/mcp/search.js.map +1 -0
- package/dist/mcp/server.d.ts +50 -0
- package/dist/mcp/server.js +555 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/overlay/anchors.d.ts +130 -0
- package/dist/overlay/anchors.js +365 -0
- package/dist/overlay/anchors.js.map +1 -0
- package/dist/overlay/api.d.ts +150 -0
- package/dist/overlay/api.js +259 -0
- package/dist/overlay/api.js.map +1 -0
- package/dist/overlay/attachments.d.ts +60 -0
- package/dist/overlay/attachments.js +163 -0
- package/dist/overlay/attachments.js.map +1 -0
- package/dist/overlay/browser.d.ts +1 -0
- package/dist/overlay/browser.js +203 -0
- package/dist/overlay/browser.js.map +1 -0
- package/dist/overlay/chip.d.ts +27 -0
- package/dist/overlay/chip.js +31 -0
- package/dist/overlay/chip.js.map +1 -0
- package/dist/overlay/compact.d.ts +11 -0
- package/dist/overlay/compact.js +21 -0
- package/dist/overlay/compact.js.map +1 -0
- package/dist/overlay/cssScope.d.ts +46 -0
- package/dist/overlay/cssScope.js +180 -0
- package/dist/overlay/cssScope.js.map +1 -0
- package/dist/overlay/cursor.d.ts +2 -0
- package/dist/overlay/cursor.js +68 -0
- package/dist/overlay/cursor.js.map +1 -0
- package/dist/overlay/devBrowser.d.ts +1 -0
- package/dist/overlay/devBrowser.js +18 -0
- package/dist/overlay/devBrowser.js.map +1 -0
- package/dist/overlay/devReview.d.ts +4 -0
- package/dist/overlay/devReview.js +18 -0
- package/dist/overlay/devReview.js.map +1 -0
- package/dist/overlay/directReviewer.d.ts +149 -0
- package/dist/overlay/directReviewer.js +448 -0
- package/dist/overlay/directReviewer.js.map +1 -0
- package/dist/overlay/elementDescription.d.ts +10 -0
- package/dist/overlay/elementDescription.js +251 -0
- package/dist/overlay/elementDescription.js.map +1 -0
- package/dist/overlay/icons.d.ts +8 -0
- package/dist/overlay/icons.js +36 -0
- package/dist/overlay/icons.js.map +1 -0
- package/dist/overlay/identity.d.ts +48 -0
- package/dist/overlay/identity.js +125 -0
- package/dist/overlay/identity.js.map +1 -0
- package/dist/overlay/localMachine.d.ts +23 -0
- package/dist/overlay/localMachine.js +40 -0
- package/dist/overlay/localMachine.js.map +1 -0
- package/dist/overlay/magicLink.d.ts +10 -0
- package/dist/overlay/magicLink.js +87 -0
- package/dist/overlay/magicLink.js.map +1 -0
- package/dist/overlay/modern-screenshot.js +1676 -0
- package/dist/overlay/movedAnchors.d.ts +30 -0
- package/dist/overlay/movedAnchors.js +128 -0
- package/dist/overlay/movedAnchors.js.map +1 -0
- package/dist/overlay/notificationGroups.d.ts +2 -0
- package/dist/overlay/notificationGroups.js +41 -0
- package/dist/overlay/notificationGroups.js.map +1 -0
- package/dist/overlay/permissions.d.ts +10 -0
- package/dist/overlay/permissions.js +9 -0
- package/dist/overlay/permissions.js.map +1 -0
- package/dist/overlay/pinGroups.d.ts +16 -0
- package/dist/overlay/pinGroups.js +17 -0
- package/dist/overlay/pinGroups.js.map +1 -0
- package/dist/overlay/presence.d.ts +50 -0
- package/dist/overlay/presence.js +258 -0
- package/dist/overlay/presence.js.map +1 -0
- package/dist/overlay/projectChannel.d.ts +11 -0
- package/dist/overlay/projectChannel.js +111 -0
- package/dist/overlay/projectChannel.js.map +1 -0
- package/dist/overlay/recorder.d.ts +56 -0
- package/dist/overlay/recorder.js +130 -0
- package/dist/overlay/recorder.js.map +1 -0
- package/dist/overlay/reviewMode.d.ts +21 -0
- package/dist/overlay/reviewMode.js +59 -0
- package/dist/overlay/reviewMode.js.map +1 -0
- package/dist/overlay/reviewerAuth.d.ts +131 -0
- package/dist/overlay/reviewerAuth.js +279 -0
- package/dist/overlay/reviewerAuth.js.map +1 -0
- package/dist/overlay/route.d.ts +18 -0
- package/dist/overlay/route.js +56 -0
- package/dist/overlay/route.js.map +1 -0
- package/dist/overlay/rrweb-record.js +63 -0
- package/dist/overlay/runtime.d.ts +1 -0
- package/dist/overlay/runtime.js +4857 -0
- package/dist/overlay/runtime.js.map +1 -0
- package/dist/overlay/session.d.ts +32 -0
- package/dist/overlay/session.js +76 -0
- package/dist/overlay/session.js.map +1 -0
- package/dist/overlay/sharedMode.d.ts +38 -0
- package/dist/overlay/sharedMode.js +37 -0
- package/dist/overlay/sharedMode.js.map +1 -0
- package/dist/overlay/sheet.d.ts +73 -0
- package/dist/overlay/sheet.js +278 -0
- package/dist/overlay/sheet.js.map +1 -0
- package/dist/overlay/snapshot.d.ts +26 -0
- package/dist/overlay/snapshot.js +185 -0
- package/dist/overlay/snapshot.js.map +1 -0
- package/dist/overlay/state.d.ts +63 -0
- package/dist/overlay/state.js +241 -0
- package/dist/overlay/state.js.map +1 -0
- package/dist/overlay/steps.d.ts +22 -0
- package/dist/overlay/steps.js +34 -0
- package/dist/overlay/steps.js.map +1 -0
- package/dist/overlay/styles.d.ts +7 -0
- package/dist/overlay/styles.js +1449 -0
- package/dist/overlay/styles.js.map +1 -0
- package/dist/overlay/trace.d.ts +19 -0
- package/dist/overlay/trace.js +29 -0
- package/dist/overlay/trace.js.map +1 -0
- package/dist/overlay/upload.d.ts +35 -0
- package/dist/overlay/upload.js +99 -0
- package/dist/overlay/upload.js.map +1 -0
- package/dist/plugin/astro.d.ts +31 -0
- package/dist/plugin/astro.js +22 -0
- package/dist/plugin/astro.js.map +1 -0
- package/dist/plugin/eleventy.d.ts +44 -0
- package/dist/plugin/eleventy.js +186 -0
- package/dist/plugin/eleventy.js.map +1 -0
- package/dist/plugin/next-loader.cjs +11 -0
- package/dist/plugin/next.d.ts +29 -0
- package/dist/plugin/next.js +176 -0
- package/dist/plugin/next.js.map +1 -0
- package/dist/plugin/nextOverlay.d.ts +2 -0
- package/dist/plugin/nextOverlay.js +22 -0
- package/dist/plugin/nextOverlay.js.map +1 -0
- package/dist/plugin/nextTransform.d.ts +19 -0
- package/dist/plugin/nextTransform.js +29 -0
- package/dist/plugin/nextTransform.js.map +1 -0
- package/dist/plugin/rsbuild.d.ts +25 -0
- package/dist/plugin/rsbuild.js +56 -0
- package/dist/plugin/rsbuild.js.map +1 -0
- package/dist/plugin/vite.d.ts +39 -0
- package/dist/plugin/vite.js +582 -0
- package/dist/plugin/vite.js.map +1 -0
- package/dist/plugin/webpack.d.ts +69 -0
- package/dist/plugin/webpack.js +192 -0
- package/dist/plugin/webpack.js.map +1 -0
- package/dist/remote/account.d.ts +41 -0
- package/dist/remote/account.js +177 -0
- package/dist/remote/account.js.map +1 -0
- package/dist/remote/base64url.d.ts +14 -0
- package/dist/remote/base64url.js +71 -0
- package/dist/remote/base64url.js.map +1 -0
- package/dist/remote/branchLabel.d.ts +12 -0
- package/dist/remote/branchLabel.js +20 -0
- package/dist/remote/branchLabel.js.map +1 -0
- package/dist/remote/client.d.ts +340 -0
- package/dist/remote/client.js +424 -0
- package/dist/remote/client.js.map +1 -0
- package/dist/remote/cloudApi.d.ts +72 -0
- package/dist/remote/cloudApi.js +72 -0
- package/dist/remote/cloudApi.js.map +1 -0
- package/dist/remote/codec.d.ts +54 -0
- package/dist/remote/codec.js +62 -0
- package/dist/remote/codec.js.map +1 -0
- package/dist/remote/config.d.ts +30 -0
- package/dist/remote/config.js +112 -0
- package/dist/remote/config.js.map +1 -0
- package/dist/remote/content-schema.d.ts +428 -0
- package/dist/remote/content-schema.js +209 -0
- package/dist/remote/content-schema.js.map +1 -0
- package/dist/remote/content.d.ts +44 -0
- package/dist/remote/content.js +75 -0
- package/dist/remote/content.js.map +1 -0
- package/dist/remote/envelope.d.ts +76 -0
- package/dist/remote/envelope.js +109 -0
- package/dist/remote/envelope.js.map +1 -0
- package/dist/remote/errors.d.ts +55 -0
- package/dist/remote/errors.js +63 -0
- package/dist/remote/errors.js.map +1 -0
- package/dist/remote/ids.d.ts +8 -0
- package/dist/remote/ids.js +25 -0
- package/dist/remote/ids.js.map +1 -0
- package/dist/remote/index.d.ts +7 -0
- package/dist/remote/index.js +8 -0
- package/dist/remote/index.js.map +1 -0
- package/dist/remote/keys.d.ts +62 -0
- package/dist/remote/keys.js +162 -0
- package/dist/remote/keys.js.map +1 -0
- package/dist/remote/localAnchors.d.ts +4 -0
- package/dist/remote/localAnchors.js +23 -0
- package/dist/remote/localAnchors.js.map +1 -0
- package/dist/remote/mapping.d.ts +11 -0
- package/dist/remote/mapping.js +22 -0
- package/dist/remote/mapping.js.map +1 -0
- package/dist/remote/presence.d.ts +63 -0
- package/dist/remote/presence.js +143 -0
- package/dist/remote/presence.js.map +1 -0
- package/dist/remote/realtime.d.ts +142 -0
- package/dist/remote/realtime.js +326 -0
- package/dist/remote/realtime.js.map +1 -0
- package/dist/remote/store.d.ts +183 -0
- package/dist/remote/store.js +907 -0
- package/dist/remote/store.js.map +1 -0
- package/dist/remote/sync.d.ts +113 -0
- package/dist/remote/sync.js +370 -0
- package/dist/remote/sync.js.map +1 -0
- package/dist/remote/types.d.ts +99 -0
- package/dist/remote/types.js +6 -0
- package/dist/remote/types.js.map +1 -0
- package/dist/setup/agents.d.ts +23 -0
- package/dist/setup/agents.js +80 -0
- package/dist/setup/agents.js.map +1 -0
- package/dist/setup/configure.d.ts +27 -0
- package/dist/setup/configure.js +201 -0
- package/dist/setup/configure.js.map +1 -0
- package/dist/setup/connect.d.ts +60 -0
- package/dist/setup/connect.js +244 -0
- package/dist/setup/connect.js.map +1 -0
- package/dist/setup/detect.d.ts +67 -0
- package/dist/setup/detect.js +168 -0
- package/dist/setup/detect.js.map +1 -0
- package/dist/setup/frameworks.d.ts +41 -0
- package/dist/setup/frameworks.js +81 -0
- package/dist/setup/frameworks.js.map +1 -0
- package/dist/sidecar/cli.d.ts +1 -0
- package/dist/sidecar/cli.js +70 -0
- package/dist/sidecar/cli.js.map +1 -0
- package/dist/sidecar/cloudSync.d.ts +33 -0
- package/dist/sidecar/cloudSync.js +139 -0
- package/dist/sidecar/cloudSync.js.map +1 -0
- package/dist/sidecar/commentFiles.d.ts +59 -0
- package/dist/sidecar/commentFiles.js +217 -0
- package/dist/sidecar/commentFiles.js.map +1 -0
- package/dist/sidecar/cssAttribution.d.ts +26 -0
- package/dist/sidecar/cssAttribution.js +114 -0
- package/dist/sidecar/cssAttribution.js.map +1 -0
- package/dist/sidecar/exportTasks.d.ts +38 -0
- package/dist/sidecar/exportTasks.js +249 -0
- package/dist/sidecar/exportTasks.js.map +1 -0
- package/dist/sidecar/http.d.ts +20 -0
- package/dist/sidecar/http.js +904 -0
- package/dist/sidecar/http.js.map +1 -0
- package/dist/sidecar/inviteTarget.d.ts +4 -0
- package/dist/sidecar/inviteTarget.js +32 -0
- package/dist/sidecar/inviteTarget.js.map +1 -0
- package/dist/sidecar/presence.d.ts +4 -0
- package/dist/sidecar/presence.js +92 -0
- package/dist/sidecar/presence.js.map +1 -0
- package/dist/storage/cliSession.d.ts +8 -0
- package/dist/storage/cliSession.js +41 -0
- package/dist/storage/cliSession.js.map +1 -0
- package/dist/storage/devStyleMap.d.ts +12 -0
- package/dist/storage/devStyleMap.js +31 -0
- package/dist/storage/devStyleMap.js.map +1 -0
- package/dist/storage/fileCache.d.ts +34 -0
- package/dist/storage/fileCache.js +122 -0
- package/dist/storage/fileCache.js.map +1 -0
- package/dist/storage/localAttachments.d.ts +82 -0
- package/dist/storage/localAttachments.js +276 -0
- package/dist/storage/localAttachments.js.map +1 -0
- package/dist/storage/localComments.d.ts +31 -0
- package/dist/storage/localComments.js +159 -0
- package/dist/storage/localComments.js.map +1 -0
- package/dist/storage/localCredentials.d.ts +74 -0
- package/dist/storage/localCredentials.js +210 -0
- package/dist/storage/localCredentials.js.map +1 -0
- package/dist/storage/localParticipants.d.ts +33 -0
- package/dist/storage/localParticipants.js +110 -0
- package/dist/storage/localParticipants.js.map +1 -0
- package/dist/storage/localRecipe.d.ts +22 -0
- package/dist/storage/localRecipe.js +46 -0
- package/dist/storage/localRecipe.js.map +1 -0
- package/dist/storage/localScreenshots.d.ts +23 -0
- package/dist/storage/localScreenshots.js +55 -0
- package/dist/storage/localScreenshots.js.map +1 -0
- package/dist/storage/localSource.d.ts +31 -0
- package/dist/storage/localSource.js +175 -0
- package/dist/storage/localSource.js.map +1 -0
- package/dist/storage/pulledComments.d.ts +81 -0
- package/dist/storage/pulledComments.js +107 -0
- package/dist/storage/pulledComments.js.map +1 -0
- package/dist/storage/remoteRecipe.d.ts +7 -0
- package/dist/storage/remoteRecipe.js +85 -0
- package/dist/storage/remoteRecipe.js.map +1 -0
- package/dist/storage/savedRemote.d.ts +2 -0
- package/dist/storage/savedRemote.js +22 -0
- package/dist/storage/savedRemote.js.map +1 -0
- package/dist/storage/sidecarAccess.d.ts +7 -0
- package/dist/storage/sidecarAccess.js +68 -0
- package/dist/storage/sidecarAccess.js.map +1 -0
- package/package.json +306 -4
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enforces `comment-content.schema.json` (required fields, types, and bounds; unknown properties
|
|
3
|
+
* are allowed and left untouched). The server cannot see content, so over-long or malformed
|
|
4
|
+
* content is refused here, never truncated or repaired.
|
|
5
|
+
* @param {any} content
|
|
6
|
+
*/
|
|
7
|
+
export function validateCommentContent(content: any): any;
|
|
8
|
+
/** `reply-content.schema.json`. @param {any} content */
|
|
9
|
+
export function validateReplyContent(content: any): any;
|
|
10
|
+
/**
|
|
11
|
+
* @param {import('./keys.js').DerivedKeys} keys
|
|
12
|
+
* @param {{ projectId: string, sessionId: string, commentId: string }} where
|
|
13
|
+
* @param {unknown} content
|
|
14
|
+
*/
|
|
15
|
+
export function sealCommentContent(keys: import("./keys.js").DerivedKeys, { projectId, sessionId, commentId }: {
|
|
16
|
+
projectId: string;
|
|
17
|
+
sessionId: string;
|
|
18
|
+
commentId: string;
|
|
19
|
+
}, content: unknown): Promise<import("./envelope.js").Envelope>;
|
|
20
|
+
/**
|
|
21
|
+
* @param {import('./keys.js').DerivedKeys} keys
|
|
22
|
+
* @param {{ projectId: string, sessionId: string, commentId: string, replyId: string }} where
|
|
23
|
+
* @param {unknown} content
|
|
24
|
+
*/
|
|
25
|
+
export function sealReplyContent(keys: import("./keys.js").DerivedKeys, { projectId, sessionId, commentId, replyId }: {
|
|
26
|
+
projectId: string;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
commentId: string;
|
|
29
|
+
replyId: string;
|
|
30
|
+
}, content: unknown): Promise<import("./envelope.js").Envelope>;
|
|
31
|
+
/**
|
|
32
|
+
* Decrypts a comment returned by the API, rebuilding the AAD from the comment's own fields. A
|
|
33
|
+
* `decrypt_failed` means the entity is unreadable: show it as such, never drop or overwrite it.
|
|
34
|
+
* Any key holder can seal content, so what decrypts is validated against the content schema like
|
|
35
|
+
* what is sealed: malformed content is `invalid_content`, shown as unreadable in the same way.
|
|
36
|
+
* @param {import('./keys.js').DerivedKeys} keys
|
|
37
|
+
* @param {import('./types.js').Comment} comment
|
|
38
|
+
*/
|
|
39
|
+
export function openComment(keys: import("./keys.js").DerivedKeys, comment: import("./types.js").Comment): Promise<any>;
|
|
40
|
+
/**
|
|
41
|
+
* @param {import('./keys.js').DerivedKeys} keys
|
|
42
|
+
* @param {import('./types.js').Reply} reply
|
|
43
|
+
*/
|
|
44
|
+
export function openReply(keys: import("./keys.js").DerivedKeys, reply: import("./types.js").Reply): Promise<any>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Comment and reply content: the plaintext inside envelopes (contract section 4.4), and helpers
|
|
3
|
+
* that bind sealing and opening to the carrying entity's own metadata.
|
|
4
|
+
*/
|
|
5
|
+
import { commentContentSchema, nonFiniteNumbers, replyContentSchema, schemaIssues } from './content-schema.js';
|
|
6
|
+
import { CryptoError } from './errors.js';
|
|
7
|
+
import { openEnvelope, sealEnvelope } from './envelope.js';
|
|
8
|
+
/** @param {unknown} value */
|
|
9
|
+
const isObject = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
10
|
+
/**
|
|
11
|
+
* Enforces `comment-content.schema.json` (required fields, types, and bounds; unknown properties
|
|
12
|
+
* are allowed and left untouched). The server cannot see content, so over-long or malformed
|
|
13
|
+
* content is refused here, never truncated or repaired.
|
|
14
|
+
* @param {any} content
|
|
15
|
+
*/
|
|
16
|
+
export function validateCommentContent(content) {
|
|
17
|
+
return validate(commentContentSchema, content, 'comment');
|
|
18
|
+
}
|
|
19
|
+
/** `reply-content.schema.json`. @param {any} content */
|
|
20
|
+
export function validateReplyContent(content) {
|
|
21
|
+
return validate(replyContentSchema, content, 'reply');
|
|
22
|
+
}
|
|
23
|
+
/** @param {any} schema @param {any} content @param {string} what */
|
|
24
|
+
function validate(schema, content, what) {
|
|
25
|
+
const issues = [...schemaIssues(schema, content), ...nonFiniteNumbers(content).map((path) => `${path}: must be a finite number`)];
|
|
26
|
+
if (issues.length > 0) {
|
|
27
|
+
throw Object.assign(new CryptoError('invalid_content', `invalid ${what} content: ${issues.slice(0, 5).join('; ')}`), { issues });
|
|
28
|
+
}
|
|
29
|
+
return content;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @param {import('./keys.js').DerivedKeys} keys
|
|
33
|
+
* @param {{ projectId: string, sessionId: string, commentId: string }} where
|
|
34
|
+
* @param {unknown} content
|
|
35
|
+
*/
|
|
36
|
+
export async function sealCommentContent(keys, { projectId, sessionId, commentId }, content) {
|
|
37
|
+
validateCommentContent(content);
|
|
38
|
+
return sealEnvelope(keys, { entityType: 'comment', projectId, sessionId, commentId }, content);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @param {import('./keys.js').DerivedKeys} keys
|
|
42
|
+
* @param {{ projectId: string, sessionId: string, commentId: string, replyId: string }} where
|
|
43
|
+
* @param {unknown} content
|
|
44
|
+
*/
|
|
45
|
+
export async function sealReplyContent(keys, { projectId, sessionId, commentId, replyId }, content) {
|
|
46
|
+
validateReplyContent(content);
|
|
47
|
+
return sealEnvelope(keys, { entityType: 'reply', projectId, sessionId, commentId, replyId }, content);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Decrypts a comment returned by the API, rebuilding the AAD from the comment's own fields. A
|
|
51
|
+
* `decrypt_failed` means the entity is unreadable: show it as such, never drop or overwrite it.
|
|
52
|
+
* Any key holder can seal content, so what decrypts is validated against the content schema like
|
|
53
|
+
* what is sealed: malformed content is `invalid_content`, shown as unreadable in the same way.
|
|
54
|
+
* @param {import('./keys.js').DerivedKeys} keys
|
|
55
|
+
* @param {import('./types.js').Comment} comment
|
|
56
|
+
*/
|
|
57
|
+
export async function openComment(keys, comment) {
|
|
58
|
+
const content = await openEnvelope(keys, { entityType: 'comment', projectId: comment.projectId, sessionId: comment.sessionId, commentId: comment.id }, comment.envelope);
|
|
59
|
+
return validateCommentContent(checkVersion(content));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @param {import('./keys.js').DerivedKeys} keys
|
|
63
|
+
* @param {import('./types.js').Reply} reply
|
|
64
|
+
*/
|
|
65
|
+
export async function openReply(keys, reply) {
|
|
66
|
+
const content = await openEnvelope(keys, { entityType: 'reply', projectId: reply.projectId, sessionId: reply.sessionId, commentId: reply.commentId, replyId: reply.id }, reply.envelope);
|
|
67
|
+
return validateReplyContent(checkVersion(content));
|
|
68
|
+
}
|
|
69
|
+
/** A client must not edit (so, here, must not present as understood) content whose `v` it does not know. */
|
|
70
|
+
function checkVersion(/** @type {any} */ content) {
|
|
71
|
+
if (!isObject(content) || content.v !== 1)
|
|
72
|
+
throw new CryptoError('invalid_content', `unsupported content version ${isObject(content) ? String(content.v) : 'unknown'}`);
|
|
73
|
+
return content;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/remote/content.js"],"names":[],"mappings":"AAAA;;;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,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzL,OAAO,oBAAoB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,4GAA4G;AAC5G,SAAS,YAAY,CAAC,kBAAkB,CAAC,OAAO;IAC9C,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,WAAW,CAAC,iBAAiB,EAAE,+BAA+B,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;IACxK,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} Envelope
|
|
3
|
+
* @property {1} v
|
|
4
|
+
* @property {'A256GCM'} alg
|
|
5
|
+
* @property {number} keyVersion
|
|
6
|
+
* @property {string} nonce 16 characters of canonical base64url.
|
|
7
|
+
* @property {string} ciphertext Canonical base64url of ciphertext followed by the 16-byte tag.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* What an envelope is bound to. For a comment, `commentId` is the comment and `replyId` is absent;
|
|
11
|
+
* for a reply, `commentId` is the parent comment.
|
|
12
|
+
* @typedef {object} Binding
|
|
13
|
+
* @property {'comment' | 'reply'} entityType
|
|
14
|
+
* @property {string} projectId
|
|
15
|
+
* @property {string} sessionId
|
|
16
|
+
* @property {string} commentId
|
|
17
|
+
* @property {string} [replyId]
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* README section 4.3: seven lines joined by a single LF, no trailing LF.
|
|
21
|
+
* @param {Binding} binding @param {number} keyVersion
|
|
22
|
+
*/
|
|
23
|
+
export function buildAad(binding: Binding, keyVersion: number): Uint8Array<ArrayBuffer>;
|
|
24
|
+
/**
|
|
25
|
+
* Seals a content object with a fresh random nonce.
|
|
26
|
+
* @param {import('./keys.js').DerivedKeys} keys
|
|
27
|
+
* @param {Binding} binding
|
|
28
|
+
* @param {unknown} content JSON-serializable content object.
|
|
29
|
+
* @returns {Promise<Envelope>}
|
|
30
|
+
*/
|
|
31
|
+
export function sealEnvelope(keys: import("./keys.js").DerivedKeys, binding: Binding, content: unknown): Promise<Envelope>;
|
|
32
|
+
/**
|
|
33
|
+
* Seals with a caller-chosen nonce. ONLY for deterministic test vectors: reusing a nonce under
|
|
34
|
+
* one key breaks AES-GCM, so production code must call {@link sealEnvelope}.
|
|
35
|
+
* @param {import('./keys.js').DerivedKeys} keys @param {Binding} binding @param {unknown} content @param {Uint8Array<ArrayBuffer>} nonce
|
|
36
|
+
* @returns {Promise<Envelope>}
|
|
37
|
+
*/
|
|
38
|
+
export function sealWithNonce(keys: import("./keys.js").DerivedKeys, binding: Binding, content: unknown, nonce: Uint8Array<ArrayBuffer>): Promise<Envelope>;
|
|
39
|
+
/**
|
|
40
|
+
* Opens an envelope. The AAD is rebuilt from `binding`, which callers take from the carrying
|
|
41
|
+
* entity's own fields, never from anything the envelope says.
|
|
42
|
+
* @param {import('./keys.js').DerivedKeys} keys
|
|
43
|
+
* @param {Binding} binding
|
|
44
|
+
* @param {Envelope} envelope
|
|
45
|
+
* @returns {Promise<any>} The parsed JSON content.
|
|
46
|
+
* @throws {CryptoError}
|
|
47
|
+
*/
|
|
48
|
+
export function openEnvelope(keys: import("./keys.js").DerivedKeys, binding: Binding, envelope: Envelope): Promise<any>;
|
|
49
|
+
export const NONCE_BYTES: 12;
|
|
50
|
+
export const TAG_BYTES: 16;
|
|
51
|
+
/** Default server limit on decoded ciphertext bytes; the server's configured value is authoritative. */
|
|
52
|
+
export const MAX_CIPHERTEXT_BYTES: 65536;
|
|
53
|
+
export type Envelope = {
|
|
54
|
+
v: 1;
|
|
55
|
+
alg: "A256GCM";
|
|
56
|
+
keyVersion: number;
|
|
57
|
+
/**
|
|
58
|
+
* 16 characters of canonical base64url.
|
|
59
|
+
*/
|
|
60
|
+
nonce: string;
|
|
61
|
+
/**
|
|
62
|
+
* Canonical base64url of ciphertext followed by the 16-byte tag.
|
|
63
|
+
*/
|
|
64
|
+
ciphertext: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* What an envelope is bound to. For a comment, `commentId` is the comment and `replyId` is absent;
|
|
68
|
+
* for a reply, `commentId` is the parent comment.
|
|
69
|
+
*/
|
|
70
|
+
export type Binding = {
|
|
71
|
+
entityType: "comment" | "reply";
|
|
72
|
+
projectId: string;
|
|
73
|
+
sessionId: string;
|
|
74
|
+
commentId: string;
|
|
75
|
+
replyId?: string | undefined;
|
|
76
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encryption envelope: AES-256-GCM with a 96-bit nonce and 128-bit tag, AAD rebuilt from the
|
|
3
|
+
* entity's own plaintext metadata (contract sections 4.2 and 4.3).
|
|
4
|
+
*
|
|
5
|
+
* WebCrypto returns `ciphertext || tag`, which is exactly the contract's `ciphertext` layout.
|
|
6
|
+
*/
|
|
7
|
+
import { decodeBase64url, encodeBase64url } from './base64url.js';
|
|
8
|
+
import { CryptoError } from './errors.js';
|
|
9
|
+
const subtle = globalThis.crypto.subtle;
|
|
10
|
+
const encoder = new TextEncoder();
|
|
11
|
+
const decoder = new TextDecoder('utf-8', { fatal: true });
|
|
12
|
+
export const NONCE_BYTES = 12;
|
|
13
|
+
export const TAG_BYTES = 16;
|
|
14
|
+
/** Default server limit on decoded ciphertext bytes; the server's configured value is authoritative. */
|
|
15
|
+
export const MAX_CIPHERTEXT_BYTES = 65536;
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {object} Envelope
|
|
18
|
+
* @property {1} v
|
|
19
|
+
* @property {'A256GCM'} alg
|
|
20
|
+
* @property {number} keyVersion
|
|
21
|
+
* @property {string} nonce 16 characters of canonical base64url.
|
|
22
|
+
* @property {string} ciphertext Canonical base64url of ciphertext followed by the 16-byte tag.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* What an envelope is bound to. For a comment, `commentId` is the comment and `replyId` is absent;
|
|
26
|
+
* for a reply, `commentId` is the parent comment.
|
|
27
|
+
* @typedef {object} Binding
|
|
28
|
+
* @property {'comment' | 'reply'} entityType
|
|
29
|
+
* @property {string} projectId
|
|
30
|
+
* @property {string} sessionId
|
|
31
|
+
* @property {string} commentId
|
|
32
|
+
* @property {string} [replyId]
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* README section 4.3: seven lines joined by a single LF, no trailing LF.
|
|
36
|
+
* @param {Binding} binding @param {number} keyVersion
|
|
37
|
+
*/
|
|
38
|
+
export function buildAad(binding, keyVersion) {
|
|
39
|
+
const { entityType, projectId, sessionId, commentId, replyId } = binding;
|
|
40
|
+
if (entityType !== 'comment' && entityType !== 'reply')
|
|
41
|
+
throw new CryptoError('malformed_envelope', 'entityType must be comment or reply');
|
|
42
|
+
if ((entityType === 'reply') !== (typeof replyId === 'string' && replyId !== '')) {
|
|
43
|
+
throw new CryptoError('malformed_envelope', 'a reply binding needs replyId and a comment binding must not have one');
|
|
44
|
+
}
|
|
45
|
+
return encoder.encode(['feedback-app:envelope:v1', entityType, projectId, sessionId, commentId, replyId ?? '', String(keyVersion)].join('\n'));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Seals a content object with a fresh random nonce.
|
|
49
|
+
* @param {import('./keys.js').DerivedKeys} keys
|
|
50
|
+
* @param {Binding} binding
|
|
51
|
+
* @param {unknown} content JSON-serializable content object.
|
|
52
|
+
* @returns {Promise<Envelope>}
|
|
53
|
+
*/
|
|
54
|
+
export async function sealEnvelope(keys, binding, content) {
|
|
55
|
+
return sealWithNonce(keys, binding, content, globalThis.crypto.getRandomValues(new Uint8Array(NONCE_BYTES)));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Seals with a caller-chosen nonce. ONLY for deterministic test vectors: reusing a nonce under
|
|
59
|
+
* one key breaks AES-GCM, so production code must call {@link sealEnvelope}.
|
|
60
|
+
* @param {import('./keys.js').DerivedKeys} keys @param {Binding} binding @param {unknown} content @param {Uint8Array<ArrayBuffer>} nonce
|
|
61
|
+
* @returns {Promise<Envelope>}
|
|
62
|
+
*/
|
|
63
|
+
export async function sealWithNonce(keys, binding, content, nonce) {
|
|
64
|
+
if (nonce.length !== NONCE_BYTES)
|
|
65
|
+
throw new CryptoError('malformed_envelope', `nonce must be ${NONCE_BYTES} bytes`);
|
|
66
|
+
const plaintext = encoder.encode(JSON.stringify(content));
|
|
67
|
+
if (plaintext.length + TAG_BYTES > MAX_CIPHERTEXT_BYTES) {
|
|
68
|
+
throw new CryptoError('invalid_content', `content is too large: the ciphertext would exceed ${MAX_CIPHERTEXT_BYTES} bytes`);
|
|
69
|
+
}
|
|
70
|
+
const sealed = await subtle.encrypt({ name: 'AES-GCM', iv: nonce, additionalData: buildAad(binding, keys.keyVersion), tagLength: TAG_BYTES * 8 }, keys.contentKey, plaintext);
|
|
71
|
+
return { v: 1, alg: 'A256GCM', keyVersion: keys.keyVersion, nonce: encodeBase64url(nonce), ciphertext: encodeBase64url(new Uint8Array(sealed)) };
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Opens an envelope. The AAD is rebuilt from `binding`, which callers take from the carrying
|
|
75
|
+
* entity's own fields, never from anything the envelope says.
|
|
76
|
+
* @param {import('./keys.js').DerivedKeys} keys
|
|
77
|
+
* @param {Binding} binding
|
|
78
|
+
* @param {Envelope} envelope
|
|
79
|
+
* @returns {Promise<any>} The parsed JSON content.
|
|
80
|
+
* @throws {CryptoError}
|
|
81
|
+
*/
|
|
82
|
+
export async function openEnvelope(keys, binding, envelope) {
|
|
83
|
+
if (envelope === null || typeof envelope !== 'object')
|
|
84
|
+
throw new CryptoError('malformed_envelope', 'envelope is not an object');
|
|
85
|
+
if (envelope.v !== 1 || envelope.alg !== 'A256GCM') {
|
|
86
|
+
throw new CryptoError('unsupported_envelope', `unsupported envelope (v=${String(envelope.v)}, alg=${String(envelope.alg)}); this client supports v=1, alg=A256GCM`);
|
|
87
|
+
}
|
|
88
|
+
if (!Number.isInteger(envelope.keyVersion) || envelope.keyVersion < 1)
|
|
89
|
+
throw new CryptoError('malformed_envelope', 'envelope keyVersion is not a positive integer');
|
|
90
|
+
if (envelope.keyVersion !== keys.keyVersion) {
|
|
91
|
+
throw new CryptoError('key_version_mismatch', `envelope uses key version ${envelope.keyVersion} but the supplied keys are for version ${keys.keyVersion}`);
|
|
92
|
+
}
|
|
93
|
+
const nonce = decodeBase64url(envelope.nonce, { bytes: NONCE_BYTES, what: 'envelope nonce' });
|
|
94
|
+
const sealed = decodeBase64url(envelope.ciphertext, { minBytes: TAG_BYTES, maxBytes: MAX_CIPHERTEXT_BYTES, what: 'envelope ciphertext' });
|
|
95
|
+
let plaintext;
|
|
96
|
+
try {
|
|
97
|
+
plaintext = await subtle.decrypt({ name: 'AES-GCM', iv: nonce, additionalData: buildAad(binding, envelope.keyVersion), tagLength: TAG_BYTES * 8 }, keys.contentKey, sealed);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
throw new CryptoError('decrypt_failed', 'authentication failed: wrong key, altered ciphertext, or an envelope bound to a different entity, session, project, or key version');
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
return JSON.parse(decoder.decode(plaintext));
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
throw new CryptoError('invalid_content', 'the decrypted content is not UTF-8 JSON');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=envelope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envelope.js","sourceRoot":"","sources":["../../src/remote/envelope.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE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AE,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,SAAS,GAAG,CAAC,EAAE,EAChH,IAAI,CAAC,UAAU,EACf,MAAM,CACP,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,WAAW,CAAC,gBAAgB,EAAE,oIAAoI,CAAC,CAAC;IAChL,CAAC;IACD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,WAAW,CAAC,iBAAiB,EAAE,yCAAyC,CAAC,CAAC;IACtF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** Errors raised by the reference client. None of them ever carries key material. */
|
|
2
|
+
/**
|
|
3
|
+
* Cryptographic or encoding failure. `code` is stable:
|
|
4
|
+
* - `invalid_base64url`: not canonical base64url (contract section 4.2).
|
|
5
|
+
* - `invalid_key`: a project key, portable key, or credential that is malformed.
|
|
6
|
+
* - `unsupported_envelope`: unknown envelope `v` or `alg`; the client must be upgraded.
|
|
7
|
+
* - `malformed_envelope`: wrong shape, nonce size, or ciphertext size.
|
|
8
|
+
* - `key_version_mismatch`: the envelope names a key version the supplied keys are not for.
|
|
9
|
+
* - `decrypt_failed`: AES-GCM authentication failed. A wrong key, a tampered ciphertext, and a
|
|
10
|
+
* wrong AAD (the envelope was moved to another entity, session, project, or key version) are
|
|
11
|
+
* indistinguishable by design; the entity must be shown as unreadable and never dropped.
|
|
12
|
+
* - `invalid_content`: the plaintext is not a supported content object.
|
|
13
|
+
*/
|
|
14
|
+
export class CryptoError extends Error {
|
|
15
|
+
/** @param {string} code @param {string} message */
|
|
16
|
+
constructor(code: string, message: string);
|
|
17
|
+
code: string;
|
|
18
|
+
}
|
|
19
|
+
/** The server answered with a contract error envelope (section 9), or an unparseable error. */
|
|
20
|
+
export class ApiError extends Error {
|
|
21
|
+
/**
|
|
22
|
+
* @param {object} init
|
|
23
|
+
* @param {number} init.status
|
|
24
|
+
* @param {string} init.code Contract `error.code`, or `http_<status>` when the body is not an error envelope.
|
|
25
|
+
* @param {string} init.message
|
|
26
|
+
* @param {string} [init.requestId]
|
|
27
|
+
* @param {Record<string, unknown>} [init.details]
|
|
28
|
+
* @param {number} [init.retryAfterSeconds] From `Retry-After` or `details.retryAfterSeconds`.
|
|
29
|
+
*/
|
|
30
|
+
constructor({ status, code, message, requestId, details, retryAfterSeconds }: {
|
|
31
|
+
status: number;
|
|
32
|
+
code: string;
|
|
33
|
+
message: string;
|
|
34
|
+
requestId?: string | undefined;
|
|
35
|
+
details?: Record<string, unknown> | undefined;
|
|
36
|
+
retryAfterSeconds?: number | undefined;
|
|
37
|
+
});
|
|
38
|
+
status: number;
|
|
39
|
+
code: string;
|
|
40
|
+
requestId: string | undefined;
|
|
41
|
+
details: Record<string, unknown> | undefined;
|
|
42
|
+
retryAfterSeconds: number | undefined;
|
|
43
|
+
/** Section 8.6 / 7.6: 429, 5xx, and `idempotency_in_progress` are retried; everything else is not. */
|
|
44
|
+
get retryable(): boolean;
|
|
45
|
+
}
|
|
46
|
+
/** The request did not produce an HTTP response (DNS, connect, reset, timeout). Always retryable. */
|
|
47
|
+
export class NetworkError extends Error {
|
|
48
|
+
/** @param {string} message @param {unknown} [cause] */
|
|
49
|
+
constructor(message: string, cause?: unknown);
|
|
50
|
+
}
|
|
51
|
+
/** The server broke a contract rule the client relies on (for example a page that makes no progress). */
|
|
52
|
+
export class ProtocolError extends Error {
|
|
53
|
+
/** @param {string} message */
|
|
54
|
+
constructor(message: string);
|
|
55
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Errors raised by the reference client. None of them ever carries key material. */
|
|
2
|
+
/**
|
|
3
|
+
* Cryptographic or encoding failure. `code` is stable:
|
|
4
|
+
* - `invalid_base64url`: not canonical base64url (contract section 4.2).
|
|
5
|
+
* - `invalid_key`: a project key, portable key, or credential that is malformed.
|
|
6
|
+
* - `unsupported_envelope`: unknown envelope `v` or `alg`; the client must be upgraded.
|
|
7
|
+
* - `malformed_envelope`: wrong shape, nonce size, or ciphertext size.
|
|
8
|
+
* - `key_version_mismatch`: the envelope names a key version the supplied keys are not for.
|
|
9
|
+
* - `decrypt_failed`: AES-GCM authentication failed. A wrong key, a tampered ciphertext, and a
|
|
10
|
+
* wrong AAD (the envelope was moved to another entity, session, project, or key version) are
|
|
11
|
+
* indistinguishable by design; the entity must be shown as unreadable and never dropped.
|
|
12
|
+
* - `invalid_content`: the plaintext is not a supported content object.
|
|
13
|
+
*/
|
|
14
|
+
export class CryptoError extends Error {
|
|
15
|
+
/** @param {string} code @param {string} message */
|
|
16
|
+
constructor(code, message) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = 'CryptoError';
|
|
19
|
+
this.code = code;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/** The server answered with a contract error envelope (section 9), or an unparseable error. */
|
|
23
|
+
export class ApiError extends Error {
|
|
24
|
+
/**
|
|
25
|
+
* @param {object} init
|
|
26
|
+
* @param {number} init.status
|
|
27
|
+
* @param {string} init.code Contract `error.code`, or `http_<status>` when the body is not an error envelope.
|
|
28
|
+
* @param {string} init.message
|
|
29
|
+
* @param {string} [init.requestId]
|
|
30
|
+
* @param {Record<string, unknown>} [init.details]
|
|
31
|
+
* @param {number} [init.retryAfterSeconds] From `Retry-After` or `details.retryAfterSeconds`.
|
|
32
|
+
*/
|
|
33
|
+
constructor({ status, code, message, requestId, details, retryAfterSeconds }) {
|
|
34
|
+
super(`${status} ${code}: ${message}`);
|
|
35
|
+
this.name = 'ApiError';
|
|
36
|
+
this.status = status;
|
|
37
|
+
this.code = code;
|
|
38
|
+
this.requestId = requestId;
|
|
39
|
+
this.details = details;
|
|
40
|
+
this.retryAfterSeconds = retryAfterSeconds;
|
|
41
|
+
}
|
|
42
|
+
/** Section 8.6 / 7.6: 429, 5xx, and `idempotency_in_progress` are retried; everything else is not. */
|
|
43
|
+
get retryable() {
|
|
44
|
+
return this.status === 429 || this.status >= 500 || this.code === 'idempotency_in_progress';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** The request did not produce an HTTP response (DNS, connect, reset, timeout). Always retryable. */
|
|
48
|
+
export class NetworkError extends Error {
|
|
49
|
+
/** @param {string} message @param {unknown} [cause] */
|
|
50
|
+
constructor(message, cause) {
|
|
51
|
+
super(message, { cause });
|
|
52
|
+
this.name = 'NetworkError';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** The server broke a contract rule the client relies on (for example a page that makes no progress). */
|
|
56
|
+
export class ProtocolError extends Error {
|
|
57
|
+
/** @param {string} message */
|
|
58
|
+
constructor(message) {
|
|
59
|
+
super(message);
|
|
60
|
+
this.name = 'ProtocolError';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/remote/errors.js"],"names":[],"mappings":"AAAA,qFAAqF;AAErF;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpC,mDAAmD;IACnD,YAAY,IAAI,EAAE,OAAO;QACvB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,+FAA+F;AAC/F,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC;;;;;;;;OAQG;IACH,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAE;QAC1E,KAAK,CAAC,GAAG,MAAM,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC7C,CAAC;IAED,sGAAsG;IACtG,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,KAAK,yBAAyB,CAAC;IAC9F,CAAC;CACF;AAED,qGAAqG;AACrG,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,uDAAuD;IACvD,YAAY,OAAO,EAAE,KAAK;QACxB,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED,yGAAyG;AACzG,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,8BAA8B;IAC9B,YAAY,OAAO;QACjB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<prefix>_<26 lowercase Crockford base32 characters>` encoding 128 CSPRNG bits (first body
|
|
3
|
+
* character 0-7). Use `cmt`, `rpl`, or `ptc`; the server generates the others.
|
|
4
|
+
* @param {'cmt' | 'rpl' | 'ptc'} prefix
|
|
5
|
+
*/
|
|
6
|
+
export function newId(prefix: "cmt" | "rpl" | "ptc"): string;
|
|
7
|
+
/** 128 random bits as 22 characters of base64url: within the 16-64 character `[A-Za-z0-9_-]` rule. */
|
|
8
|
+
export function newIdempotencyKey(): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Client-generated identifiers (contract section 1) and idempotency keys (section 6). */
|
|
2
|
+
import { encodeBase64url } from './base64url.js';
|
|
3
|
+
const CROCKFORD = '0123456789abcdefghjkmnpqrstvwxyz';
|
|
4
|
+
/**
|
|
5
|
+
* `<prefix>_<26 lowercase Crockford base32 characters>` encoding 128 CSPRNG bits (first body
|
|
6
|
+
* character 0-7). Use `cmt`, `rpl`, or `ptc`; the server generates the others.
|
|
7
|
+
* @param {'cmt' | 'rpl' | 'ptc'} prefix
|
|
8
|
+
*/
|
|
9
|
+
export function newId(prefix) {
|
|
10
|
+
const bytes = globalThis.crypto.getRandomValues(new Uint8Array(16));
|
|
11
|
+
let n = 0n;
|
|
12
|
+
for (const byte of bytes)
|
|
13
|
+
n = (n << 8n) | BigInt(byte);
|
|
14
|
+
let body = '';
|
|
15
|
+
for (let i = 0; i < 26; i += 1) {
|
|
16
|
+
body = CROCKFORD[Number(n & 31n)] + body;
|
|
17
|
+
n >>= 5n;
|
|
18
|
+
}
|
|
19
|
+
return `${prefix}_${body}`;
|
|
20
|
+
}
|
|
21
|
+
/** 128 random bits as 22 characters of base64url: within the 16-64 character `[A-Za-z0-9_-]` rule. */
|
|
22
|
+
export function newIdempotencyKey() {
|
|
23
|
+
return encodeBase64url(globalThis.crypto.getRandomValues(new Uint8Array(16)));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.js","sourceRoot":"","sources":["../../src/remote/ids.js"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,SAAS,GAAG,kCAAkC,CAAC;AAErD;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,MAAM;IAC1B,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IACvD,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;QACzC,CAAC,KAAK,EAAE,CAAC;IACX,CAAC;IACD,OAAO,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC;AAC7B,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,iBAAiB;IAC/B,OAAO,eAAe,CAAC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ApiError } from "./errors.js";
|
|
2
|
+
export { SessionSync } from "./sync.js";
|
|
3
|
+
export { SessionWatcher } from "./realtime.js";
|
|
4
|
+
export { ProjectKey, ParticipantKeys } from "./keys.js";
|
|
5
|
+
export { validateCommentContent, validateReplyContent } from "./content.js";
|
|
6
|
+
export { newId, newIdempotencyKey } from "./ids.js";
|
|
7
|
+
export { FeedbackClient, ProjectApi, normalizeBaseUrl } from "./client.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ApiError } from './errors.js';
|
|
2
|
+
export { ProjectKey, ParticipantKeys } from './keys.js';
|
|
3
|
+
export { validateCommentContent, validateReplyContent } from './content.js';
|
|
4
|
+
export { newId, newIdempotencyKey } from './ids.js';
|
|
5
|
+
export { FeedbackClient, ProjectApi, normalizeBaseUrl } from './client.js';
|
|
6
|
+
export { SessionSync } from './sync.js';
|
|
7
|
+
export { SessionWatcher } from './realtime.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/remote/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** @param {unknown} value */
|
|
2
|
+
export function assertKeyVersion(value: unknown): number;
|
|
3
|
+
export const KEY_BYTES: 32;
|
|
4
|
+
export const CREDENTIAL_PREFIX: "sa1";
|
|
5
|
+
export const PORTABLE_KEY_PREFIX: "fbpk1";
|
|
6
|
+
/** The subkeys of one project key version. Safe to log: it prints as a redacted marker. */
|
|
7
|
+
export class DerivedKeys {
|
|
8
|
+
/** @param {number} keyVersion @param {Uint8Array} authKey @param {CryptoKey} contentKey @param {string} verifier */
|
|
9
|
+
constructor(keyVersion: number, authKey: Uint8Array, contentKey: CryptoKey, verifier: string);
|
|
10
|
+
keyVersion: number;
|
|
11
|
+
/** `base64url(SHA-256(authKey))`: what the server stores; not a secret. */
|
|
12
|
+
verifier: string;
|
|
13
|
+
/** The non-extractable AES-256-GCM content key. It never leaves this process. */
|
|
14
|
+
get contentKey(): CryptoKey;
|
|
15
|
+
/** `Authorization` header value: `Bearer sa1.<kv>.<base64url(authKey)>`. Never log or put it in a URL. */
|
|
16
|
+
authorizationHeader(): string;
|
|
17
|
+
toJSON(): string;
|
|
18
|
+
[INSPECT](): string;
|
|
19
|
+
#private;
|
|
20
|
+
}
|
|
21
|
+
/** A Standalone project key `K` and its key version. */
|
|
22
|
+
export class ProjectKey {
|
|
23
|
+
/** 32 bytes from the platform CSPRNG. */
|
|
24
|
+
static generate(keyVersion?: number): ProjectKey;
|
|
25
|
+
/**
|
|
26
|
+
* Parses `fbpk1.<projectId>.<keyVersion>.<base64url(K)>`.
|
|
27
|
+
* @param {string} portable
|
|
28
|
+
* @returns {{ projectId: string, key: ProjectKey }}
|
|
29
|
+
*/
|
|
30
|
+
static parsePortable(portable: string): {
|
|
31
|
+
projectId: string;
|
|
32
|
+
key: ProjectKey;
|
|
33
|
+
};
|
|
34
|
+
/** @param {Uint8Array} bytes @param {number} keyVersion */
|
|
35
|
+
constructor(bytes: Uint8Array, keyVersion: number);
|
|
36
|
+
keyVersion: number;
|
|
37
|
+
/**
|
|
38
|
+
* The portable form: possessing it grants full access to the project. Keep it only in
|
|
39
|
+
* user-private storage; it is unrecoverable if lost (README section 2.1).
|
|
40
|
+
* @param {string} projectId
|
|
41
|
+
*/
|
|
42
|
+
toPortable(projectId: string): string;
|
|
43
|
+
/** Derives `authKey` and `contentKey` for this key version. */
|
|
44
|
+
derive(): Promise<DerivedKeys>;
|
|
45
|
+
/** Export project-wide content material only when creating a reviewer link. Never log. */
|
|
46
|
+
exportReviewerKey(): Promise<string>;
|
|
47
|
+
/** Private, domain-separated HMAC seed for remote shared-build anchor IDs. */
|
|
48
|
+
exportAnchorSeed(): Promise<string>;
|
|
49
|
+
toJSON(): string;
|
|
50
|
+
[INSPECT](): string;
|
|
51
|
+
#private;
|
|
52
|
+
}
|
|
53
|
+
/** Reviewer authentication is independent of the content key; no project auth subkey exists here. */
|
|
54
|
+
export class ParticipantKeys extends DerivedKeys {
|
|
55
|
+
/** @param {string} contentSecret @param {string} credential @param {number} [keyVersion] */
|
|
56
|
+
static import(contentSecret: string, credential: string, keyVersion?: number): Promise<ParticipantKeys>;
|
|
57
|
+
/** @param {number} keyVersion @param {string} credential @param {CryptoKey} contentKey */
|
|
58
|
+
constructor(keyVersion: number, credential: string, contentKey: CryptoKey);
|
|
59
|
+
#private;
|
|
60
|
+
}
|
|
61
|
+
declare const INSPECT: unique symbol;
|
|
62
|
+
export {};
|