wao 0.41.3 → 0.41.5
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/.babelrc-cjs +5 -0
- package/.babelrc-esm +5 -0
- package/.gitmodules +4 -0
- package/.prettierrc +6 -0
- package/README.md +90 -0
- package/app/.eslintrc.json +3 -0
- package/app/.mocharc.cjs +6 -0
- package/app/arweave.mjs +87 -0
- package/app/components/Footer.js +76 -0
- package/app/components/Global.js +1128 -0
- package/app/components/Header.js +306 -0
- package/app/components/Left.js +28 -0
- package/app/components/Logo.js +34 -0
- package/app/components/Middle.js +37 -0
- package/app/components/Sidebar.js +93 -0
- package/app/components/Tags.js +42 -0
- package/app/components/editor/Editor.js +322 -0
- package/app/components/editor/FilePath.js +42 -0
- package/app/components/editor/MonacoEditor.js +44 -0
- package/app/components/left/LeftMessages.js +85 -0
- package/app/components/left/LeftModules.js +86 -0
- package/app/components/left/LeftNetworks.js +438 -0
- package/app/components/left/LeftProcesses.js +98 -0
- package/app/components/left/LeftProjects.js +397 -0
- package/app/components/left/LeftTests.js +189 -0
- package/app/components/middle/MiddleBlocks.js +79 -0
- package/app/components/middle/MiddleEntity.js +16 -0
- package/app/components/middle/MiddleEntityAccount.js +264 -0
- package/app/components/middle/MiddleEntityAssignment.js +104 -0
- package/app/components/middle/MiddleEntityBlock.js +148 -0
- package/app/components/middle/MiddleEntityMessage.js +430 -0
- package/app/components/middle/MiddleEntityModule.js +183 -0
- package/app/components/middle/MiddleEntityProcess.js +323 -0
- package/app/components/middle/MiddleEntityTx.js +211 -0
- package/app/components/middle/MiddleMessages.js +87 -0
- package/app/components/middle/MiddleModules.js +89 -0
- package/app/components/middle/MiddleNetworks.js +516 -0
- package/app/components/middle/MiddleProcesses.js +87 -0
- package/app/components/middle/MiddleTests.js +134 -0
- package/app/components/modals/CreateFileModal.js +115 -0
- package/app/components/modals/CreateFolderModal.js +83 -0
- package/app/components/modals/CreateProjectModal.js +63 -0
- package/app/components/modals/FSModal.js +141 -0
- package/app/components/modals/ImportModal.js +105 -0
- package/app/components/modals/LaunchNetworkModal.js +95 -0
- package/app/components/modals/Modal.js +38 -0
- package/app/components/modals/ProxyModal.js +122 -0
- package/app/components/modals/RenameFileModal.js +95 -0
- package/app/components/styles/EditorScrollbarStyle.js +29 -0
- package/app/components/styles/EntityScrollbarStyle.js +29 -0
- package/app/components/styles/GlobalStyle.js +102 -0
- package/app/components/styles/XtermStyle.js +37 -0
- package/app/components/terminal/Terminal.js +132 -0
- package/app/components/terminal/Xterm.js +160 -0
- package/app/components/ui/avatar.jsx +49 -0
- package/app/components/ui/checkbox.jsx +17 -0
- package/app/components/ui/close-button.jsx +20 -0
- package/app/components/ui/color-mode.jsx +61 -0
- package/app/components/ui/dialog.jsx +54 -0
- package/app/components/ui/drawer.jsx +44 -0
- package/app/components/ui/field.jsx +22 -0
- package/app/components/ui/input-group.jsx +39 -0
- package/app/components/ui/popover.jsx +49 -0
- package/app/components/ui/provider.jsx +12 -0
- package/app/components/ui/radio.jsx +17 -0
- package/app/components/ui/slider.jsx +107 -0
- package/app/components/ui/toaster.jsx +69 -0
- package/app/components/ui/tooltip.jsx +35 -0
- package/app/index.js +10 -0
- package/app/jsconfig.json +7 -0
- package/app/lib/GithubCSS.js +1218 -0
- package/app/lib/addon-fit.js +72 -0
- package/app/lib/data.js +31 -0
- package/app/lib/github-markdown.css +1169 -0
- package/app/lib/global.js +1 -0
- package/app/lib/guide.js +82 -0
- package/app/lib/hub.js +109 -0
- package/app/lib/scripts.js +47 -0
- package/app/lib/store.js +34 -0
- package/app/lib/use.js +64 -0
- package/app/lib/utils.js +387 -0
- package/app/lib/webrtc.js +217 -0
- package/app/next.config.js +25 -0
- package/app/package.json +62 -0
- package/app/pages/404.js +9 -0
- package/app/pages/_app.js +10 -0
- package/app/pages/_document.js +14 -0
- package/app/pages/index.js +121 -0
- package/app/playwright.config.mjs +41 -0
- package/app/proxy.mjs +21 -0
- package/app/public/assets/cover.png +0 -0
- package/app/public/blueprints/apm.lua +91 -0
- package/app/public/blueprints/arena.lua +345 -0
- package/app/public/blueprints/arns.lua +318 -0
- package/app/public/blueprints/chat.lua +210 -0
- package/app/public/blueprints/chatroom.lua +56 -0
- package/app/public/blueprints/patch-legacy-reply.lua +13 -0
- package/app/public/blueprints/staking.lua +93 -0
- package/app/public/blueprints/token.lua +298 -0
- package/app/public/blueprints/voting.lua +45 -0
- package/app/public/favicon.ico +0 -0
- package/app/public/logo.png +0 -0
- package/cli-esm.js +55 -0
- package/cli.js +54 -0
- package/devnet/app/api.js +129 -0
- package/devnet/app/components/layout.js +89 -0
- package/devnet/app/components/pagination.js +144 -0
- package/devnet/app/components/search.js +159 -0
- package/devnet/app/components/table.js +124 -0
- package/devnet/app/components/tags.js +89 -0
- package/devnet/app/index.html +14 -0
- package/devnet/app/main.js +215 -0
- package/devnet/app/router.js +59 -0
- package/devnet/app/state.js +19 -0
- package/devnet/app/style.css +1606 -0
- package/devnet/app/utils.js +77 -0
- package/devnet/app/views/blocks.js +75 -0
- package/devnet/app/views/dashboard.js +127 -0
- package/devnet/app/views/entity.js +1473 -0
- package/devnet/app/views/messages.js +90 -0
- package/devnet/app/views/modules.js +165 -0
- package/devnet/app/views/processes.js +90 -0
- package/devnet/app/views/schedulers.js +90 -0
- package/devnet/app/views/transactions.js +88 -0
- package/devnet/migrations/0001_initial.sql +51 -0
- package/devnet/package.json +26 -0
- package/devnet/playwright.config.js +7 -0
- package/devnet/src/cu-worker.js +166 -0
- package/devnet/src/index.js +309 -0
- package/devnet/vite.config.js +17 -0
- package/devnet/vitest.config.js +10 -0
- package/devnet/wrangler-cu.toml +32 -0
- package/devnet/wrangler.toml +38 -0
- package/dhfs-tutorial-app/package.json +15 -0
- package/dist/esm/workspace/dashboard/public/favicon.png +0 -0
- package/dist/esm/workspace/src/counter.lua +14 -0
- package/dist/package.json +82 -0
- package/hb.sh +18 -0
- package/hbsig/.babelrc-cjs +5 -0
- package/hbsig/.babelrc-esm +5 -0
- package/hbsig/README.md +1 -0
- package/hbsig/dist/cjs/bin_to_str.js +44 -0
- package/hbsig/dist/cjs/collect-body-keys.js +470 -0
- package/hbsig/dist/cjs/commit.js +330 -0
- package/hbsig/dist/cjs/encode-array-item.js +110 -0
- package/hbsig/dist/cjs/encode-utils.js +242 -0
- package/hbsig/dist/cjs/encode.js +1365 -0
- package/hbsig/dist/cjs/erl_json.js +326 -0
- package/hbsig/dist/cjs/erl_str.js +1042 -0
- package/hbsig/dist/cjs/flat.js +279 -0
- package/hbsig/dist/cjs/http-message-signatures/httpbis.js +489 -0
- package/hbsig/dist/cjs/http-message-signatures/index.js +25 -0
- package/hbsig/dist/cjs/http-message-signatures/structured-header.js +129 -0
- package/hbsig/dist/cjs/httpsig.js +861 -0
- package/hbsig/dist/cjs/id.js +470 -0
- package/hbsig/dist/cjs/index.js +174 -0
- package/hbsig/dist/cjs/nocrypto.js +51 -0
- package/hbsig/dist/cjs/parser.js +201 -0
- package/hbsig/dist/cjs/send-utils.js +1231 -0
- package/hbsig/dist/cjs/send.js +211 -0
- package/hbsig/dist/cjs/signer-utils.js +494 -0
- package/hbsig/dist/cjs/signer.js +436 -0
- package/hbsig/dist/cjs/structured.js +515 -0
- package/hbsig/dist/cjs/test.js +12 -0
- package/hbsig/dist/cjs/utils.js +44 -0
- package/hbsig/dist/esm/bin_to_str.js +46 -0
- package/hbsig/dist/esm/collect-body-keys.js +436 -0
- package/hbsig/dist/esm/commit.js +219 -0
- package/hbsig/dist/esm/encode-array-item.js +112 -0
- package/hbsig/dist/esm/encode-utils.js +191 -0
- package/hbsig/dist/esm/encode.js +1256 -0
- package/hbsig/dist/esm/erl_json.js +292 -0
- package/hbsig/dist/esm/erl_str.js +1144 -0
- package/hbsig/dist/esm/flat.js +250 -0
- package/hbsig/dist/esm/http-message-signatures/httpbis.js +438 -0
- package/hbsig/dist/esm/http-message-signatures/index.js +4 -0
- package/hbsig/dist/esm/http-message-signatures/structured-header.js +105 -0
- package/hbsig/dist/esm/httpsig.js +866 -0
- package/hbsig/dist/esm/id.js +459 -0
- package/hbsig/dist/esm/index.js +13 -0
- package/hbsig/dist/esm/nocrypto.js +4 -0
- package/hbsig/dist/esm/package.json +3 -0
- package/hbsig/dist/esm/parser.js +171 -0
- package/hbsig/dist/esm/send-utils.js +1132 -0
- package/hbsig/dist/esm/send.js +142 -0
- package/hbsig/dist/esm/signer-utils.js +375 -0
- package/hbsig/dist/esm/signer.js +312 -0
- package/hbsig/dist/esm/structured.js +496 -0
- package/hbsig/dist/esm/test.js +2 -0
- package/hbsig/dist/esm/utils.js +29 -0
- package/hbsig/dist/package.json +39 -0
- package/hbsig/make.js +36 -0
- package/hbsig/package.json +39 -0
- package/hbsig/src/bin_to_str.js +46 -0
- package/hbsig/src/collect-body-keys.js +436 -0
- package/hbsig/src/commit.js +219 -0
- package/hbsig/src/encode-array-item.js +112 -0
- package/hbsig/src/encode-utils.js +191 -0
- package/hbsig/src/encode.js +1256 -0
- package/hbsig/src/erl_json.js +292 -0
- package/hbsig/src/erl_str.js +1144 -0
- package/hbsig/src/flat.js +250 -0
- package/hbsig/src/http-message-signatures/httpbis.js +438 -0
- package/hbsig/src/http-message-signatures/index.js +4 -0
- package/hbsig/src/http-message-signatures/structured-header.js +105 -0
- package/hbsig/src/httpsig.js +866 -0
- package/hbsig/src/id.js +459 -0
- package/hbsig/src/index.js +13 -0
- package/hbsig/src/nocrypto.js +4 -0
- package/hbsig/src/parser.js +171 -0
- package/hbsig/src/send-utils.js +1132 -0
- package/hbsig/src/send.js +142 -0
- package/hbsig/src/signer-utils.js +375 -0
- package/hbsig/src/signer.js +312 -0
- package/hbsig/src/structured.js +496 -0
- package/hbsig/src/test.js +2 -0
- package/hbsig/src/utils.js +29 -0
- package/lp/index.html +25 -0
- package/lp/package.json +19 -0
- package/lp/public/cover.png +0 -0
- package/lp/public/favicon.ico +0 -0
- package/lp/public/favicon.png +0 -0
- package/lp/public/images/book.jpg +0 -0
- package/lp/public/images/dashboard.png +0 -0
- package/lp/public/images/devnet.png +0 -0
- package/lp/public/images/hero-bg.png +0 -0
- package/lp/public/images/hyperadd.png +0 -0
- package/lp/public/images/message-flow.png +0 -0
- package/lp/public/images/mobile.png +0 -0
- package/lp/public/images/og-cover.png +0 -0
- package/lp/public/images/scan.png +0 -0
- package/lp/public/images/wao-hub.png +0 -0
- package/lp/public/images/wao-web.png +0 -0
- package/lp/public/logo.png +0 -0
- package/lp/src/App.jsx +29 -0
- package/lp/src/components/CodeBlock.jsx +37 -0
- package/lp/src/components/CodeBlock.module.css +89 -0
- package/lp/src/components/Footer.jsx +22 -0
- package/lp/src/components/Footer.module.css +60 -0
- package/lp/src/components/Nav.jsx +80 -0
- package/lp/src/components/Nav.module.css +177 -0
- package/lp/src/components/SectionWrapper.jsx +15 -0
- package/lp/src/hooks/useReveal.js +25 -0
- package/lp/src/hooks/useScrolled.js +14 -0
- package/lp/src/main.jsx +10 -0
- package/lp/src/sections/Book.jsx +60 -0
- package/lp/src/sections/Book.module.css +204 -0
- package/lp/src/sections/Browser.jsx +46 -0
- package/lp/src/sections/Browser.module.css +67 -0
- package/lp/src/sections/Devnet.jsx +55 -0
- package/lp/src/sections/Devnet.module.css +136 -0
- package/lp/src/sections/GetStarted.jsx +51 -0
- package/lp/src/sections/GetStarted.module.css +128 -0
- package/lp/src/sections/Hero.jsx +67 -0
- package/lp/src/sections/Hero.module.css +202 -0
- package/lp/src/sections/HyperADD.jsx +46 -0
- package/lp/src/sections/HyperADD.module.css +113 -0
- package/lp/src/sections/SDK.jsx +90 -0
- package/lp/src/sections/SDK.module.css +122 -0
- package/lp/src/sections/Testing.jsx +47 -0
- package/lp/src/sections/Testing.module.css +124 -0
- package/lp/src/sections/Vision.jsx +93 -0
- package/lp/src/sections/Vision.module.css +147 -0
- package/lp/src/styles/globals.css +285 -0
- package/lp/src/utils/scrollTo.js +4 -0
- package/lp/vite.config.js +7 -0
- package/make.js +39 -0
- package/package.json +17 -12
- package/patches/@permaweb+ao-loader+0.0.44.patch +64 -0
- package/plan.md +435 -0
- package/rebar.lock +1 -0
- package/src/accounts-web.js +128 -0
- package/src/accounts.js +124 -0
- package/src/adaptor-base.js +622 -0
- package/src/adaptor-cf.js +11 -0
- package/src/adaptor-web.js +11 -0
- package/src/adaptor.js +10 -0
- package/src/ao-loader.js +30660 -0
- package/src/ao.js +1173 -0
- package/src/aoconnect-base.js +1098 -0
- package/src/aoconnect-cf.js +9 -0
- package/src/aoconnect-web.js +8 -0
- package/src/aoconnect.js +8 -0
- package/src/aos_wamr.js +1 -0
- package/src/ar-remote.js +87 -0
- package/src/ar.js +276 -0
- package/src/armem-base.js +529 -0
- package/src/armem-cf.js +67 -0
- package/src/armem-web.js +19 -0
- package/src/armem.js +26 -0
- package/src/bao.js +141 -0
- package/src/bar.js +366 -0
- package/src/build.js +7 -0
- package/src/bundler.js +119 -0
- package/src/car.js +10 -0
- package/src/cf-env.js +29 -0
- package/src/cf.js +11 -0
- package/src/cli.js +561 -0
- package/src/compress.js +112 -0
- package/src/create.js +415 -0
- package/src/devs.js +86 -0
- package/src/dirname.js +1 -0
- package/src/dodb.js +26 -0
- package/src/erl_json.js +289 -0
- package/src/erl_str.js +1139 -0
- package/src/gql.js +229 -0
- package/src/hb.js +967 -0
- package/src/helpers.js +203 -0
- package/src/http.js +619 -0
- package/src/hub/bundler.js +123 -0
- package/src/hub/cu.js +74 -0
- package/src/hub/fs.js +157 -0
- package/src/hub/index.js +85 -0
- package/src/hub/utils.js +64 -0
- package/src/hub/ws-proxy.js +67 -0
- package/src/hyper-aos.js +1 -0
- package/src/hyperbeam-server.js +21 -0
- package/src/hyperbeam.js +585 -0
- package/src/index.js +5 -0
- package/src/keygen.js +47 -0
- package/src/lfdb.js +67 -0
- package/src/lua/aos.wasm +0 -0
- package/src/lua/aos2_0_1.js +1 -0
- package/src/lua/aos2_0_1.wasm +0 -0
- package/src/lua/aos2_0_3.js +1 -0
- package/src/lua/aos2_0_3.wasm +0 -0
- package/src/lua/aos2_0_4_32.js +1 -0
- package/src/lua/aos2_0_4_32.wasm +0 -0
- package/src/lua/aos2_0_6.wasm +0 -0
- package/src/lua/apm.lua +61 -0
- package/src/lua/llama.wasm +0 -0
- package/src/lua/process.wasm +0 -0
- package/src/lua/sqlite.js +1 -0
- package/src/lua/sqlite.wasm +0 -0
- package/src/lua/weavedb_mock.lua +44 -0
- package/src/lua/weavedrive.lua +53 -0
- package/src/run.js +25 -0
- package/src/server.js +173 -0
- package/src/storage-multi.js +183 -0
- package/src/tao.js +12 -0
- package/src/tar.js +10 -0
- package/src/test.js +42 -0
- package/src/tgql-d1.js +407 -0
- package/src/tgql.js +310 -0
- package/src/toerl.js +162 -0
- package/src/utils.js +777 -0
- package/src/wao.js +29 -0
- package/src/waosm/README.md +81 -0
- package/src/waosm/waosm.d.ts +40 -0
- package/src/waosm/waosm.js +240 -0
- package/src/waosm/waosm_bg.wasm +0 -0
- package/src/waosm/waosm_bg.wasm.d.ts +8 -0
- package/src/waosm-node/README.md +81 -0
- package/src/waosm-node/waosm.d.ts +8 -0
- package/src/waosm-node/waosm.js +4 -0
- package/src/waosm-node/waosm_bg.js +147 -0
- package/src/waosm-node/waosm_bg.wasm +0 -0
- package/src/waosm-node/waosm_bg.wasm.d.ts +8 -0
- package/src/waosm-node/waosm_bg.wasm.js +14 -0
- package/src/waosm-node.js +9 -0
- package/src/war.js +10 -0
- package/src/weavedrive.js +376 -0
- package/src/web.js +11 -0
- package/src/workspace/.mcp.json +8 -0
- package/src/workspace/CLAUDE.md +258 -0
- package/src/workspace/README.md +85 -0
- package/src/workspace/dashboard/index.html +163 -0
- package/src/workspace/dashboard/package.json +18 -0
- package/src/workspace/dashboard/public/favicon.ico +0 -0
- package/src/workspace/dashboard/public/favicon.png +0 -0
- package/src/workspace/dashboard/server.js +224 -0
- package/src/workspace/dashboard/src/App.jsx +2350 -0
- package/{cjs/workspace/frontend → src/workspace/dashboard}/vite.config.js +6 -0
- package/src/workspace/package.json +18 -0
- package/src/workspace/src/counter.lua +14 -0
- package/tsconfig.json +18 -0
- package/types/index.d.ts +329 -0
- package/waollama/.eslintrc.json +3 -0
- package/waollama/README.md +19 -0
- package/waollama/arweave.mjs +87 -0
- package/waollama/components/ui/avatar.jsx +49 -0
- package/waollama/components/ui/checkbox.jsx +17 -0
- package/waollama/components/ui/close-button.jsx +20 -0
- package/waollama/components/ui/color-mode.jsx +61 -0
- package/waollama/components/ui/dialog.jsx +54 -0
- package/waollama/components/ui/drawer.jsx +44 -0
- package/waollama/components/ui/field.jsx +22 -0
- package/waollama/components/ui/input-group.jsx +39 -0
- package/waollama/components/ui/popover.jsx +49 -0
- package/waollama/components/ui/provider.jsx +12 -0
- package/waollama/components/ui/radio.jsx +17 -0
- package/waollama/components/ui/slider.jsx +107 -0
- package/waollama/components/ui/tooltip.jsx +35 -0
- package/waollama/index.js +10 -0
- package/waollama/jsconfig.json +7 -0
- package/waollama/lib/ao-loader.js +30654 -0
- package/waollama/lib/client.js +1 -0
- package/waollama/lib/wasm.js +1 -0
- package/waollama/next.config.js +25 -0
- package/waollama/package.json +43 -0
- package/waollama/pages/404.js +9 -0
- package/waollama/pages/_app.js +9 -0
- package/waollama/pages/_document.js +14 -0
- package/waollama/pages/index.js +212 -0
- package/waollama/playwright.config.js +31 -0
- package/waollama/proxy.mjs +21 -0
- package/waollama/public/favicon.ico +0 -0
- package/waollama/public/human.png +0 -0
- package/waollama/public/llama.png +0 -0
- package/waosm/Cargo.toml +11 -0
- package/waosm/README.md +81 -0
- package/waosm/compress.js +112 -0
- package/waosm/make.js +33 -0
- package/waosm/package.json +10 -0
- package/waosm/src/lib.rs +180 -0
- package/waosm/test.js +16 -0
- package/cjs/workspace/.claude/agents/builder.md +0 -99
- package/cjs/workspace/.claude/agents/device-builder.md +0 -86
- package/cjs/workspace/.claude/agents/tester.md +0 -90
- package/cjs/workspace/.claude/mcp/dashboard/server.js +0 -128
- package/cjs/workspace/.claude/rules/deploy.md +0 -45
- package/cjs/workspace/.claude/rules/frontend.md +0 -69
- package/cjs/workspace/.claude/rules/hyperbeam.md +0 -104
- package/cjs/workspace/.claude/rules/lua.md +0 -108
- package/cjs/workspace/.claude/rules/testing.md +0 -257
- package/cjs/workspace/.claude/settings.json +0 -109
- package/cjs/workspace/.claude/skills/build/SKILL.md +0 -214
- package/cjs/workspace/.claude/skills/build-aos/SKILL.md +0 -129
- package/cjs/workspace/.claude/skills/build-device/SKILL.md +0 -192
- package/cjs/workspace/.claude/skills/build-frontend/SKILL.md +0 -134
- package/cjs/workspace/.claude/skills/build-module/SKILL.md +0 -281
- package/cjs/workspace/.claude/skills/create-aos/SKILL.md +0 -63
- package/cjs/workspace/.claude/skills/create-device/SKILL.md +0 -87
- package/cjs/workspace/.claude/skills/create-module/SKILL.md +0 -162
- package/cjs/workspace/.claude/skills/debug/SKILL.md +0 -57
- package/cjs/workspace/.claude/skills/deploy/SKILL.md +0 -85
- package/cjs/workspace/.claude/skills/dev/SKILL.md +0 -32
- package/cjs/workspace/.claude/skills/plan/SKILL.md +0 -176
- package/cjs/workspace/.claude/skills/readme/SKILL.md +0 -186
- package/cjs/workspace/.claude/skills/report/SKILL.md +0 -49
- package/cjs/workspace/.claude/skills/team/SKILL.md +0 -101
- package/cjs/workspace/.claude/skills/test/SKILL.md +0 -56
- package/cjs/workspace/.claude/skills/test-device/SKILL.md +0 -114
- package/cjs/workspace/.claude/skills/test-e2e/SKILL.md +0 -103
- package/cjs/workspace/.claude/skills/test-hb/SKILL.md +0 -76
- package/cjs/workspace/.claude/skills/validate/SKILL.md +0 -96
- package/cjs/workspace/.claude/skills/validate/scripts/check-lua.sh +0 -41
- package/cjs/workspace/docs/aos-lua.md +0 -428
- package/cjs/workspace/docs/debug.md +0 -230
- package/cjs/workspace/docs/hyperbeam-dev.md +0 -606
- package/cjs/workspace/docs/hyperbeam-devices.md +0 -618
- package/cjs/workspace/docs/wao-sdk.md +0 -807
- package/cjs/workspace/frontend/e2e/.gitkeep +0 -0
- package/cjs/workspace/frontend/index.html +0 -12
- package/cjs/workspace/frontend/package.json +0 -24
- package/cjs/workspace/frontend/playwright.config.js +0 -10
- package/cjs/workspace/frontend/src/App.jsx +0 -24
- package/cjs/workspace/frontend/test/.gitkeep +0 -0
- package/cjs/workspace/frontend/vitest.config.js +0 -10
- package/cjs/workspace/scripts/deploy.js +0 -140
- package/cjs/workspace/scripts/keygen.js +0 -52
- package/cjs/workspace/test/aos.test.js +0 -98
- package/cjs/workspace/test/hyperbeam.test.js +0 -80
- package/esm/compiler/native +0 -0
- package/esm/workspace/.claude/agents/builder.md +0 -99
- package/esm/workspace/.claude/agents/device-builder.md +0 -86
- package/esm/workspace/.claude/agents/tester.md +0 -90
- package/esm/workspace/.claude/mcp/dashboard/server.js +0 -128
- package/esm/workspace/.claude/rules/deploy.md +0 -45
- package/esm/workspace/.claude/rules/frontend.md +0 -69
- package/esm/workspace/.claude/rules/hyperbeam.md +0 -104
- package/esm/workspace/.claude/rules/lua.md +0 -108
- package/esm/workspace/.claude/rules/testing.md +0 -257
- package/esm/workspace/.claude/settings.json +0 -109
- package/esm/workspace/.claude/skills/build/SKILL.md +0 -214
- package/esm/workspace/.claude/skills/build-aos/SKILL.md +0 -129
- package/esm/workspace/.claude/skills/build-device/SKILL.md +0 -192
- package/esm/workspace/.claude/skills/build-frontend/SKILL.md +0 -134
- package/esm/workspace/.claude/skills/build-module/SKILL.md +0 -281
- package/esm/workspace/.claude/skills/create-aos/SKILL.md +0 -63
- package/esm/workspace/.claude/skills/create-device/SKILL.md +0 -87
- package/esm/workspace/.claude/skills/create-module/SKILL.md +0 -162
- package/esm/workspace/.claude/skills/debug/SKILL.md +0 -57
- package/esm/workspace/.claude/skills/deploy/SKILL.md +0 -85
- package/esm/workspace/.claude/skills/dev/SKILL.md +0 -32
- package/esm/workspace/.claude/skills/plan/SKILL.md +0 -176
- package/esm/workspace/.claude/skills/readme/SKILL.md +0 -186
- package/esm/workspace/.claude/skills/report/SKILL.md +0 -49
- package/esm/workspace/.claude/skills/team/SKILL.md +0 -101
- package/esm/workspace/.claude/skills/test/SKILL.md +0 -56
- package/esm/workspace/.claude/skills/test-device/SKILL.md +0 -114
- package/esm/workspace/.claude/skills/test-e2e/SKILL.md +0 -103
- package/esm/workspace/.claude/skills/test-hb/SKILL.md +0 -76
- package/esm/workspace/.claude/skills/validate/SKILL.md +0 -96
- package/esm/workspace/.claude/skills/validate/scripts/check-lua.sh +0 -41
- package/esm/workspace/docs/aos-lua.md +0 -428
- package/esm/workspace/docs/debug.md +0 -230
- package/esm/workspace/docs/hyperbeam-dev.md +0 -606
- package/esm/workspace/docs/hyperbeam-devices.md +0 -618
- package/esm/workspace/docs/wao-sdk.md +0 -807
- package/esm/workspace/frontend/e2e/.gitkeep +0 -0
- package/esm/workspace/frontend/index.html +0 -12
- package/esm/workspace/frontend/package.json +0 -24
- package/esm/workspace/frontend/playwright.config.js +0 -10
- package/esm/workspace/frontend/src/App.jsx +0 -24
- package/esm/workspace/frontend/src/main.jsx +0 -9
- package/esm/workspace/frontend/test/.gitkeep +0 -0
- package/esm/workspace/frontend/vite.config.js +0 -6
- package/esm/workspace/frontend/vitest.config.js +0 -10
- package/esm/workspace/scripts/deploy.js +0 -140
- package/esm/workspace/scripts/keygen.js +0 -52
- package/esm/workspace/test/aos.test.js +0 -98
- package/esm/workspace/test/hyperbeam.test.js +0 -80
- /package/{cjs/workspace/dashboard/public → devnet/app}/favicon.ico +0 -0
- /package/{cjs/workspace → dhfs-tutorial-app}/src/counter.lua +0 -0
- /package/{cjs → dist/cjs}/accounts-web.js +0 -0
- /package/{cjs → dist/cjs}/accounts.js +0 -0
- /package/{cjs → dist/cjs}/adaptor-base.js +0 -0
- /package/{cjs → dist/cjs}/adaptor-cf.js +0 -0
- /package/{cjs → dist/cjs}/adaptor-web.js +0 -0
- /package/{cjs → dist/cjs}/adaptor.js +0 -0
- /package/{cjs → dist/cjs}/ao-loader.js +0 -0
- /package/{cjs → dist/cjs}/ao.js +0 -0
- /package/{cjs → dist/cjs}/aoconnect-base.js +0 -0
- /package/{cjs → dist/cjs}/aoconnect-cf.js +0 -0
- /package/{cjs → dist/cjs}/aoconnect-web.js +0 -0
- /package/{cjs → dist/cjs}/aoconnect.js +0 -0
- /package/{cjs → dist/cjs}/aos_wamr.js +0 -0
- /package/{cjs → dist/cjs}/ar-remote.js +0 -0
- /package/{cjs → dist/cjs}/ar.js +0 -0
- /package/{cjs → dist/cjs}/armem-base.js +0 -0
- /package/{cjs → dist/cjs}/armem-cf.js +0 -0
- /package/{cjs → dist/cjs}/armem-web.js +0 -0
- /package/{cjs → dist/cjs}/armem.js +0 -0
- /package/{cjs → dist/cjs}/bao.js +0 -0
- /package/{cjs → dist/cjs}/bar.js +0 -0
- /package/{cjs → dist/cjs}/build.js +0 -0
- /package/{cjs → dist/cjs}/bundler.js +0 -0
- /package/{cjs → dist/cjs}/car.js +0 -0
- /package/{cjs → dist/cjs}/cf-env.js +0 -0
- /package/{cjs → dist/cjs}/cf.js +0 -0
- /package/{cjs → dist/cjs}/cli.js +0 -0
- /package/{cjs → dist/cjs}/compress.js +0 -0
- /package/{cjs → dist/cjs}/create.js +0 -0
- /package/{cjs → dist/cjs}/devs.js +0 -0
- /package/{cjs → dist/cjs}/dirname.js +0 -0
- /package/{cjs → dist/cjs}/dodb.js +0 -0
- /package/{cjs → dist/cjs}/erl_json.js +0 -0
- /package/{cjs → dist/cjs}/erl_str.js +0 -0
- /package/{cjs → dist/cjs}/gql.js +0 -0
- /package/{cjs → dist/cjs}/hb.js +0 -0
- /package/{cjs → dist/cjs}/helpers.js +0 -0
- /package/{cjs → dist/cjs}/http.js +0 -0
- /package/{cjs → dist/cjs}/hub/bundler.js +0 -0
- /package/{cjs → dist/cjs}/hub/cu.js +0 -0
- /package/{cjs → dist/cjs}/hub/fs.js +0 -0
- /package/{cjs → dist/cjs}/hub/index.js +0 -0
- /package/{cjs → dist/cjs}/hub/utils.js +0 -0
- /package/{cjs → dist/cjs}/hub/ws-proxy.js +0 -0
- /package/{cjs → dist/cjs}/hyper-aos.js +0 -0
- /package/{cjs → dist/cjs}/hyperbeam-server.js +0 -0
- /package/{cjs → dist/cjs}/hyperbeam.js +0 -0
- /package/{cjs → dist/cjs}/index.js +0 -0
- /package/{cjs → dist/cjs}/keygen.js +0 -0
- /package/{cjs → dist/cjs}/lfdb.js +0 -0
- /package/{cjs → dist/cjs}/lua/aos.wasm +0 -0
- /package/{cjs → dist/cjs}/lua/aos2_0_1.js +0 -0
- /package/{cjs → dist/cjs}/lua/aos2_0_1.wasm +0 -0
- /package/{cjs → dist/cjs}/lua/aos2_0_3.js +0 -0
- /package/{cjs → dist/cjs}/lua/aos2_0_3.wasm +0 -0
- /package/{cjs → dist/cjs}/lua/aos2_0_4_32.js +0 -0
- /package/{cjs → dist/cjs}/lua/aos2_0_4_32.wasm +0 -0
- /package/{cjs → dist/cjs}/lua/aos2_0_6.wasm +0 -0
- /package/{cjs → dist/cjs}/lua/apm.lua +0 -0
- /package/{cjs → dist/cjs}/lua/llama.wasm +0 -0
- /package/{cjs → dist/cjs}/lua/process.wasm +0 -0
- /package/{cjs → dist/cjs}/lua/sqlite.js +0 -0
- /package/{cjs → dist/cjs}/lua/sqlite.wasm +0 -0
- /package/{cjs → dist/cjs}/lua/weavedb_mock.lua +0 -0
- /package/{cjs → dist/cjs}/lua/weavedrive.lua +0 -0
- /package/{cjs → dist/cjs}/run.js +0 -0
- /package/{cjs → dist/cjs}/server.js +0 -0
- /package/{cjs → dist/cjs}/storage-multi.js +0 -0
- /package/{cjs → dist/cjs}/tao.js +0 -0
- /package/{cjs → dist/cjs}/tar.js +0 -0
- /package/{cjs → dist/cjs}/test.js +0 -0
- /package/{cjs → dist/cjs}/tgql-d1.js +0 -0
- /package/{cjs → dist/cjs}/tgql.js +0 -0
- /package/{cjs → dist/cjs}/toerl.js +0 -0
- /package/{cjs → dist/cjs}/utils.js +0 -0
- /package/{cjs → dist/cjs}/wao.js +0 -0
- /package/{cjs → dist/cjs}/waosm/waosm.js +0 -0
- /package/{cjs → dist/cjs}/waosm-node/waosm.js +0 -0
- /package/{cjs → dist/cjs}/waosm-node/waosm_bg.js +0 -0
- /package/{cjs → dist/cjs}/waosm-node/waosm_bg.wasm +0 -0
- /package/{cjs → dist/cjs}/waosm-node/waosm_bg.wasm.js +0 -0
- /package/{cjs → dist/cjs}/waosm-node.js +0 -0
- /package/{cjs → dist/cjs}/war.js +0 -0
- /package/{cjs → dist/cjs}/weavedrive.js +0 -0
- /package/{cjs → dist/cjs}/web.js +0 -0
- /package/{cjs → dist/cjs}/workspace/.mcp.json +0 -0
- /package/{cjs → dist/cjs}/workspace/CLAUDE.md +0 -0
- /package/{cjs → dist/cjs}/workspace/README.md +0 -0
- /package/{cjs → dist/cjs}/workspace/dashboard/index.html +0 -0
- /package/{cjs → dist/cjs}/workspace/dashboard/package.json +0 -0
- /package/{esm → dist/cjs}/workspace/dashboard/public/favicon.ico +0 -0
- /package/{cjs → dist/cjs}/workspace/dashboard/public/favicon.png +0 -0
- /package/{cjs → dist/cjs}/workspace/dashboard/server.js +0 -0
- /package/{cjs → dist/cjs}/workspace/dashboard/src/App.jsx +0 -0
- /package/{cjs → dist/cjs}/workspace/dashboard/src/main.jsx +0 -0
- /package/{cjs → dist/cjs}/workspace/dashboard/vite.config.js +0 -0
- /package/{cjs → dist/cjs}/workspace/package.json +0 -0
- /package/{esm → dist/cjs}/workspace/src/counter.lua +0 -0
- /package/{esm → dist/esm}/accounts-web.js +0 -0
- /package/{esm → dist/esm}/accounts.js +0 -0
- /package/{esm → dist/esm}/adaptor-base.js +0 -0
- /package/{esm → dist/esm}/adaptor-cf.js +0 -0
- /package/{esm → dist/esm}/adaptor-web.js +0 -0
- /package/{esm → dist/esm}/adaptor.js +0 -0
- /package/{esm → dist/esm}/ao-loader.js +0 -0
- /package/{esm → dist/esm}/ao.js +0 -0
- /package/{esm → dist/esm}/aoconnect-base.js +0 -0
- /package/{esm → dist/esm}/aoconnect-cf.js +0 -0
- /package/{esm → dist/esm}/aoconnect-web.js +0 -0
- /package/{esm → dist/esm}/aoconnect.js +0 -0
- /package/{esm → dist/esm}/aos_wamr.js +0 -0
- /package/{esm → dist/esm}/ar-remote.js +0 -0
- /package/{esm → dist/esm}/ar.js +0 -0
- /package/{esm → dist/esm}/armem-base.js +0 -0
- /package/{esm → dist/esm}/armem-cf.js +0 -0
- /package/{esm → dist/esm}/armem-web.js +0 -0
- /package/{esm → dist/esm}/armem.js +0 -0
- /package/{esm → dist/esm}/bao.js +0 -0
- /package/{esm → dist/esm}/bar.js +0 -0
- /package/{esm → dist/esm}/build.js +0 -0
- /package/{esm → dist/esm}/bundler.js +0 -0
- /package/{esm → dist/esm}/car.js +0 -0
- /package/{esm → dist/esm}/cf-env.js +0 -0
- /package/{esm → dist/esm}/cf.js +0 -0
- /package/{esm → dist/esm}/cli.js +0 -0
- /package/{esm → dist/esm}/compress.js +0 -0
- /package/{esm → dist/esm}/create.js +0 -0
- /package/{esm → dist/esm}/devs.js +0 -0
- /package/{esm → dist/esm}/dirname.js +0 -0
- /package/{esm → dist/esm}/dodb.js +0 -0
- /package/{esm → dist/esm}/erl_json.js +0 -0
- /package/{esm → dist/esm}/erl_str.js +0 -0
- /package/{esm → dist/esm}/gql.js +0 -0
- /package/{esm → dist/esm}/hb.js +0 -0
- /package/{esm → dist/esm}/helpers.js +0 -0
- /package/{esm → dist/esm}/http.js +0 -0
- /package/{esm → dist/esm}/hub/bundler.js +0 -0
- /package/{esm → dist/esm}/hub/cu.js +0 -0
- /package/{esm → dist/esm}/hub/fs.js +0 -0
- /package/{esm → dist/esm}/hub/index.js +0 -0
- /package/{esm → dist/esm}/hub/utils.js +0 -0
- /package/{esm → dist/esm}/hub/ws-proxy.js +0 -0
- /package/{esm → dist/esm}/hyper-aos.js +0 -0
- /package/{esm → dist/esm}/hyperbeam-server.js +0 -0
- /package/{esm → dist/esm}/hyperbeam.js +0 -0
- /package/{esm → dist/esm}/index.js +0 -0
- /package/{esm → dist/esm}/keygen.js +0 -0
- /package/{esm → dist/esm}/lfdb.js +0 -0
- /package/{esm → dist/esm}/lua/aos.wasm +0 -0
- /package/{esm → dist/esm}/lua/aos2_0_1.js +0 -0
- /package/{esm → dist/esm}/lua/aos2_0_1.wasm +0 -0
- /package/{esm → dist/esm}/lua/aos2_0_3.js +0 -0
- /package/{esm → dist/esm}/lua/aos2_0_3.wasm +0 -0
- /package/{esm → dist/esm}/lua/aos2_0_4_32.js +0 -0
- /package/{esm → dist/esm}/lua/aos2_0_4_32.wasm +0 -0
- /package/{esm → dist/esm}/lua/aos2_0_6.wasm +0 -0
- /package/{esm → dist/esm}/lua/apm.lua +0 -0
- /package/{esm → dist/esm}/lua/llama.wasm +0 -0
- /package/{esm → dist/esm}/lua/process.wasm +0 -0
- /package/{esm → dist/esm}/lua/sqlite.js +0 -0
- /package/{esm → dist/esm}/lua/sqlite.wasm +0 -0
- /package/{esm → dist/esm}/lua/weavedb_mock.lua +0 -0
- /package/{esm → dist/esm}/lua/weavedrive.lua +0 -0
- /package/{esm → dist/esm}/package.json +0 -0
- /package/{esm → dist/esm}/run.js +0 -0
- /package/{esm → dist/esm}/server.js +0 -0
- /package/{esm → dist/esm}/storage-multi.js +0 -0
- /package/{esm → dist/esm}/tao.js +0 -0
- /package/{esm → dist/esm}/tar.js +0 -0
- /package/{esm → dist/esm}/test.js +0 -0
- /package/{esm → dist/esm}/tgql-d1.js +0 -0
- /package/{esm → dist/esm}/tgql.js +0 -0
- /package/{esm → dist/esm}/toerl.js +0 -0
- /package/{esm → dist/esm}/utils.js +0 -0
- /package/{esm → dist/esm}/wao.js +0 -0
- /package/{esm → dist/esm}/waosm/README.md +0 -0
- /package/{esm → dist/esm}/waosm/waosm.d.ts +0 -0
- /package/{esm → dist/esm}/waosm/waosm.js +0 -0
- /package/{esm → dist/esm}/waosm/waosm_bg.wasm +0 -0
- /package/{esm → dist/esm}/waosm/waosm_bg.wasm.d.ts +0 -0
- /package/{esm → dist/esm}/waosm-node/README.md +0 -0
- /package/{esm → dist/esm}/waosm-node/waosm.d.ts +0 -0
- /package/{esm → dist/esm}/waosm-node/waosm.js +0 -0
- /package/{esm → dist/esm}/waosm-node/waosm_bg.js +0 -0
- /package/{esm → dist/esm}/waosm-node/waosm_bg.wasm +0 -0
- /package/{esm → dist/esm}/waosm-node/waosm_bg.wasm.d.ts +0 -0
- /package/{esm → dist/esm}/waosm-node/waosm_bg.wasm.js +0 -0
- /package/{esm → dist/esm}/waosm-node.js +0 -0
- /package/{esm → dist/esm}/war.js +0 -0
- /package/{esm → dist/esm}/weavedrive.js +0 -0
- /package/{esm → dist/esm}/web.js +0 -0
- /package/{esm → dist/esm}/workspace/.mcp.json +0 -0
- /package/{esm → dist/esm}/workspace/CLAUDE.md +0 -0
- /package/{esm → dist/esm}/workspace/README.md +0 -0
- /package/{esm → dist/esm}/workspace/dashboard/index.html +0 -0
- /package/{esm → dist/esm}/workspace/dashboard/package.json +0 -0
- /package/{esm/workspace/dashboard/public/favicon.png → dist/esm/workspace/dashboard/public/favicon.ico} +0 -0
- /package/{esm → dist/esm}/workspace/dashboard/server.js +0 -0
- /package/{esm → dist/esm}/workspace/dashboard/src/App.jsx +0 -0
- /package/{cjs/workspace/frontend → dist/esm/workspace/dashboard}/src/main.jsx +0 -0
- /package/{esm → dist/esm}/workspace/dashboard/vite.config.js +0 -0
- /package/{esm → dist/esm}/workspace/package.json +0 -0
- /package/{postinstall.cjs → dist/postinstall.cjs} +0 -0
- /package/{esm → src}/workspace/dashboard/src/main.jsx +0 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import base64url from "base64url"
|
|
2
|
+
import { httpbis } from "./http-message-signatures/index.js"
|
|
3
|
+
import { parseItem, serializeList } from "structured-headers"
|
|
4
|
+
import { httpsig_from } from "./httpsig.js"
|
|
5
|
+
import { structured_to } from "./structured.js"
|
|
6
|
+
import { result } from "./send-utils.js"
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
augmentHeaders,
|
|
10
|
+
createSignatureBase,
|
|
11
|
+
createSigningParameters,
|
|
12
|
+
formatSignatureBase,
|
|
13
|
+
} = httpbis
|
|
14
|
+
|
|
15
|
+
const toMsg = async req => {
|
|
16
|
+
let msg = {}
|
|
17
|
+
req?.headers?.forEach((v, k) => {
|
|
18
|
+
msg[k] = v
|
|
19
|
+
})
|
|
20
|
+
if (req.body) {
|
|
21
|
+
const arrayBuffer = await req.arrayBuffer()
|
|
22
|
+
msg.body =
|
|
23
|
+
typeof Buffer !== "undefined"
|
|
24
|
+
? Buffer.from(arrayBuffer) // Node.js
|
|
25
|
+
: new Uint8Array(arrayBuffer) // Browser
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return msg
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function send(signedMsg, fetchImpl = fetch) {
|
|
32
|
+
const fetchOptions = {
|
|
33
|
+
method: signedMsg.method,
|
|
34
|
+
headers: signedMsg.headers,
|
|
35
|
+
redirect: "follow",
|
|
36
|
+
}
|
|
37
|
+
if (
|
|
38
|
+
signedMsg.body !== undefined &&
|
|
39
|
+
signedMsg.method !== "GET" &&
|
|
40
|
+
signedMsg.method !== "HEAD"
|
|
41
|
+
) {
|
|
42
|
+
fetchOptions.body = signedMsg.body
|
|
43
|
+
}
|
|
44
|
+
const response = await fetchImpl(signedMsg.url, fetchOptions)
|
|
45
|
+
if (response.status >= 400) {
|
|
46
|
+
throw new Error(`${response.status}: ${await response.text()}`)
|
|
47
|
+
}
|
|
48
|
+
return await result(response)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const httpSigName = address => {
|
|
52
|
+
const decoded = base64url.toBuffer(address)
|
|
53
|
+
const hexString = [...decoded.subarray(1, 9)]
|
|
54
|
+
.map(byte => byte.toString(16).padStart(2, "0"))
|
|
55
|
+
.join("")
|
|
56
|
+
// Use 'comm-' prefix to match HyperBEAM's siginfo_to_commitments pattern
|
|
57
|
+
// (it strips <<"comm-", Rest/binary>> before parsing structured fields)
|
|
58
|
+
return `comm-${hexString}`
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const toView = value => {
|
|
62
|
+
if (ArrayBuffer.isView(value)) {
|
|
63
|
+
return Buffer.from(value.buffer, value.byteOffset, value.byteLength)
|
|
64
|
+
} else if (typeof value === "string") return base64url.toBuffer(value)
|
|
65
|
+
|
|
66
|
+
throw new Error(
|
|
67
|
+
"Value must be Uint8Array, ArrayBuffer, or base64url-encoded string"
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const toHttpSigner = signer => {
|
|
72
|
+
const params = ["alg", "keyid"].sort()
|
|
73
|
+
return async ({ request, fields }) => {
|
|
74
|
+
let signatureBase
|
|
75
|
+
let signatureInput
|
|
76
|
+
let createCalled = false
|
|
77
|
+
|
|
78
|
+
const create = injected => {
|
|
79
|
+
createCalled = true
|
|
80
|
+
|
|
81
|
+
const { publicKey, alg = "rsa-pss-sha512" } = injected
|
|
82
|
+
|
|
83
|
+
const publicKeyBuffer = toView(publicKey)
|
|
84
|
+
// Use standard base64 encoding for keyid to be compatible with HyperBEAM's
|
|
85
|
+
// base64:decode in dev_codec_httpsig_keyid:apply_scheme
|
|
86
|
+
// Include "publickey:" prefix so HyperBEAM knows the key scheme
|
|
87
|
+
const keyidBase64 = `publickey:${publicKeyBuffer.toString("base64")}`
|
|
88
|
+
|
|
89
|
+
const signingParameters = createSigningParameters({
|
|
90
|
+
params,
|
|
91
|
+
paramValues: {
|
|
92
|
+
keyid: keyidBase64,
|
|
93
|
+
alg,
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
// SORT THE FIELDS HERE to match Erlang's lists:sort(maps:keys(Enc))
|
|
98
|
+
const sortedFields = [...fields].sort()
|
|
99
|
+
|
|
100
|
+
const signatureBaseArray = createSignatureBase(
|
|
101
|
+
{ fields: sortedFields },
|
|
102
|
+
request
|
|
103
|
+
)
|
|
104
|
+
signatureInput = serializeList([
|
|
105
|
+
[
|
|
106
|
+
signatureBaseArray.map(([item]) => parseItem(item)),
|
|
107
|
+
signingParameters,
|
|
108
|
+
],
|
|
109
|
+
])
|
|
110
|
+
|
|
111
|
+
signatureBaseArray.push(['"@signature-params"', [signatureInput]])
|
|
112
|
+
signatureBase = formatSignatureBase(signatureBaseArray)
|
|
113
|
+
return new TextEncoder().encode(signatureBase)
|
|
114
|
+
}
|
|
115
|
+
const result = await signer(create, "httpsig")
|
|
116
|
+
if (!createCalled) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
"create() must be invoked in order to construct the data to sign"
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (!result.signature || !result.address) {
|
|
123
|
+
throw new Error("Signer must return signature and address")
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const signatureBuffer = toView(result.signature)
|
|
127
|
+
const signedHeaders = augmentHeaders(
|
|
128
|
+
request.headers,
|
|
129
|
+
signatureBuffer,
|
|
130
|
+
signatureInput,
|
|
131
|
+
httpSigName(result.address)
|
|
132
|
+
)
|
|
133
|
+
const finalHeaders = {}
|
|
134
|
+
for (const [key, value] of Object.entries(signedHeaders)) {
|
|
135
|
+
if (key === "Signature" || key === "Signature-Input") {
|
|
136
|
+
finalHeaders[key.toLowerCase()] = value
|
|
137
|
+
} else finalHeaders[key] = value
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return { ...request, headers: finalHeaders }
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import base64url from "base64url"
|
|
2
|
+
import crypto from "crypto"
|
|
3
|
+
import { httpbis } from "./http-message-signatures/index.js"
|
|
4
|
+
import { parseItem, serializeList } from "structured-headers"
|
|
5
|
+
import { decodeSigInput, extractPubKey } from "./parser.js"
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
augmentHeaders,
|
|
9
|
+
createSignatureBase,
|
|
10
|
+
createSigningParameters,
|
|
11
|
+
formatSignatureBase,
|
|
12
|
+
} = httpbis
|
|
13
|
+
|
|
14
|
+
const { verifyMessage } = httpbis
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Convert JWK modulus (n) to PEM format public key
|
|
18
|
+
* @param {Buffer} nBuffer - The modulus buffer
|
|
19
|
+
* @returns {string} PEM formatted public key
|
|
20
|
+
*/
|
|
21
|
+
function jwkModulusToPem(nBuffer) {
|
|
22
|
+
// RSA public key with standard exponent
|
|
23
|
+
const rsaPublicKey = crypto.createPublicKey({
|
|
24
|
+
key: {
|
|
25
|
+
kty: "RSA",
|
|
26
|
+
n: base64url.encode(nBuffer),
|
|
27
|
+
e: "AQAB", // Standard exponent 65537
|
|
28
|
+
},
|
|
29
|
+
format: "jwk",
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
return rsaPublicKey.export({ type: "spki", format: "pem" })
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Extract signature name from headers
|
|
37
|
+
* @param {Object} headers - Request headers
|
|
38
|
+
* @returns {string|null} Signature name or null
|
|
39
|
+
*/
|
|
40
|
+
function extractSignatureName(headers) {
|
|
41
|
+
const signatureHeader = headers["signature"] || headers["Signature"]
|
|
42
|
+
if (!signatureHeader) return null
|
|
43
|
+
|
|
44
|
+
// Extract signature name (e.g., "http-sig-xxxxxxxx")
|
|
45
|
+
// Handle both "name:" and "name=" formats
|
|
46
|
+
const match = signatureHeader.match(/^([^:=]+)[:=]/)
|
|
47
|
+
return match ? match[1] : null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Verify an HTTP signed message using http-message-signatures
|
|
52
|
+
*
|
|
53
|
+
* @param {Object} signedMessage - The signed message to verify
|
|
54
|
+
* @param {string} signedMessage.url - Request URL
|
|
55
|
+
* @param {string} signedMessage.method - HTTP method
|
|
56
|
+
* @param {Object} signedMessage.headers - Headers including signature
|
|
57
|
+
* @param {string} [signedMessage.body] - Request body
|
|
58
|
+
* @param {string|Buffer} [publicKey] - Optional public key (if not provided, extracts from keyid)
|
|
59
|
+
* @returns {Object} Verification result
|
|
60
|
+
*/
|
|
61
|
+
export async function verify(signedMessage, publicKey) {
|
|
62
|
+
try {
|
|
63
|
+
const { url, method, headers, body } = signedMessage
|
|
64
|
+
|
|
65
|
+
// Determine which public key to use
|
|
66
|
+
let keyLookup
|
|
67
|
+
|
|
68
|
+
if (publicKey) {
|
|
69
|
+
// Use provided public key
|
|
70
|
+
const pem =
|
|
71
|
+
typeof publicKey === "string" ? publicKey : jwkModulusToPem(publicKey)
|
|
72
|
+
|
|
73
|
+
keyLookup = async keyId => {
|
|
74
|
+
return {
|
|
75
|
+
id: keyId,
|
|
76
|
+
algs: ["rsa-pss-sha512", "rsa-pss-sha256", "rsa-v1_5-sha256"],
|
|
77
|
+
verify: async (data, signature, parameters) => {
|
|
78
|
+
const verifier = crypto.createVerify(
|
|
79
|
+
`RSA-SHA${parameters.alg.includes("512") ? "512" : "256"}`
|
|
80
|
+
)
|
|
81
|
+
verifier.update(data)
|
|
82
|
+
|
|
83
|
+
if (parameters.alg.startsWith("rsa-pss")) {
|
|
84
|
+
return verifier.verify(
|
|
85
|
+
{
|
|
86
|
+
key: pem,
|
|
87
|
+
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
|
|
88
|
+
saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST,
|
|
89
|
+
},
|
|
90
|
+
signature
|
|
91
|
+
)
|
|
92
|
+
} else {
|
|
93
|
+
return verifier.verify(pem, signature)
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
// Extract public key from keyid
|
|
100
|
+
const signatureName = extractSignatureName(headers)
|
|
101
|
+
const extractedKey = extractPubKey(headers, signatureName)
|
|
102
|
+
if (!extractedKey) {
|
|
103
|
+
return {
|
|
104
|
+
valid: false,
|
|
105
|
+
error: "No public key provided and none found in signature",
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const pem = jwkModulusToPem(extractedKey)
|
|
110
|
+
|
|
111
|
+
keyLookup = async keyId => {
|
|
112
|
+
// The library might pass the keyId in different formats, so be flexible
|
|
113
|
+
return {
|
|
114
|
+
id: keyId,
|
|
115
|
+
algs: ["rsa-pss-sha512", "rsa-pss-sha256", "rsa-v1_5-sha256"],
|
|
116
|
+
verify: async (data, signature, parameters) => {
|
|
117
|
+
try {
|
|
118
|
+
const verifier = crypto.createVerify(
|
|
119
|
+
`RSA-SHA${parameters.alg.includes("512") ? "512" : "256"}`
|
|
120
|
+
)
|
|
121
|
+
verifier.update(data)
|
|
122
|
+
|
|
123
|
+
let verified
|
|
124
|
+
if (parameters.alg.startsWith("rsa-pss")) {
|
|
125
|
+
verified = verifier.verify(
|
|
126
|
+
{
|
|
127
|
+
key: pem,
|
|
128
|
+
padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
|
|
129
|
+
saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST,
|
|
130
|
+
},
|
|
131
|
+
signature
|
|
132
|
+
)
|
|
133
|
+
} else {
|
|
134
|
+
verified = verifier.verify(pem, signature)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return verified
|
|
138
|
+
} catch (error) {
|
|
139
|
+
console.error("Verification error:", error)
|
|
140
|
+
return false
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Create request object for verification
|
|
148
|
+
const request = {
|
|
149
|
+
method,
|
|
150
|
+
url,
|
|
151
|
+
headers: { ...headers },
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Extract additional info from headers
|
|
155
|
+
const signatureName = extractSignatureName(headers)
|
|
156
|
+
const extractedPublicKey = extractPubKey(headers, signatureName)
|
|
157
|
+
|
|
158
|
+
// Extract algorithm from signature-input
|
|
159
|
+
const signatureInputHeader =
|
|
160
|
+
headers["signature-input"] || headers["Signature-Input"]
|
|
161
|
+
const decodedSigInput = decodeSigInput(signatureInputHeader, signatureName)
|
|
162
|
+
const algorithm = decodedSigInput?.params?.alg
|
|
163
|
+
|
|
164
|
+
// Verify using the library
|
|
165
|
+
let verified = false
|
|
166
|
+
let verificationError = null
|
|
167
|
+
|
|
168
|
+
try {
|
|
169
|
+
const verificationResult = await verifyMessage(
|
|
170
|
+
{
|
|
171
|
+
keyLookup,
|
|
172
|
+
requiredFields: [], // Don't require specific fields
|
|
173
|
+
},
|
|
174
|
+
request
|
|
175
|
+
)
|
|
176
|
+
// If we get here without throwing, verification succeeded
|
|
177
|
+
verified = true
|
|
178
|
+
} catch (verifyError) {
|
|
179
|
+
// Verification failed
|
|
180
|
+
verificationError = verifyError.message
|
|
181
|
+
verified = false
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
valid: true, // The signature format is valid
|
|
186
|
+
verified, // Whether the cryptographic verification passed
|
|
187
|
+
signatureName,
|
|
188
|
+
keyId: extractedPublicKey
|
|
189
|
+
? base64url.encode(extractedPublicKey)
|
|
190
|
+
: undefined,
|
|
191
|
+
algorithm,
|
|
192
|
+
publicKeyFromHeader: extractedPublicKey,
|
|
193
|
+
decodedSignatureInput: decodedSigInput,
|
|
194
|
+
...(verificationError && { error: verificationError }),
|
|
195
|
+
}
|
|
196
|
+
} catch (error) {
|
|
197
|
+
return {
|
|
198
|
+
valid: false,
|
|
199
|
+
error: error.message,
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Extract public key from a signed message
|
|
206
|
+
*
|
|
207
|
+
* @param {Object} signedMessage - The signed message
|
|
208
|
+
* @returns {Buffer|null} The public key buffer or null
|
|
209
|
+
*/
|
|
210
|
+
function extractPublicKeyFromMessage(signedMessage) {
|
|
211
|
+
const signatureName = extractSignatureName(signedMessage.headers)
|
|
212
|
+
return extractPubKey(signedMessage.headers, signatureName)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export async function send(signedMsg, fetchImpl = fetch) {
|
|
216
|
+
const fetchOptions = {
|
|
217
|
+
method: signedMsg.method,
|
|
218
|
+
headers: signedMsg.headers,
|
|
219
|
+
redirect: "follow",
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Only add body if it exists and method supports it
|
|
223
|
+
if (
|
|
224
|
+
signedMsg.body !== undefined &&
|
|
225
|
+
signedMsg.method !== "GET" &&
|
|
226
|
+
signedMsg.method !== "HEAD"
|
|
227
|
+
) {
|
|
228
|
+
fetchOptions.body = signedMsg.body
|
|
229
|
+
}
|
|
230
|
+
const response = await fetchImpl(signedMsg.url, fetchOptions)
|
|
231
|
+
|
|
232
|
+
if (response.status >= 400) {
|
|
233
|
+
throw new Error(`${response.status}: ${await response.text()}`)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return {
|
|
237
|
+
headers: response.headers,
|
|
238
|
+
body: await response.text(),
|
|
239
|
+
status: response.status,
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Convert value to Buffer
|
|
245
|
+
*/
|
|
246
|
+
const toView = value => {
|
|
247
|
+
if (ArrayBuffer.isView(value)) {
|
|
248
|
+
return Buffer.from(value.buffer, value.byteOffset, value.byteLength)
|
|
249
|
+
} else if (typeof value === "string") {
|
|
250
|
+
return base64url.toBuffer(value)
|
|
251
|
+
}
|
|
252
|
+
throw new Error(
|
|
253
|
+
"Value must be Uint8Array, ArrayBuffer, or base64url-encoded string"
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Generate HTTP signature name from address
|
|
259
|
+
*/
|
|
260
|
+
const httpSigName = address => {
|
|
261
|
+
const decoded = base64url.toBuffer(address)
|
|
262
|
+
const hexString = [...decoded.subarray(1, 9)]
|
|
263
|
+
.map(byte => byte.toString(16).padStart(2, "0"))
|
|
264
|
+
.join("")
|
|
265
|
+
return `http-sig-${hexString}`
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Create HTTP signer wrapper
|
|
270
|
+
*/
|
|
271
|
+
export const toHttpSigner = signer => {
|
|
272
|
+
const params = ["alg", "keyid"].sort()
|
|
273
|
+
|
|
274
|
+
return async ({ request, fields }) => {
|
|
275
|
+
let signatureBase
|
|
276
|
+
let signatureInput
|
|
277
|
+
let createCalled = false
|
|
278
|
+
|
|
279
|
+
const create = injected => {
|
|
280
|
+
createCalled = true
|
|
281
|
+
|
|
282
|
+
const { publicKey, alg = "rsa-pss-sha512" } = injected
|
|
283
|
+
|
|
284
|
+
const publicKeyBuffer = toView(publicKey)
|
|
285
|
+
// Use standard base64 encoding for keyid to be compatible with HyperBEAM's
|
|
286
|
+
// base64:decode in dev_codec_httpsig_keyid:apply_scheme
|
|
287
|
+
// Include "publickey:" prefix so HyperBEAM knows the key scheme
|
|
288
|
+
const keyidBase64 = `publickey:${publicKeyBuffer.toString("base64")}`
|
|
289
|
+
|
|
290
|
+
const signingParameters = createSigningParameters({
|
|
291
|
+
params,
|
|
292
|
+
paramValues: {
|
|
293
|
+
keyid: keyidBase64,
|
|
294
|
+
alg,
|
|
295
|
+
},
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
const signatureBaseArray = createSignatureBase({ fields }, request)
|
|
299
|
+
signatureInput = serializeList([
|
|
300
|
+
[
|
|
301
|
+
signatureBaseArray.map(([item]) => parseItem(item)),
|
|
302
|
+
signingParameters,
|
|
303
|
+
],
|
|
304
|
+
])
|
|
305
|
+
|
|
306
|
+
signatureBaseArray.push(['"@signature-params"', [signatureInput]])
|
|
307
|
+
signatureBase = formatSignatureBase(signatureBaseArray)
|
|
308
|
+
|
|
309
|
+
return new TextEncoder().encode(signatureBase)
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const result = await signer(create, "httpsig")
|
|
313
|
+
|
|
314
|
+
if (!createCalled) {
|
|
315
|
+
throw new Error(
|
|
316
|
+
"create() must be invoked in order to construct the data to sign"
|
|
317
|
+
)
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (!result.signature || !result.address) {
|
|
321
|
+
throw new Error("Signer must return signature and address")
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const signatureBuffer = toView(result.signature)
|
|
325
|
+
const signedHeaders = augmentHeaders(
|
|
326
|
+
request.headers,
|
|
327
|
+
signatureBuffer,
|
|
328
|
+
signatureInput,
|
|
329
|
+
httpSigName(result.address)
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
// Only lowercase the signature headers
|
|
333
|
+
const finalHeaders = {}
|
|
334
|
+
for (const [key, value] of Object.entries(signedHeaders)) {
|
|
335
|
+
if (key === "Signature" || key === "Signature-Input") {
|
|
336
|
+
finalHeaders[key.toLowerCase()] = value
|
|
337
|
+
} else {
|
|
338
|
+
finalHeaders[key] = value
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return {
|
|
343
|
+
...request,
|
|
344
|
+
headers: finalHeaders,
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Utility function to extract the message ID from a signed message
|
|
351
|
+
* Based on the original code's hash calculation
|
|
352
|
+
*/
|
|
353
|
+
async function getMessageId(signedMessage) {
|
|
354
|
+
// Extract signature from the Signature header
|
|
355
|
+
const signatureHeader =
|
|
356
|
+
signedMessage.headers.Signature || signedMessage.headers.signature
|
|
357
|
+
const match = signatureHeader.match(/Signature:\s*'http-sig-[^:]+:([^']+)'/)
|
|
358
|
+
const signature = match ? match[1] : null
|
|
359
|
+
|
|
360
|
+
if (!signature) {
|
|
361
|
+
throw new Error("Could not extract signature from headers")
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Hash the signature to get message ID
|
|
365
|
+
const encoder = new TextEncoder()
|
|
366
|
+
const data = encoder.encode(signature)
|
|
367
|
+
const hashBuffer = await crypto.subtle.digest("SHA-256", data)
|
|
368
|
+
const hashArray = Array.from(new Uint8Array(hashBuffer))
|
|
369
|
+
const hashBase64 = btoa(String.fromCharCode(...hashArray))
|
|
370
|
+
|
|
371
|
+
return hashBase64
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Re-export functions from parser.js for backward compatibility
|
|
375
|
+
export { decodeSigInput, extractPubKey }
|