@aptos-labs/ts-sdk - v5.1.4
    Preparing search index...

    Class Keyless

    A class to query all Keyless related queries on Aptos.

    More documentation on how to integrate Keyless Accounts see the below Aptos Keyless Integration Guide.

    Hierarchy (View Summary)

    Index

    Keyless

    • Initializes a new instance of the Aptos class with the provided configuration. This allows you to interact with the Aptos blockchain using the specified network settings.

      Parameters

      • config: AptosConfig

        The configuration settings for connecting to the Aptos network.

      Returns Keyless

      import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

      async function runExample() {
      // Create a new configuration for the Aptos client
      const config = new AptosConfig({ network: Network.TESTNET }); // Specify your desired network

      // Initialize the Aptos client with the configuration
      const aptos = new Aptos(config);

      console.log("Aptos client initialized:", aptos);
      }
      runExample().catch(console.error);
    • Fetches the pepper from the Aptos pepper service API.

      Parameters

      • args: { derivationPath?: string; ephemeralKeyPair: EphemeralKeyPair; jwt: string }

        The arguments for fetching the pepper.

        • OptionalderivationPath?: string

          A derivation path used for creating multiple accounts per user via the BIP-44 standard. Defaults to "m/44'/637'/0'/0'/0".

        • ephemeralKeyPair: EphemeralKeyPair

          The EphemeralKeyPair used to generate the nonce in the JWT token.

        • jwt: string

          JWT token.

      Returns Promise<Uint8Array<ArrayBufferLike>>

      The pepper which is a Uint8Array of length 31.

      import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

      const config = new AptosConfig({ network: Network.TESTNET });
      const aptos = new Aptos(config);

      async function runExample() {
      const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair
      const jwt = "your_jwt_token"; // replace with a real JWT token

      // Fetching the pepper using the provided JWT and ephemeral key pair
      const pepper = await aptos.getPepper({
      jwt,
      ephemeralKeyPair,
      // derivationPath: "m/44'/637'/0'/0'/0" // specify your own if needed
      });

      console.log("Fetched pepper:", pepper);
      }
      runExample().catch(console.error);
    • Fetches a proof from the Aptos prover service API.

      Parameters

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

        The arguments for fetching the proof.

        • ephemeralKeyPair: EphemeralKeyPair

          The EphemeralKeyPair used to generate the nonce in the JWT token.

        • jwt: string

          JWT token.

        • Optionalpepper?: HexInput

          The pepper used for the account. If not provided, it will be fetched from the Aptos pepper service.

        • OptionaluidKey?: string

          A key in the JWT token to use to set the uidVal in the IdCommitment.

      Returns Promise<ZeroKnowledgeSig>

      The proof which is represented by a ZeroKnowledgeSig.

      import { Aptos, AptosConfig, Network, EphemeralKeyPair, getPepper } from "@aptos-labs/ts-sdk";

      const config = new AptosConfig({ network: Network.TESTNET });
      const aptos = new Aptos(config);

      async function runExample() {
      const jwt = "your_jwt_token"; // replace with a real JWT token
      const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair

      // Fetch the proof using the getProof function
      const proof = await aptos.getProof({
      jwt,
      ephemeralKeyPair,
      pepper: await getPepper({}), // fetch the pepper if not provided
      uidKey: "sub", // specify the uid key
      });

      console.log("Fetched proof:", proof);
      }
      runExample().catch(console.error);
    • This installs a set of FederatedJWKs at an address for a given iss.

      It will fetch the JSON Web Keyset (JWK) set from the well-known endpoint and update the FederatedJWKs at the sender's address to reflect it.

      Parameters

      • args: {
            iss: string;
            jwksUrl?: string;
            options?: InputGenerateTransactionOptions;
            sender: Account;
        }
        • iss: string

          the iss claim of the federated OIDC provider.

        • OptionaljwksUrl?: string

          the URL to find the corresponding JWKs. For supported IDP providers this parameter in not necessary.

        • Optionaloptions?: InputGenerateTransactionOptions
        • sender: Account

          The account that will install the JWKs

      Returns Promise<SimpleTransaction>

      The pending transaction that results from submission.

    Properties

    config: AptosConfig

    The configuration settings for connecting to the Aptos network.