tenzro-wallet 0.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/LICENSE +201 -0
- package/README.md +128 -0
- package/dist/balance/aggregator.d.ts +16 -0
- package/dist/balance/aggregator.d.ts.map +1 -0
- package/dist/balance/aggregator.js +73 -0
- package/dist/balance/aggregator.js.map +1 -0
- package/dist/balance/index.d.ts +3 -0
- package/dist/balance/index.d.ts.map +1 -0
- package/dist/balance/index.js +2 -0
- package/dist/balance/index.js.map +1 -0
- package/dist/consent/index.d.ts +3 -0
- package/dist/consent/index.d.ts.map +1 -0
- package/dist/consent/index.js +2 -0
- package/dist/consent/index.js.map +1 -0
- package/dist/consent/policy.d.ts +27 -0
- package/dist/consent/policy.d.ts.map +1 -0
- package/dist/consent/policy.js +121 -0
- package/dist/consent/policy.js.map +1 -0
- package/dist/crypto/eip1559.d.ts +53 -0
- package/dist/crypto/eip1559.d.ts.map +1 -0
- package/dist/crypto/eip1559.js +79 -0
- package/dist/crypto/eip1559.js.map +1 -0
- package/dist/crypto/keccak256.d.ts +20 -0
- package/dist/crypto/keccak256.d.ts.map +1 -0
- package/dist/crypto/keccak256.js +167 -0
- package/dist/crypto/keccak256.js.map +1 -0
- package/dist/crypto/rlp.d.ts +30 -0
- package/dist/crypto/rlp.d.ts.map +1 -0
- package/dist/crypto/rlp.js +165 -0
- package/dist/crypto/rlp.js.map +1 -0
- package/dist/crypto/sha256.d.ts +14 -0
- package/dist/crypto/sha256.d.ts.map +1 -0
- package/dist/crypto/sha256.js +33 -0
- package/dist/crypto/sha256.js.map +1 -0
- package/dist/crypto/solana.d.ts +86 -0
- package/dist/crypto/solana.d.ts.map +1 -0
- package/dist/crypto/solana.js +218 -0
- package/dist/crypto/solana.js.map +1 -0
- package/dist/custody/frost/backend.d.ts +59 -0
- package/dist/custody/frost/backend.d.ts.map +1 -0
- package/dist/custody/frost/backend.js +83 -0
- package/dist/custody/frost/backend.js.map +1 -0
- package/dist/custody/frost/coordinator.d.ts +148 -0
- package/dist/custody/frost/coordinator.d.ts.map +1 -0
- package/dist/custody/frost/coordinator.js +58 -0
- package/dist/custody/frost/coordinator.js.map +1 -0
- package/dist/custody/frost/ed25519-driver.d.ts +30 -0
- package/dist/custody/frost/ed25519-driver.d.ts.map +1 -0
- package/dist/custody/frost/ed25519-driver.js +76 -0
- package/dist/custody/frost/ed25519-driver.js.map +1 -0
- package/dist/custody/frost/http-adapter.d.ts +77 -0
- package/dist/custody/frost/http-adapter.d.ts.map +1 -0
- package/dist/custody/frost/http-adapter.js +168 -0
- package/dist/custody/frost/http-adapter.js.map +1 -0
- package/dist/custody/frost/hybrid-driver.d.ts +37 -0
- package/dist/custody/frost/hybrid-driver.d.ts.map +1 -0
- package/dist/custody/frost/hybrid-driver.js +60 -0
- package/dist/custody/frost/hybrid-driver.js.map +1 -0
- package/dist/custody/frost/index.d.ts +12 -0
- package/dist/custody/frost/index.d.ts.map +1 -0
- package/dist/custody/frost/index.js +6 -0
- package/dist/custody/frost/index.js.map +1 -0
- package/dist/custody/frost/secp256k1-driver.d.ts +26 -0
- package/dist/custody/frost/secp256k1-driver.d.ts.map +1 -0
- package/dist/custody/frost/secp256k1-driver.js +78 -0
- package/dist/custody/frost/secp256k1-driver.js.map +1 -0
- package/dist/custody/index.d.ts +9 -0
- package/dist/custody/index.d.ts.map +1 -0
- package/dist/custody/index.js +11 -0
- package/dist/custody/index.js.map +1 -0
- package/dist/custody/internal-mpc.d.ts +14 -0
- package/dist/custody/internal-mpc.d.ts.map +1 -0
- package/dist/custody/internal-mpc.js +40 -0
- package/dist/custody/internal-mpc.js.map +1 -0
- package/dist/custody/mldsa/coordinator.d.ts +63 -0
- package/dist/custody/mldsa/coordinator.d.ts.map +1 -0
- package/dist/custody/mldsa/coordinator.js +44 -0
- package/dist/custody/mldsa/coordinator.js.map +1 -0
- package/dist/custody/mldsa/driver.d.ts +23 -0
- package/dist/custody/mldsa/driver.d.ts.map +1 -0
- package/dist/custody/mldsa/driver.js +43 -0
- package/dist/custody/mldsa/driver.js.map +1 -0
- package/dist/custody/mldsa/http-adapter.d.ts +59 -0
- package/dist/custody/mldsa/http-adapter.d.ts.map +1 -0
- package/dist/custody/mldsa/http-adapter.js +103 -0
- package/dist/custody/mldsa/http-adapter.js.map +1 -0
- package/dist/custody/mldsa/index.d.ts +7 -0
- package/dist/custody/mldsa/index.d.ts.map +1 -0
- package/dist/custody/mldsa/index.js +4 -0
- package/dist/custody/mldsa/index.js.map +1 -0
- package/dist/custody/pairing/http-adapter.d.ts +40 -0
- package/dist/custody/pairing/http-adapter.d.ts.map +1 -0
- package/dist/custody/pairing/http-adapter.js +113 -0
- package/dist/custody/pairing/http-adapter.js.map +1 -0
- package/dist/custody/pairing/index.d.ts +10 -0
- package/dist/custody/pairing/index.d.ts.map +1 -0
- package/dist/custody/pairing/index.js +8 -0
- package/dist/custody/pairing/index.js.map +1 -0
- package/dist/custody/pairing/port.d.ts +121 -0
- package/dist/custody/pairing/port.d.ts.map +1 -0
- package/dist/custody/pairing/port.js +40 -0
- package/dist/custody/pairing/port.js.map +1 -0
- package/dist/custody/passkey-share/http-adapter.d.ts +77 -0
- package/dist/custody/passkey-share/http-adapter.d.ts.map +1 -0
- package/dist/custody/passkey-share/http-adapter.js +125 -0
- package/dist/custody/passkey-share/http-adapter.js.map +1 -0
- package/dist/custody/passkey-share/index.d.ts +7 -0
- package/dist/custody/passkey-share/index.d.ts.map +1 -0
- package/dist/custody/passkey-share/index.js +4 -0
- package/dist/custody/passkey-share/index.js.map +1 -0
- package/dist/custody/passkey-share/unwrapper.d.ts +174 -0
- package/dist/custody/passkey-share/unwrapper.d.ts.map +1 -0
- package/dist/custody/passkey-share/unwrapper.js +132 -0
- package/dist/custody/passkey-share/unwrapper.js.map +1 -0
- package/dist/custody/passkey-share/webauthn-adapter.d.ts +112 -0
- package/dist/custody/passkey-share/webauthn-adapter.d.ts.map +1 -0
- package/dist/custody/passkey-share/webauthn-adapter.js +150 -0
- package/dist/custody/passkey-share/webauthn-adapter.js.map +1 -0
- package/dist/custody/surface-key-id.d.ts +15 -0
- package/dist/custody/surface-key-id.d.ts.map +1 -0
- package/dist/custody/surface-key-id.js +25 -0
- package/dist/custody/surface-key-id.js.map +1 -0
- package/dist/dapp/eip6963.d.ts +64 -0
- package/dist/dapp/eip6963.d.ts.map +1 -0
- package/dist/dapp/eip6963.js +55 -0
- package/dist/dapp/eip6963.js.map +1 -0
- package/dist/dapp/index.d.ts +21 -0
- package/dist/dapp/index.d.ts.map +1 -0
- package/dist/dapp/index.js +24 -0
- package/dist/dapp/index.js.map +1 -0
- package/dist/identity/delegate-set.d.ts +57 -0
- package/dist/identity/delegate-set.d.ts.map +1 -0
- package/dist/identity/delegate-set.js +85 -0
- package/dist/identity/delegate-set.js.map +1 -0
- package/dist/identity/did.d.ts +17 -0
- package/dist/identity/did.d.ts.map +1 -0
- package/dist/identity/did.js +60 -0
- package/dist/identity/did.js.map +1 -0
- package/dist/identity/index.d.ts +14 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +8 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/identity/provision.d.ts +13 -0
- package/dist/identity/provision.d.ts.map +1 -0
- package/dist/identity/provision.js +151 -0
- package/dist/identity/provision.js.map +1 -0
- package/dist/identity/provisioning-http-adapter.d.ts +81 -0
- package/dist/identity/provisioning-http-adapter.d.ts.map +1 -0
- package/dist/identity/provisioning-http-adapter.js +114 -0
- package/dist/identity/provisioning-http-adapter.js.map +1 -0
- package/dist/identity/recovery-http-adapter.d.ts +83 -0
- package/dist/identity/recovery-http-adapter.d.ts.map +1 -0
- package/dist/identity/recovery-http-adapter.js +139 -0
- package/dist/identity/recovery-http-adapter.js.map +1 -0
- package/dist/identity/wallet-new.d.ts +132 -0
- package/dist/identity/wallet-new.d.ts.map +1 -0
- package/dist/identity/wallet-new.js +94 -0
- package/dist/identity/wallet-new.js.map +1 -0
- package/dist/identity/wallet-recover.d.ts +116 -0
- package/dist/identity/wallet-recover.d.ts.map +1 -0
- package/dist/identity/wallet-recover.js +95 -0
- package/dist/identity/wallet-recover.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/kernel.d.ts +119 -0
- package/dist/kernel.d.ts.map +1 -0
- package/dist/kernel.js +144 -0
- package/dist/kernel.js.map +1 -0
- package/dist/ports/adapters/tenzro-identity-adapter.d.ts +44 -0
- package/dist/ports/adapters/tenzro-identity-adapter.d.ts.map +1 -0
- package/dist/ports/adapters/tenzro-identity-adapter.js +60 -0
- package/dist/ports/adapters/tenzro-identity-adapter.js.map +1 -0
- package/dist/ports/adapters/tenzro-sdk-adapter.d.ts +86 -0
- package/dist/ports/adapters/tenzro-sdk-adapter.d.ts.map +1 -0
- package/dist/ports/adapters/tenzro-sdk-adapter.js +100 -0
- package/dist/ports/adapters/tenzro-sdk-adapter.js.map +1 -0
- package/dist/ports/agent/acp.d.ts +66 -0
- package/dist/ports/agent/acp.d.ts.map +1 -0
- package/dist/ports/agent/acp.js +27 -0
- package/dist/ports/agent/acp.js.map +1 -0
- package/dist/ports/agent/adapters/acp-adapter.d.ts +67 -0
- package/dist/ports/agent/adapters/acp-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/acp-adapter.js +70 -0
- package/dist/ports/agent/adapters/acp-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/agent-bond-adapter.d.ts +31 -0
- package/dist/ports/agent/adapters/agent-bond-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/agent-bond-adapter.js +82 -0
- package/dist/ports/agent/adapters/agent-bond-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/agent-payment-adapter.d.ts +66 -0
- package/dist/ports/agent/adapters/agent-payment-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/agent-payment-adapter.js +75 -0
- package/dist/ports/agent/adapters/agent-payment-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/ap2-adapter.d.ts +28 -0
- package/dist/ports/agent/adapters/ap2-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/ap2-adapter.js +97 -0
- package/dist/ports/agent/adapters/ap2-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/auth-approval-adapter.d.ts +26 -0
- package/dist/ports/agent/adapters/auth-approval-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/auth-approval-adapter.js +37 -0
- package/dist/ports/agent/adapters/auth-approval-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/erc7802-adapter.d.ts +30 -0
- package/dist/ports/agent/adapters/erc7802-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/erc7802-adapter.js +60 -0
- package/dist/ports/agent/adapters/erc7802-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/erc8004-adapter.d.ts +54 -0
- package/dist/ports/agent/adapters/erc8004-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/erc8004-adapter.js +53 -0
- package/dist/ports/agent/adapters/erc8004-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/escrow-adapter.d.ts +33 -0
- package/dist/ports/agent/adapters/escrow-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/escrow-adapter.js +109 -0
- package/dist/ports/agent/adapters/escrow-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/fee-estimator-adapter.d.ts +31 -0
- package/dist/ports/agent/adapters/fee-estimator-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/fee-estimator-adapter.js +103 -0
- package/dist/ports/agent/adapters/fee-estimator-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/htlc-escrow-adapter.d.ts +68 -0
- package/dist/ports/agent/adapters/htlc-escrow-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/htlc-escrow-adapter.js +131 -0
- package/dist/ports/agent/adapters/htlc-escrow-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/insurance-adapter.d.ts +32 -0
- package/dist/ports/agent/adapters/insurance-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/insurance-adapter.js +103 -0
- package/dist/ports/agent/adapters/insurance-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/lifecycle-adapter.d.ts +26 -0
- package/dist/ports/agent/adapters/lifecycle-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/lifecycle-adapter.js +136 -0
- package/dist/ports/agent/adapters/lifecycle-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/nanopayment-adapter.d.ts +62 -0
- package/dist/ports/agent/adapters/nanopayment-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/nanopayment-adapter.js +76 -0
- package/dist/ports/agent/adapters/nanopayment-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/payment-rails-adapter.d.ts +67 -0
- package/dist/ports/agent/adapters/payment-rails-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/payment-rails-adapter.js +108 -0
- package/dist/ports/agent/adapters/payment-rails-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/principal-chain-adapter.d.ts +23 -0
- package/dist/ports/agent/adapters/principal-chain-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/principal-chain-adapter.js +156 -0
- package/dist/ports/agent/adapters/principal-chain-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/session-key-adapter.d.ts +45 -0
- package/dist/ports/agent/adapters/session-key-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/session-key-adapter.js +80 -0
- package/dist/ports/agent/adapters/session-key-adapter.js.map +1 -0
- package/dist/ports/agent/adapters/tee-attestation-adapter.d.ts +32 -0
- package/dist/ports/agent/adapters/tee-attestation-adapter.d.ts.map +1 -0
- package/dist/ports/agent/adapters/tee-attestation-adapter.js +38 -0
- package/dist/ports/agent/adapters/tee-attestation-adapter.js.map +1 -0
- package/dist/ports/agent/agent-bond.d.ts +80 -0
- package/dist/ports/agent/agent-bond.d.ts.map +1 -0
- package/dist/ports/agent/agent-bond.js +23 -0
- package/dist/ports/agent/agent-bond.js.map +1 -0
- package/dist/ports/agent/agent-payment.d.ts +72 -0
- package/dist/ports/agent/agent-payment.d.ts.map +1 -0
- package/dist/ports/agent/agent-payment.js +17 -0
- package/dist/ports/agent/agent-payment.js.map +1 -0
- package/dist/ports/agent/ap2.d.ts +104 -0
- package/dist/ports/agent/ap2.d.ts.map +1 -0
- package/dist/ports/agent/ap2.js +22 -0
- package/dist/ports/agent/ap2.js.map +1 -0
- package/dist/ports/agent/auth-approval.d.ts +40 -0
- package/dist/ports/agent/auth-approval.d.ts.map +1 -0
- package/dist/ports/agent/auth-approval.js +23 -0
- package/dist/ports/agent/auth-approval.js.map +1 -0
- package/dist/ports/agent/erc7802.d.ts +94 -0
- package/dist/ports/agent/erc7802.d.ts.map +1 -0
- package/dist/ports/agent/erc7802.js +30 -0
- package/dist/ports/agent/erc7802.js.map +1 -0
- package/dist/ports/agent/erc8004.d.ts +57 -0
- package/dist/ports/agent/erc8004.d.ts.map +1 -0
- package/dist/ports/agent/erc8004.js +20 -0
- package/dist/ports/agent/erc8004.js.map +1 -0
- package/dist/ports/agent/escrow.d.ts +74 -0
- package/dist/ports/agent/escrow.d.ts.map +1 -0
- package/dist/ports/agent/escrow.js +18 -0
- package/dist/ports/agent/escrow.js.map +1 -0
- package/dist/ports/agent/fee-estimator.d.ts +71 -0
- package/dist/ports/agent/fee-estimator.d.ts.map +1 -0
- package/dist/ports/agent/fee-estimator.js +21 -0
- package/dist/ports/agent/fee-estimator.js.map +1 -0
- package/dist/ports/agent/htlc-escrow.d.ts +94 -0
- package/dist/ports/agent/htlc-escrow.d.ts.map +1 -0
- package/dist/ports/agent/htlc-escrow.js +25 -0
- package/dist/ports/agent/htlc-escrow.js.map +1 -0
- package/dist/ports/agent/index.d.ts +58 -0
- package/dist/ports/agent/index.d.ts.map +1 -0
- package/dist/ports/agent/index.js +24 -0
- package/dist/ports/agent/index.js.map +1 -0
- package/dist/ports/agent/insurance.d.ts +65 -0
- package/dist/ports/agent/insurance.d.ts.map +1 -0
- package/dist/ports/agent/insurance.js +18 -0
- package/dist/ports/agent/insurance.js.map +1 -0
- package/dist/ports/agent/lifecycle.d.ts +69 -0
- package/dist/ports/agent/lifecycle.d.ts.map +1 -0
- package/dist/ports/agent/lifecycle.js +17 -0
- package/dist/ports/agent/lifecycle.js.map +1 -0
- package/dist/ports/agent/nanopayment.d.ts +72 -0
- package/dist/ports/agent/nanopayment.d.ts.map +1 -0
- package/dist/ports/agent/nanopayment.js +16 -0
- package/dist/ports/agent/nanopayment.js.map +1 -0
- package/dist/ports/agent/payment-rails.d.ts +140 -0
- package/dist/ports/agent/payment-rails.d.ts.map +1 -0
- package/dist/ports/agent/payment-rails.js +25 -0
- package/dist/ports/agent/payment-rails.js.map +1 -0
- package/dist/ports/agent/principal-chain.d.ts +95 -0
- package/dist/ports/agent/principal-chain.d.ts.map +1 -0
- package/dist/ports/agent/principal-chain.js +16 -0
- package/dist/ports/agent/principal-chain.js.map +1 -0
- package/dist/ports/agent/session-key.d.ts +94 -0
- package/dist/ports/agent/session-key.d.ts.map +1 -0
- package/dist/ports/agent/session-key.js +31 -0
- package/dist/ports/agent/session-key.js.map +1 -0
- package/dist/ports/agent/tee-attestation.d.ts +51 -0
- package/dist/ports/agent/tee-attestation.d.ts.map +1 -0
- package/dist/ports/agent/tee-attestation.js +28 -0
- package/dist/ports/agent/tee-attestation.js.map +1 -0
- package/dist/ports/bridge/adapters/bridge-adapter-base.d.ts +47 -0
- package/dist/ports/bridge/adapters/bridge-adapter-base.d.ts.map +1 -0
- package/dist/ports/bridge/adapters/bridge-adapter-base.js +144 -0
- package/dist/ports/bridge/adapters/bridge-adapter-base.js.map +1 -0
- package/dist/ports/bridge/adapters/canton-bridge-adapter.d.ts +30 -0
- package/dist/ports/bridge/adapters/canton-bridge-adapter.d.ts.map +1 -0
- package/dist/ports/bridge/adapters/canton-bridge-adapter.js +31 -0
- package/dist/ports/bridge/adapters/canton-bridge-adapter.js.map +1 -0
- package/dist/ports/bridge/adapters/ccip-adapter.d.ts +30 -0
- package/dist/ports/bridge/adapters/ccip-adapter.d.ts.map +1 -0
- package/dist/ports/bridge/adapters/ccip-adapter.js +31 -0
- package/dist/ports/bridge/adapters/ccip-adapter.js.map +1 -0
- package/dist/ports/bridge/adapters/debridge-adapter.d.ts +27 -0
- package/dist/ports/bridge/adapters/debridge-adapter.d.ts.map +1 -0
- package/dist/ports/bridge/adapters/debridge-adapter.js +28 -0
- package/dist/ports/bridge/adapters/debridge-adapter.js.map +1 -0
- package/dist/ports/bridge/adapters/layerzero-adapter.d.ts +30 -0
- package/dist/ports/bridge/adapters/layerzero-adapter.d.ts.map +1 -0
- package/dist/ports/bridge/adapters/layerzero-adapter.js +31 -0
- package/dist/ports/bridge/adapters/layerzero-adapter.js.map +1 -0
- package/dist/ports/bridge/adapters/lifi-adapter.d.ts +48 -0
- package/dist/ports/bridge/adapters/lifi-adapter.d.ts.map +1 -0
- package/dist/ports/bridge/adapters/lifi-adapter.js +49 -0
- package/dist/ports/bridge/adapters/lifi-adapter.js.map +1 -0
- package/dist/ports/bridge/adapters/wormhole-adapter.d.ts +26 -0
- package/dist/ports/bridge/adapters/wormhole-adapter.d.ts.map +1 -0
- package/dist/ports/bridge/adapters/wormhole-adapter.js +27 -0
- package/dist/ports/bridge/adapters/wormhole-adapter.js.map +1 -0
- package/dist/ports/bridge/bridge.d.ts +123 -0
- package/dist/ports/bridge/bridge.d.ts.map +1 -0
- package/dist/ports/bridge/bridge.js +20 -0
- package/dist/ports/bridge/bridge.js.map +1 -0
- package/dist/ports/bridge/index.d.ts +13 -0
- package/dist/ports/bridge/index.d.ts.map +1 -0
- package/dist/ports/bridge/index.js +11 -0
- package/dist/ports/bridge/index.js.map +1 -0
- package/dist/ports/canton/adapters/ledger-api-adapter.d.ts +52 -0
- package/dist/ports/canton/adapters/ledger-api-adapter.d.ts.map +1 -0
- package/dist/ports/canton/adapters/ledger-api-adapter.js +232 -0
- package/dist/ports/canton/adapters/ledger-api-adapter.js.map +1 -0
- package/dist/ports/canton/canton-identity.d.ts +60 -0
- package/dist/ports/canton/canton-identity.d.ts.map +1 -0
- package/dist/ports/canton/canton-identity.js +28 -0
- package/dist/ports/canton/canton-identity.js.map +1 -0
- package/dist/ports/canton/canton-validator.d.ts +182 -0
- package/dist/ports/canton/canton-validator.d.ts.map +1 -0
- package/dist/ports/canton/canton-validator.js +39 -0
- package/dist/ports/canton/canton-validator.js.map +1 -0
- package/dist/ports/canton/fingerprint.d.ts +24 -0
- package/dist/ports/canton/fingerprint.d.ts.map +1 -0
- package/dist/ports/canton/fingerprint.js +31 -0
- package/dist/ports/canton/fingerprint.js.map +1 -0
- package/dist/ports/canton/hash.d.ts +37 -0
- package/dist/ports/canton/hash.d.ts.map +1 -0
- package/dist/ports/canton/hash.js +68 -0
- package/dist/ports/canton/hash.js.map +1 -0
- package/dist/ports/canton/http.d.ts +64 -0
- package/dist/ports/canton/http.d.ts.map +1 -0
- package/dist/ports/canton/http.js +177 -0
- package/dist/ports/canton/http.js.map +1 -0
- package/dist/ports/cross-vm.d.ts +79 -0
- package/dist/ports/cross-vm.d.ts.map +1 -0
- package/dist/ports/cross-vm.js +81 -0
- package/dist/ports/cross-vm.js.map +1 -0
- package/dist/ports/index.d.ts +18 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +11 -0
- package/dist/ports/index.js.map +1 -0
- package/dist/ports/tenzro-identity.d.ts +29 -0
- package/dist/ports/tenzro-identity.d.ts.map +1 -0
- package/dist/ports/tenzro-identity.js +19 -0
- package/dist/ports/tenzro-identity.js.map +1 -0
- package/dist/ports/tenzro-rpc.d.ts +79 -0
- package/dist/ports/tenzro-rpc.d.ts.map +1 -0
- package/dist/ports/tenzro-rpc.js +21 -0
- package/dist/ports/tenzro-rpc.js.map +1 -0
- package/dist/router/index.d.ts +3 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +2 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/route.d.ts +17 -0
- package/dist/router/route.d.ts.map +1 -0
- package/dist/router/route.js +78 -0
- package/dist/router/route.js.map +1 -0
- package/dist/settlement/nanopayment-flow.d.ts +48 -0
- package/dist/settlement/nanopayment-flow.d.ts.map +1 -0
- package/dist/settlement/nanopayment-flow.js +111 -0
- package/dist/settlement/nanopayment-flow.js.map +1 -0
- package/dist/surfaces/canton-external.d.ts +43 -0
- package/dist/surfaces/canton-external.d.ts.map +1 -0
- package/dist/surfaces/canton-external.js +252 -0
- package/dist/surfaces/canton-external.js.map +1 -0
- package/dist/surfaces/canton-internal.d.ts +34 -0
- package/dist/surfaces/canton-internal.d.ts.map +1 -0
- package/dist/surfaces/canton-internal.js +163 -0
- package/dist/surfaces/canton-internal.js.map +1 -0
- package/dist/surfaces/canton-onboarding.d.ts +64 -0
- package/dist/surfaces/canton-onboarding.d.ts.map +1 -0
- package/dist/surfaces/canton-onboarding.js +113 -0
- package/dist/surfaces/canton-onboarding.js.map +1 -0
- package/dist/surfaces/evm-on-tenzro.d.ts +29 -0
- package/dist/surfaces/evm-on-tenzro.d.ts.map +1 -0
- package/dist/surfaces/evm-on-tenzro.js +226 -0
- package/dist/surfaces/evm-on-tenzro.js.map +1 -0
- package/dist/surfaces/index.d.ts +13 -0
- package/dist/surfaces/index.d.ts.map +1 -0
- package/dist/surfaces/index.js +7 -0
- package/dist/surfaces/index.js.map +1 -0
- package/dist/surfaces/svm-on-tenzro.d.ts +24 -0
- package/dist/surfaces/svm-on-tenzro.d.ts.map +1 -0
- package/dist/surfaces/svm-on-tenzro.js +238 -0
- package/dist/surfaces/svm-on-tenzro.js.map +1 -0
- package/dist/surfaces/tenzro-native.d.ts +45 -0
- package/dist/surfaces/tenzro-native.d.ts.map +1 -0
- package/dist/surfaces/tenzro-native.js +299 -0
- package/dist/surfaces/tenzro-native.js.map +1 -0
- package/dist/surfaces/util.d.ts +18 -0
- package/dist/surfaces/util.d.ts.map +1 -0
- package/dist/surfaces/util.js +36 -0
- package/dist/surfaces/util.js.map +1 -0
- package/dist/types/asset.d.ts +43 -0
- package/dist/types/asset.d.ts.map +1 -0
- package/dist/types/asset.js +13 -0
- package/dist/types/asset.js.map +1 -0
- package/dist/types/consent.d.ts +46 -0
- package/dist/types/consent.d.ts.map +1 -0
- package/dist/types/consent.js +18 -0
- package/dist/types/consent.js.map +1 -0
- package/dist/types/identity.d.ts +115 -0
- package/dist/types/identity.d.ts.map +1 -0
- package/dist/types/identity.js +12 -0
- package/dist/types/identity.js.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/intent.d.ts +132 -0
- package/dist/types/intent.d.ts.map +1 -0
- package/dist/types/intent.js +8 -0
- package/dist/types/intent.js.map +1 -0
- package/dist/types/signing-driver.d.ts +48 -0
- package/dist/types/signing-driver.d.ts.map +1 -0
- package/dist/types/signing-driver.js +9 -0
- package/dist/types/signing-driver.js.map +1 -0
- package/dist/types/surface-module.d.ts +38 -0
- package/dist/types/surface-module.d.ts.map +1 -0
- package/dist/types/surface-module.js +19 -0
- package/dist/types/surface-module.js.map +1 -0
- package/dist/types/surface.d.ts +17 -0
- package/dist/types/surface.d.ts.map +1 -0
- package/dist/types/surface.js +28 -0
- package/dist/types/surface.js.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PasskeyShareUnwrapper — turns a passkey assertion into a usable
|
|
3
|
+
* `FrostDeviceShareHolder` that the FROST drivers consume.
|
|
4
|
+
*
|
|
5
|
+
* Two strategies, selected at runtime by capability:
|
|
6
|
+
*
|
|
7
|
+
* - PRF mode (preferred). Uses the WebAuthn PRF extension
|
|
8
|
+
* (CTAP2.1 hmac-secret). The authenticator returns
|
|
9
|
+
* `prfResults.first`, a 32-byte symmetric key that we use to
|
|
10
|
+
* decrypt a server-stored share envelope. No additional Tenzro
|
|
11
|
+
* round trip beyond fetching the wrapped envelope.
|
|
12
|
+
*
|
|
13
|
+
* - largeBlob mode (preferred when prf unavailable but largeBlob is).
|
|
14
|
+
* Reads the wrapped share directly from the passkey credential's
|
|
15
|
+
* `largeBlob` storage; no Tenzro round trip at all (the envelope
|
|
16
|
+
* ships with the passkey).
|
|
17
|
+
*
|
|
18
|
+
* - Escrow mode (fallback for authenticators without PRF/largeBlob —
|
|
19
|
+
* e.g. Apple's iOS 17- platform passkeys). The server holds the
|
|
20
|
+
* share encrypted under a key derived from the assertion + a
|
|
21
|
+
* Tenzro-issued pepper. Per assertion = per pepper, so each
|
|
22
|
+
* unwrap is single-use and rate-limited by the node.
|
|
23
|
+
*
|
|
24
|
+
* Tenzro endpoints (Tenzro implements; wallet kernel only consumes):
|
|
25
|
+
*
|
|
26
|
+
* PRF / largeBlob path:
|
|
27
|
+
* 1. `GET /wallet/share/envelope?credentialId=...&surfaceKey=...`
|
|
28
|
+
* Response: `{wrappedShare, alg, salt}`. `wrappedShare` is the
|
|
29
|
+
* ciphertext over the FROST share `s_i`; the device unwraps it
|
|
30
|
+
* with the PRF result (or the largeBlob blob).
|
|
31
|
+
*
|
|
32
|
+
* Escrow path:
|
|
33
|
+
* 1. `POST /wallet/share/escrow/challenge`
|
|
34
|
+
* Body: `{credentialId, surfaceKey}`.
|
|
35
|
+
* Response: `{nonce, expiresAt}`.
|
|
36
|
+
*
|
|
37
|
+
* 2. `POST /wallet/share/escrow/unwrap`
|
|
38
|
+
* Body: `{credentialId, surfaceKey, assertion, nonce}`.
|
|
39
|
+
* The node verifies the assertion against the registered
|
|
40
|
+
* passkey, then derives the per-assertion pepper and returns
|
|
41
|
+
* `{wrappedShare, pepper}`. The device combines them to
|
|
42
|
+
* recover `s_i`.
|
|
43
|
+
*
|
|
44
|
+
* Both paths are single-use per round (the node binds the response
|
|
45
|
+
* to the FROST `sessionId` once known).
|
|
46
|
+
*
|
|
47
|
+
* The unwrapper *itself* is browser-clean (`fetch` + WebCrypto). The
|
|
48
|
+
* authenticator interactions live above this layer in the host app's
|
|
49
|
+
* WebAuthn glue.
|
|
50
|
+
*/
|
|
51
|
+
import type { FrostDeviceShareHolder, FrostScheme } from '../frost/coordinator.js';
|
|
52
|
+
export type ShareUnwrapMode = 'prf' | 'large-blob' | 'escrow';
|
|
53
|
+
/**
|
|
54
|
+
* Capability bag advertised by the host's WebAuthn glue. The host
|
|
55
|
+
* decides at navigator level whether the authenticator supports PRF
|
|
56
|
+
* (CTAP2.1) and largeBlob (CTAP2.1+ extension). The unwrapper consumes
|
|
57
|
+
* these flags and falls back through the priority chain.
|
|
58
|
+
*/
|
|
59
|
+
export interface PasskeyCapabilities {
|
|
60
|
+
readonly prf: boolean;
|
|
61
|
+
readonly largeBlob: boolean;
|
|
62
|
+
/** Always true — escrow is the universal fallback. */
|
|
63
|
+
readonly escrow: true;
|
|
64
|
+
}
|
|
65
|
+
export interface ShareUnwrapRequest {
|
|
66
|
+
readonly credentialId: string;
|
|
67
|
+
readonly surfaceKeyId: string;
|
|
68
|
+
readonly scheme: FrostScheme;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Adapter the unwrapper calls into. Production implementation is the
|
|
72
|
+
* host's WebAuthn layer; tests inject a fake. None of the methods are
|
|
73
|
+
* required by every mode — the unwrapper checks capabilities first.
|
|
74
|
+
*/
|
|
75
|
+
export interface PasskeyAuthenticatorAdapter {
|
|
76
|
+
/** PRF mode: navigate the assertion ceremony with `prf` extension. */
|
|
77
|
+
prfAssertion?(req: ShareUnwrapRequest): Promise<{
|
|
78
|
+
readonly prfOutput: Uint8Array;
|
|
79
|
+
readonly assertion: PasskeyAssertion;
|
|
80
|
+
}>;
|
|
81
|
+
/** largeBlob mode: read the wrapped share blob from the credential. */
|
|
82
|
+
readLargeBlob?(req: ShareUnwrapRequest): Promise<{
|
|
83
|
+
readonly blob: Uint8Array;
|
|
84
|
+
readonly assertion: PasskeyAssertion;
|
|
85
|
+
}>;
|
|
86
|
+
/** Escrow mode: do an assertion ceremony with no extension. */
|
|
87
|
+
basicAssertion(req: ShareUnwrapRequest & {
|
|
88
|
+
readonly nonce: string;
|
|
89
|
+
}): Promise<PasskeyAssertion>;
|
|
90
|
+
}
|
|
91
|
+
/** Same wire shape as `pairing/port.ts` — duplicated here to avoid coupling. */
|
|
92
|
+
export interface PasskeyAssertion {
|
|
93
|
+
readonly credentialId: string;
|
|
94
|
+
readonly clientDataJson: string;
|
|
95
|
+
readonly authenticatorData: string;
|
|
96
|
+
readonly signature: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Server transport. Implements the four `/wallet/share/*` endpoints
|
|
100
|
+
* documented in this file's header. Tenzro provides; kernel consumes.
|
|
101
|
+
*/
|
|
102
|
+
export interface ShareEnvelopePort {
|
|
103
|
+
/** GET /wallet/share/envelope */
|
|
104
|
+
fetchEnvelope(req: ShareUnwrapRequest): Promise<{
|
|
105
|
+
readonly wrappedShare: Uint8Array;
|
|
106
|
+
/** AEAD identifier — `aes-256-gcm` baseline for M5. */
|
|
107
|
+
readonly alg: string;
|
|
108
|
+
/** Salt used by the wrapping HKDF. */
|
|
109
|
+
readonly salt: Uint8Array;
|
|
110
|
+
}>;
|
|
111
|
+
/** POST /wallet/share/escrow/challenge */
|
|
112
|
+
startEscrow(req: ShareUnwrapRequest): Promise<{
|
|
113
|
+
readonly nonce: string;
|
|
114
|
+
readonly expiresAt: number;
|
|
115
|
+
}>;
|
|
116
|
+
/** POST /wallet/share/escrow/unwrap */
|
|
117
|
+
finishEscrow(req: ShareUnwrapRequest & {
|
|
118
|
+
readonly assertion: PasskeyAssertion;
|
|
119
|
+
readonly nonce: string;
|
|
120
|
+
}): Promise<{
|
|
121
|
+
readonly wrappedShare: Uint8Array;
|
|
122
|
+
readonly pepper: Uint8Array;
|
|
123
|
+
}>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Builds a `FrostDeviceShareHolder` from a passkey assertion. The
|
|
127
|
+
* actual FROST commit/respond computation runs inside the device's
|
|
128
|
+
* FROST library, fed with the unwrapped share `s_i`.
|
|
129
|
+
*
|
|
130
|
+
* Production needs a real FROST library binding (zk-crypto WASM,
|
|
131
|
+
* frost-core, etc.) injected as `runFrost`. This module only
|
|
132
|
+
* orchestrates the unwrap → bind → dispose sequence, so the FROST
|
|
133
|
+
* library can be swapped without touching the kernel.
|
|
134
|
+
*/
|
|
135
|
+
export interface FrostBackend {
|
|
136
|
+
commit(args: {
|
|
137
|
+
share: Uint8Array;
|
|
138
|
+
scheme: FrostScheme;
|
|
139
|
+
}): Promise<Uint8Array>;
|
|
140
|
+
respond(args: {
|
|
141
|
+
readonly share: Uint8Array;
|
|
142
|
+
readonly scheme: FrostScheme;
|
|
143
|
+
readonly preimage: Uint8Array;
|
|
144
|
+
readonly groupCommitment: Uint8Array;
|
|
145
|
+
readonly signerSet: readonly string[];
|
|
146
|
+
readonly lambda: Uint8Array;
|
|
147
|
+
}): Promise<Uint8Array>;
|
|
148
|
+
}
|
|
149
|
+
export interface PasskeyShareUnwrapperOptions {
|
|
150
|
+
readonly capabilities: PasskeyCapabilities;
|
|
151
|
+
readonly authenticator: PasskeyAuthenticatorAdapter;
|
|
152
|
+
readonly envelope: ShareEnvelopePort;
|
|
153
|
+
readonly frost: FrostBackend;
|
|
154
|
+
/**
|
|
155
|
+
* Selects the symmetric-decrypt routine. WebCrypto is the default;
|
|
156
|
+
* tests inject a stub. Returns the raw share bytes.
|
|
157
|
+
*/
|
|
158
|
+
readonly aeadDecrypt: (args: {
|
|
159
|
+
readonly key: Uint8Array;
|
|
160
|
+
readonly ciphertext: Uint8Array;
|
|
161
|
+
readonly alg: string;
|
|
162
|
+
readonly salt: Uint8Array;
|
|
163
|
+
}) => Promise<Uint8Array>;
|
|
164
|
+
}
|
|
165
|
+
export declare class PasskeyShareUnwrapper {
|
|
166
|
+
private readonly opts;
|
|
167
|
+
constructor(opts: PasskeyShareUnwrapperOptions);
|
|
168
|
+
/** Capability-driven mode selection. PRF > largeBlob > escrow. */
|
|
169
|
+
pickMode(): ShareUnwrapMode;
|
|
170
|
+
unwrap(req: ShareUnwrapRequest): Promise<FrostDeviceShareHolder>;
|
|
171
|
+
private unwrapShare;
|
|
172
|
+
private bindHolder;
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=unwrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unwrapper.d.ts","sourceRoot":"","sources":["../../../src/custody/passkey-share/unwrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEnF,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,sEAAsE;IACtE,YAAY,CAAC,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAC9C,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;QAC/B,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;KACtC,CAAC,CAAC;IACH,uEAAuE;IACvE,aAAa,CAAC,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAC/C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;QAC1B,QAAQ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@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PasskeyShareUnwrapper — turns a passkey assertion into a usable
|
|
3
|
+
* `FrostDeviceShareHolder` that the FROST drivers consume.
|
|
4
|
+
*
|
|
5
|
+
* Two strategies, selected at runtime by capability:
|
|
6
|
+
*
|
|
7
|
+
* - PRF mode (preferred). Uses the WebAuthn PRF extension
|
|
8
|
+
* (CTAP2.1 hmac-secret). The authenticator returns
|
|
9
|
+
* `prfResults.first`, a 32-byte symmetric key that we use to
|
|
10
|
+
* decrypt a server-stored share envelope. No additional Tenzro
|
|
11
|
+
* round trip beyond fetching the wrapped envelope.
|
|
12
|
+
*
|
|
13
|
+
* - largeBlob mode (preferred when prf unavailable but largeBlob is).
|
|
14
|
+
* Reads the wrapped share directly from the passkey credential's
|
|
15
|
+
* `largeBlob` storage; no Tenzro round trip at all (the envelope
|
|
16
|
+
* ships with the passkey).
|
|
17
|
+
*
|
|
18
|
+
* - Escrow mode (fallback for authenticators without PRF/largeBlob —
|
|
19
|
+
* e.g. Apple's iOS 17- platform passkeys). The server holds the
|
|
20
|
+
* share encrypted under a key derived from the assertion + a
|
|
21
|
+
* Tenzro-issued pepper. Per assertion = per pepper, so each
|
|
22
|
+
* unwrap is single-use and rate-limited by the node.
|
|
23
|
+
*
|
|
24
|
+
* Tenzro endpoints (Tenzro implements; wallet kernel only consumes):
|
|
25
|
+
*
|
|
26
|
+
* PRF / largeBlob path:
|
|
27
|
+
* 1. `GET /wallet/share/envelope?credentialId=...&surfaceKey=...`
|
|
28
|
+
* Response: `{wrappedShare, alg, salt}`. `wrappedShare` is the
|
|
29
|
+
* ciphertext over the FROST share `s_i`; the device unwraps it
|
|
30
|
+
* with the PRF result (or the largeBlob blob).
|
|
31
|
+
*
|
|
32
|
+
* Escrow path:
|
|
33
|
+
* 1. `POST /wallet/share/escrow/challenge`
|
|
34
|
+
* Body: `{credentialId, surfaceKey}`.
|
|
35
|
+
* Response: `{nonce, expiresAt}`.
|
|
36
|
+
*
|
|
37
|
+
* 2. `POST /wallet/share/escrow/unwrap`
|
|
38
|
+
* Body: `{credentialId, surfaceKey, assertion, nonce}`.
|
|
39
|
+
* The node verifies the assertion against the registered
|
|
40
|
+
* passkey, then derives the per-assertion pepper and returns
|
|
41
|
+
* `{wrappedShare, pepper}`. The device combines them to
|
|
42
|
+
* recover `s_i`.
|
|
43
|
+
*
|
|
44
|
+
* Both paths are single-use per round (the node binds the response
|
|
45
|
+
* to the FROST `sessionId` once known).
|
|
46
|
+
*
|
|
47
|
+
* The unwrapper *itself* is browser-clean (`fetch` + WebCrypto). The
|
|
48
|
+
* authenticator interactions live above this layer in the host app's
|
|
49
|
+
* WebAuthn glue.
|
|
50
|
+
*/
|
|
51
|
+
export class PasskeyShareUnwrapper {
|
|
52
|
+
opts;
|
|
53
|
+
constructor(opts) {
|
|
54
|
+
this.opts = opts;
|
|
55
|
+
}
|
|
56
|
+
/** Capability-driven mode selection. PRF > largeBlob > escrow. */
|
|
57
|
+
pickMode() {
|
|
58
|
+
if (this.opts.capabilities.prf && this.opts.authenticator.prfAssertion) {
|
|
59
|
+
return 'prf';
|
|
60
|
+
}
|
|
61
|
+
if (this.opts.capabilities.largeBlob && this.opts.authenticator.readLargeBlob) {
|
|
62
|
+
return 'large-blob';
|
|
63
|
+
}
|
|
64
|
+
return 'escrow';
|
|
65
|
+
}
|
|
66
|
+
async unwrap(req) {
|
|
67
|
+
const mode = this.pickMode();
|
|
68
|
+
const share = await this.unwrapShare(mode, req);
|
|
69
|
+
return this.bindHolder(share, req.scheme);
|
|
70
|
+
}
|
|
71
|
+
async unwrapShare(mode, req) {
|
|
72
|
+
if (mode === 'prf') {
|
|
73
|
+
const { prfOutput } = await this.opts.authenticator.prfAssertion(req);
|
|
74
|
+
const env = await this.opts.envelope.fetchEnvelope(req);
|
|
75
|
+
return this.opts.aeadDecrypt({
|
|
76
|
+
key: prfOutput,
|
|
77
|
+
ciphertext: env.wrappedShare,
|
|
78
|
+
alg: env.alg,
|
|
79
|
+
salt: env.salt,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (mode === 'large-blob') {
|
|
83
|
+
const { blob } = await this.opts.authenticator.readLargeBlob(req);
|
|
84
|
+
// The largeBlob carries the share already decrypted at provision
|
|
85
|
+
// time (the credential acts as the trust boundary). The blob is
|
|
86
|
+
// the share bytes; pass through.
|
|
87
|
+
return blob;
|
|
88
|
+
}
|
|
89
|
+
// escrow
|
|
90
|
+
const challenge = await this.opts.envelope.startEscrow(req);
|
|
91
|
+
const assertion = await this.opts.authenticator.basicAssertion({
|
|
92
|
+
...req,
|
|
93
|
+
nonce: challenge.nonce,
|
|
94
|
+
});
|
|
95
|
+
const { wrappedShare, pepper } = await this.opts.envelope.finishEscrow({
|
|
96
|
+
...req,
|
|
97
|
+
assertion,
|
|
98
|
+
nonce: challenge.nonce,
|
|
99
|
+
});
|
|
100
|
+
return this.opts.aeadDecrypt({
|
|
101
|
+
key: pepper,
|
|
102
|
+
ciphertext: wrappedShare,
|
|
103
|
+
alg: 'aes-256-gcm',
|
|
104
|
+
salt: new Uint8Array(0),
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
bindHolder(share, scheme) {
|
|
108
|
+
const { frost } = this.opts;
|
|
109
|
+
let disposed = false;
|
|
110
|
+
const wipe = () => {
|
|
111
|
+
if (disposed)
|
|
112
|
+
return;
|
|
113
|
+
share.fill(0);
|
|
114
|
+
disposed = true;
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
scheme,
|
|
118
|
+
async commit() {
|
|
119
|
+
if (disposed)
|
|
120
|
+
throw new Error('share holder already disposed');
|
|
121
|
+
return frost.commit({ share, scheme });
|
|
122
|
+
},
|
|
123
|
+
async respond(args) {
|
|
124
|
+
if (disposed)
|
|
125
|
+
throw new Error('share holder already disposed');
|
|
126
|
+
return frost.respond({ share, scheme, ...args });
|
|
127
|
+
},
|
|
128
|
+
dispose: wipe,
|
|
129
|
+
};
|
|
130
|
+
}
|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Q,GAAG,KAAK,CAAC;QACrB,MAAM,IAAI,GAAG,GAAG,EAAE;YAChB,IAAI,QAAQ;gBAAE,OAAO;YACrB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACd,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC,CAAC;QACF,OAAO;YACL,MAAM;YACN,KAAK,CAAC,MAAM;gBACV,IAAI,QAAQ;oBAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;gBAC/D,OAAO,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;YACzC,CAAC;YACD,KAAK,CAAC,OAAO,CAAC,IAAI;gBAChB,IAAI,QAAQ;oBAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;gBAC/D,OAAO,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;YACnD,CAAC;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebAuthnAuthenticatorAdapter — browser implementation of the
|
|
3
|
+
* `PasskeyAuthenticatorAdapter` port. Wraps `navigator.credentials.get`
|
|
4
|
+
* for the three modes the unwrapper consumes:
|
|
5
|
+
*
|
|
6
|
+
* 1. PRF (preferred). CTAP2.1 hmac-secret exposed through the WebAuthn
|
|
7
|
+
* `prf` extension. Authenticator returns a 32-byte symmetric key
|
|
8
|
+
* via `clientExtensionResults.prf.results.first` that the
|
|
9
|
+
* unwrapper uses to AEAD-decrypt the wrapped FROST share.
|
|
10
|
+
*
|
|
11
|
+
* `prf.eval.first` is set to a stable per-surface salt so the
|
|
12
|
+
* authenticator-derived key is bound to a specific surface key.
|
|
13
|
+
* Per WebAuthn L3 §10.1.4, the salt is hashed inside the
|
|
14
|
+
* authenticator with a domain-separation prefix, so we don't
|
|
15
|
+
* pre-hash here.
|
|
16
|
+
*
|
|
17
|
+
* 2. largeBlob. Read-mode call with `largeBlob: { read: true }`.
|
|
18
|
+
* Returns the wrapped share blob. We don't write to largeBlob
|
|
19
|
+
* here — that happens at provisioning time.
|
|
20
|
+
*
|
|
21
|
+
* 3. Basic assertion (escrow fallback). No extensions. The challenge
|
|
22
|
+
* is the Tenzro-issued nonce so the assertion is replay-bound.
|
|
23
|
+
*
|
|
24
|
+
* All three paths surface the assertion in the same shape the
|
|
25
|
+
* `PasskeyAssertion` port expects (base64url strings — that's what the
|
|
26
|
+
* native browser API hands us already; we just rewrap the buffers).
|
|
27
|
+
*
|
|
28
|
+
* Browser-only. Importing this file in a Node environment is a host
|
|
29
|
+
* configuration mistake — the kernel itself never imports it. Keep all
|
|
30
|
+
* `navigator` access behind methods so the module file itself is safe
|
|
31
|
+
* to import for tree-shaking.
|
|
32
|
+
*/
|
|
33
|
+
import type { PasskeyAssertion, PasskeyAuthenticatorAdapter, ShareUnwrapRequest } from './unwrapper.js';
|
|
34
|
+
export interface WebAuthnAdapterConfig {
|
|
35
|
+
/** Relying-party id (`rp.id`) — usually the wallet's apex domain. */
|
|
36
|
+
readonly rpId: string;
|
|
37
|
+
/**
|
|
38
|
+
* Resolves the salt fed to the PRF extension for a given surface key.
|
|
39
|
+
* Default: SHA-256 of `surfaceKeyId` UTF-8 bytes. Hosts wanting a
|
|
40
|
+
* versioned/rotation-safe scheme can override.
|
|
41
|
+
*/
|
|
42
|
+
readonly prfSalt?: (req: ShareUnwrapRequest) => Promise<Uint8Array> | Uint8Array;
|
|
43
|
+
/**
|
|
44
|
+
* Override `navigator.credentials` for tests. In production, leave
|
|
45
|
+
* unset — the adapter reads `globalThis.navigator.credentials`.
|
|
46
|
+
*/
|
|
47
|
+
readonly credentials?: CredentialsContainer;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Subset of `CredentialsContainer` we exercise. Mirrors the lib.dom
|
|
51
|
+
* shape so passing the real `navigator.credentials` works directly.
|
|
52
|
+
*/
|
|
53
|
+
export interface CredentialsContainer {
|
|
54
|
+
get(options: PublicKeyCredentialRequestOptionsLike): Promise<PublicKeyCredentialLike | null>;
|
|
55
|
+
}
|
|
56
|
+
/** Subset of `CredentialRequestOptions` we set. */
|
|
57
|
+
export interface PublicKeyCredentialRequestOptionsLike {
|
|
58
|
+
publicKey: {
|
|
59
|
+
challenge: ArrayBuffer | Uint8Array;
|
|
60
|
+
rpId: string;
|
|
61
|
+
allowCredentials?: ReadonlyArray<{
|
|
62
|
+
id: ArrayBuffer | Uint8Array;
|
|
63
|
+
type: 'public-key';
|
|
64
|
+
}>;
|
|
65
|
+
userVerification?: 'required' | 'preferred' | 'discouraged';
|
|
66
|
+
extensions?: {
|
|
67
|
+
prf?: {
|
|
68
|
+
eval: {
|
|
69
|
+
first: ArrayBuffer | Uint8Array;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
largeBlob?: {
|
|
73
|
+
read?: boolean;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** Subset of `PublicKeyCredential` + `AuthenticatorAssertionResponse` shape. */
|
|
79
|
+
export interface PublicKeyCredentialLike {
|
|
80
|
+
rawId: ArrayBuffer;
|
|
81
|
+
response: {
|
|
82
|
+
clientDataJSON: ArrayBuffer;
|
|
83
|
+
authenticatorData: ArrayBuffer;
|
|
84
|
+
signature: ArrayBuffer;
|
|
85
|
+
};
|
|
86
|
+
getClientExtensionResults?(): {
|
|
87
|
+
prf?: {
|
|
88
|
+
results?: {
|
|
89
|
+
first?: ArrayBuffer;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
largeBlob?: {
|
|
93
|
+
blob?: ArrayBuffer;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export declare class WebAuthnAuthenticatorAdapter implements PasskeyAuthenticatorAdapter {
|
|
98
|
+
#private;
|
|
99
|
+
constructor(cfg: WebAuthnAdapterConfig);
|
|
100
|
+
prfAssertion(req: ShareUnwrapRequest): Promise<{
|
|
101
|
+
prfOutput: Uint8Array;
|
|
102
|
+
assertion: PasskeyAssertion;
|
|
103
|
+
}>;
|
|
104
|
+
readLargeBlob(req: ShareUnwrapRequest): Promise<{
|
|
105
|
+
blob: Uint8Array;
|
|
106
|
+
assertion: PasskeyAssertion;
|
|
107
|
+
}>;
|
|
108
|
+
basicAssertion(req: ShareUnwrapRequest & {
|
|
109
|
+
readonly nonce: string;
|
|
110
|
+
}): Promise<PasskeyAssertion>;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=webauthn-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webauthn-adapter.d.ts","sourceRoot":"","sources":["../../../src/custody/passkey-share/webauthn-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,qBAAqB;IACpC,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,OAAO,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC;IACjF;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,oBAAoB,CAAC;CAC7C;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,OAAO,EAAE,qCAAqC,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC;CAC9F;AAED,mDAAmD;AACnD,MAAM,WAAW,qCAAqC;IACpD,SAAS,EAAE;QACT,SAAS,EAAE,WAAW,GAAG,UAAU,CAAC;QACpC,IAAI,EAAE,MAAM,CAAC;QACb,gBAAg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AC,KAAK,EAAE,MAAM,CAAA;KAAE,GACnD,OAAO,CAAC,gBAAgB,CAAC;CAsC7B"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebAuthnAuthenticatorAdapter — browser implementation of the
|
|
3
|
+
* `PasskeyAuthenticatorAdapter` port. Wraps `navigator.credentials.get`
|
|
4
|
+
* for the three modes the unwrapper consumes:
|
|
5
|
+
*
|
|
6
|
+
* 1. PRF (preferred). CTAP2.1 hmac-secret exposed through the WebAuthn
|
|
7
|
+
* `prf` extension. Authenticator returns a 32-byte symmetric key
|
|
8
|
+
* via `clientExtensionResults.prf.results.first` that the
|
|
9
|
+
* unwrapper uses to AEAD-decrypt the wrapped FROST share.
|
|
10
|
+
*
|
|
11
|
+
* `prf.eval.first` is set to a stable per-surface salt so the
|
|
12
|
+
* authenticator-derived key is bound to a specific surface key.
|
|
13
|
+
* Per WebAuthn L3 §10.1.4, the salt is hashed inside the
|
|
14
|
+
* authenticator with a domain-separation prefix, so we don't
|
|
15
|
+
* pre-hash here.
|
|
16
|
+
*
|
|
17
|
+
* 2. largeBlob. Read-mode call with `largeBlob: { read: true }`.
|
|
18
|
+
* Returns the wrapped share blob. We don't write to largeBlob
|
|
19
|
+
* here — that happens at provisioning time.
|
|
20
|
+
*
|
|
21
|
+
* 3. Basic assertion (escrow fallback). No extensions. The challenge
|
|
22
|
+
* is the Tenzro-issued nonce so the assertion is replay-bound.
|
|
23
|
+
*
|
|
24
|
+
* All three paths surface the assertion in the same shape the
|
|
25
|
+
* `PasskeyAssertion` port expects (base64url strings — that's what the
|
|
26
|
+
* native browser API hands us already; we just rewrap the buffers).
|
|
27
|
+
*
|
|
28
|
+
* Browser-only. Importing this file in a Node environment is a host
|
|
29
|
+
* configuration mistake — the kernel itself never imports it. Keep all
|
|
30
|
+
* `navigator` access behind methods so the module file itself is safe
|
|
31
|
+
* to import for tree-shaking.
|
|
32
|
+
*/
|
|
33
|
+
export class WebAuthnAuthenticatorAdapter {
|
|
34
|
+
#cfg;
|
|
35
|
+
constructor(cfg) {
|
|
36
|
+
this.#cfg = cfg;
|
|
37
|
+
}
|
|
38
|
+
async prfAssertion(req) {
|
|
39
|
+
const salt = await this.#prfSalt(req);
|
|
40
|
+
// PRF binds to an authenticator-derived hmac key, so the WebAuthn
|
|
41
|
+
// challenge itself is independent of the salt. Use 32 random bytes
|
|
42
|
+
// to keep the assertion fresh; the unwrapper wraps the round in a
|
|
43
|
+
// server-issued envelope fetch so replay is bounded there.
|
|
44
|
+
const challenge = randomBytes(32);
|
|
45
|
+
const cred = await this.#get({
|
|
46
|
+
publicKey: {
|
|
47
|
+
challenge,
|
|
48
|
+
rpId: this.#cfg.rpId,
|
|
49
|
+
allowCredentials: [{ id: base64UrlDecode(req.credentialId), type: 'public-key' }],
|
|
50
|
+
userVerification: 'required',
|
|
51
|
+
extensions: { prf: { eval: { first: salt } } },
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
const ext = cred.getClientExtensionResults?.();
|
|
55
|
+
const first = ext?.prf?.results?.first;
|
|
56
|
+
if (!first) {
|
|
57
|
+
throw new Error('WebAuthn PRF unavailable on this credential — caller must fall back to escrow');
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
prfOutput: new Uint8Array(first),
|
|
61
|
+
assertion: toAssertion(cred),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
async readLargeBlob(req) {
|
|
65
|
+
const cred = await this.#get({
|
|
66
|
+
publicKey: {
|
|
67
|
+
challenge: randomBytes(32),
|
|
68
|
+
rpId: this.#cfg.rpId,
|
|
69
|
+
allowCredentials: [{ id: base64UrlDecode(req.credentialId), type: 'public-key' }],
|
|
70
|
+
userVerification: 'required',
|
|
71
|
+
extensions: { largeBlob: { read: true } },
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
const ext = cred.getClientExtensionResults?.();
|
|
75
|
+
const blob = ext?.largeBlob?.blob;
|
|
76
|
+
if (!blob) {
|
|
77
|
+
throw new Error('WebAuthn largeBlob read returned empty — caller must fall back to escrow');
|
|
78
|
+
}
|
|
79
|
+
return { blob: new Uint8Array(blob), assertion: toAssertion(cred) };
|
|
80
|
+
}
|
|
81
|
+
async basicAssertion(req) {
|
|
82
|
+
// Escrow path: server-issued nonce becomes the WebAuthn challenge,
|
|
83
|
+
// so the resulting signature is replay-bound to that nonce.
|
|
84
|
+
const cred = await this.#get({
|
|
85
|
+
publicKey: {
|
|
86
|
+
challenge: base64UrlDecode(req.nonce),
|
|
87
|
+
rpId: this.#cfg.rpId,
|
|
88
|
+
allowCredentials: [{ id: base64UrlDecode(req.credentialId), type: 'public-key' }],
|
|
89
|
+
userVerification: 'required',
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
return toAssertion(cred);
|
|
93
|
+
}
|
|
94
|
+
// --- internals ---
|
|
95
|
+
async #get(options) {
|
|
96
|
+
const creds = this.#cfg.credentials ??
|
|
97
|
+
globalThis.navigator
|
|
98
|
+
?.credentials;
|
|
99
|
+
if (!creds) {
|
|
100
|
+
throw new Error('navigator.credentials unavailable — WebAuthnAuthenticatorAdapter requires a browser context');
|
|
101
|
+
}
|
|
102
|
+
const cred = await creds.get(options);
|
|
103
|
+
if (!cred)
|
|
104
|
+
throw new Error('WebAuthn assertion cancelled or returned null');
|
|
105
|
+
return cred;
|
|
106
|
+
}
|
|
107
|
+
async #prfSalt(req) {
|
|
108
|
+
if (this.#cfg.prfSalt) {
|
|
109
|
+
const out = await this.#cfg.prfSalt(req);
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
return defaultPrfSalt(req.surfaceKeyId);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// ─── helpers ──────────────────────────────────────────────────────────────
|
|
116
|
+
function toAssertion(cred) {
|
|
117
|
+
return {
|
|
118
|
+
credentialId: base64UrlEncode(new Uint8Array(cred.rawId)),
|
|
119
|
+
clientDataJson: base64UrlEncode(new Uint8Array(cred.response.clientDataJSON)),
|
|
120
|
+
authenticatorData: base64UrlEncode(new Uint8Array(cred.response.authenticatorData)),
|
|
121
|
+
signature: base64UrlEncode(new Uint8Array(cred.response.signature)),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
async function defaultPrfSalt(surfaceKeyId) {
|
|
125
|
+
const enc = new TextEncoder().encode(surfaceKeyId);
|
|
126
|
+
const digest = await crypto.subtle.digest('SHA-256', enc);
|
|
127
|
+
return new Uint8Array(digest);
|
|
128
|
+
}
|
|
129
|
+
function randomBytes(n) {
|
|
130
|
+
const out = new Uint8Array(n);
|
|
131
|
+
crypto.getRandomValues(out);
|
|
132
|
+
return out;
|
|
133
|
+
}
|
|
134
|
+
// base64url (RFC 4648 §5) — what WebAuthn naturally hands back.
|
|
135
|
+
function base64UrlEncode(bytes) {
|
|
136
|
+
let s = '';
|
|
137
|
+
for (let i = 0; i < bytes.length; i++)
|
|
138
|
+
s += String.fromCharCode(bytes[i]);
|
|
139
|
+
return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
|
|
140
|
+
}
|
|
141
|
+
function base64UrlDecode(b64u) {
|
|
142
|
+
const pad = b64u.length % 4 === 0 ? '' : '='.repeat(4 - (b64u.length % 4));
|
|
143
|
+
const b64 = b64u.replace(/-/g, '+').replace(/_/g, '/') + pad;
|
|
144
|
+
const bin = atob(b64);
|
|
145
|
+
const out = new Uint8Array(bin.length);
|
|
146
|
+
for (let i = 0; i < bin.length; i++)
|
|
147
|
+
out[i] = bin.charCodeAt(i);
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=webauthn-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webauthn-adapter.js","sourceRoot":"","sources":["../../../src/custody/passkey-share/webauthn-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AA+DH,MAAM,OAAO,4BAA4B;IAC9B,IAAI,CAAwB;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;QAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical wire identifier for a `SurfaceKey`. Used as the
|
|
3
|
+
* `surfaceKey` field on Tenzro custody endpoint payloads
|
|
4
|
+
* (`/wallet/frost/*`, `/wallet/mldsa/*`, etc.) so the node can find
|
|
5
|
+
* the correct share-set without the wallet shipping public-key bytes
|
|
6
|
+
* inline on every request.
|
|
7
|
+
*
|
|
8
|
+
* Convention:
|
|
9
|
+
* - tenzro-native / svm-on-tenzro: `{surface}:{address}`
|
|
10
|
+
* - evm-on-tenzro: `{surface}:{address}` (lower-case hex)
|
|
11
|
+
* - canton-{internal,external}: `{surface}:{partyId}`
|
|
12
|
+
*/
|
|
13
|
+
import type { SurfaceKey } from '../types/identity.js';
|
|
14
|
+
export declare function surfaceKeyId(key: SurfaceKey): string;
|
|
15
|
+
//# sourceMappingURL=surface-key-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-key-id.d.ts","sourceRoot":"","sources":["../../src/custody/surface-key-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAWpD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical wire identifier for a `SurfaceKey`. Used as the
|
|
3
|
+
* `surfaceKey` field on Tenzro custody endpoint payloads
|
|
4
|
+
* (`/wallet/frost/*`, `/wallet/mldsa/*`, etc.) so the node can find
|
|
5
|
+
* the correct share-set without the wallet shipping public-key bytes
|
|
6
|
+
* inline on every request.
|
|
7
|
+
*
|
|
8
|
+
* Convention:
|
|
9
|
+
* - tenzro-native / svm-on-tenzro: `{surface}:{address}`
|
|
10
|
+
* - evm-on-tenzro: `{surface}:{address}` (lower-case hex)
|
|
11
|
+
* - canton-{internal,external}: `{surface}:{partyId}`
|
|
12
|
+
*/
|
|
13
|
+
export function surfaceKeyId(key) {
|
|
14
|
+
switch (key.surface) {
|
|
15
|
+
case 'tenzro-native':
|
|
16
|
+
case 'svm-on-tenzro':
|
|
17
|
+
return `${key.surface}:${key.address}`;
|
|
18
|
+
case 'evm-on-tenzro':
|
|
19
|
+
return `${key.surface}:${key.address.toLowerCase()}`;
|
|
20
|
+
case 'canton-internal':
|
|
21
|
+
case 'canton-external':
|
|
22
|
+
return `${key.surface}:${key.partyId}`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=surface-key-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-key-id.js","sourceRoot":"","sources":["../../src/custody/surface-key-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,MAAM,UAAU,YAAY,CAAC,GAAe;IAC1C,QAAQ,GAAG,CAAC,OAAO,EAAE,CAAC;QACpB,KAAK,eAAe,CAAC;QACrB,KAAK,eAAe;YAClB,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QACzC,KAAK,eAAe;YAClB,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;QACvD,KAAK,iBAAiB,CAAC;QACvB,KAAK,iBAAiB;YACpB,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;IAC3C,CAAC;AACH,CAAC"}
|