@blockchaincommons/components - v1.0.0-beta.4
    Preparing search index...

    Class ECPublicKey

    EC compressed public key for ECDSA verification (secp256k1, 33 bytes)

    An ECPublicKey is a 33-byte compressed representation of a public key on the secp256k1 curve. The first byte is a prefix (0x02 or 0x03) that indicates the parity of the y-coordinate, followed by the 32-byte x-coordinate.

    These public keys are used to:

    • Verify ECDSA signatures
    • Identify the owner of a private key without revealing the private key

    CBOR Serialization

    ECPublicKey is serialized to CBOR with tags 40306 (or legacy 306).

    The format is a map:

    #6.40306({
    3: h'<33-byte-public-key>' // key data (no key 2 means public key)
    })

    Implements

    Index
    KEY_SIZE: number = ecdsa.PUBLIC_KEY_SIZE

    The byte length of a ECPublicKey.

    • Verify an ECDSA signature. A key that does not decode, or a signature whose r or s is not below the curve order, is an InvalidData failure (the reference's ecdsa_verify panics on them); any other pair is true or false.

      Parameters

      • signature: Uint8Array
      • message: Uint8Array

      Returns boolean

    • The first four bytes of reference() in hex, the reference's ref_hex_short.

      Returns string

    • The reference's Display: the type name over the short reference.

      Returns string

    • The CBOR tags of this type; the first one is used to encode. As the reference, this type is only encoded: it has no fromCbor.

      Returns Tag[]

    • Returns the untagged CBOR encoding.

      Format: { 3: h'<33-byte-key>' } Note: No key 2 indicates this is a public key

      Returns Cbor