# PublicKey

Represents a public key object storing either a K1, R1 or WebAuthN key

# Constructor

  • constructor(
      keyType: PublicKeyType = PublicKeyType.K1,
      data: u8[] | null = null
    )
    

    keyType - Type of public key

    data - Data bytes of public key

# Fields

  • var keyType: PublicKeyType;
    

    Uses PublicKeyType enum where:

    enum PublicKeyType {
      K1 = 0,
      R1 = 1,
      WebAuthN = 2
    }
    
  • var k1: ECCPublicKey | null;
    

    ECCPublicKey object is type is K1, null by default

  • var r1: ECCPublicKey | null;
    

    ECCPublicKey object is type is R1, null by default

  • var k1: ECCPublicKey | null;
    

    ECCPublicKey object is type is K1, null by default

  • var webAuthN: WebAuthNPublicKey | null;
    

    WebAuthNPublicKey object is type is WebAuthN, null by default

# Instance Methods

  • static function toString(): string
    
    Prints the hex representation of the public key bytes. Note this will not print prefixes like PUB_K1, those are client-side

# Static Equality methods

  • static function eq(a: PublicKey, b: PublicKey): bool
    

    Checks that the two public keys are equal

  • static function neq(a: PublicKey, b: PublicKey): bool
    

    Checks that the two public keys are not equal

  • static function gt(a: PublicKey, b: PublicKey): bool
    

    Checks whether public key a is larger than public key b

  • static function lt(a: PublicKey, b: PublicKey): bool
    

    Checks whether public key a is less than public key b