CompatPrivateKeyBundle extension

This enhances the xmtp.PrivateKeyBundle to simplify access to the "wallet", "identity" and "preKeys".

This extension handles the compatibility logic required to support both V1 and V2 of PrivateKeyBundle.

TODO: roll this into a "PrivateKeyBundle" helper class

on

Properties

identity → EthPrivateKey
This returns the identity key for the bundle.
no setter
preKeys List<EthPrivateKey>
This yields all authorized preKeys in the bundle.
no setter
wallet → EthereumAddress
This returns the wallet that authorized this "identity"
no setter

Methods

getPre(EthereumAddress address) → EthPrivateKey
Get the preKey with the specified address. Throws an error when it cannot be found.
toV1() PrivateKeyBundleV1
Create the v1 bundle for these keys. Note: v1 bundles sign their identity key with type .ecdsaCompact
toV2() PrivateKeyBundleV2
Create the v2 bundle for these keys. Note: v2 bundles sign their identity key with type .walletEcdsaCompact