@rhinestone/sdk 2.0.0-beta.9 → 2.1.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/README.md +2 -2
- package/dist/src/accounts/adapter.d.ts +31 -0
- package/dist/src/accounts/adapter.d.ts.map +1 -0
- package/dist/src/accounts/adapters/eoa.d.ts +4 -0
- package/dist/src/accounts/adapters/eoa.d.ts.map +1 -0
- package/dist/src/accounts/adapters/eoa.js +45 -0
- package/dist/src/accounts/adapters/hca.d.ts +5 -0
- package/dist/src/accounts/adapters/hca.d.ts.map +1 -0
- package/dist/src/accounts/adapters/hca.js +121 -0
- package/dist/src/accounts/adapters/kernel.d.ts +9 -0
- package/dist/src/accounts/adapters/kernel.d.ts.map +1 -0
- package/dist/src/accounts/adapters/kernel.js +159 -0
- package/dist/src/accounts/adapters/nexus.d.ts +16 -0
- package/dist/src/accounts/adapters/nexus.d.ts.map +1 -0
- package/dist/src/accounts/adapters/nexus.js +212 -0
- package/dist/src/accounts/adapters/safe.d.ts +6 -0
- package/dist/src/accounts/adapters/safe.d.ts.map +1 -0
- package/dist/src/accounts/adapters/safe.js +194 -0
- package/dist/src/accounts/adapters/shared.d.ts +9 -0
- package/dist/src/accounts/adapters/shared.d.ts.map +1 -0
- package/dist/src/accounts/adapters/shared.js +62 -0
- package/dist/src/accounts/adapters/startale.d.ts +14 -0
- package/dist/src/accounts/adapters/startale.d.ts.map +1 -0
- package/dist/src/accounts/adapters/startale.js +165 -0
- package/dist/src/accounts/construction.d.ts +25 -0
- package/dist/src/accounts/construction.d.ts.map +1 -0
- package/dist/src/accounts/construction.js +34 -0
- package/dist/src/accounts/deployment.d.ts +12 -0
- package/dist/src/accounts/deployment.d.ts.map +1 -0
- package/dist/src/accounts/deployment.js +33 -0
- package/dist/src/accounts/erc7579-calls.d.ts +4 -0
- package/dist/src/accounts/erc7579-calls.d.ts.map +1 -0
- package/dist/src/accounts/erc7579-calls.js +57 -0
- package/dist/src/accounts/error.d.ts +3 -10
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +5 -11
- package/dist/src/accounts/legacy.d.ts +14 -0
- package/dist/src/accounts/legacy.d.ts.map +1 -0
- package/dist/src/accounts/legacy.js +40 -0
- package/dist/src/accounts/registry.d.ts +4 -0
- package/dist/src/accounts/registry.d.ts.map +1 -0
- package/dist/src/accounts/registry.js +22 -0
- package/dist/src/accounts/types.d.ts +131 -0
- package/dist/src/accounts/types.d.ts.map +1 -0
- package/dist/src/accounts/types.js +1 -0
- package/dist/src/accounts/wallet-account.d.ts +3 -0
- package/dist/src/accounts/wallet-account.d.ts.map +1 -0
- package/dist/src/accounts/wallet-account.js +12 -0
- package/dist/src/actions/deploy.d.ts +4 -0
- package/dist/src/actions/deploy.d.ts.map +1 -0
- package/dist/src/actions/deploy.js +8 -0
- package/dist/src/actions/ecdsa.d.ts +2 -2
- package/dist/src/actions/ecdsa.d.ts.map +1 -1
- package/dist/src/actions/ecdsa.js +12 -65
- package/dist/src/actions/index.d.ts +2 -16
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +3 -49
- package/dist/src/actions/mfa.d.ts +1 -1
- package/dist/src/actions/mfa.d.ts.map +1 -1
- package/dist/src/actions/mfa.js +30 -10
- package/dist/src/actions/modules.d.ts +4 -0
- package/dist/src/actions/modules.d.ts.map +1 -0
- package/dist/src/actions/modules.js +22 -0
- package/dist/src/actions/ownable.d.ts +6 -0
- package/dist/src/actions/ownable.d.ts.map +1 -0
- package/dist/src/actions/ownable.js +63 -0
- package/dist/src/actions/passkeys.d.ts +2 -2
- package/dist/src/actions/passkeys.d.ts.map +1 -1
- package/dist/src/actions/passkeys.js +23 -78
- package/dist/src/actions/recovery.d.ts +58 -24
- package/dist/src/actions/recovery.d.ts.map +1 -1
- package/dist/src/actions/recovery.js +107 -162
- package/dist/src/actions/runtime.d.ts +17 -0
- package/dist/src/actions/runtime.d.ts.map +1 -0
- package/dist/src/actions/runtime.js +182 -0
- package/dist/src/actions/smart-sessions.d.ts +30 -6
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +69 -18
- package/dist/src/actions/webauthn.d.ts +6 -0
- package/dist/src/actions/webauthn.d.ts.map +1 -0
- package/dist/src/actions/webauthn.js +67 -0
- package/dist/src/api/account.d.ts +265 -0
- package/dist/src/api/account.d.ts.map +1 -0
- package/dist/src/api/account.js +638 -0
- package/dist/src/api/accounts.d.ts +12 -0
- package/dist/src/api/accounts.d.ts.map +1 -0
- package/dist/src/api/accounts.js +17 -0
- package/dist/src/api/compose-types.d.ts +147 -0
- package/dist/src/api/compose-types.d.ts.map +1 -0
- package/dist/src/api/compose-types.js +1 -0
- package/dist/src/api/compose.d.ts +6 -0
- package/dist/src/api/compose.d.ts.map +1 -0
- package/dist/src/api/compose.js +772 -0
- package/dist/src/api/direct-signing.d.ts +27 -0
- package/dist/src/api/direct-signing.d.ts.map +1 -0
- package/dist/src/api/direct-signing.js +191 -0
- package/dist/src/api/project-mappers.d.ts +7 -0
- package/dist/src/api/project-mappers.d.ts.map +1 -0
- package/dist/src/api/project-mappers.js +23 -0
- package/dist/src/api/queries/app-fees.d.ts +4 -0
- package/dist/src/api/queries/app-fees.d.ts.map +1 -0
- package/dist/src/api/queries/app-fees.js +3 -0
- package/dist/src/api/queries/portfolio.d.ts +9 -0
- package/dist/src/api/queries/portfolio.d.ts.map +1 -0
- package/dist/src/api/queries/portfolio.js +28 -0
- package/dist/src/api/queries/session.d.ts +8 -0
- package/dist/src/api/queries/session.d.ts.map +1 -0
- package/dist/src/api/queries/session.js +15 -0
- package/dist/src/api/sdk.d.ts +80 -0
- package/dist/src/api/sdk.d.ts.map +1 -0
- package/dist/src/api/sdk.js +103 -0
- package/dist/src/api/signer-selection.d.ts +20 -0
- package/dist/src/api/signer-selection.d.ts.map +1 -0
- package/dist/src/api/signer-selection.js +159 -0
- package/dist/src/calls/normalize.d.ts +9 -0
- package/dist/src/calls/normalize.d.ts.map +1 -0
- package/dist/src/calls/normalize.js +17 -0
- package/dist/src/calls/resolve.d.ts +3 -0
- package/dist/src/calls/resolve.d.ts.map +1 -0
- package/dist/src/calls/resolve.js +15 -0
- package/dist/src/calls/types.d.ts +25 -0
- package/dist/src/calls/types.d.ts.map +1 -0
- package/dist/src/calls/types.js +1 -0
- package/dist/src/chains/caip2.d.ts +10 -0
- package/dist/src/chains/caip2.d.ts.map +1 -0
- package/dist/src/chains/caip2.js +85 -0
- package/dist/src/chains/catalog.d.ts +5 -0
- package/dist/src/chains/catalog.d.ts.map +1 -0
- package/dist/src/chains/catalog.js +41 -0
- package/dist/src/chains/errors.d.ts +15 -0
- package/dist/src/chains/errors.d.ts.map +1 -0
- package/dist/src/chains/errors.js +21 -0
- package/dist/src/{orchestrator/destinations.d.ts → chains/non-evm.d.ts} +9 -6
- package/dist/src/chains/non-evm.d.ts.map +1 -0
- package/dist/src/chains/non-evm.js +30 -0
- package/dist/src/chains/tokens.d.ts +4 -0
- package/dist/src/chains/tokens.d.ts.map +1 -0
- package/dist/src/chains/tokens.js +22 -0
- package/dist/src/chains/types.d.ts +25 -0
- package/dist/src/chains/types.d.ts.map +1 -0
- package/dist/src/chains/types.js +1 -0
- package/dist/src/clients/bundler/client.d.ts +10 -0
- package/dist/src/clients/bundler/client.d.ts.map +1 -0
- package/dist/src/clients/bundler/client.js +85 -0
- package/dist/src/clients/bundler/endpoints.d.ts +3 -0
- package/dist/src/clients/bundler/endpoints.d.ts.map +1 -0
- package/dist/src/clients/bundler/endpoints.js +18 -0
- package/dist/src/clients/bundler/port.d.ts +22 -0
- package/dist/src/clients/bundler/port.d.ts.map +1 -0
- package/dist/src/clients/bundler/port.js +1 -0
- package/dist/src/clients/json-rpc.d.ts +20 -0
- package/dist/src/clients/json-rpc.d.ts.map +1 -0
- package/dist/src/clients/json-rpc.js +56 -0
- package/dist/src/clients/orchestrator/auth.d.ts +7 -0
- package/dist/src/clients/orchestrator/auth.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/auth.js +27 -0
- package/dist/src/clients/orchestrator/chain-catalog.d.ts +36 -0
- package/dist/src/clients/orchestrator/chain-catalog.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/chain-catalog.js +67 -0
- package/dist/src/clients/orchestrator/client.d.ts +13 -0
- package/dist/src/clients/orchestrator/client.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/client.js +97 -0
- package/dist/src/clients/orchestrator/errors.d.ts +238 -0
- package/dist/src/clients/orchestrator/errors.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/errors.js +525 -0
- package/dist/src/clients/orchestrator/fetch.d.ts +7 -0
- package/dist/src/clients/orchestrator/fetch.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/fetch.js +37 -0
- package/dist/src/clients/orchestrator/mappers.d.ts +9 -0
- package/dist/src/clients/orchestrator/mappers.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/mappers.js +198 -0
- package/dist/src/clients/orchestrator/port.d.ts +26 -0
- package/dist/src/clients/orchestrator/port.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/port.js +1 -0
- package/dist/src/{orchestrator/types.d.ts → clients/orchestrator/public.d.ts} +113 -43
- package/dist/src/clients/orchestrator/public.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/public.js +14 -0
- package/dist/src/clients/orchestrator/types.d.ts +144 -0
- package/dist/src/clients/orchestrator/types.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/types.js +1 -0
- package/dist/src/clients/orchestrator/wire.d.ts +19 -0
- package/dist/src/clients/orchestrator/wire.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/wire.gen.d.ts +6463 -0
- package/dist/src/clients/orchestrator/wire.gen.d.ts.map +1 -0
- package/dist/src/clients/orchestrator/wire.gen.js +1 -0
- package/dist/src/clients/orchestrator/wire.js +1 -0
- package/dist/src/clients/paymaster/client.d.ts +8 -0
- package/dist/src/clients/paymaster/client.d.ts.map +1 -0
- package/dist/src/clients/paymaster/client.js +38 -0
- package/dist/src/clients/paymaster/endpoints.d.ts +3 -0
- package/dist/src/clients/paymaster/endpoints.d.ts.map +1 -0
- package/dist/src/clients/paymaster/endpoints.js +16 -0
- package/dist/src/clients/paymaster/port.d.ts +17 -0
- package/dist/src/clients/paymaster/port.d.ts.map +1 -0
- package/dist/src/clients/paymaster/port.js +1 -0
- package/dist/src/clients/rpc/client.d.ts +6 -0
- package/dist/src/clients/rpc/client.d.ts.map +1 -0
- package/dist/src/clients/rpc/client.js +66 -0
- package/dist/src/clients/rpc/compatibility.d.ts +12 -0
- package/dist/src/clients/rpc/compatibility.d.ts.map +1 -0
- package/dist/src/clients/rpc/compatibility.js +16 -0
- package/dist/src/clients/rpc/port.d.ts +13 -0
- package/dist/src/clients/rpc/port.d.ts.map +1 -0
- package/dist/src/clients/rpc/port.js +1 -0
- package/dist/src/clients/rpc/providers.d.ts +3 -0
- package/dist/src/clients/rpc/providers.d.ts.map +1 -0
- package/dist/src/clients/rpc/providers.js +8 -0
- package/dist/src/clients/rpc/transport.d.ts +4 -0
- package/dist/src/clients/rpc/transport.d.ts.map +1 -0
- package/dist/src/clients/rpc/transport.js +5 -0
- package/dist/src/clients/rpc/types.d.ts +23 -0
- package/dist/src/clients/rpc/types.d.ts.map +1 -0
- package/dist/src/clients/rpc/types.js +1 -0
- package/dist/src/config/account-runtime.d.ts +7 -0
- package/dist/src/config/account-runtime.d.ts.map +1 -0
- package/dist/src/config/account-runtime.js +36 -0
- package/dist/src/config/account.d.ts +767 -0
- package/dist/src/config/account.d.ts.map +1 -0
- package/dist/src/config/account.js +10 -0
- package/dist/src/config/defaults.d.ts +14 -0
- package/dist/src/config/defaults.d.ts.map +1 -0
- package/dist/src/config/defaults.js +26 -0
- package/dist/src/config/input.d.ts +59 -0
- package/dist/src/config/input.d.ts.map +1 -0
- package/dist/src/config/input.js +1 -0
- package/dist/src/config/legacy.d.ts +22 -0
- package/dist/src/config/legacy.d.ts.map +1 -0
- package/dist/src/config/legacy.js +23 -0
- package/dist/src/config/resolve.d.ts +13 -0
- package/dist/src/config/resolve.d.ts.map +1 -0
- package/dist/src/config/resolve.js +200 -0
- package/dist/src/config/resolved.d.ts +77 -0
- package/dist/src/config/resolved.d.ts.map +1 -0
- package/dist/src/config/resolved.js +1 -0
- package/dist/src/config/validate.d.ts +3 -0
- package/dist/src/config/validate.d.ts.map +1 -0
- package/dist/src/config/validate.js +6 -0
- package/dist/src/{execution/error.d.ts → errors/execution.d.ts} +47 -9
- package/dist/src/errors/execution.d.ts.map +1 -0
- package/dist/src/errors/execution.js +131 -0
- package/dist/src/errors/index.d.ts +6 -4
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +7 -6
- package/dist/src/index.d.ts +14 -84
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +9 -293
- package/dist/src/jwt-server/jcs.d.ts +1 -1
- package/dist/src/jwt-server/jcs.js +4 -2
- package/dist/src/modules/erc7579-abi.d.ts +4 -0
- package/dist/src/modules/erc7579-abi.d.ts.map +1 -0
- package/dist/src/modules/erc7579-abi.js +12 -0
- package/dist/src/modules/intent-executor.d.ts +6 -0
- package/dist/src/modules/intent-executor.d.ts.map +1 -0
- package/dist/src/modules/intent-executor.js +13 -0
- package/dist/src/modules/legacy-core.d.ts +29 -0
- package/dist/src/modules/legacy-core.d.ts.map +1 -0
- package/dist/src/modules/legacy-core.js +80 -0
- package/dist/src/modules/normalize.d.ts +4 -0
- package/dist/src/modules/normalize.d.ts.map +1 -0
- package/dist/src/modules/normalize.js +15 -0
- package/dist/src/modules/plan.d.ts +16 -0
- package/dist/src/modules/plan.d.ts.map +1 -0
- package/dist/src/modules/plan.js +51 -0
- package/dist/src/modules/read-core.d.ts +62 -0
- package/dist/src/modules/read-core.d.ts.map +1 -0
- package/dist/src/modules/read-core.js +206 -0
- package/dist/src/modules/types.d.ts +46 -0
- package/dist/src/modules/types.d.ts.map +1 -0
- package/dist/src/modules/types.js +1 -0
- package/dist/src/modules/validators/capabilities.d.ts +4 -0
- package/dist/src/modules/validators/capabilities.d.ts.map +1 -0
- package/dist/src/modules/validators/capabilities.js +58 -0
- package/dist/src/modules/validators/contribution.d.ts +4 -0
- package/dist/src/modules/validators/contribution.d.ts.map +1 -0
- package/dist/src/modules/validators/contribution.js +64 -0
- package/dist/src/modules/validators/definition.d.ts +3 -0
- package/dist/src/modules/validators/definition.d.ts.map +1 -0
- package/dist/src/modules/validators/definition.js +68 -0
- package/dist/src/modules/validators/ens.d.ts +5 -0
- package/dist/src/modules/validators/ens.d.ts.map +1 -0
- package/dist/src/modules/validators/ens.js +34 -0
- package/dist/src/modules/validators/k1.d.ts +2 -0
- package/dist/src/modules/validators/k1.d.ts.map +1 -0
- package/dist/src/modules/validators/k1.js +1 -0
- package/dist/src/modules/validators/multi-factor.d.ts +18 -0
- package/dist/src/modules/validators/multi-factor.d.ts.map +1 -0
- package/dist/src/modules/validators/multi-factor.js +79 -0
- package/dist/src/modules/validators/ownable.d.ts +26 -0
- package/dist/src/modules/validators/ownable.d.ts.map +1 -0
- package/dist/src/modules/validators/ownable.js +84 -0
- package/dist/src/modules/validators/permissions.d.ts +2 -1
- package/dist/src/modules/validators/permissions.d.ts.map +1 -1
- package/dist/src/modules/validators/permissions.js +192 -18
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts +19 -0
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts.map +1 -0
- package/dist/src/modules/validators/policies/claim/arbiters.js +82 -0
- package/dist/src/modules/validators/resolve.d.ts +5 -0
- package/dist/src/modules/validators/resolve.d.ts.map +1 -0
- package/dist/src/modules/validators/resolve.js +22 -0
- package/dist/src/modules/validators/signer-id.d.ts +5 -0
- package/dist/src/modules/validators/signer-id.d.ts.map +1 -0
- package/dist/src/modules/validators/signer-id.js +8 -0
- package/dist/src/modules/validators/smart-session-signature-types.d.ts +35 -0
- package/dist/src/modules/validators/smart-session-signature-types.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-session-signature-types.js +1 -0
- package/dist/src/modules/validators/smart-sessions/authorization.d.ts +99 -0
- package/dist/src/modules/validators/smart-sessions/authorization.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/authorization.js +101 -0
- package/dist/src/modules/validators/smart-sessions/calls.d.ts +19 -0
- package/dist/src/modules/validators/smart-sessions/calls.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/calls.js +85 -0
- package/dist/src/modules/validators/smart-sessions/cross-chain-permits.d.ts +4 -0
- package/dist/src/modules/validators/smart-sessions/cross-chain-permits.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/cross-chain-permits.js +77 -0
- package/dist/src/modules/validators/smart-sessions/digest.d.ts +5 -0
- package/dist/src/modules/validators/smart-sessions/digest.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/digest.js +30 -0
- package/dist/src/modules/validators/smart-sessions/mock-signature.d.ts +10 -0
- package/dist/src/modules/validators/smart-sessions/mock-signature.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/mock-signature.js +31 -0
- package/dist/src/modules/validators/smart-sessions/module.d.ts +11 -0
- package/dist/src/modules/validators/smart-sessions/module.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/module.js +18 -0
- package/dist/src/modules/validators/smart-sessions/policies/addresses.d.ts +23 -0
- package/dist/src/modules/validators/smart-sessions/policies/addresses.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/policies/addresses.js +29 -0
- package/dist/src/modules/validators/smart-sessions/policies/claim.d.ts +10 -0
- package/dist/src/modules/validators/smart-sessions/policies/claim.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/policies/claim.js +106 -0
- package/dist/src/modules/validators/smart-sessions/policies/encode.d.ts +4 -0
- package/dist/src/modules/validators/smart-sessions/policies/encode.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/policies/encode.js +197 -0
- package/dist/src/modules/validators/smart-sessions/resolve.d.ts +16 -0
- package/dist/src/modules/validators/smart-sessions/resolve.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/resolve.js +120 -0
- package/dist/src/modules/validators/smart-sessions/signature.d.ts +14 -0
- package/dist/src/modules/validators/smart-sessions/signature.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/signature.js +167 -0
- package/dist/src/modules/validators/smart-sessions/state.d.ts +19 -0
- package/dist/src/modules/validators/smart-sessions/state.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/state.js +42 -0
- package/dist/src/modules/validators/smart-sessions/types.d.ts +227 -0
- package/dist/src/modules/validators/smart-sessions/types.d.ts.map +1 -0
- package/dist/src/modules/validators/smart-sessions/types.js +1 -0
- package/dist/src/modules/validators/social-recovery.d.ts +16 -0
- package/dist/src/modules/validators/social-recovery.d.ts.map +1 -0
- package/dist/src/modules/validators/social-recovery.js +17 -0
- package/dist/src/modules/validators/types.d.ts +143 -0
- package/dist/src/modules/validators/types.d.ts.map +1 -0
- package/dist/src/modules/validators/types.js +1 -0
- package/dist/src/modules/validators/webauthn.d.ts +54 -0
- package/dist/src/modules/validators/webauthn.d.ts.map +1 -0
- package/dist/src/modules/validators/webauthn.js +159 -0
- package/dist/src/signing/context.d.ts +25 -0
- package/dist/src/signing/context.d.ts.map +1 -0
- package/dist/src/signing/context.js +163 -0
- package/dist/src/signing/contribution.d.ts +13 -0
- package/dist/src/signing/contribution.d.ts.map +1 -0
- package/dist/src/signing/contribution.js +83 -0
- package/dist/src/signing/eip7702.d.ts +41 -0
- package/dist/src/signing/eip7702.d.ts.map +1 -0
- package/dist/src/signing/eip7702.js +215 -0
- package/dist/src/signing/error.d.ts +27 -0
- package/dist/src/signing/error.d.ts.map +1 -0
- package/dist/src/signing/error.js +25 -0
- package/dist/src/signing/execute.d.ts +17 -0
- package/dist/src/signing/execute.d.ts.map +1 -0
- package/dist/src/signing/execute.js +138 -0
- package/dist/src/signing/intent-plans/assemble.d.ts +15 -0
- package/dist/src/signing/intent-plans/assemble.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/assemble.js +96 -0
- package/dist/src/signing/intent-plans/independent.d.ts +48 -0
- package/dist/src/signing/intent-plans/independent.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/independent.js +150 -0
- package/dist/src/signing/intent-plans/plan.d.ts +14 -0
- package/dist/src/signing/intent-plans/plan.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/plan.js +187 -0
- package/dist/src/signing/intent-plans/types.d.ts +63 -0
- package/dist/src/signing/intent-plans/types.d.ts.map +1 -0
- package/dist/src/signing/intent-plans/types.js +1 -0
- package/dist/src/signing/message.d.ts +28 -0
- package/dist/src/signing/message.d.ts.map +1 -0
- package/dist/src/signing/message.js +90 -0
- package/dist/src/signing/passkeys.d.ts +28 -0
- package/dist/src/signing/passkeys.d.ts.map +1 -0
- package/dist/src/signing/passkeys.js +17 -0
- package/dist/src/signing/plan.d.ts +35 -0
- package/dist/src/signing/plan.d.ts.map +1 -0
- package/dist/src/signing/plan.js +377 -0
- package/dist/src/signing/protocols/erc6492.d.ts +11 -0
- package/dist/src/signing/protocols/erc6492.d.ts.map +1 -0
- package/dist/src/signing/protocols/erc6492.js +24 -0
- package/dist/src/signing/protocols/erc7739.d.ts +17 -0
- package/dist/src/signing/protocols/erc7739.d.ts.map +1 -0
- package/dist/src/signing/protocols/erc7739.js +84 -0
- package/dist/src/signing/session-enable.d.ts +35 -0
- package/dist/src/signing/session-enable.d.ts.map +1 -0
- package/dist/src/signing/session-enable.js +62 -0
- package/dist/src/signing/signers/compatibility.d.ts +4 -0
- package/dist/src/signing/signers/compatibility.d.ts.map +1 -0
- package/dist/src/signing/signers/compatibility.js +51 -0
- package/dist/src/signing/signers/ecdsa.d.ts +14 -0
- package/dist/src/signing/signers/ecdsa.d.ts.map +1 -0
- package/dist/src/signing/signers/ecdsa.js +54 -0
- package/dist/src/signing/signers/registry.d.ts +7 -0
- package/dist/src/signing/signers/registry.d.ts.map +1 -0
- package/dist/src/signing/signers/registry.js +33 -0
- package/dist/src/signing/signers/types.d.ts +16 -0
- package/dist/src/signing/signers/types.d.ts.map +1 -0
- package/dist/src/signing/signers/types.js +1 -0
- package/dist/src/signing/signers/wallet-chain.d.ts +9 -0
- package/dist/src/signing/signers/wallet-chain.d.ts.map +1 -0
- package/dist/src/signing/signers/wallet-chain.js +15 -0
- package/dist/src/signing/signers/webauthn.d.ts +11 -0
- package/dist/src/signing/signers/webauthn.d.ts.map +1 -0
- package/dist/src/signing/signers/webauthn.js +14 -0
- package/dist/src/signing/typed-data.d.ts +39 -0
- package/dist/src/signing/typed-data.d.ts.map +1 -0
- package/dist/src/signing/typed-data.js +135 -0
- package/dist/src/signing/types.d.ts +346 -0
- package/dist/src/signing/types.d.ts.map +1 -0
- package/dist/src/signing/types.js +1 -0
- package/dist/src/signing/user-operation.d.ts +23 -0
- package/dist/src/signing/user-operation.d.ts.map +1 -0
- package/dist/src/signing/user-operation.js +61 -0
- package/dist/src/smart-sessions/index.d.ts +16 -0
- package/dist/src/smart-sessions/index.d.ts.map +1 -0
- package/dist/src/smart-sessions/index.js +45 -0
- package/dist/src/transactions/intents/account.d.ts +15 -0
- package/dist/src/transactions/intents/account.d.ts.map +1 -0
- package/dist/src/transactions/intents/account.js +48 -0
- package/dist/src/transactions/intents/compatibility.d.ts +4 -0
- package/dist/src/transactions/intents/compatibility.d.ts.map +1 -0
- package/dist/src/transactions/intents/compatibility.js +19 -0
- package/dist/src/transactions/intents/normalize.d.ts +5 -0
- package/dist/src/transactions/intents/normalize.d.ts.map +1 -0
- package/dist/src/transactions/intents/normalize.js +48 -0
- package/dist/src/transactions/intents/prepare.d.ts +7 -0
- package/dist/src/transactions/intents/prepare.d.ts.map +1 -0
- package/dist/src/transactions/intents/prepare.js +249 -0
- package/dist/src/transactions/intents/quotes.d.ts +3 -0
- package/dist/src/transactions/intents/quotes.d.ts.map +1 -0
- package/dist/src/transactions/intents/quotes.js +11 -0
- package/dist/src/transactions/intents/request.d.ts +11 -0
- package/dist/src/transactions/intents/request.d.ts.map +1 -0
- package/dist/src/transactions/intents/request.js +55 -0
- package/dist/src/transactions/intents/send.d.ts +3 -0
- package/dist/src/transactions/intents/send.d.ts.map +1 -0
- package/dist/src/transactions/intents/send.js +22 -0
- package/dist/src/transactions/intents/session-signing.d.ts +7 -0
- package/dist/src/transactions/intents/session-signing.d.ts.map +1 -0
- package/dist/src/transactions/intents/session-signing.js +363 -0
- package/dist/src/transactions/intents/sessions.d.ts +17 -0
- package/dist/src/transactions/intents/sessions.d.ts.map +1 -0
- package/dist/src/transactions/intents/sessions.js +85 -0
- package/dist/src/transactions/intents/sign-transaction.d.ts +10 -0
- package/dist/src/transactions/intents/sign-transaction.d.ts.map +1 -0
- package/dist/src/transactions/intents/sign-transaction.js +386 -0
- package/dist/src/transactions/intents/split.d.ts +13 -0
- package/dist/src/transactions/intents/split.d.ts.map +1 -0
- package/dist/src/transactions/intents/split.js +3 -0
- package/dist/src/transactions/intents/status-policy.d.ts +13 -0
- package/dist/src/transactions/intents/status-policy.d.ts.map +1 -0
- package/dist/src/transactions/intents/status-policy.js +39 -0
- package/dist/src/transactions/intents/status.d.ts +4 -0
- package/dist/src/transactions/intents/status.d.ts.map +1 -0
- package/dist/src/transactions/intents/status.js +50 -0
- package/dist/src/transactions/intents/submit.d.ts +3 -0
- package/dist/src/transactions/intents/submit.d.ts.map +1 -0
- package/dist/src/transactions/intents/submit.js +32 -0
- package/dist/src/transactions/intents/types.d.ts +136 -0
- package/dist/src/transactions/intents/types.d.ts.map +1 -0
- package/dist/src/transactions/intents/types.js +1 -0
- package/dist/src/transactions/user-operations/hash.d.ts +5 -0
- package/dist/src/transactions/user-operations/hash.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/hash.js +9 -0
- package/dist/src/transactions/user-operations/nonce.d.ts +18 -0
- package/dist/src/transactions/user-operations/nonce.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/nonce.js +43 -0
- package/dist/src/transactions/user-operations/prepare.d.ts +12 -0
- package/dist/src/transactions/user-operations/prepare.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/prepare.js +136 -0
- package/dist/src/transactions/user-operations/reconstruct.d.ts +28 -0
- package/dist/src/transactions/user-operations/reconstruct.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/reconstruct.js +52 -0
- package/dist/src/transactions/user-operations/send.d.ts +3 -0
- package/dist/src/transactions/user-operations/send.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/send.js +8 -0
- package/dist/src/transactions/user-operations/sign.d.ts +3 -0
- package/dist/src/transactions/user-operations/sign.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/sign.js +14 -0
- package/dist/src/transactions/user-operations/status.d.ts +4 -0
- package/dist/src/transactions/user-operations/status.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/status.js +37 -0
- package/dist/src/transactions/user-operations/submit.d.ts +3 -0
- package/dist/src/transactions/user-operations/submit.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/submit.js +8 -0
- package/dist/src/transactions/user-operations/types.d.ts +68 -0
- package/dist/src/transactions/user-operations/types.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/types.js +1 -0
- package/dist/src/transactions/user-operations/validator-account.d.ts +5 -0
- package/dist/src/transactions/user-operations/validator-account.d.ts.map +1 -0
- package/dist/src/transactions/user-operations/validator-account.js +26 -0
- package/dist/src/utils/index.d.ts +68 -4
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +113 -51
- package/package.json +10 -11
- package/dist/src/accounts/index.d.ts +0 -51
- package/dist/src/accounts/index.d.ts.map +0 -1
- package/dist/src/accounts/index.js +0 -589
- package/dist/src/accounts/json-rpc/index.d.ts +0 -5
- package/dist/src/accounts/json-rpc/index.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/index.js +0 -19
- package/dist/src/accounts/json-rpc/providers.d.ts +0 -5
- package/dist/src/accounts/json-rpc/providers.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/providers.js +0 -16
- package/dist/src/accounts/kernel.d.ts +0 -27
- package/dist/src/accounts/kernel.d.ts.map +0 -1
- package/dist/src/accounts/kernel.js +0 -272
- package/dist/src/accounts/nexus.d.ts +0 -33
- package/dist/src/accounts/nexus.d.ts.map +0 -1
- package/dist/src/accounts/nexus.js +0 -444
- package/dist/src/accounts/safe.d.ts +0 -33
- package/dist/src/accounts/safe.d.ts.map +0 -1
- package/dist/src/accounts/safe.js +0 -343
- package/dist/src/accounts/signing/common.d.ts +0 -32
- package/dist/src/accounts/signing/common.d.ts.map +0 -1
- package/dist/src/accounts/signing/common.js +0 -184
- package/dist/src/accounts/signing/message.d.ts +0 -7
- package/dist/src/accounts/signing/message.d.ts.map +0 -1
- package/dist/src/accounts/signing/message.js +0 -45
- package/dist/src/accounts/signing/passkeys.d.ts +0 -36
- package/dist/src/accounts/signing/passkeys.d.ts.map +0 -1
- package/dist/src/accounts/signing/passkeys.js +0 -119
- package/dist/src/accounts/signing/typedData.d.ts +0 -5
- package/dist/src/accounts/signing/typedData.d.ts.map +0 -1
- package/dist/src/accounts/signing/typedData.js +0 -33
- package/dist/src/accounts/startale.d.ts +0 -26
- package/dist/src/accounts/startale.d.ts.map +0 -1
- package/dist/src/accounts/startale.js +0 -191
- package/dist/src/accounts/utils.d.ts +0 -33
- package/dist/src/accounts/utils.d.ts.map +0 -1
- package/dist/src/accounts/utils.js +0 -202
- package/dist/src/auth/provider.d.ts +0 -7
- package/dist/src/auth/provider.d.ts.map +0 -1
- package/dist/src/auth/provider.js +0 -38
- package/dist/src/execution/compact.d.ts +0 -5
- package/dist/src/execution/compact.d.ts.map +0 -1
- package/dist/src/execution/compact.js +0 -4
- package/dist/src/execution/error.d.ts.map +0 -1
- package/dist/src/execution/error.js +0 -85
- package/dist/src/execution/index.d.ts +0 -42
- package/dist/src/execution/index.d.ts.map +0 -1
- package/dist/src/execution/index.js +0 -202
- package/dist/src/execution/utils.d.ts +0 -127
- package/dist/src/execution/utils.d.ts.map +0 -1
- package/dist/src/execution/utils.js +0 -1116
- package/dist/src/modules/abi/smart-sessions.d.ts +0 -104
- package/dist/src/modules/abi/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/abi/smart-sessions.js +0 -128
- package/dist/src/modules/chain-abstraction.d.ts +0 -5
- package/dist/src/modules/chain-abstraction.d.ts.map +0 -1
- package/dist/src/modules/chain-abstraction.js +0 -3
- package/dist/src/modules/common.d.ts +0 -30
- package/dist/src/modules/common.d.ts.map +0 -1
- package/dist/src/modules/common.js +0 -30
- package/dist/src/modules/index.d.ts +0 -11
- package/dist/src/modules/index.d.ts.map +0 -1
- package/dist/src/modules/index.js +0 -90
- package/dist/src/modules/legacy.d.ts +0 -10
- package/dist/src/modules/legacy.d.ts.map +0 -1
- package/dist/src/modules/legacy.js +0 -62
- package/dist/src/modules/read.d.ts +0 -10
- package/dist/src/modules/read.d.ts.map +0 -1
- package/dist/src/modules/read.js +0 -171
- package/dist/src/modules/validators/core.d.ts +0 -31
- package/dist/src/modules/validators/core.d.ts.map +0 -1
- package/dist/src/modules/validators/core.js +0 -266
- package/dist/src/modules/validators/index.d.ts +0 -4
- package/dist/src/modules/validators/index.d.ts.map +0 -1
- package/dist/src/modules/validators/index.js +0 -3
- package/dist/src/modules/validators/smart-sessions.d.ts +0 -196
- package/dist/src/modules/validators/smart-sessions.d.ts.map +0 -1
- package/dist/src/modules/validators/smart-sessions.js +0 -772
- package/dist/src/orchestrator/caip2.d.ts +0 -13
- package/dist/src/orchestrator/caip2.d.ts.map +0 -1
- package/dist/src/orchestrator/caip2.js +0 -52
- package/dist/src/orchestrator/client.d.ts +0 -29
- package/dist/src/orchestrator/client.d.ts.map +0 -1
- package/dist/src/orchestrator/client.js +0 -293
- package/dist/src/orchestrator/consts.d.ts +0 -6
- package/dist/src/orchestrator/consts.d.ts.map +0 -1
- package/dist/src/orchestrator/consts.js +0 -5
- package/dist/src/orchestrator/destinations.d.ts.map +0 -1
- package/dist/src/orchestrator/destinations.js +0 -36
- package/dist/src/orchestrator/error.d.ts +0 -97
- package/dist/src/orchestrator/error.d.ts.map +0 -1
- package/dist/src/orchestrator/error.js +0 -173
- package/dist/src/orchestrator/index.d.ts +0 -12
- package/dist/src/orchestrator/index.d.ts.map +0 -1
- package/dist/src/orchestrator/index.js +0 -10
- package/dist/src/orchestrator/registry.d.ts +0 -17
- package/dist/src/orchestrator/registry.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.js +0 -100
- package/dist/src/orchestrator/types.d.ts.map +0 -1
- package/dist/src/orchestrator/types.js +0 -15
- package/dist/src/orchestrator/utils.d.ts +0 -3
- package/dist/src/orchestrator/utils.d.ts.map +0 -1
- package/dist/src/orchestrator/utils.js +0 -22
- package/dist/src/types.d.ts +0 -466
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/utils/walletClient.d.ts +0 -34
- package/dist/src/utils/walletClient.d.ts.map +0 -1
- package/dist/src/utils/walletClient.js +0 -117
- /package/dist/src/{types.js → accounts/adapter.js} +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { SigningPipelineError } from './error.js';
|
|
2
|
+
import { materializeSigningStage, validateSigningPlan } from './plan.js';
|
|
3
|
+
export async function executeSigningPlan(input) {
|
|
4
|
+
try {
|
|
5
|
+
validateSigningPlan(input.plan);
|
|
6
|
+
}
|
|
7
|
+
catch (cause) {
|
|
8
|
+
if (cause instanceof SigningPipelineError)
|
|
9
|
+
throw cause;
|
|
10
|
+
throw pipelineError(input.plan, 'plan', 'Signing plan validation failed', {}, cause);
|
|
11
|
+
}
|
|
12
|
+
for (const stage of input.plan.stages) {
|
|
13
|
+
for (const task of stage.taskTemplates) {
|
|
14
|
+
if (!task.when &&
|
|
15
|
+
input.signerInvoker.has &&
|
|
16
|
+
!input.signerInvoker.has(task.signer)) {
|
|
17
|
+
throw pipelineError(input.plan, 'invoke', `Missing signer ${task.signer.id}`, {
|
|
18
|
+
stageId: stage.id,
|
|
19
|
+
taskId: task.id,
|
|
20
|
+
signerRole: task.role,
|
|
21
|
+
...(task.chain ? { chain: task.chain } : {}),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const priorOutputs = {};
|
|
27
|
+
const transcripts = [];
|
|
28
|
+
for (const stagePlan of input.plan.stages) {
|
|
29
|
+
let facts = [];
|
|
30
|
+
if (stagePlan.checkpoint.kind !== 'none') {
|
|
31
|
+
try {
|
|
32
|
+
facts = await input.checkpoints.read(stagePlan.checkpoint);
|
|
33
|
+
}
|
|
34
|
+
catch (cause) {
|
|
35
|
+
throw pipelineError(input.plan, 'read', `Signing checkpoint ${stagePlan.checkpoint.id} failed`, { stageId: stagePlan.id }, cause);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
let declaredPriorOutputs;
|
|
39
|
+
let stage;
|
|
40
|
+
try {
|
|
41
|
+
declaredPriorOutputs = selectDeclaredPriorOutputs(stagePlan, priorOutputs);
|
|
42
|
+
stage = materializeSigningStage({
|
|
43
|
+
plan: input.plan,
|
|
44
|
+
stage: stagePlan,
|
|
45
|
+
payloads: input.payloads,
|
|
46
|
+
facts,
|
|
47
|
+
priorOutputs: declaredPriorOutputs,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (cause) {
|
|
51
|
+
throw pipelineError(input.plan, 'plan', `Signing stage ${stagePlan.id} materialization failed`, { stageId: stagePlan.id }, cause);
|
|
52
|
+
}
|
|
53
|
+
for (const task of stage.tasks) {
|
|
54
|
+
if (task.when &&
|
|
55
|
+
input.signerInvoker.has &&
|
|
56
|
+
!input.signerInvoker.has(task.signer)) {
|
|
57
|
+
throw pipelineError(input.plan, 'invoke', `Missing signer ${task.signer.id}`, {
|
|
58
|
+
stageId: stage.stageId,
|
|
59
|
+
taskId: task.id,
|
|
60
|
+
signerRole: task.role,
|
|
61
|
+
...(task.chain ? { chain: task.chain } : {}),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const results = {};
|
|
66
|
+
const invoke = async (taskId) => {
|
|
67
|
+
const task = stage.tasks.find(({ id }) => id === taskId);
|
|
68
|
+
if (!task)
|
|
69
|
+
throw new Error(`Unknown materialized signing task ${taskId}`);
|
|
70
|
+
try {
|
|
71
|
+
results[task.id] = await input.signerInvoker.invoke(task.signer, task.invocation);
|
|
72
|
+
}
|
|
73
|
+
catch (cause) {
|
|
74
|
+
throw pipelineError(input.plan, 'invoke', `Signing task ${task.id} failed`, {
|
|
75
|
+
stageId: stage.stageId,
|
|
76
|
+
taskId: task.id,
|
|
77
|
+
signerRole: task.role,
|
|
78
|
+
...(task.chain ? { chain: task.chain } : {}),
|
|
79
|
+
}, cause);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
for (const batch of stage.schedule) {
|
|
83
|
+
if (batch.execution === 'parallel') {
|
|
84
|
+
await Promise.all(batch.taskIds.map(invoke));
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
for (const taskId of batch.taskIds)
|
|
88
|
+
await invoke(taskId);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
let outputs;
|
|
92
|
+
try {
|
|
93
|
+
outputs = input.assembleStage({
|
|
94
|
+
plan: input.plan,
|
|
95
|
+
stagePlan,
|
|
96
|
+
stage,
|
|
97
|
+
results,
|
|
98
|
+
priorOutputs: declaredPriorOutputs,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
catch (cause) {
|
|
102
|
+
if (cause instanceof SigningPipelineError)
|
|
103
|
+
throw cause;
|
|
104
|
+
throw pipelineError(input.plan, 'final-assembly', `Signing stage ${stage.stageId} assembly failed`, { stageId: stage.stageId }, cause);
|
|
105
|
+
}
|
|
106
|
+
for (const artifact of stagePlan.artifacts) {
|
|
107
|
+
const output = outputs[artifact.id];
|
|
108
|
+
if (output === undefined) {
|
|
109
|
+
throw pipelineError(input.plan, 'final-assembly', `Assembler omitted artifact ${artifact.id}`, { stageId: stage.stageId, artifactId: artifact.id });
|
|
110
|
+
}
|
|
111
|
+
priorOutputs[`${stage.stageId}:${artifact.id}`] = output;
|
|
112
|
+
}
|
|
113
|
+
transcripts.push({ stage, results, outputs });
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
planKind: input.plan.kind,
|
|
117
|
+
payloadId: input.plan.payload.id,
|
|
118
|
+
stages: transcripts,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function selectDeclaredPriorOutputs(stage, outputs) {
|
|
122
|
+
return Object.fromEntries(stage.priorOutputs.map((reference) => {
|
|
123
|
+
const key = `${reference.stageId}:${reference.outputId}`;
|
|
124
|
+
const output = outputs[key];
|
|
125
|
+
if (output === undefined) {
|
|
126
|
+
throw new Error(`Declared prior output ${key} is unavailable`);
|
|
127
|
+
}
|
|
128
|
+
return [key, output];
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
function pipelineError(plan, failureStage, message, context, cause) {
|
|
132
|
+
return new SigningPipelineError(message, {
|
|
133
|
+
planKind: plan.kind,
|
|
134
|
+
payloadKind: plan.payload.kind,
|
|
135
|
+
failureStage,
|
|
136
|
+
...context,
|
|
137
|
+
}, cause === undefined ? undefined : { cause });
|
|
138
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Hex } from 'viem';
|
|
2
|
+
import type { SigningContext } from '../context.js';
|
|
3
|
+
import type { SigningStageAssemblyInput } from '../execute.js';
|
|
4
|
+
import type { ArtifactAssemblyPlan, SigningArtifact } from '../types.js';
|
|
5
|
+
export declare function assembleIntentStage(input: SigningStageAssemblyInput, context: SigningContext): Readonly<Record<string, SigningArtifact>>;
|
|
6
|
+
export declare function assembleIntentValidatorArtifact(input: {
|
|
7
|
+
readonly artifact: ArtifactAssemblyPlan;
|
|
8
|
+
readonly context: SigningContext;
|
|
9
|
+
readonly validatorContribution: Hex;
|
|
10
|
+
readonly diagnostics?: {
|
|
11
|
+
readonly plan: SigningStageAssemblyInput['plan'];
|
|
12
|
+
readonly stageId: string;
|
|
13
|
+
};
|
|
14
|
+
}): Hex;
|
|
15
|
+
//# sourceMappingURL=assemble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../signing/intent-plans/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAGhD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAE3D,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAErE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,yBAAyB,EAChC,OAAO,EAAE,cAAc,GACtB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAsB3C;AAED,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IACrD,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAA;IACvC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;IAChC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,CAAA;IACnC,QAAQ,CAAC,WAAW,CAAC,EAAE;QACrB,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC,MAAM,CAAC,CAAA;QAChD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KACzB,CAAA;CACF,GAAG,GAAG,CAsCN"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { encodePlannedValidatorContribution } from '../contribution.js';
|
|
2
|
+
import { runSigningStep } from '../error.js';
|
|
3
|
+
import { wrapErc7739TypedDataSignature } from '../protocols/erc7739.js';
|
|
4
|
+
export function assembleIntentStage(input, context) {
|
|
5
|
+
const outputs = {};
|
|
6
|
+
for (const artifact of input.stagePlan.artifacts) {
|
|
7
|
+
if (artifact.input.kind === 'session-claim-pair')
|
|
8
|
+
continue;
|
|
9
|
+
outputs[artifact.id] =
|
|
10
|
+
artifact.input.kind === 'reuse-artifact'
|
|
11
|
+
? resolveReusedArtifact(artifact.id, artifact.input, input.priorOutputs)
|
|
12
|
+
: assembleSignedArtifact(input, artifact, context);
|
|
13
|
+
}
|
|
14
|
+
for (const artifact of input.stagePlan.artifacts) {
|
|
15
|
+
if (artifact.input.kind !== 'session-claim-pair')
|
|
16
|
+
continue;
|
|
17
|
+
const preClaimSig = outputs[artifact.input.preClaimArtifactId];
|
|
18
|
+
const notarizedClaimSig = outputs[artifact.input.notarizedClaimArtifactId];
|
|
19
|
+
if (typeof preClaimSig !== 'string' ||
|
|
20
|
+
typeof notarizedClaimSig !== 'string') {
|
|
21
|
+
throw new Error(`Session claim pair ${artifact.id} is incomplete`);
|
|
22
|
+
}
|
|
23
|
+
outputs[artifact.id] = { preClaimSig, notarizedClaimSig };
|
|
24
|
+
}
|
|
25
|
+
return outputs;
|
|
26
|
+
}
|
|
27
|
+
export function assembleIntentValidatorArtifact(input) {
|
|
28
|
+
if (input.artifact.erc6492.kind !== 'none') {
|
|
29
|
+
throw new Error('ERC-6492 is forbidden for intent signatures');
|
|
30
|
+
}
|
|
31
|
+
const step = (failureStage, operation) => input.diagnostics
|
|
32
|
+
? runSigningStep({
|
|
33
|
+
plan: input.diagnostics.plan,
|
|
34
|
+
failureStage,
|
|
35
|
+
stageId: input.diagnostics.stageId,
|
|
36
|
+
artifactId: input.artifact.id,
|
|
37
|
+
usage: input.artifact.usage,
|
|
38
|
+
operation,
|
|
39
|
+
})
|
|
40
|
+
: operation();
|
|
41
|
+
let contribution = input.validatorContribution;
|
|
42
|
+
const erc7739 = input.artifact.erc7739;
|
|
43
|
+
if (erc7739.kind === 'wrap-typed-data') {
|
|
44
|
+
contribution = step('protocol-operation', () => wrapErc7739TypedDataSignature({
|
|
45
|
+
typedData: erc7739.typedData,
|
|
46
|
+
signature: contribution,
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
return input.artifact.accountEnvelope.kind === 'none'
|
|
50
|
+
? contribution
|
|
51
|
+
: step('account-envelope', () => input.context.accountAdapter.encodeSignatureEnvelope({
|
|
52
|
+
account: input.context.account,
|
|
53
|
+
envelope: input.artifact.accountEnvelope,
|
|
54
|
+
validatorContribution: contribution,
|
|
55
|
+
purpose: 'intent',
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
function assembleSignedArtifact(input, artifact, context) {
|
|
59
|
+
if (artifact.validatorCodec.kind === 'none') {
|
|
60
|
+
if (artifact.input.kind !== 'task-results' ||
|
|
61
|
+
artifact.input.taskIds.length !== 1) {
|
|
62
|
+
throw new Error(`Direct artifact ${artifact.id} requires one task`);
|
|
63
|
+
}
|
|
64
|
+
const result = input.results[artifact.input.taskIds[0]];
|
|
65
|
+
if (result?.kind !== 'ecdsa-signature') {
|
|
66
|
+
throw new Error(`Direct artifact ${artifact.id} requires an ECDSA result`);
|
|
67
|
+
}
|
|
68
|
+
return result.signature;
|
|
69
|
+
}
|
|
70
|
+
return assembleIntentValidatorArtifact({
|
|
71
|
+
artifact,
|
|
72
|
+
context,
|
|
73
|
+
validatorContribution: runSigningStep({
|
|
74
|
+
plan: input.plan,
|
|
75
|
+
failureStage: 'validator-encode',
|
|
76
|
+
stageId: input.stage.stageId,
|
|
77
|
+
artifactId: artifact.id,
|
|
78
|
+
usage: artifact.usage,
|
|
79
|
+
operation: () => encodePlannedValidatorContribution({
|
|
80
|
+
artifact,
|
|
81
|
+
stage: input.stage,
|
|
82
|
+
results: input.results,
|
|
83
|
+
}),
|
|
84
|
+
}),
|
|
85
|
+
diagnostics: { plan: input.plan, stageId: input.stage.stageId },
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function resolveReusedArtifact(artifactId, route, priorOutputs) {
|
|
89
|
+
const source = priorOutputs[`${route.stageId}:${route.artifactId}`];
|
|
90
|
+
if (typeof source === 'string')
|
|
91
|
+
return source;
|
|
92
|
+
if (source && route.selection === 'pre-claim' && 'preClaimSig' in source) {
|
|
93
|
+
return source.preClaimSig;
|
|
94
|
+
}
|
|
95
|
+
throw new Error(`Reused artifact ${route.artifactId} is unavailable for ${artifactId}`);
|
|
96
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Account, Address, Hex } from 'viem';
|
|
2
|
+
import type { WebAuthnAccount } from 'viem/account-abstraction';
|
|
3
|
+
import type { SigningContext } from '../context.js';
|
|
4
|
+
import type { ArtifactAssemblyPlan } from '../types.js';
|
|
5
|
+
export interface IndependentOwnerDescriptor {
|
|
6
|
+
readonly ownerId: string;
|
|
7
|
+
readonly identity: Address | Hex;
|
|
8
|
+
readonly kind: 'ecdsa' | 'webauthn';
|
|
9
|
+
readonly factorId?: string;
|
|
10
|
+
readonly factorPublicId?: number | Hex;
|
|
11
|
+
}
|
|
12
|
+
export type IndependentOwnerSignatureData = {
|
|
13
|
+
readonly kind: 'ecdsa';
|
|
14
|
+
readonly signer: Address;
|
|
15
|
+
readonly origin: readonly Hex[];
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: 'passkey';
|
|
18
|
+
readonly publicKey: Hex;
|
|
19
|
+
readonly origin: readonly {
|
|
20
|
+
readonly webauthn: {
|
|
21
|
+
readonly authenticatorData: Hex;
|
|
22
|
+
readonly challengeIndex?: number;
|
|
23
|
+
readonly clientDataJSON: string;
|
|
24
|
+
readonly typeIndex?: number;
|
|
25
|
+
readonly userVerificationRequired?: boolean;
|
|
26
|
+
};
|
|
27
|
+
readonly signature: Hex;
|
|
28
|
+
}[];
|
|
29
|
+
};
|
|
30
|
+
export type IndependentOwnerSignature = ({
|
|
31
|
+
readonly intentId: string;
|
|
32
|
+
} & IndependentOwnerSignatureData) | {
|
|
33
|
+
readonly intentId: string;
|
|
34
|
+
readonly kind: 'multi-factor';
|
|
35
|
+
readonly validatorId: number | Hex;
|
|
36
|
+
readonly signature: IndependentOwnerSignatureData;
|
|
37
|
+
};
|
|
38
|
+
export declare function assembleIndependentIntentArtifact(input: {
|
|
39
|
+
readonly intentId: string;
|
|
40
|
+
readonly originIndex: number;
|
|
41
|
+
readonly originCount: number;
|
|
42
|
+
readonly signatures: readonly IndependentOwnerSignature[];
|
|
43
|
+
readonly owners: readonly IndependentOwnerDescriptor[];
|
|
44
|
+
readonly artifact: ArtifactAssemblyPlan;
|
|
45
|
+
readonly context: SigningContext;
|
|
46
|
+
}): Hex;
|
|
47
|
+
export type IndependentSigner = Account | WebAuthnAccount;
|
|
48
|
+
//# sourceMappingURL=independent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"independent.d.ts","sourceRoot":"","sources":["../../../../signing/intent-plans/independent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAY/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAGpD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,GAAG,CAAA;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAAA;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CACvC;AAED,MAAM,MAAM,6BAA6B,GACrC;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,EAAE,CAAA;CAChC,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS;QACxB,QAAQ,CAAC,QAAQ,EAAE;YACjB,QAAQ,CAAC,iBAAiB,EAAE,GAAG,CAAA;YAC/B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;YAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;YAC/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;YAC3B,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAA;SAC5C,CAAA;QACD,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAA;KACxB,EAAE,CAAA;CACJ,CAAA;AAEL,MAAM,MAAM,yBAAyB,GACjC,CAAC;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,6BAA6B,CAAC,GAC/D;IACE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,GAAG,CAAA;IAClC,QAAQ,CAAC,SAAS,EAAE,6BAA6B,CAAA;CAClD,CAAA;AAEL,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACvD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,UAAU,EAAE,SAAS,yBAAyB,EAAE,CAAA;IACzD,QAAQ,CAAC,MAAM,EAAE,SAAS,0BAA0B,EAAE,CAAA;IACtD,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAA;IACvC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;CACjC,GAAG,GAAG,CA2BN;AAoLD,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,eAAe,CAAA"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { InsufficientOwnerSignaturesError, MismatchedOwnerSignaturesError, UnknownOwnerError, } from '../../errors/execution.js';
|
|
2
|
+
import { encodeValidatorContribution } from '../../modules/validators/contribution.js';
|
|
3
|
+
import { encodeValidatorId } from '../../modules/validators/multi-factor.js';
|
|
4
|
+
import { assembleIntentValidatorArtifact } from './assemble.js';
|
|
5
|
+
export function assembleIndependentIntentArtifact(input) {
|
|
6
|
+
if (input.artifact.validatorCodec.kind === 'none') {
|
|
7
|
+
throw new Error('Independent signing requires a validator codec');
|
|
8
|
+
}
|
|
9
|
+
if (input.artifact.validatorCodec.kind === 'smart-session-state') {
|
|
10
|
+
throw new Error('Smart Session state cannot be signed independently');
|
|
11
|
+
}
|
|
12
|
+
const contributions = importOwnerContributions(input);
|
|
13
|
+
const codec = input.artifact.validatorCodec;
|
|
14
|
+
if (codec.kind === 'smart-session') {
|
|
15
|
+
throw new Error('Smart Session state cannot be signed independently');
|
|
16
|
+
}
|
|
17
|
+
const validatorContribution = input.artifact.validatorFactors
|
|
18
|
+
? encodeIndependentFactors(codec, input.artifact.validatorFactors, contributions)
|
|
19
|
+
: encodeAtomicContributions(codec, contributions.map(({ contribution }) => contribution));
|
|
20
|
+
return assembleIntentValidatorArtifact({
|
|
21
|
+
artifact: input.artifact,
|
|
22
|
+
context: input.context,
|
|
23
|
+
validatorContribution,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function importOwnerContributions(input) {
|
|
27
|
+
const seen = new Set();
|
|
28
|
+
return input.signatures.map((value) => {
|
|
29
|
+
if (value.intentId !== input.intentId) {
|
|
30
|
+
throw new MismatchedOwnerSignaturesError({
|
|
31
|
+
context: { intentIds: [input.intentId, value.intentId] },
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const signature = value.kind === 'multi-factor' ? value.signature : value;
|
|
35
|
+
if (signature.origin.length !== input.originCount) {
|
|
36
|
+
throw new MismatchedOwnerSignaturesError({
|
|
37
|
+
context: { expectedOriginCount: input.originCount },
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const identity = signature.kind === 'ecdsa'
|
|
41
|
+
? signature.signer.toLowerCase()
|
|
42
|
+
: signature.publicKey.toLowerCase();
|
|
43
|
+
const owner = input.owners.find((candidate) => candidate.identity.toLowerCase() === identity &&
|
|
44
|
+
(value.kind === 'multi-factor'
|
|
45
|
+
? candidate.factorPublicId !== undefined &&
|
|
46
|
+
sameValidatorId(candidate.factorPublicId, value.validatorId)
|
|
47
|
+
: candidate.factorId === undefined));
|
|
48
|
+
if (!owner) {
|
|
49
|
+
const matchingIdentity = input.owners.filter((candidate) => candidate.identity.toLowerCase() === identity);
|
|
50
|
+
if (matchingIdentity.length > 0 &&
|
|
51
|
+
(value.kind === 'multi-factor' ||
|
|
52
|
+
matchingIdentity.some(({ factorId }) => factorId !== undefined))) {
|
|
53
|
+
throw new MismatchedOwnerSignaturesError({
|
|
54
|
+
context: value.kind === 'multi-factor'
|
|
55
|
+
? { validatorId: value.validatorId }
|
|
56
|
+
: { expectedKind: 'multi-factor' },
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
throw new UnknownOwnerError({
|
|
60
|
+
context: signature.kind === 'passkey'
|
|
61
|
+
? { publicKey: signature.publicKey }
|
|
62
|
+
: { signer: signature.signer },
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const contributionKey = `${owner.factorId ?? 'root'}:${identity}`;
|
|
66
|
+
if (seen.has(contributionKey))
|
|
67
|
+
throw new MismatchedOwnerSignaturesError({
|
|
68
|
+
context: { duplicateOwner: identity },
|
|
69
|
+
});
|
|
70
|
+
seen.add(contributionKey);
|
|
71
|
+
if ((signature.kind === 'ecdsa' && owner.kind !== 'ecdsa') ||
|
|
72
|
+
(signature.kind === 'passkey' && owner.kind !== 'webauthn')) {
|
|
73
|
+
throw new MismatchedOwnerSignaturesError({
|
|
74
|
+
context: { owner: identity },
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const contribution = signature.kind === 'ecdsa'
|
|
78
|
+
? {
|
|
79
|
+
kind: 'ecdsa',
|
|
80
|
+
ownerId: owner.ownerId,
|
|
81
|
+
signature: signature.origin[input.originIndex],
|
|
82
|
+
encoding: 'validator-contribution',
|
|
83
|
+
}
|
|
84
|
+
: {
|
|
85
|
+
kind: 'webauthn',
|
|
86
|
+
ownerId: owner.ownerId,
|
|
87
|
+
publicKey: signature.publicKey,
|
|
88
|
+
signature: signature.origin[input.originIndex].signature,
|
|
89
|
+
authenticatorData: signature.origin[input.originIndex].webauthn.authenticatorData,
|
|
90
|
+
clientDataJSON: signature.origin[input.originIndex].webauthn.clientDataJSON,
|
|
91
|
+
challengeIndex: signature.origin[input.originIndex].webauthn.challengeIndex ?? 0,
|
|
92
|
+
typeIndex: signature.origin[input.originIndex].webauthn.typeIndex ?? 0,
|
|
93
|
+
userVerificationRequired: signature.origin[input.originIndex].webauthn
|
|
94
|
+
.userVerificationRequired ?? false,
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
...(owner.factorId ? { factorId: owner.factorId } : {}),
|
|
98
|
+
contribution,
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function sameValidatorId(left, right) {
|
|
103
|
+
try {
|
|
104
|
+
return (encodeValidatorId(left).toLowerCase() ===
|
|
105
|
+
encodeValidatorId(right).toLowerCase());
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function encodeIndependentFactors(codec, factors, contributions) {
|
|
112
|
+
const factorContributions = factors.flatMap((factor) => {
|
|
113
|
+
const selected = contributions.flatMap((entry) => entry.factorId === factor.id ? [entry.contribution] : []);
|
|
114
|
+
if (selected.length === 0)
|
|
115
|
+
return [];
|
|
116
|
+
if (selected.length < factor.codec.threshold) {
|
|
117
|
+
throw new InsufficientOwnerSignaturesError({
|
|
118
|
+
required: factor.codec.threshold,
|
|
119
|
+
provided: selected.length,
|
|
120
|
+
validatorId: factor.publicId,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return [
|
|
124
|
+
{
|
|
125
|
+
kind: 'factor',
|
|
126
|
+
factorId: factor.id,
|
|
127
|
+
publicId: factor.publicId,
|
|
128
|
+
validator: factor.validator,
|
|
129
|
+
contribution: encodeValidatorContribution(factor.codec, selected),
|
|
130
|
+
},
|
|
131
|
+
];
|
|
132
|
+
});
|
|
133
|
+
if (factorContributions.length < codec.threshold) {
|
|
134
|
+
throw new InsufficientOwnerSignaturesError({
|
|
135
|
+
required: codec.threshold,
|
|
136
|
+
provided: factorContributions.length,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return encodeValidatorContribution(codec, factorContributions);
|
|
140
|
+
}
|
|
141
|
+
function encodeAtomicContributions(codec, contributions) {
|
|
142
|
+
if (codec.kind === 'ordered-threshold' &&
|
|
143
|
+
contributions.length < codec.threshold) {
|
|
144
|
+
throw new InsufficientOwnerSignaturesError({
|
|
145
|
+
required: codec.threshold,
|
|
146
|
+
provided: contributions.length,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return encodeValidatorContribution(codec, contributions);
|
|
150
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SigningContext } from '../context.js';
|
|
2
|
+
import type { SigningCheckpointPort, SigningPlan, SigningTranscript } from '../types.js';
|
|
3
|
+
import type { IndependentSigningProjection, IntentSigningPlanCreationInput } from './types.js';
|
|
4
|
+
export declare function createIntentSigningPlan(input: IntentSigningPlanCreationInput): SigningPlan;
|
|
5
|
+
export declare function projectIndependentSigning(plan: SigningPlan, signerIds: readonly string[], ownerIds?: readonly string[]): {
|
|
6
|
+
readonly plan: SigningPlan;
|
|
7
|
+
readonly projection: IndependentSigningProjection;
|
|
8
|
+
};
|
|
9
|
+
export declare function executeIntentSigning(input: {
|
|
10
|
+
readonly planInput: IntentSigningPlanCreationInput;
|
|
11
|
+
readonly context: SigningContext;
|
|
12
|
+
readonly checkpoints: SigningCheckpointPort;
|
|
13
|
+
}): Promise<SigningTranscript>;
|
|
14
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../signing/intent-plans/plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EAClB,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EACV,4BAA4B,EAC5B,8BAA8B,EAC/B,MAAM,SAAS,CAAA;AAEhB,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,8BAA8B,GACpC,WAAW,CAoEb;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,GAC3B;IACD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAC1B,QAAQ,CAAC,UAAU,EAAE,4BAA4B,CAAA;CAClD,CA8DA;AAoFD,wBAAsB,oBAAoB,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,SAAS,EAAE,8BAA8B,CAAA;IAClD,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;IAChC,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAA;CAC5C,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAS7B"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { executeSigningPlan } from '../execute.js';
|
|
2
|
+
import { assembleIntentStage } from './assemble.js';
|
|
3
|
+
export function createIntentSigningPlan(input) {
|
|
4
|
+
const targetArtifact = input.intent.target
|
|
5
|
+
? requireSingleArtifact(input.intent.artifacts.filter(({ usage, payloadId }) => usage === 'intent-target' && payloadId === input.intent.target?.id), 'target')
|
|
6
|
+
: undefined;
|
|
7
|
+
const plan = {
|
|
8
|
+
version: 1,
|
|
9
|
+
kind: 'intent-full',
|
|
10
|
+
payload: { kind: 'intent', id: input.intent.id },
|
|
11
|
+
configuredTopology: input.intent.configuredTopology,
|
|
12
|
+
effectiveSelection: input.intent.effectiveSelection,
|
|
13
|
+
preparedIntent: {
|
|
14
|
+
signatureMode: input.intent.preparedSignatureMode,
|
|
15
|
+
artifacts: input.intent.artifacts.map(({ id, usage, payloadId, cardinality, shape }) => ({
|
|
16
|
+
id,
|
|
17
|
+
usage,
|
|
18
|
+
payloadId,
|
|
19
|
+
cardinality,
|
|
20
|
+
shape,
|
|
21
|
+
})),
|
|
22
|
+
...(input.intent.destination
|
|
23
|
+
? {
|
|
24
|
+
destination: input.intent.destination.mode === 'sign'
|
|
25
|
+
? {
|
|
26
|
+
mode: 'sign',
|
|
27
|
+
artifactId: input.intent.destination.artifactId,
|
|
28
|
+
payloadId: input.intent.destination.payload.id,
|
|
29
|
+
}
|
|
30
|
+
: input.intent.destination,
|
|
31
|
+
}
|
|
32
|
+
: {}),
|
|
33
|
+
...(targetArtifact
|
|
34
|
+
? {
|
|
35
|
+
target: {
|
|
36
|
+
artifactId: targetArtifact.id,
|
|
37
|
+
payloadId: targetArtifact.payloadId,
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
: {}),
|
|
41
|
+
},
|
|
42
|
+
stages: input.stages.map((stage) => ({
|
|
43
|
+
id: stage.id,
|
|
44
|
+
checkpoint: stage.checkpoint,
|
|
45
|
+
priorOutputs: stage.priorOutputs,
|
|
46
|
+
taskTemplates: stage.tasks,
|
|
47
|
+
schedule: stage.schedule,
|
|
48
|
+
artifacts: stage.artifacts.map((artifact) => ({
|
|
49
|
+
...artifact,
|
|
50
|
+
stageId: stage.id,
|
|
51
|
+
})),
|
|
52
|
+
})),
|
|
53
|
+
publicOutputs: input.intent.artifacts.map((artifact) => ({
|
|
54
|
+
id: artifact.id,
|
|
55
|
+
source: { kind: 'artifact', artifactId: artifact.id },
|
|
56
|
+
exposedForIndependentSigning: artifact.exposedForIndependentSigning,
|
|
57
|
+
})),
|
|
58
|
+
};
|
|
59
|
+
assertPreparedMode(input);
|
|
60
|
+
assertIntentRoutes(input, plan);
|
|
61
|
+
return plan;
|
|
62
|
+
}
|
|
63
|
+
export function projectIndependentSigning(plan, signerIds, ownerIds) {
|
|
64
|
+
if (plan.kind !== 'intent-full') {
|
|
65
|
+
throw new Error('Independent signing requires a full intent plan');
|
|
66
|
+
}
|
|
67
|
+
const selected = new Set(signerIds);
|
|
68
|
+
const selectedOwners = ownerIds ? new Set(ownerIds) : undefined;
|
|
69
|
+
if (selected.size !== signerIds.length) {
|
|
70
|
+
throw new Error('Independent signer selection contains duplicates');
|
|
71
|
+
}
|
|
72
|
+
for (const signerId of selected) {
|
|
73
|
+
if (!plan.effectiveSelection.signerIds.includes(signerId)) {
|
|
74
|
+
throw new Error(`Independent signer ${signerId} is not in the plan`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const stages = plan.stages.map((stage) => {
|
|
78
|
+
const taskTemplates = stage.taskTemplates.filter((task) => selected.has(task.signer.id) &&
|
|
79
|
+
(!selectedOwners ||
|
|
80
|
+
[...selectedOwners].some((ownerId) => task.id.includes(ownerId))));
|
|
81
|
+
const taskIds = new Set(taskTemplates.map(({ id }) => id));
|
|
82
|
+
return {
|
|
83
|
+
...stage,
|
|
84
|
+
priorOutputs: [],
|
|
85
|
+
taskTemplates,
|
|
86
|
+
schedule: stage.schedule
|
|
87
|
+
.map((batch) => ({
|
|
88
|
+
...batch,
|
|
89
|
+
taskIds: batch.taskIds.filter((taskId) => taskIds.has(taskId)),
|
|
90
|
+
}))
|
|
91
|
+
.filter(({ taskIds: ids }) => ids.length > 0),
|
|
92
|
+
artifacts: [],
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
const projected = {
|
|
96
|
+
...plan,
|
|
97
|
+
kind: 'intent-independent',
|
|
98
|
+
effectiveSelection: {
|
|
99
|
+
...plan.effectiveSelection,
|
|
100
|
+
signerIds: plan.effectiveSelection.signerIds.filter((id) => selected.has(id)),
|
|
101
|
+
},
|
|
102
|
+
stages,
|
|
103
|
+
publicOutputs: stages.flatMap((stage) => stage.taskTemplates.map((task) => ({
|
|
104
|
+
id: `${task.id}-contribution`,
|
|
105
|
+
source: { kind: 'task-result', taskId: task.id },
|
|
106
|
+
exposedForIndependentSigning: true,
|
|
107
|
+
}))),
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
plan: projected,
|
|
111
|
+
projection: {
|
|
112
|
+
planKind: 'intent-independent',
|
|
113
|
+
sourceIntentId: plan.payload.id,
|
|
114
|
+
exposedArtifactIds: projected.publicOutputs.map(({ id }) => id),
|
|
115
|
+
selectedSignerIds: [...signerIds],
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function assertIntentRoutes(input, plan) {
|
|
120
|
+
const artifacts = plan.stages.flatMap((stage) => stage.artifacts);
|
|
121
|
+
const requirements = new Map(input.intent.artifacts.map((artifact) => [artifact.id, artifact]));
|
|
122
|
+
if (requirements.size !== input.intent.artifacts.length) {
|
|
123
|
+
throw new Error('Intent artifact requirements contain duplicate ids');
|
|
124
|
+
}
|
|
125
|
+
for (const requirement of input.intent.artifacts) {
|
|
126
|
+
if (!artifacts.some(({ id }) => id === requirement.id)) {
|
|
127
|
+
throw new Error(`Intent artifact ${requirement.id} has no assembly route`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const destination = input.intent.destination;
|
|
131
|
+
if (!destination)
|
|
132
|
+
return;
|
|
133
|
+
const requirement = requirements.get(destination.artifactId);
|
|
134
|
+
if (!requirement || requirement.usage !== 'intent-destination') {
|
|
135
|
+
throw new Error('Intent destination artifact requirement is missing');
|
|
136
|
+
}
|
|
137
|
+
const route = artifacts.find(({ id }) => id === destination.artifactId);
|
|
138
|
+
if (!route)
|
|
139
|
+
throw new Error('Intent destination assembly route is missing');
|
|
140
|
+
if (destination.mode === 'sign') {
|
|
141
|
+
if (requirement.payloadId !== destination.payload.id ||
|
|
142
|
+
route.input.kind !== 'task-results') {
|
|
143
|
+
throw new Error('Intent destination signing route is incompatible');
|
|
144
|
+
}
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (route.input.kind !== 'reuse-artifact' ||
|
|
148
|
+
route.input.artifactId !== destination.originArtifactId ||
|
|
149
|
+
route.input.selection !== destination.selection) {
|
|
150
|
+
throw new Error('Intent destination reuse route is incompatible');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function requireSingleArtifact(artifacts, role) {
|
|
154
|
+
if (artifacts.length !== 1) {
|
|
155
|
+
throw new Error(`Intent ${role} requires exactly one artifact`);
|
|
156
|
+
}
|
|
157
|
+
return artifacts[0];
|
|
158
|
+
}
|
|
159
|
+
function assertPreparedMode(input) {
|
|
160
|
+
const originArtifacts = input.intent.artifacts.filter(({ usage }) => usage === 'intent-origin' ||
|
|
161
|
+
usage === 'intent-pre-claim' ||
|
|
162
|
+
usage === 'intent-notarized-claim');
|
|
163
|
+
const expectedPerOrigin = 1;
|
|
164
|
+
const expected = input.intent.origins.length * expectedPerOrigin;
|
|
165
|
+
if (originArtifacts.length !== expected) {
|
|
166
|
+
throw new Error(`Prepared signature mode requires ${expected} origin artifacts, received ${originArtifacts.length}`);
|
|
167
|
+
}
|
|
168
|
+
const invalidShape = originArtifacts.some(({ shape }) => input.intent.preparedSignatureMode === 'default'
|
|
169
|
+
? shape !== 'hex'
|
|
170
|
+
: !['hex', 'session-claims'].includes(shape));
|
|
171
|
+
if (invalidShape) {
|
|
172
|
+
const expectedShape = input.intent.preparedSignatureMode === 'default'
|
|
173
|
+
? 'hex'
|
|
174
|
+
: 'hex or session-claims';
|
|
175
|
+
throw new Error(`Prepared signature mode requires ${expectedShape} origin artifacts`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
export async function executeIntentSigning(input) {
|
|
179
|
+
const plan = createIntentSigningPlan(input.planInput);
|
|
180
|
+
return executeSigningPlan({
|
|
181
|
+
plan,
|
|
182
|
+
payloads: input.planInput.payloads,
|
|
183
|
+
signerInvoker: input.context.signerInvoker,
|
|
184
|
+
checkpoints: input.checkpoints,
|
|
185
|
+
assembleStage: (stage) => assembleIntentStage(stage, input.context),
|
|
186
|
+
});
|
|
187
|
+
}
|