whyoleg/cryptography-kotlin

Add support for encoding/decoding compressed EC keys

Closed this issue · 1 comments

            public sealed class RAW : Format() {
                public companion object : RAW() {
                    override val name: String get() = "RAW"
                }
                public data object COMPRESSED : RAW() {
                    override val name: String get() = "RAW_COMPRESSED"
                }
            }

Hi, @whyoleg currently the EC public key encoder/decoder only supports the uncompressed format which starts with 04. I plan to add a new compressed format in RAW format. What do you think :)

Hey!
Yeah, that should be fine with minor API addition: let's add a name for companion object, so that it will be:

public companion object Uncompressed : RAW()

In this way, both Format.RAW and Format.RAW.Uncompressed will be resolved and first could be used in most of the cases, while explicit name could be used for cases when you need to handle both variants.

Also, on current moment formats with multiple representations uses / as a separator in name, so let's use RAW/COMPRESSED