Checks challenge transaction signed by user on developer's side.
Token Object
Attribute | Type | Description |
---|---|---|
seed | String | DApp private seed |
xdr | String | Challenge Transaction XDR |
address | String | User public key |
Secret Seeds
Make sure you keep all the secret seeds stored safely, extracting into ENV variables or equivalent. Keys present throughout the documentation only serve for example purposes and belong to an account in the Test network.
Methods
#hash(format = :binary) ⇒ String
Returns transaction hash.
#validate!(strict = true) ⇒ Boolean
Validates transaction signed by developer and user.
strict
True by default, checks that the transaction respects the time bounds.
Value
Mobius::Client::strict_interval
is 10s.
Exceptions
Calling this method can raise on of the following exceptions:
Unauthorized — if one of the signatures is invalid
Invalid — if transaction is malformed or time bounds are missing
Expired — if transaction is expired (current time outside it's time bounds)
#time_bounds ⇒ Stellar::TimeBounds
Returns time bounds for given transaction.
Exceptions
Calling this method can raise on of the following exceptions:
Unauthorized – if one of the signatures is invalid.
Invalid – if transaction is malformed or time bounds are missing.
seed = "SBBT7NRAKW43LN6ZGSZI37HEJDYWOC62LIZUL35KHO6NI2SKJLEPVAY4"
xdr = "AAAAAB...sYzQAI"
address = "GDPNZJR42G4PVA3235JHCGGTU2J54X4XGJIMQGDJXYGHQDY6MQW5SZ5Y"
token = Mobius::Client::Auth::Token.new(seed, xdr, address)
# =>
<Mobius::Client::Auth::Token:0x00007f90ac841b80
@seed="SBBT7NRAKW43LN6ZGSZI37HEJDYWOC62LIZUL35KHO6NI2SKJLEPVAY4",
@xdr="AAAAAB...sYzQAI",
@address="GDPNZJR42G4PVA3235JHCGGTU2J54X4XGJIMQGDJXYGHQDY6MQW5SZ5Y"
>
token.validate!
# =>
true
token.time_bounds
# =>
<Stellar::TimeBounds:0x00007f90ac840f50
@attributes={
min_time: 1530665318,
max_time: 1530751718
}
>
token.hash
# =>
%CX8ѤU>r;
const seed = 'SBBT7NRAKW43LN6ZGSZI37HEJDYWOC62LIZUL35KHO6NI2SKJLEPVAY4';
const xdr = 'AAAAAB...sYzQAI';
const address = 'GDPNZJR42G4PVA3235JHCGGTU2J54X4XGJIMQGDJXYGHQDY6MQW5SZ5Y';
const token = Mobius.Auth.Token(seed, xdr, address);
token.validate(); // => true
token.timeBounds; // => { minTime: 1530665318, maxTime: 1530751718 }
token.hash; // => '%CX8ѤU>r;'
XDR Viewer
Click the links below to open the Stellar XDR Viewer for each one.