Background: for Yoroi we need to convert our Icarus-style public & private keys to the new Shelley wrapper. To make this easy, I add a from_bytes function to both PublicKey and PrivateKey
Usage in Yoroi looks like this
export function v2SkKeyToV3Key(
v2Key: RustModule.WalletV2.PrivateKey,
): RustModule.WalletV3.PrivateKey {
return RustModule.WalletV3.PrivateKey.from_extended_bytes(
// need to slice out the chain code from the private key
Buffer.from(v2Key.to_hex().slice(0, 128), 'hex')
);
}
export function v2PkKeyToV3Key(
v2Key: RustModule.WalletV2.PublicKey,
): RustModule.WalletV3.PublicKey {
return RustModule.WalletV3.PublicKey.from_bytes(
// need to slice out the chain code from the public key
Buffer.from(v2Key.to_hex().slice(0, 64), 'hex')
);
}
Background: for Yoroi we need to convert our Icarus-style public & private keys to the new Shelley wrapper. To make this easy, I add a
from_bytes
function to bothPublicKey
andPrivateKey
Usage in Yoroi looks like this
Solves #52 #53