Skip to content

Commit

Permalink
DRep extended key: add CastVerificationKeyRole
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Oct 19, 2023
1 parent ec72630 commit 1bc2112
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cardano-api/internal/Cardano/Api/Keys/Shelley.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1723,6 +1723,18 @@ instance SerialiseAsBech32 (SigningKey DRepExtendedKey) where
bech32PrefixFor _ = "drep_xsk"
bech32PrefixesPermitted _ = ["drep_xsk"]

instance CastVerificationKeyRole DRepExtendedKey DRepKey where
castVerificationKey (DRepExtendedVerificationKey vk) =
DRepVerificationKey
. Shelley.VKey
. fromMaybe impossible
. Crypto.rawDeserialiseVerKeyDSIGN
. Crypto.HD.xpubPublicKey
$ vk
where
impossible =
error "castVerificationKey: byron and shelley key sizes do not match!"

--
-- Committee keys
--
Expand Down

0 comments on commit 1bc2112

Please sign in to comment.