Module

WebAuth

Classes

InvalidChallengeError

Methods

# inner gatherTxSigners(transaction, signers) → {Array.<string>}

Checks if a transaction has been signed by one or more of the given signers, returning a list of non-repeated signers that were found to have signed the given transaction.

Parameters:
Name Type Description
transaction Transaction | FeeBumpTransaction

The signed transaction.

signers Array.<string>

The signer's public keys.

View Source lib/webauth/utils.js, line 38

A list of signers that were found to have signed the transaction.

Array.<string>
Example
let keypair1 = Keypair.random();
let keypair2 = Keypair.random();
const account = new StellarSdk.Account(keypair1.publicKey(), "-1");

const transaction = new TransactionBuilder(account, { fee: 100 })
   .setTimeout(30)
   .build();

transaction.sign(keypair1, keypair2)
WebAuth.gatherTxSigners(transaction, [keypair1.publicKey(), keypair2.publicKey()])

# inner verifyTxSignedBy(transaction, accountID) → {boolean}

Verifies if a transaction was signed by the given account id.

Parameters:
Name Type Description
transaction Transaction | FeeBumpTransaction

The signed transaction.

accountID string

The signer's public key.

View Source lib/webauth/utils.js, line 86

Whether or not accountID was found to have signed the transaction.

boolean
Example
let keypair = Keypair.random();
const account = new StellarSdk.Account(keypair.publicKey(), "-1");

const transaction = new TransactionBuilder(account, { fee: 100 })
   .setTimeout(30)
   .build();

transaction.sign(keypair)
WebAuth.verifyTxSignedBy(transaction, keypair.publicKey())