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.
The configuration settings for connecting to the Aptos network.
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);
Optional
pepper?: HexInputOptional
proofOptional
uidOptional
pepper?: HexInputOptional
proofOptional
uidFetches the pepper from the Aptos pepper service API.
The arguments for fetching the pepper.
Optional
derivationA derivation path used for creating multiple accounts per user via the BIP-44 standard. Defaults to "m/44'/637'/0'/0'/0".
The EphemeralKeyPair used to generate the nonce in the JWT token.
JWT token.
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.
The arguments for fetching the proof.
The EphemeralKeyPair used to generate the nonce in the JWT token.
JWT token.
Optional
pepper?: HexInputThe pepper used for the account. If not provided, it will be fetched from the Aptos pepper service.
Optional
uidA key in the JWT token to use to set the uidVal in the IdCommitment.
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.
the iss claim of the federated OIDC provider.
Optional
jwksthe URL to find the corresponding JWKs. For supported IDP providers this parameter in not necessary.
Optional
options?: InputGenerateTransactionOptionsThe account that will install the JWKs
The pending transaction that results from submission.
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.