Represents a Keyless Public Key used for authentication.

This class encapsulates the public key functionality for keyless authentication, including methods for generating and verifying signatures, as well as serialization and deserialization of the key. The KeylessPublicKey is represented in the SDK as AnyPublicKey.

Hierarchy (view full)

Constructors

Methods

  • Serializes a Serializable value to its BCS representation. This function is the TypeScript SDK equivalent of bcs::to_bytes in Move.

    Returns Uint8Array

    the BCS representation of the Serializable instance as a byte buffer.

  • Converts the BCS-serialized bytes of a value into a Hex instance. This function provides a Hex representation of the BCS-serialized data for easier handling and manipulation.

    Returns Hex

    A Hex instance with the BCS-serialized bytes loaded into its underlying Uint8Array.

  • Serializes the current instance into a format suitable for transmission or storage. This function ensures that all relevant fields are properly serialized, including the proof and optional fields.

    Parameters

    • serializer: Serializer

      The serializer instance used to perform the serialization.

    Returns void

  • Creates a KeylessPublicKey from the JWT components plus pepper

    Parameters

    • args: {
          aud: string;
          iss: string;
          pepper: HexInput;
          uidKey: string;
          uidVal: string;
      }
      • aud: string

        the client ID of the application

      • iss: string

        the iss of the identity

      • pepper: HexInput

        The pepper used to maintain privacy of the account

      • uidKey: string

        the key to use to get the uidVal in the JWT token

      • uidVal: string

        the value of the uidKey in the JWT token

    Returns KeylessPublicKey

    KeylessPublicKey

  • Deserializes a ZeroKnowledgeSig object from the provided deserializer. This function allows you to reconstruct a ZeroKnowledgeSig instance from its serialized form.

    Parameters

    • deserializer: Deserializer

      The deserializer instance used to read the serialized data.

    Returns KeylessPublicKey

    A new instance of ZeroKnowledgeSig.

  • Creates a KeylessPublicKey instance from a JWT and a pepper value. This function is useful for generating a public key that can be used for authentication based on the provided JWT claims and pepper.

    Parameters

    • args: {
          jwt: string;
          pepper: HexInput;
          uidKey?: string;
      }

      The arguments for creating the KeylessPublicKey.

      • jwt: string

        The JSON Web Token to decode.

      • pepper: HexInput

        The pepper value used in the key creation process.

      • OptionaluidKey?: string

        An optional key to retrieve the unique identifier from the JWT payload, defaults to "sub".

    Returns KeylessPublicKey

    A KeylessPublicKey instance created from the provided JWT and pepper.

  • Checks if the provided public key is a valid instance by verifying its structure and types.

    Parameters

    • publicKey: PublicKey

      The public key to validate.

    Returns boolean

    A boolean indicating whether the public key is a valid instance.

  • Loads a KeylessPublicKey instance from the provided deserializer. This function is used to deserialize the necessary components to create a KeylessPublicKey.

    Parameters

    • deserializer: Deserializer

      The deserializer used to extract the string and byte data.

    Returns KeylessPublicKey

    A new instance of KeylessPublicKey.

Properties

idCommitment: Uint8Array

A value representing a cryptographic commitment to a user identity.

It is calculated from the aud, uidKey, uidVal, pepper.

iss: string

The value of the 'iss' claim on the JWT which identifies the OIDC provider.

ID_COMMITMENT_LENGTH: number = 32

The number of bytes that idCommitment should be