Skip to content

Commit

Permalink
Merge pull request #327 from input-output-hk/smelc/drep-extended-key-…
Browse files Browse the repository at this point in the history
…missing-bit

DRep extended key: add CastVerificationKeyRole
  • Loading branch information
smelc authored Oct 20, 2023
2 parents 8295c20 + d133e42 commit 2e299c1
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 (DRep): byron and shelley key sizes do not match!"

--
-- Committee keys
--
Expand Down

0 comments on commit 2e299c1

Please sign in to comment.