diff --git a/src/lib_crypto/base58.ml b/src/lib_crypto/base58.ml index e90baa899..9b6a483ba 100644 --- a/src/lib_crypto/base58.ml +++ b/src/lib_crypto/base58.ml @@ -327,6 +327,7 @@ module Prefix = struct let ed25519_secret_key = "\043\246\078\007" (* edsk(98) *) let ed25519_signature = "\009\245\205\134\018" (* edsig(99) *) let secp256k1_signature = "\013\115\101\019\063" (* spsig1(99) *) + let generic_signature = "\004\130\043" (* sig(96) *) (* 4 *) let chain_id = "\087\082\000" (* Net(15) *) diff --git a/src/lib_crypto/base58.mli b/src/lib_crypto/base58.mli index 0095338a1..94ccfedcd 100644 --- a/src/lib_crypto/base58.mli +++ b/src/lib_crypto/base58.mli @@ -27,6 +27,7 @@ module Prefix : sig val secp256k1_public_key: string val secp256k1_secret_key: string val secp256k1_signature: string + val generic_signature: string val chain_id: string end diff --git a/src/lib_crypto/signature.ml b/src/lib_crypto/signature.ml index ffb950e58..e7130ff8c 100644 --- a/src/lib_crypto/signature.ml +++ b/src/lib_crypto/signature.ml @@ -348,12 +348,15 @@ let of_string_opt s = of_bytes_opt (MBytes.of_string s) type Base58.data += Data of t let b58check_encoding = Base58.register_encoding - ~prefix: "\004\130\043" - ~length: 96 + ~prefix: Base58.Prefix.generic_signature + ~length: Ed25519.size ~to_raw: to_string ~of_raw: of_string_opt ~wrap: (fun x -> Data x) +let () = + Base58.check_encoded_prefix b58check_encoding "sig" 96 + include Helpers.MakeRaw(struct type nonrec t = t let name = name