Key Custody Frameworks: Engineering Secure Wallet Architectures