Class FederatedKeylessAccount

Account implementation for the FederatedKeyless authentication scheme.

Used to represent a FederatedKeyless based account and sign transactions with it.

Use FederatedKeylessAccount.create() to instantiate a KeylessAccount with a JSON Web Token (JWT), proof, EphemeralKeyPair and the address the JSON Web Key Set (JWKS) are installed that will be used to verify the JWT.

When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT, EphemeralKeyPair, and corresponding proof.

Hierarchy (view full)

Implementation - Account (On-Chain Model)

accountAddress: AccountAddress

Account address associated with the account

aud: string

The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's OIDC registration with the identity provider.

ephemeralKeyPair: EphemeralKeyPair

The EphemeralKeyPair used to generate sign.

jwt: string

The JWT token used to derive the account

pepper: Uint8Array

A value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider.

proof: undefined | ZeroKnowledgeSig

The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair.

proofOrPromise: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>

The proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on fetching the proof.

The FederatedKeylessPublicKey associated with the account

signingScheme: SigningScheme = SigningScheme.SingleKey

Signing scheme used to sign transactions

uidKey: string

The claim on the JWT to identify a user. This is typically 'sub' or 'email'.

uidVal: string

The value of the uidKey claim on the JWT. This intended to be a stable user identifier.

Implementation - BCS

  • 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.

Constructors

  • Use the static generator FederatedKeylessAccount.create(...) instead. Creates a KeylessAccount instance using the provided parameters. This function allows you to set up a KeylessAccount with specific attributes such as address, proof, and JWT.

    Parameters

    • args: {
          address?: AccountAddress;
          aud: string;
          audless?: boolean;
          ephemeralKeyPair: EphemeralKeyPair;
          iss: string;
          jwkAddress: AccountAddress;
          jwt: string;
          pepper: HexInput;
          proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;
          proofFetchCallback?: ProofFetchCallback;
          uidKey: string;
          uidVal: string;
          verificationKeyHash?: HexInput;
      }

      The parameters for creating a KeylessAccount.

      • Optionaladdress?: AccountAddress

        Optional account address associated with the KeylessAccount.

      • aud: string
      • Optionalaudless?: boolean
      • ephemeralKeyPair: EphemeralKeyPair

        The ephemeral key pair used in the account creation.

      • iss: string
      • jwkAddress: AccountAddress

        The address which stores the JSON Web Key Set (JWKS) used to verify the JWT.

      • jwt: string

        A JSON Web Token used for authentication.

      • pepper: HexInput
      • proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>

        A Zero Knowledge Signature or a promise that resolves to one.

      • OptionalproofFetchCallback?: ProofFetchCallback

        Optional callback function for fetching proof.

      • uidKey: string

        Optional key for user identification, defaults to "sub".

      • uidVal: string
      • OptionalverificationKeyHash?: HexInput

    Returns FederatedKeylessAccount

Methods

  • Serializes the transaction data into a format suitable for transmission or storage. This function ensures that both the transaction bytes and the proof are properly serialized.

    Parameters

    • serializer: Serializer

      The serializer instance used to convert the transaction data into bytes.

    Returns void

  • Deserializes the provided deserializer to create a KeylessAccount instance. This function extracts necessary components such as the JWT, UID key, pepper, ephemeral key pair, and proof from the deserializer.

    Parameters

    • deserializer: Deserializer

      The deserializer instance used to retrieve the serialized data.

    Returns FederatedKeylessAccount

    A KeylessAccount instance created from the deserialized data.

Properties

audless: boolean
verificationKeyHash?: Uint8Array

The hash of the verification key used to verify the proof. This is optional and can be used to check verifying key rotations which may invalidate the proof.

PEPPER_LENGTH: number = 31
MMNEPVFCICPMFPCPTTAAATR