ox 0.1.7 → 0.2.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/CHANGELOG.md +16 -0
- package/_cjs/core/Abi.js +0 -2
- package/_cjs/core/Abi.js.map +1 -1
- package/_cjs/core/AbiConstructor.js +0 -5
- package/_cjs/core/AbiConstructor.js.map +1 -1
- package/_cjs/core/AbiError.js +0 -5
- package/_cjs/core/AbiError.js.map +1 -1
- package/_cjs/core/AbiEvent.js +0 -7
- package/_cjs/core/AbiEvent.js.map +1 -1
- package/_cjs/core/AbiFunction.js +0 -5
- package/_cjs/core/AbiFunction.js.map +1 -1
- package/_cjs/core/AbiItem.js +0 -6
- package/_cjs/core/AbiItem.js.map +1 -1
- package/_cjs/core/AbiParameters.js +0 -5
- package/_cjs/core/AbiParameters.js.map +1 -1
- package/_cjs/core/Address.js +0 -5
- package/_cjs/core/Address.js.map +1 -1
- package/_cjs/core/AesGcm.js +0 -4
- package/_cjs/core/AesGcm.js.map +1 -1
- package/_cjs/core/Authorization.js +0 -11
- package/_cjs/core/Authorization.js.map +1 -1
- package/_cjs/core/Base58.js +0 -6
- package/_cjs/core/Base58.js.map +1 -1
- package/_cjs/core/Base64.js +0 -6
- package/_cjs/core/Base64.js.map +1 -1
- package/_cjs/core/Blobs.js +0 -11
- package/_cjs/core/Blobs.js.map +1 -1
- package/_cjs/core/Block.js +0 -2
- package/_cjs/core/Block.js.map +1 -1
- package/_cjs/core/Bloom.js +0 -2
- package/_cjs/core/Bloom.js.map +1 -1
- package/_cjs/core/Bls.js +0 -3
- package/_cjs/core/Bls.js.map +1 -1
- package/_cjs/core/BlsPoint.js +0 -4
- package/_cjs/core/BlsPoint.js.map +1 -1
- package/_cjs/core/Bytes.js +0 -22
- package/_cjs/core/Bytes.js.map +1 -1
- package/_cjs/core/ContractAddress.js +0 -3
- package/_cjs/core/ContractAddress.js.map +1 -1
- package/_cjs/core/Ens.js +0 -3
- package/_cjs/core/Ens.js.map +1 -1
- package/_cjs/core/Filter.js +0 -2
- package/_cjs/core/Filter.js.map +1 -1
- package/_cjs/core/Hash.js +0 -4
- package/_cjs/core/Hash.js.map +1 -1
- package/_cjs/core/HdKey.js +0 -4
- package/_cjs/core/HdKey.js.map +1 -1
- package/_cjs/core/Hex.js +0 -21
- package/_cjs/core/Hex.js.map +1 -1
- package/_cjs/core/Json.js +0 -2
- package/_cjs/core/Json.js.map +1 -1
- package/_cjs/core/Kzg.js +0 -1
- package/_cjs/core/Kzg.js.map +1 -1
- package/_cjs/core/Log.js +0 -2
- package/_cjs/core/Log.js.map +1 -1
- package/_cjs/core/Mnemonic.js +0 -5
- package/_cjs/core/Mnemonic.js.map +1 -1
- package/_cjs/core/P256.js +0 -3
- package/_cjs/core/P256.js.map +1 -1
- package/_cjs/core/PersonalMessage.js +0 -2
- package/_cjs/core/PersonalMessage.js.map +1 -1
- package/_cjs/core/Provider.js +0 -2
- package/_cjs/core/Provider.js.map +1 -1
- package/_cjs/core/PublicKey.js +0 -6
- package/_cjs/core/PublicKey.js.map +1 -1
- package/_cjs/core/Rlp.js +0 -6
- package/_cjs/core/Rlp.js.map +1 -1
- package/_cjs/core/RpcRequest.js +0 -2
- package/_cjs/core/RpcRequest.js.map +1 -1
- package/_cjs/core/RpcResponse.js +0 -1
- package/_cjs/core/RpcResponse.js.map +1 -1
- package/_cjs/core/RpcTransport.js +0 -1
- package/_cjs/core/RpcTransport.js.map +1 -1
- package/_cjs/core/Secp256k1.js +0 -4
- package/_cjs/core/Secp256k1.js.map +1 -1
- package/_cjs/core/Signature.js +0 -17
- package/_cjs/core/Signature.js.map +1 -1
- package/_cjs/core/Siwe.js +0 -1
- package/_cjs/core/Siwe.js.map +1 -1
- package/_cjs/core/Transaction.js +0 -2
- package/_cjs/core/Transaction.js.map +1 -1
- package/_cjs/core/TransactionEnvelopeEip1559.js +0 -8
- package/_cjs/core/TransactionEnvelopeEip1559.js.map +1 -1
- package/_cjs/core/TransactionEnvelopeEip2930.js +0 -8
- package/_cjs/core/TransactionEnvelopeEip2930.js.map +1 -1
- package/_cjs/core/TransactionEnvelopeEip4844.js +0 -8
- package/_cjs/core/TransactionEnvelopeEip4844.js.map +1 -1
- package/_cjs/core/TransactionEnvelopeEip7702.js +0 -7
- package/_cjs/core/TransactionEnvelopeEip7702.js.map +1 -1
- package/_cjs/core/TransactionEnvelopeLegacy.js +0 -8
- package/_cjs/core/TransactionEnvelopeLegacy.js.map +1 -1
- package/_cjs/core/TransactionReceipt.js +0 -2
- package/_cjs/core/TransactionReceipt.js.map +1 -1
- package/_cjs/core/TransactionRequest.js +0 -1
- package/_cjs/core/TransactionRequest.js.map +1 -1
- package/_cjs/core/TypedData.js +19 -12
- package/_cjs/core/TypedData.js.map +1 -1
- package/_cjs/core/ValidatorData.js +0 -2
- package/_cjs/core/ValidatorData.js.map +1 -1
- package/_cjs/core/Value.js +0 -6
- package/_cjs/core/Value.js.map +1 -1
- package/_cjs/core/WebAuthnP256.js +2 -9
- package/_cjs/core/WebAuthnP256.js.map +1 -1
- package/_cjs/core/WebCryptoP256.js +0 -3
- package/_cjs/core/WebCryptoP256.js.map +1 -1
- package/_cjs/core/Withdrawal.js +0 -2
- package/_cjs/core/Withdrawal.js.map +1 -1
- package/_cjs/core/internal/base58.js +0 -1
- package/_cjs/core/internal/base58.js.map +1 -1
- package/_cjs/core/internal/promise.js +0 -1
- package/_cjs/core/internal/promise.js.map +1 -1
- package/_cjs/core/internal/rpcTransport.js +0 -1
- package/_cjs/core/internal/rpcTransport.js.map +1 -1
- package/_cjs/core/internal/webauthn.js +36 -8
- package/_cjs/core/internal/webauthn.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/core/Abi.js +0 -6
- package/_esm/core/Abi.js.map +1 -1
- package/_esm/core/AbiConstructor.js +0 -15
- package/_esm/core/AbiConstructor.js.map +1 -1
- package/_esm/core/AbiError.js +0 -14
- package/_esm/core/AbiError.js.map +1 -1
- package/_esm/core/AbiEvent.js +0 -20
- package/_esm/core/AbiEvent.js.map +1 -1
- package/_esm/core/AbiFunction.js +0 -14
- package/_esm/core/AbiFunction.js.map +1 -1
- package/_esm/core/AbiItem.js +0 -16
- package/_esm/core/AbiItem.js.map +1 -1
- package/_esm/core/AbiParameters.js +0 -14
- package/_esm/core/AbiParameters.js.map +1 -1
- package/_esm/core/Address.js +0 -13
- package/_esm/core/Address.js.map +1 -1
- package/_esm/core/AesGcm.js +0 -12
- package/_esm/core/AesGcm.js.map +1 -1
- package/_esm/core/Authorization.js +0 -33
- package/_esm/core/Authorization.js.map +1 -1
- package/_esm/core/Base58.js +0 -18
- package/_esm/core/Base58.js.map +1 -1
- package/_esm/core/Base64.js +0 -18
- package/_esm/core/Base64.js.map +1 -1
- package/_esm/core/Blobs.js +0 -28
- package/_esm/core/Blobs.js.map +1 -1
- package/_esm/core/Block.js +0 -6
- package/_esm/core/Block.js.map +1 -1
- package/_esm/core/Bloom.js +0 -5
- package/_esm/core/Bloom.js.map +1 -1
- package/_esm/core/Bls.js +0 -8
- package/_esm/core/Bls.js.map +1 -1
- package/_esm/core/BlsPoint.js +0 -8
- package/_esm/core/BlsPoint.js.map +1 -1
- package/_esm/core/Bytes.js +0 -53
- package/_esm/core/Bytes.js.map +1 -1
- package/_esm/core/ContractAddress.js +0 -9
- package/_esm/core/ContractAddress.js.map +1 -1
- package/_esm/core/Ens.js +0 -9
- package/_esm/core/Ens.js.map +1 -1
- package/_esm/core/Filter.js +0 -6
- package/_esm/core/Filter.js.map +1 -1
- package/_esm/core/Hash.js +0 -8
- package/_esm/core/Hash.js.map +1 -1
- package/_esm/core/HdKey.js +0 -11
- package/_esm/core/HdKey.js.map +1 -1
- package/_esm/core/Hex.js +0 -45
- package/_esm/core/Hex.js.map +1 -1
- package/_esm/core/Json.js +0 -6
- package/_esm/core/Json.js.map +1 -1
- package/_esm/core/Kzg.js +0 -2
- package/_esm/core/Kzg.js.map +1 -1
- package/_esm/core/Log.js +0 -6
- package/_esm/core/Log.js.map +1 -1
- package/_esm/core/Mnemonic.js +0 -15
- package/_esm/core/Mnemonic.js.map +1 -1
- package/_esm/core/P256.js +0 -7
- package/_esm/core/P256.js.map +1 -1
- package/_esm/core/PersonalMessage.js +0 -4
- package/_esm/core/PersonalMessage.js.map +1 -1
- package/_esm/core/Provider.js +0 -5
- package/_esm/core/Provider.js.map +1 -1
- package/_esm/core/PublicKey.js +0 -18
- package/_esm/core/PublicKey.js.map +1 -1
- package/_esm/core/Rlp.js +0 -18
- package/_esm/core/Rlp.js.map +1 -1
- package/_esm/core/RpcRequest.js +0 -6
- package/_esm/core/RpcRequest.js.map +1 -1
- package/_esm/core/RpcResponse.js +0 -3
- package/_esm/core/RpcResponse.js.map +1 -1
- package/_esm/core/RpcTransport.js +0 -3
- package/_esm/core/RpcTransport.js.map +1 -1
- package/_esm/core/Secp256k1.js +0 -12
- package/_esm/core/Secp256k1.js.map +1 -1
- package/_esm/core/Signature.js +0 -49
- package/_esm/core/Signature.js.map +1 -1
- package/_esm/core/Siwe.js +0 -3
- package/_esm/core/Siwe.js.map +1 -1
- package/_esm/core/Transaction.js +0 -6
- package/_esm/core/Transaction.js.map +1 -1
- package/_esm/core/TransactionEnvelopeEip1559.js +0 -22
- package/_esm/core/TransactionEnvelopeEip1559.js.map +1 -1
- package/_esm/core/TransactionEnvelopeEip2930.js +0 -23
- package/_esm/core/TransactionEnvelopeEip2930.js.map +1 -1
- package/_esm/core/TransactionEnvelopeEip4844.js +0 -24
- package/_esm/core/TransactionEnvelopeEip4844.js.map +1 -1
- package/_esm/core/TransactionEnvelopeEip7702.js +0 -21
- package/_esm/core/TransactionEnvelopeEip7702.js.map +1 -1
- package/_esm/core/TransactionEnvelopeLegacy.js +0 -24
- package/_esm/core/TransactionEnvelopeLegacy.js.map +1 -1
- package/_esm/core/TransactionReceipt.js +0 -6
- package/_esm/core/TransactionReceipt.js.map +1 -1
- package/_esm/core/TransactionRequest.js +0 -3
- package/_esm/core/TransactionRequest.js.map +1 -1
- package/_esm/core/TypedData.js +18 -26
- package/_esm/core/TypedData.js.map +1 -1
- package/_esm/core/ValidatorData.js +0 -4
- package/_esm/core/ValidatorData.js.map +1 -1
- package/_esm/core/Value.js +0 -12
- package/_esm/core/Value.js.map +1 -1
- package/_esm/core/WebAuthnP256.js +2 -23
- package/_esm/core/WebAuthnP256.js.map +1 -1
- package/_esm/core/WebCryptoP256.js +0 -9
- package/_esm/core/WebCryptoP256.js.map +1 -1
- package/_esm/core/Withdrawal.js +0 -6
- package/_esm/core/Withdrawal.js.map +1 -1
- package/_esm/core/internal/base58.js +0 -3
- package/_esm/core/internal/base58.js.map +1 -1
- package/_esm/core/internal/promise.js +0 -3
- package/_esm/core/internal/promise.js.map +1 -1
- package/_esm/core/internal/rpcTransport.js +0 -4
- package/_esm/core/internal/rpcTransport.js.map +1 -1
- package/_esm/core/internal/webauthn.js +40 -8
- package/_esm/core/internal/webauthn.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/core/Abi.d.ts +0 -6
- package/_types/core/Abi.d.ts.map +1 -1
- package/_types/core/AbiConstructor.d.ts +0 -15
- package/_types/core/AbiConstructor.d.ts.map +1 -1
- package/_types/core/AbiError.d.ts +1 -16
- package/_types/core/AbiError.d.ts.map +1 -1
- package/_types/core/AbiEvent.d.ts +0 -21
- package/_types/core/AbiEvent.d.ts.map +1 -1
- package/_types/core/AbiFunction.d.ts +0 -15
- package/_types/core/AbiFunction.d.ts.map +1 -1
- package/_types/core/AbiItem.d.ts +0 -18
- package/_types/core/AbiItem.d.ts.map +1 -1
- package/_types/core/AbiParameters.d.ts +0 -15
- package/_types/core/AbiParameters.d.ts.map +1 -1
- package/_types/core/Address.d.ts +0 -15
- package/_types/core/Address.d.ts.map +1 -1
- package/_types/core/AesGcm.d.ts +0 -9
- package/_types/core/AesGcm.d.ts.map +1 -1
- package/_types/core/Authorization.d.ts +0 -33
- package/_types/core/Authorization.d.ts.map +1 -1
- package/_types/core/Base58.d.ts +0 -18
- package/_types/core/Base58.d.ts.map +1 -1
- package/_types/core/Base64.d.ts +0 -18
- package/_types/core/Base64.d.ts.map +1 -1
- package/_types/core/Blobs.d.ts +0 -33
- package/_types/core/Blobs.d.ts.map +1 -1
- package/_types/core/Block.d.ts +0 -6
- package/_types/core/Block.d.ts.map +1 -1
- package/_types/core/Bloom.d.ts +0 -6
- package/_types/core/Bloom.d.ts.map +1 -1
- package/_types/core/Bls.d.ts +0 -9
- package/_types/core/Bls.d.ts.map +1 -1
- package/_types/core/BlsPoint.d.ts +0 -12
- package/_types/core/BlsPoint.d.ts.map +1 -1
- package/_types/core/Bytes.d.ts +0 -66
- package/_types/core/Bytes.d.ts.map +1 -1
- package/_types/core/ContractAddress.d.ts +0 -9
- package/_types/core/ContractAddress.d.ts.map +1 -1
- package/_types/core/Ens.d.ts +0 -9
- package/_types/core/Ens.d.ts.map +1 -1
- package/_types/core/Filter.d.ts +0 -6
- package/_types/core/Filter.d.ts.map +1 -1
- package/_types/core/Hash.d.ts +0 -12
- package/_types/core/Hash.d.ts.map +1 -1
- package/_types/core/HdKey.d.ts +0 -12
- package/_types/core/HdKey.d.ts.map +1 -1
- package/_types/core/Hex.d.ts +0 -63
- package/_types/core/Hex.d.ts.map +1 -1
- package/_types/core/Json.d.ts +0 -6
- package/_types/core/Json.d.ts.map +1 -1
- package/_types/core/Kzg.d.ts +0 -3
- package/_types/core/Kzg.d.ts.map +1 -1
- package/_types/core/Log.d.ts +0 -6
- package/_types/core/Log.d.ts.map +1 -1
- package/_types/core/Mnemonic.d.ts +0 -15
- package/_types/core/Mnemonic.d.ts.map +1 -1
- package/_types/core/P256.d.ts +0 -9
- package/_types/core/P256.d.ts.map +1 -1
- package/_types/core/PersonalMessage.d.ts +0 -6
- package/_types/core/PersonalMessage.d.ts.map +1 -1
- package/_types/core/Provider.d.ts +0 -6
- package/_types/core/Provider.d.ts.map +1 -1
- package/_types/core/PublicKey.d.ts +0 -18
- package/_types/core/PublicKey.d.ts.map +1 -1
- package/_types/core/Rlp.d.ts +1 -18
- package/_types/core/Rlp.d.ts.map +1 -1
- package/_types/core/RpcRequest.d.ts +0 -6
- package/_types/core/RpcRequest.d.ts.map +1 -1
- package/_types/core/RpcResponse.d.ts +0 -3
- package/_types/core/RpcResponse.d.ts.map +1 -1
- package/_types/core/RpcTransport.d.ts +0 -3
- package/_types/core/RpcTransport.d.ts.map +1 -1
- package/_types/core/Secp256k1.d.ts +0 -12
- package/_types/core/Secp256k1.d.ts.map +1 -1
- package/_types/core/Signature.d.ts +0 -51
- package/_types/core/Signature.d.ts.map +1 -1
- package/_types/core/Siwe.d.ts +0 -3
- package/_types/core/Siwe.d.ts.map +1 -1
- package/_types/core/Transaction.d.ts +0 -6
- package/_types/core/Transaction.d.ts.map +1 -1
- package/_types/core/TransactionEnvelopeEip1559.d.ts +0 -24
- package/_types/core/TransactionEnvelopeEip1559.d.ts.map +1 -1
- package/_types/core/TransactionEnvelopeEip2930.d.ts +0 -24
- package/_types/core/TransactionEnvelopeEip2930.d.ts.map +1 -1
- package/_types/core/TransactionEnvelopeEip4844.d.ts +0 -24
- package/_types/core/TransactionEnvelopeEip4844.d.ts.map +1 -1
- package/_types/core/TransactionEnvelopeEip7702.d.ts +0 -21
- package/_types/core/TransactionEnvelopeEip7702.d.ts.map +1 -1
- package/_types/core/TransactionEnvelopeLegacy.d.ts +0 -24
- package/_types/core/TransactionEnvelopeLegacy.d.ts.map +1 -1
- package/_types/core/TransactionReceipt.d.ts +0 -6
- package/_types/core/TransactionReceipt.d.ts.map +1 -1
- package/_types/core/TransactionRequest.d.ts +0 -3
- package/_types/core/TransactionRequest.d.ts.map +1 -1
- package/_types/core/TypedData.d.ts +7 -30
- package/_types/core/TypedData.d.ts.map +1 -1
- package/_types/core/ValidatorData.d.ts +0 -6
- package/_types/core/ValidatorData.d.ts.map +1 -1
- package/_types/core/Value.d.ts +0 -18
- package/_types/core/Value.d.ts.map +1 -1
- package/_types/core/WebAuthnP256.d.ts +1 -25
- package/_types/core/WebAuthnP256.d.ts.map +1 -1
- package/_types/core/WebCryptoP256.d.ts +0 -9
- package/_types/core/WebCryptoP256.d.ts.map +1 -1
- package/_types/core/Withdrawal.d.ts +0 -6
- package/_types/core/Withdrawal.d.ts.map +1 -1
- package/_types/core/internal/base58.d.ts +1 -3
- package/_types/core/internal/base58.d.ts.map +1 -1
- package/_types/core/internal/promise.d.ts +1 -3
- package/_types/core/internal/promise.d.ts.map +1 -1
- package/_types/core/internal/rpcTransport.d.ts +0 -3
- package/_types/core/internal/rpcTransport.d.ts.map +1 -1
- package/_types/core/internal/webauthn.d.ts +6 -2
- package/_types/core/internal/webauthn.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/core/Abi.ts +0 -8
- package/core/AbiConstructor.ts +0 -20
- package/core/AbiError.ts +1 -20
- package/core/AbiEvent.ts +0 -27
- package/core/AbiFunction.ts +0 -19
- package/core/AbiItem.ts +0 -22
- package/core/AbiParameters.ts +0 -19
- package/core/Address.ts +0 -18
- package/core/AesGcm.ts +0 -16
- package/core/Authorization.ts +0 -44
- package/core/Base58.ts +0 -24
- package/core/Base64.ts +0 -24
- package/core/Blobs.ts +0 -39
- package/core/Block.ts +0 -8
- package/core/Bloom.ts +0 -7
- package/core/Bls.ts +0 -11
- package/core/BlsPoint.ts +0 -12
- package/core/Bytes.ts +0 -75
- package/core/ContractAddress.ts +0 -12
- package/core/Ens.ts +0 -12
- package/core/Filter.ts +0 -8
- package/core/Hash.ts +0 -12
- package/core/HdKey.ts +0 -15
- package/core/Hex.ts +0 -66
- package/core/Json.ts +0 -8
- package/core/Kzg.ts +0 -3
- package/core/Log.ts +0 -8
- package/core/Mnemonic.ts +0 -20
- package/core/P256.ts +0 -10
- package/core/PersonalMessage.ts +0 -7
- package/core/Provider.ts +0 -7
- package/core/PublicKey.ts +0 -24
- package/core/Rlp.ts +0 -23
- package/core/RpcRequest.ts +0 -8
- package/core/RpcResponse.ts +0 -4
- package/core/RpcTransport.ts +0 -4
- package/core/Secp256k1.ts +0 -16
- package/core/Signature.ts +0 -66
- package/core/Siwe.ts +0 -4
- package/core/Transaction.ts +0 -8
- package/core/TransactionEnvelopeEip1559.ts +0 -30
- package/core/TransactionEnvelopeEip2930.ts +0 -31
- package/core/TransactionEnvelopeEip4844.ts +0 -32
- package/core/TransactionEnvelopeEip7702.ts +0 -28
- package/core/TransactionEnvelopeLegacy.ts +0 -32
- package/core/TransactionReceipt.ts +0 -8
- package/core/TransactionRequest.ts +0 -4
- package/core/TypedData.ts +15 -36
- package/core/ValidatorData.ts +0 -7
- package/core/Value.ts +0 -18
- package/core/WebAuthnP256.ts +5 -34
- package/core/WebCryptoP256.ts +0 -12
- package/core/Withdrawal.ts +0 -8
- package/core/internal/base58.ts +0 -3
- package/core/internal/promise.ts +0 -3
- package/core/internal/rpcTransport.ts +0 -5
- package/core/internal/webauthn.ts +58 -17
- package/package.json +1 -1
- package/version.ts +1 -1
package/core/TypedData.ts
CHANGED
|
@@ -157,7 +157,10 @@ export function assert<
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
// Validate domain types.
|
|
160
|
-
if (types.EIP712Domain && domain)
|
|
160
|
+
if (types.EIP712Domain && domain) {
|
|
161
|
+
if (typeof domain !== 'object') throw new InvalidDomainError({ domain })
|
|
162
|
+
validateData(types.EIP712Domain, domain)
|
|
163
|
+
}
|
|
161
164
|
|
|
162
165
|
// Validate message types.
|
|
163
166
|
if (primaryType !== 'EIP712Domain') {
|
|
@@ -181,10 +184,6 @@ export declare namespace assert {
|
|
|
181
184
|
| Errors.GlobalErrorType
|
|
182
185
|
}
|
|
183
186
|
|
|
184
|
-
assert.parseError = (error: unknown) =>
|
|
185
|
-
/* v8 ignore next */
|
|
186
|
-
error as assert.ErrorType
|
|
187
|
-
|
|
188
187
|
/**
|
|
189
188
|
* Creates [EIP-712 Typed Data](https://eips.ethereum.org/EIPS/eip-712) [`domainSeparator`](https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator) for the provided domain.
|
|
190
189
|
*
|
|
@@ -214,10 +213,6 @@ export declare namespace domainSeparator {
|
|
|
214
213
|
type ErrorType = hashDomain.ErrorType | Errors.GlobalErrorType
|
|
215
214
|
}
|
|
216
215
|
|
|
217
|
-
domainSeparator.parseError = (error: unknown) =>
|
|
218
|
-
/* v8 ignore next */
|
|
219
|
-
error as domainSeparator.ErrorType
|
|
220
|
-
|
|
221
216
|
/**
|
|
222
217
|
* Encodes typed data in [EIP-712 format](https://eips.ethereum.org/EIPS/eip-712): `0x19 ‖ 0x01 ‖ domainSeparator ‖ hashStruct(message)`.
|
|
223
218
|
*
|
|
@@ -320,9 +315,6 @@ export declare namespace encode {
|
|
|
320
315
|
| Errors.GlobalErrorType
|
|
321
316
|
}
|
|
322
317
|
|
|
323
|
-
/* v8 ignore next */
|
|
324
|
-
encode.parseError = (error: unknown) => error as encode.ErrorType
|
|
325
|
-
|
|
326
318
|
/**
|
|
327
319
|
* Encodes [EIP-712 Typed Data](https://eips.ethereum.org/EIPS/eip-712) schema for the provided primaryType.
|
|
328
320
|
*
|
|
@@ -372,9 +364,6 @@ export declare namespace encodeType {
|
|
|
372
364
|
type ErrorType = findTypeDependencies.ErrorType | Errors.GlobalErrorType
|
|
373
365
|
}
|
|
374
366
|
|
|
375
|
-
/* v8 ignore next */
|
|
376
|
-
encodeType.parseError = (error: unknown) => error as encodeType.ErrorType
|
|
377
|
-
|
|
378
367
|
/**
|
|
379
368
|
* Gets [EIP-712 Typed Data](https://eips.ethereum.org/EIPS/eip-712) schema for EIP-721 domain.
|
|
380
369
|
*
|
|
@@ -421,10 +410,6 @@ export declare namespace extractEip712DomainTypes {
|
|
|
421
410
|
type ErrorType = Errors.GlobalErrorType
|
|
422
411
|
}
|
|
423
412
|
|
|
424
|
-
extractEip712DomainTypes.parseError = (error: unknown) =>
|
|
425
|
-
/* v8 ignore next */
|
|
426
|
-
error as extractEip712DomainTypes.ErrorType
|
|
427
|
-
|
|
428
413
|
/**
|
|
429
414
|
* Gets the payload to use for signing typed data in [EIP-712 format](https://eips.ethereum.org/EIPS/eip-712).
|
|
430
415
|
*
|
|
@@ -484,10 +469,6 @@ export declare namespace getSignPayload {
|
|
|
484
469
|
| Errors.GlobalErrorType
|
|
485
470
|
}
|
|
486
471
|
|
|
487
|
-
getSignPayload.parseError = (error: unknown) =>
|
|
488
|
-
/* v8 ignore next */
|
|
489
|
-
error as getSignPayload.ErrorType
|
|
490
|
-
|
|
491
472
|
/**
|
|
492
473
|
* Hashes [EIP-712 Typed Data](https://eips.ethereum.org/EIPS/eip-712) domain.
|
|
493
474
|
*
|
|
@@ -537,9 +518,6 @@ export declare namespace hashDomain {
|
|
|
537
518
|
type ErrorType = hashStruct.ErrorType | Errors.GlobalErrorType
|
|
538
519
|
}
|
|
539
520
|
|
|
540
|
-
/* v8 ignore next */
|
|
541
|
-
hashDomain.parseError = (error: unknown) => error as hashDomain.ErrorType
|
|
542
|
-
|
|
543
521
|
/**
|
|
544
522
|
* Hashes [EIP-712 Typed Data](https://eips.ethereum.org/EIPS/eip-712) struct.
|
|
545
523
|
*
|
|
@@ -594,9 +572,6 @@ export declare namespace hashStruct {
|
|
|
594
572
|
| Errors.GlobalErrorType
|
|
595
573
|
}
|
|
596
574
|
|
|
597
|
-
/* v8 ignore next */
|
|
598
|
-
hashStruct.parseError = (error: unknown) => error as hashStruct.ErrorType
|
|
599
|
-
|
|
600
575
|
/**
|
|
601
576
|
* Serializes [EIP-712 Typed Data](https://eips.ethereum.org/EIPS/eip-712) schema into string.
|
|
602
577
|
*
|
|
@@ -681,10 +656,6 @@ export declare namespace serialize {
|
|
|
681
656
|
type ErrorType = Json.stringify.ErrorType | Errors.GlobalErrorType
|
|
682
657
|
}
|
|
683
658
|
|
|
684
|
-
serialize.parseError = (error: unknown) =>
|
|
685
|
-
/* v8 ignore next */
|
|
686
|
-
error as serialize.ErrorType
|
|
687
|
-
|
|
688
659
|
/**
|
|
689
660
|
* Checks if [EIP-712 Typed Data](https://eips.ethereum.org/EIPS/eip-712) is valid.
|
|
690
661
|
*
|
|
@@ -734,9 +705,6 @@ export declare namespace validate {
|
|
|
734
705
|
type ErrorType = assert.ErrorType | Errors.GlobalErrorType
|
|
735
706
|
}
|
|
736
707
|
|
|
737
|
-
/* v8 ignore next */
|
|
738
|
-
validate.parseError = (error: unknown) => error as validate.ErrorType
|
|
739
|
-
|
|
740
708
|
/** Thrown when the bytes size of a typed data value does not match the expected size. */
|
|
741
709
|
export class BytesSizeMismatchError extends Errors.BaseError {
|
|
742
710
|
override readonly name = 'TypedData.BytesSizeMismatchError'
|
|
@@ -749,6 +717,17 @@ export class BytesSizeMismatchError extends Errors.BaseError {
|
|
|
749
717
|
}
|
|
750
718
|
}
|
|
751
719
|
|
|
720
|
+
/** Thrown when the domain is invalid. */
|
|
721
|
+
export class InvalidDomainError extends Errors.BaseError {
|
|
722
|
+
override readonly name = 'TypedData.InvalidDomainError'
|
|
723
|
+
|
|
724
|
+
constructor({ domain }: { domain: unknown }) {
|
|
725
|
+
super(`Invalid domain "${Json.stringify(domain)}".`, {
|
|
726
|
+
metaMessages: ['Must be a valid EIP-712 domain.'],
|
|
727
|
+
})
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
752
731
|
/** Thrown when the primary type of a typed data value is invalid. */
|
|
753
732
|
export class InvalidPrimaryTypeError extends Errors.BaseError {
|
|
754
733
|
override readonly name = 'TypedData.InvalidPrimaryTypeError'
|
package/core/ValidatorData.ts
CHANGED
|
@@ -45,9 +45,6 @@ export declare namespace encode {
|
|
|
45
45
|
| Errors.GlobalErrorType
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
/* v8 ignore next */
|
|
49
|
-
encode.parseError = (error: unknown) => error as encode.ErrorType
|
|
50
|
-
|
|
51
48
|
/**
|
|
52
49
|
* Gets the payload to use for signing [ERC-191 formatted](https://eips.ethereum.org/EIPS/eip-191#0x00) data with an intended validator.
|
|
53
50
|
*
|
|
@@ -81,7 +78,3 @@ export declare namespace getSignPayload {
|
|
|
81
78
|
| encode.ErrorType
|
|
82
79
|
| Errors.GlobalErrorType
|
|
83
80
|
}
|
|
84
|
-
|
|
85
|
-
/* v8 ignore next */
|
|
86
|
-
getSignPayload.parseError = (error: unknown) =>
|
|
87
|
-
error as getSignPayload.ErrorType
|
package/core/Value.ts
CHANGED
|
@@ -46,9 +46,6 @@ export declare namespace format {
|
|
|
46
46
|
type ErrorType = Errors.GlobalErrorType
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
/* v8 ignore next */
|
|
50
|
-
format.parseError = (error: unknown) => error as format.ErrorType
|
|
51
|
-
|
|
52
49
|
/**
|
|
53
50
|
* Formats a `bigint` Value (default: wei) to a string representation of Ether.
|
|
54
51
|
*
|
|
@@ -75,9 +72,6 @@ export declare namespace formatEther {
|
|
|
75
72
|
type ErrorType = format.ErrorType | Errors.GlobalErrorType
|
|
76
73
|
}
|
|
77
74
|
|
|
78
|
-
/* v8 ignore next */
|
|
79
|
-
formatEther.parseError = (error: unknown) => error as formatEther.ErrorType
|
|
80
|
-
|
|
81
75
|
/**
|
|
82
76
|
* Formats a `bigint` Value (default: wei) to a string representation of Gwei.
|
|
83
77
|
*
|
|
@@ -101,9 +95,6 @@ export declare namespace formatGwei {
|
|
|
101
95
|
type ErrorType = format.ErrorType | Errors.GlobalErrorType
|
|
102
96
|
}
|
|
103
97
|
|
|
104
|
-
/* v8 ignore next */
|
|
105
|
-
formatGwei.parseError = (error: unknown) => error as formatGwei.ErrorType
|
|
106
|
-
|
|
107
98
|
/**
|
|
108
99
|
* Parses a `string` representation of a Value to `bigint` (multiplied by the given exponent).
|
|
109
100
|
*
|
|
@@ -165,9 +156,6 @@ export declare namespace from {
|
|
|
165
156
|
type ErrorType = Errors.GlobalErrorType
|
|
166
157
|
}
|
|
167
158
|
|
|
168
|
-
/* v8 ignore next */
|
|
169
|
-
from.parseError = (error: unknown) => error as from.ErrorType
|
|
170
|
-
|
|
171
159
|
/**
|
|
172
160
|
* Parses a string representation of Ether to a `bigint` Value (default: wei).
|
|
173
161
|
*
|
|
@@ -194,9 +182,6 @@ export declare namespace fromEther {
|
|
|
194
182
|
type ErrorType = from.ErrorType | Errors.GlobalErrorType
|
|
195
183
|
}
|
|
196
184
|
|
|
197
|
-
/* v8 ignore next */
|
|
198
|
-
fromEther.parseError = (error: unknown) => error as fromEther.ErrorType
|
|
199
|
-
|
|
200
185
|
/**
|
|
201
186
|
* Parses a string representation of Gwei to a `bigint` Value (default: wei).
|
|
202
187
|
*
|
|
@@ -220,9 +205,6 @@ export declare namespace fromGwei {
|
|
|
220
205
|
type ErrorType = from.ErrorType | Errors.GlobalErrorType
|
|
221
206
|
}
|
|
222
207
|
|
|
223
|
-
/* v8 ignore next */
|
|
224
|
-
fromGwei.parseError = (error: unknown) => error as fromGwei.ErrorType
|
|
225
|
-
|
|
226
208
|
/**
|
|
227
209
|
* Thrown when a value is not a valid decimal number.
|
|
228
210
|
*
|
package/core/WebAuthnP256.ts
CHANGED
|
@@ -67,9 +67,10 @@ export async function createCredential(
|
|
|
67
67
|
creationOptions,
|
|
68
68
|
)) as internal.PublicKeyCredential
|
|
69
69
|
if (!credential) throw new CredentialCreationFailedError()
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
)
|
|
70
|
+
|
|
71
|
+
const response = credential.response as AuthenticatorAttestationResponse
|
|
72
|
+
const publicKey = await internal.parseCredentialPublicKey(response)
|
|
73
|
+
|
|
73
74
|
return {
|
|
74
75
|
id: credential.id,
|
|
75
76
|
publicKey,
|
|
@@ -99,13 +100,10 @@ export declare namespace createCredential {
|
|
|
99
100
|
|
|
100
101
|
type ErrorType =
|
|
101
102
|
| getCredentialCreationOptions.ErrorType
|
|
103
|
+
| internal.parseCredentialPublicKey.ErrorType
|
|
102
104
|
| Errors.GlobalErrorType
|
|
103
105
|
}
|
|
104
106
|
|
|
105
|
-
createCredential.parseError = (error: unknown) =>
|
|
106
|
-
/* v8 ignore next */
|
|
107
|
-
error as createCredential.ErrorType
|
|
108
|
-
|
|
109
107
|
/**
|
|
110
108
|
* Gets the authenticator data which contains information about the
|
|
111
109
|
* processing of an authenticator request (ie. from `WebAuthnP256.sign`).
|
|
@@ -156,10 +154,6 @@ export declare namespace getAuthenticatorData {
|
|
|
156
154
|
type ErrorType = Errors.GlobalErrorType
|
|
157
155
|
}
|
|
158
156
|
|
|
159
|
-
getAuthenticatorData.parseError = (error: unknown) =>
|
|
160
|
-
/* v8 ignore next */
|
|
161
|
-
error as getAuthenticatorData.ErrorType
|
|
162
|
-
|
|
163
157
|
/**
|
|
164
158
|
* Constructs the Client Data in stringified JSON format which represents client data that
|
|
165
159
|
* was passed to `credentials.get()` in {@link ox#WebAuthnP256.(sign:function)}.
|
|
@@ -219,10 +213,6 @@ export declare namespace getClientDataJSON {
|
|
|
219
213
|
type ErrorType = Errors.GlobalErrorType
|
|
220
214
|
}
|
|
221
215
|
|
|
222
|
-
getClientDataJSON.parseError = (error: unknown) =>
|
|
223
|
-
/* v8 ignore next */
|
|
224
|
-
error as getClientDataJSON.ErrorType
|
|
225
|
-
|
|
226
216
|
/**
|
|
227
217
|
* Returns the creation options for a P256 WebAuthn Credential to be used with
|
|
228
218
|
* the Web Authentication API.
|
|
@@ -361,10 +351,6 @@ export declare namespace getCredentialCreationOptions {
|
|
|
361
351
|
| Errors.GlobalErrorType
|
|
362
352
|
}
|
|
363
353
|
|
|
364
|
-
getCredentialCreationOptions.parseError = (error: unknown) =>
|
|
365
|
-
/* v8 ignore next */
|
|
366
|
-
error as getCredentialCreationOptions.ErrorType
|
|
367
|
-
|
|
368
354
|
/**
|
|
369
355
|
* Returns the request options to sign a challenge with the Web Authentication API.
|
|
370
356
|
*
|
|
@@ -430,9 +416,6 @@ export declare namespace getCredentialRequestOptions {
|
|
|
430
416
|
| Errors.GlobalErrorType
|
|
431
417
|
}
|
|
432
418
|
|
|
433
|
-
getCredentialRequestOptions.parseError = (error: unknown) =>
|
|
434
|
-
error as getCredentialRequestOptions.ErrorType
|
|
435
|
-
|
|
436
419
|
/**
|
|
437
420
|
* Constructs the final digest that was signed and computed by the authenticator. This payload includes
|
|
438
421
|
* the cryptographic `challenge`, as well as authenticator metadata (`authenticatorData` + `clientDataJSON`).
|
|
@@ -557,10 +540,6 @@ export declare namespace getSignPayload {
|
|
|
557
540
|
| Errors.GlobalErrorType
|
|
558
541
|
}
|
|
559
542
|
|
|
560
|
-
getSignPayload.parseError = (error: unknown) =>
|
|
561
|
-
/* v8 ignore next */
|
|
562
|
-
error as getSignPayload.ErrorType
|
|
563
|
-
|
|
564
543
|
/**
|
|
565
544
|
* Signs a challenge using a stored WebAuthn P256 Credential. If no Credential is provided,
|
|
566
545
|
* a prompt will be displayed for the user to select an existing Credential
|
|
@@ -664,10 +643,6 @@ export declare namespace sign {
|
|
|
664
643
|
| Errors.GlobalErrorType
|
|
665
644
|
}
|
|
666
645
|
|
|
667
|
-
sign.parseError = (error: unknown) =>
|
|
668
|
-
/* v8 ignore next */
|
|
669
|
-
error as sign.ErrorType
|
|
670
|
-
|
|
671
646
|
/**
|
|
672
647
|
* Verifies a signature using the Credential's public key and the challenge which was signed.
|
|
673
648
|
*
|
|
@@ -776,10 +751,6 @@ export declare namespace verify {
|
|
|
776
751
|
| Errors.GlobalErrorType
|
|
777
752
|
}
|
|
778
753
|
|
|
779
|
-
verify.parseError = (error: unknown) =>
|
|
780
|
-
/* v8 ignore next */
|
|
781
|
-
error as verify.ErrorType
|
|
782
|
-
|
|
783
754
|
/** Thrown when a WebAuthn P256 credential creation fails. */
|
|
784
755
|
export class CredentialCreationFailedError extends Errors.BaseError<Error> {
|
|
785
756
|
override readonly name = 'WebAuthnP256.CredentialCreationFailedError'
|
package/core/WebCryptoP256.ts
CHANGED
|
@@ -68,10 +68,6 @@ export declare namespace createKeyPair {
|
|
|
68
68
|
type ErrorType = PublicKey.from.ErrorType | Errors.GlobalErrorType
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
createKeyPair.parseError = (error: unknown) =>
|
|
72
|
-
/* v8 ignore next */
|
|
73
|
-
error as createKeyPair.ErrorType
|
|
74
|
-
|
|
75
71
|
/**
|
|
76
72
|
* Signs a payload with the provided `CryptoKey` private key and returns a P256 signature.
|
|
77
73
|
*
|
|
@@ -124,10 +120,6 @@ export declare namespace sign {
|
|
|
124
120
|
type ErrorType = Bytes.fromArray.ErrorType | Errors.GlobalErrorType
|
|
125
121
|
}
|
|
126
122
|
|
|
127
|
-
sign.parseError = (error: unknown) =>
|
|
128
|
-
/* v8 ignore next */
|
|
129
|
-
error as sign.ErrorType
|
|
130
|
-
|
|
131
123
|
/**
|
|
132
124
|
* Verifies a payload was signed by the provided public key.
|
|
133
125
|
*
|
|
@@ -184,7 +176,3 @@ export declare namespace verify {
|
|
|
184
176
|
|
|
185
177
|
type ErrorType = Errors.GlobalErrorType
|
|
186
178
|
}
|
|
187
|
-
|
|
188
|
-
verify.parseError = (error: unknown) =>
|
|
189
|
-
/* v8 ignore next */
|
|
190
|
-
error as verify.ErrorType
|
package/core/Withdrawal.ts
CHANGED
|
@@ -49,10 +49,6 @@ export declare namespace fromRpc {
|
|
|
49
49
|
export type ErrorType = Errors.GlobalErrorType
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
fromRpc.parseError = (error: unknown) =>
|
|
53
|
-
/* v8 ignore next */
|
|
54
|
-
error as fromRpc.ErrorType
|
|
55
|
-
|
|
56
52
|
/**
|
|
57
53
|
* Converts a {@link ox#Withdrawal.Withdrawal} to an {@link ox#Withdrawal.Rpc}.
|
|
58
54
|
*
|
|
@@ -89,7 +85,3 @@ export function toRpc(withdrawal: Withdrawal): Rpc {
|
|
|
89
85
|
export declare namespace toRpc {
|
|
90
86
|
export type ErrorType = Errors.GlobalErrorType
|
|
91
87
|
}
|
|
92
|
-
|
|
93
|
-
toRpc.parseError = (error: unknown) =>
|
|
94
|
-
/* v8 ignore next */
|
|
95
|
-
error as toRpc.ErrorType
|
package/core/internal/base58.ts
CHANGED
package/core/internal/promise.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { p256 } from '@noble/curves/p256'
|
|
2
|
-
import type * as
|
|
2
|
+
import type * as Errors from '../Errors.js'
|
|
3
3
|
import * as Hex from '../Hex.js'
|
|
4
4
|
import * as PublicKey from '../PublicKey.js'
|
|
5
|
+
import { CredentialCreationFailedError } from '../WebAuthnP256.js'
|
|
5
6
|
|
|
6
7
|
/** @internal */
|
|
7
8
|
export type AttestationConveyancePreference =
|
|
@@ -178,21 +179,61 @@ export function parseAsn1Signature(bytes: Uint8Array) {
|
|
|
178
179
|
* @internal
|
|
179
180
|
*/
|
|
180
181
|
export async function parseCredentialPublicKey(
|
|
181
|
-
|
|
182
|
+
response: AuthenticatorAttestationResponse,
|
|
182
183
|
): Promise<PublicKey.PublicKey> {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
new
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
184
|
+
try {
|
|
185
|
+
const publicKeyBuffer = response.getPublicKey()
|
|
186
|
+
if (!publicKeyBuffer) throw new CredentialCreationFailedError()
|
|
187
|
+
|
|
188
|
+
// Converting `publicKeyBuffer` throws when credential is created by 1Password Firefox Add-on
|
|
189
|
+
const publicKeyBytes = new Uint8Array(publicKeyBuffer)
|
|
190
|
+
const cryptoKey = await crypto.subtle.importKey(
|
|
191
|
+
'spki',
|
|
192
|
+
new Uint8Array(publicKeyBytes),
|
|
193
|
+
{
|
|
194
|
+
name: 'ECDSA',
|
|
195
|
+
namedCurve: 'P-256',
|
|
196
|
+
hash: 'SHA-256',
|
|
197
|
+
},
|
|
198
|
+
true,
|
|
199
|
+
['verify'],
|
|
200
|
+
)
|
|
201
|
+
const publicKey = new Uint8Array(
|
|
202
|
+
await crypto.subtle.exportKey('raw', cryptoKey),
|
|
203
|
+
)
|
|
204
|
+
return PublicKey.from(publicKey)
|
|
205
|
+
} catch (error) {
|
|
206
|
+
// Fallback for 1Password Firefox Add-on restricts access to certain credential properties
|
|
207
|
+
// so we need to use `attestationObject` to extract the public key.
|
|
208
|
+
// https://github.com/passwordless-id/webauthn/issues/50#issuecomment-2072902094
|
|
209
|
+
if ((error as Error).message !== 'Permission denied to access object')
|
|
210
|
+
throw error
|
|
211
|
+
|
|
212
|
+
const data = new Uint8Array(response.attestationObject)
|
|
213
|
+
const coordinateLength = 0x20
|
|
214
|
+
const cborPrefix = 0x58
|
|
215
|
+
|
|
216
|
+
const findStart = (key: number) => {
|
|
217
|
+
const coordinate = new Uint8Array([key, cborPrefix, coordinateLength])
|
|
218
|
+
for (let i = 0; i < data.length - coordinate.length; i++)
|
|
219
|
+
if (coordinate.every((byte, j) => data[i + j] === byte))
|
|
220
|
+
return i + coordinate.length
|
|
221
|
+
throw new CredentialCreationFailedError()
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const xStart = findStart(0x21)
|
|
225
|
+
const yStart = findStart(0x22)
|
|
226
|
+
|
|
227
|
+
return PublicKey.from(
|
|
228
|
+
new Uint8Array([
|
|
229
|
+
0x04,
|
|
230
|
+
...data.slice(xStart, xStart + coordinateLength),
|
|
231
|
+
...data.slice(yStart, yStart + coordinateLength),
|
|
232
|
+
]),
|
|
233
|
+
)
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export declare namespace parseCredentialPublicKey {
|
|
238
|
+
type ErrorType = CredentialCreationFailedError | Errors.GlobalErrorType
|
|
198
239
|
}
|
package/package.json
CHANGED
package/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export const version = '0.
|
|
2
|
+
export const version = '0.2.0'
|