public class Sep10Challenge
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Sep10Challenge.ChallengeTransaction
Used to store the results produced by
readChallengeTransaction(String, String, Network, String[], String) . |
static class |
Sep10Challenge.Signer
Represents a transaction signer.
|
Modifier and Type | Method and Description |
---|---|
static Transaction |
newChallenge(KeyPair signer,
Network network,
java.lang.String clientAccountId,
java.lang.String domainName,
java.lang.String webAuthDomain,
TimeBounds timebounds)
Returns a valid SEP 10 challenge, for use in web authentication.
|
static Transaction |
newChallenge(KeyPair signer,
Network network,
java.lang.String clientAccountId,
java.lang.String domainName,
java.lang.String webAuthDomain,
TimeBounds timebounds,
java.lang.String clientDomain,
java.lang.String clientSigningKey)
Returns a valid SEP 10 challenge, for use in web authentication.
|
static Sep10Challenge.ChallengeTransaction |
readChallengeTransaction(java.lang.String challengeXdr,
java.lang.String serverAccountId,
Network network,
java.lang.String[] domainNames,
java.lang.String webAuthDomain)
Reads a SEP 10 challenge transaction and returns the decoded transaction envelope and client account ID contained within.
|
static Sep10Challenge.ChallengeTransaction |
readChallengeTransaction(java.lang.String challengeXdr,
java.lang.String serverAccountId,
Network network,
java.lang.String domainName,
java.lang.String webAuthDomain)
Reads a SEP 10 challenge transaction and returns the decoded transaction envelope and client account ID contained within.
|
static java.util.Set<java.lang.String> |
verifyChallengeTransactionSigners(java.lang.String challengeXdr,
java.lang.String serverAccountId,
Network network,
java.lang.String[] domainNames,
java.lang.String webAuthDomain,
java.util.Set<java.lang.String> signers)
Verifies that for a SEP 10 challenge transaction
all signatures on the transaction are accounted for.
|
static java.util.Set<java.lang.String> |
verifyChallengeTransactionSigners(java.lang.String challengeXdr,
java.lang.String serverAccountId,
Network network,
java.lang.String domainName,
java.lang.String webAuthDomain,
java.util.Set<java.lang.String> signers)
Verifies that for a SEP 10 challenge transaction
all signatures on the transaction are accounted for.
|
static java.util.Set<java.lang.String> |
verifyChallengeTransactionThreshold(java.lang.String challengeXdr,
java.lang.String serverAccountId,
Network network,
java.lang.String[] domainNames,
java.lang.String webAuthDomain,
int threshold,
java.util.Set<Sep10Challenge.Signer> signers)
Verifies that for a SEP-0010 challenge transaction
all signatures on the transaction are accounted for and that the signatures
meet a threshold on an account.
|
static java.util.Set<java.lang.String> |
verifyChallengeTransactionThreshold(java.lang.String challengeXdr,
java.lang.String serverAccountId,
Network network,
java.lang.String domainName,
java.lang.String webAuthDomain,
int threshold,
java.util.Set<Sep10Challenge.Signer> signers)
Verifies that for a SEP-0010 challenge transaction
all signatures on the transaction are accounted for and that the signatures
meet a threshold on an account.
|
public static Transaction newChallenge(KeyPair signer, Network network, java.lang.String clientAccountId, java.lang.String domainName, java.lang.String webAuthDomain, TimeBounds timebounds) throws InvalidSep10ChallengeException
signer
- The server's signing account.network
- The Stellar network used by the server.clientAccountId
- The stellar account belonging to the client.domainName
- The fully qualified domain name of the service requiring authentication.webAuthDomain
- The fully qualified domain name of the service issuing the challenge.timebounds
- The lifetime of the challenge token.InvalidSep10ChallengeException
public static Transaction newChallenge(KeyPair signer, Network network, java.lang.String clientAccountId, java.lang.String domainName, java.lang.String webAuthDomain, TimeBounds timebounds, java.lang.String clientDomain, java.lang.String clientSigningKey) throws InvalidSep10ChallengeException
signer
- The server's signing account.network
- The Stellar network used by the server.clientAccountId
- The stellar account belonging to the client.domainName
- The fully qualified domain name of the service requiring authentication.webAuthDomain
- The fully qualified domain name of the service issuing the challenge.timebounds
- The lifetime of the challenge token.clientDomain
- The domain of the client application requesting authentication.clientSigningKey
- The stellar account listed as the SIGNING_KEY on the client domain's TOML file.InvalidSep10ChallengeException
public static Sep10Challenge.ChallengeTransaction readChallengeTransaction(java.lang.String challengeXdr, java.lang.String serverAccountId, Network network, java.lang.String[] domainNames, java.lang.String webAuthDomain) throws InvalidSep10ChallengeException, java.io.IOException
It also verifies that transaction is signed by the server.
It does not verify that the transaction has been signed by the client or
that any signatures other than the servers on the transaction are valid. Use
one of the following functions to completely verify the transaction:
verifyChallengeTransactionSigners(String, String, Network, String, String, Set)
or
verifyChallengeTransactionThreshold(String, String, Network, String, String, int, Set)
or
verifyChallengeTransactionSigners(String, String, Network, String[], String, Set)
or
verifyChallengeTransactionThreshold(String, String, Network, String[], String, int, Set)
or
challengeXdr
- SEP-0010 transaction challenge transaction in base64.serverAccountId
- Account ID for server's account.network
- The network to connect to for verifying and retrieving.domainNames
- An array of home domains, one of which is expected to be included in the first Manage Data operation's string key.webAuthDomain
- The home domain that is expected to be included as the value of the Manage Data operation with the 'web_auth_domain' key. If no such operation is included, this parameter is not used.Sep10Challenge.ChallengeTransaction
, the decoded transaction envelope and client account ID contained within.InvalidSep10ChallengeException
- If the SEP-0010 validation fails, the exception will be thrown.java.io.IOException
- If read XDR string fails, the exception will be thrown.public static Sep10Challenge.ChallengeTransaction readChallengeTransaction(java.lang.String challengeXdr, java.lang.String serverAccountId, Network network, java.lang.String domainName, java.lang.String webAuthDomain) throws InvalidSep10ChallengeException, java.io.IOException
It also verifies that transaction is signed by the server.
It does not verify that the transaction has been signed by the client or
that any signatures other than the servers on the transaction are valid. Use
one of the following functions to completely verify the transaction:
verifyChallengeTransactionSigners(String, String, Network, String, String, Set)
or
verifyChallengeTransactionThreshold(String, String, Network, String, String, int, Set)
or
verifyChallengeTransactionSigners(String, String, Network, String[], String, Set)
or
verifyChallengeTransactionThreshold(String, String, Network, String[], String, int, Set)
or
challengeXdr
- SEP-0010 transaction challenge transaction in base64.serverAccountId
- Account ID for server's account.network
- The network to connect to for verifying and retrieving.domainName
- The home domain that is expected to be included in the first Manage Data operation's string key.webAuthDomain
- The home domain that is expected to be included as the value of the Manage Data operation with the 'web_auth_domain' key, if present.Sep10Challenge.ChallengeTransaction
, the decoded transaction envelope and client account ID contained within.InvalidSep10ChallengeException
- If the SEP-0010 validation fails, the exception will be thrown.java.io.IOException
- If read XDR string fails, the exception will be thrown.public static java.util.Set<java.lang.String> verifyChallengeTransactionSigners(java.lang.String challengeXdr, java.lang.String serverAccountId, Network network, java.lang.String domainName, java.lang.String webAuthDomain, java.util.Set<java.lang.String> signers) throws InvalidSep10ChallengeException, java.io.IOException
challengeXdr
- SEP-0010 transaction challenge transaction in base64.serverAccountId
- Account ID for server's account.network
- The network to connect to for verifying and retrieving.domainName
- The home domain that is expected to be included in the first Manage Data operation's string key.webAuthDomain
- The home domain that is expected to be included as the value of the Manage Data operation with the 'web_auth_domain' key, if present.signers
- The signers of client account.InvalidSep10ChallengeException
- If the SEP-0010 validation fails, the exception will be thrown.java.io.IOException
- If read XDR string fails, the exception will be thrown.public static java.util.Set<java.lang.String> verifyChallengeTransactionSigners(java.lang.String challengeXdr, java.lang.String serverAccountId, Network network, java.lang.String[] domainNames, java.lang.String webAuthDomain, java.util.Set<java.lang.String> signers) throws InvalidSep10ChallengeException, java.io.IOException
challengeXdr
- SEP-0010 transaction challenge transaction in base64.serverAccountId
- Account ID for server's account.network
- The network to connect to for verifying and retrieving.domainNames
- An array of home domains, one of which is expected to be included in the first Manage Data operation's string key.webAuthDomain
- The home domain that is expected to be included as the value of the Manage Data operation with the 'web_auth_domain' key, if present.signers
- The signers of client account.InvalidSep10ChallengeException
- If the SEP-0010 validation fails, the exception will be thrown.java.io.IOException
- If read XDR string fails, the exception will be thrown.public static java.util.Set<java.lang.String> verifyChallengeTransactionThreshold(java.lang.String challengeXdr, java.lang.String serverAccountId, Network network, java.lang.String[] domainNames, java.lang.String webAuthDomain, int threshold, java.util.Set<Sep10Challenge.Signer> signers) throws InvalidSep10ChallengeException, java.io.IOException
challengeXdr
- SEP-0010 transaction challenge transaction in base64.serverAccountId
- Account ID for server's account.network
- The network to connect to for verifying and retrieving.domainNames
- An array of home domains, one of which is expected to be included in the first Manage Data operation's string key.webAuthDomain
- The home domain that is expected to be included as the value of the Manage Data operation with the 'web_auth_domain' key, if present.threshold
- The threshold on the client account.signers
- The signers of client account.InvalidSep10ChallengeException
- If the SEP-0010 validation fails, the exception will be thrown.java.io.IOException
- If read XDR string fails, the exception will be thrown.public static java.util.Set<java.lang.String> verifyChallengeTransactionThreshold(java.lang.String challengeXdr, java.lang.String serverAccountId, Network network, java.lang.String domainName, java.lang.String webAuthDomain, int threshold, java.util.Set<Sep10Challenge.Signer> signers) throws InvalidSep10ChallengeException, java.io.IOException
challengeXdr
- SEP-0010 transaction challenge transaction in base64.serverAccountId
- Account ID for server's account.network
- The network to connect to for verifying and retrieving.domainName
- The home domain that is expected to be included in the first Manage Data operation's string key.webAuthDomain
- The home domain that is expected to be included as the value of the Manage Data operation with the 'web_auth_domain' key, if present.threshold
- The threshold on the client account.signers
- The signers of client account.InvalidSep10ChallengeException
- If the SEP-0010 validation fails, the exception will be thrown.java.io.IOException
- If read XDR string fails, the exception will be thrown.