PHP WebShell
Текущая директория: /opt/BitGoJS/node_modules/@aptos-labs/ts-sdk/dist/esm
Просмотр файла: chunk-ALNQK276.mjs.map
{"version":3,"sources":["../../src/api/keyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account, EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from \"../account\";\nimport { FederatedKeylessAccount } from \"../account/FederatedKeylessAccount\";\nimport { AccountAddressInput, ZeroKnowledgeSig } from \"../core\";\nimport {\n deriveKeylessAccount,\n getPepper,\n getProof,\n updateFederatedKeylessJwkSetTransaction,\n} from \"../internal/keyless\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions\";\nimport { HexInput } from \"../types\";\nimport { AptosConfig } from \"./aptosConfig\";\n\n/**\n * A class to query all `Keyless` related queries on Aptos.\n *\n * More documentation on how to integrate Keyless Accounts see the below\n * [Aptos Keyless Integration Guide](https://aptos.dev/guides/keyless-accounts/#aptos-keyless-integration-guide).\n */\nexport class Keyless {\n /**\n * Initializes a new instance of the Aptos class with the provided configuration.\n * This allows you to interact with the Aptos blockchain using the specified network settings.\n *\n * @param config - The configuration settings for connecting to the Aptos network.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a new configuration for the Aptos client\n * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your desired network\n *\n * // Initialize the Aptos client with the configuration\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Fetches the pepper from the Aptos pepper service API.\n *\n * @param args - The arguments for fetching the pepper.\n * @param args.jwt - JWT token.\n * @param args.ephemeralKeyPair - The EphemeralKeyPair used to generate the nonce in the JWT token.\n * @param args.derivationPath - A derivation path used for creating multiple accounts per user via the BIP-44 standard. Defaults\n * to \"m/44'/637'/0'/0'/0\".\n * @returns The pepper which is a Uint8Array of length 31.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair\n * const jwt = \"your_jwt_token\"; // replace with a real JWT token\n *\n * // Fetching the pepper using the provided JWT and ephemeral key pair\n * const pepper = await aptos.getPepper({\n * jwt,\n * ephemeralKeyPair,\n * // derivationPath: \"m/44'/637'/0'/0'/0\" // specify your own if needed\n * });\n *\n * console.log(\"Fetched pepper:\", pepper);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getPepper(args: {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n derivationPath?: string;\n }): Promise<Uint8Array> {\n return getPepper({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches a proof from the Aptos prover service API.\n *\n * @param args - The arguments for fetching the proof.\n * @param args.jwt - JWT token.\n * @param args.ephemeralKeyPair - The EphemeralKeyPair used to generate the nonce in the JWT token.\n * @param args.pepper - The pepper used for the account. If not provided, it will be fetched from the Aptos pepper service.\n * @param args.uidKey - A key in the JWT token to use to set the uidVal in the IdCommitment.\n *\n * @returns The proof which is represented by a ZeroKnowledgeSig.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, EphemeralKeyPair, getPepper } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * const jwt = \"your_jwt_token\"; // replace with a real JWT token\n * const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair\n *\n * // Fetch the proof using the getProof function\n * const proof = await aptos.getProof({\n * jwt,\n * ephemeralKeyPair,\n * pepper: await getPepper({}), // fetch the pepper if not provided\n * uidKey: \"sub\", // specify the uid key\n * });\n *\n * console.log(\"Fetched proof:\", proof);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getProof(args: {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper?: HexInput;\n uidKey?: string;\n }): Promise<ZeroKnowledgeSig> {\n return getProof({ aptosConfig: this.config, ...args });\n }\n\n async deriveKeylessAccount(args: {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n }): Promise<KeylessAccount>;\n\n async deriveKeylessAccount(args: {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n }): Promise<FederatedKeylessAccount>;\n\n /**\n * Derives a Keyless Account from the provided JWT token and corresponding EphemeralKeyPair. This function computes the proof\n * via the proving service and can fetch the pepper from the pepper service if not explicitly provided.\n *\n * @param args - The arguments required to derive the Keyless Account.\n * @param args.jwt - The JWT token used for deriving the account.\n * @param args.ephemeralKeyPair - The EphemeralKeyPair used to generate the nonce in the JWT token.\n * @param args.jwkAddress - The address the where the JWKs used to verify signatures are found. Setting the value derives a\n * FederatedKeylessAccount.\n * @param args.uidKey - An optional key in the JWT token to set the uidVal in the IdCommitment.\n * @param args.pepper - An optional pepper value.\n * @param args.proofFetchCallback - An optional callback function for fetching the proof in the background, allowing for a more\n * responsive user experience.\n *\n * @returns A KeylessAccount that can be used to sign transactions.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, deriveKeylessAccount } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * const jwt = \"your_jwt_token\"; // replace with a real JWT token\n * const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair\n *\n * // Deriving the Keyless Account\n * const keylessAccount = await deriveKeylessAccount({\n * jwt,\n * ephemeralKeyPair,\n * uidKey: \"your_uid_key\", // optional\n * pepper: \"your_pepper\", // optional\n * });\n *\n * console.log(\"Keyless Account derived:\", keylessAccount);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async deriveKeylessAccount(args: {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress?: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n }): Promise<KeylessAccount | FederatedKeylessAccount> {\n return deriveKeylessAccount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * This installs a set of FederatedJWKs at an address for a given iss.\n *\n * It will fetch the JSON Web Keyset (JWK) set from the well-known endpoint and update the FederatedJWKs at the sender's address\n * to reflect it.\n *\n * @param args.sender The account that will install the JWKs\n * @param args.iss the iss claim of the federated OIDC provider.\n * @param args.jwksUrl the URL to find the corresponding JWKs. For supported IDP providers this parameter in not necessary.\n *\n * @returns The pending transaction that results from submission.\n */\n async updateFederatedKeylessJwkSetTransaction(args: {\n sender: Account;\n iss: string;\n jwksUrl?: string;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return updateFederatedKeylessJwkSetTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"8DAsBO,IAAMA,EAAN,KAAc,CAuBnB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAmC3C,MAAM,UAAUC,EAIQ,CACtB,OAAOC,EAAU,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACxD,CAqCA,MAAM,SAASA,EAKe,CAC5B,OAAOE,EAAS,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACvD,CA2DA,MAAM,qBAAqBA,EAO2B,CACpD,OAAOG,EAAqB,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CACnE,CAcA,MAAM,wCAAwCA,EAKf,CAC7B,OAAOI,EAAwC,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CACtF,CACF","names":["Keyless","config","args","getPepper","getProof","deriveKeylessAccount","updateFederatedKeylessJwkSetTransaction"]}Выполнить команду
Для локальной разработки. Не используйте в интернете!