Skip to content

Commit

Permalink
stop supporting Base58 in json
Browse files Browse the repository at this point in the history
  • Loading branch information
paweljakubas committed Oct 21, 2020
1 parent 6d001e1 commit 6a1ebd1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions core/lib/Cardano/Address/Script.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module Cardano.Address.Script
import Prelude

import Codec.Binary.Encoding
( AbstractEncoding (..), detectEncoding, encode, fromBase16, fromBase58 )
( AbstractEncoding (..), detectEncoding, encode, fromBase16 )
import Control.Applicative
( (<|>) )
import Control.DeepSeq
Expand Down Expand Up @@ -241,10 +241,11 @@ showErr (ErrorKeyHashFromTextInvalidString EBase16) =
showErr (ErrorKeyHashFromTextInvalidString EBech32{}) =
"Invalid Bech32-encoded string."
showErr (ErrorKeyHashFromTextInvalidString EBase58) =
"Invalid Base58-encoded string."
"Verification key hash must be must be encoded as \
\base16 or bech32."
showErr ErrorKeyHashFromTextWrongEncoding =
"Verification key hash must be must be encoded as \
\base16, bech32 or base58."
\base16 or bech32."
showErr ErrorKeyHashFromTextWrongPayload =
"Verification key hash must contain exactly 28 bytes."
showErr ErrorKeyHashFromTextWrongHrp =
Expand All @@ -263,9 +264,7 @@ keyHashFromText txt = case detectEncoding str of
Left _ -> Left $ ErrorKeyHashFromTextInvalidString EBase16
Right bytes -> checkPayload bytes
Just EBech32{} -> fromBech32
Just EBase58 -> case fromBase58 (toBytes str) of
Left _ -> Left $ ErrorKeyHashFromTextInvalidString EBase58
Right bytes -> checkPayload bytes
Just EBase58 -> Left ErrorKeyHashFromTextWrongEncoding
Nothing -> Left ErrorKeyHashFromTextWrongEncoding
where
str = T.unpack txt
Expand Down

0 comments on commit 6a1ebd1

Please sign in to comment.