Skip to content

Commit

Permalink
SEP-10: get service domain from TOML file (stellar#297)
Browse files Browse the repository at this point in the history
* SEP-10: get service domain from TOML file

* Use host instead of hostname
  • Loading branch information
quietbits authored Aug 22, 2022
1 parent f23e04a commit d93d543
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/demo-wallet-client/src/ducks/sep24DepositAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,14 @@ export const depositAssetAction = createAsyncThunk<
"SEP-24 deposit is enabled, and requires authentication so we should go through SEP-10",
});

const serviceDomain = new URL(tomlResponse.TRANSFER_SERVER_SEP0024).host;

// SEP-10 start
const challengeTransaction = await sep10AuthStart({
authEndpoint: tomlResponse.WEB_AUTH_ENDPOINT,
serverSigningKey: tomlResponse.SIGNING_KEY,
publicKey: custodialPublicKey || publicKey,
homeDomain,
homeDomain: serviceDomain,
clientDomain,
memoId: custodialMemoId,
});
Expand Down
4 changes: 3 additions & 1 deletion packages/demo-wallet-client/src/ducks/sep24WithdrawAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ export const withdrawAssetAction = createAsyncThunk<
"SEP-24 withdrawal is enabled, and requires authentication so we should go through SEP-10",
});

const serviceDomain = new URL(tomlResponse.TRANSFER_SERVER_SEP0024).host;

// SEP-10 start
const challengeTransaction = await sep10AuthStart({
authEndpoint: tomlResponse.WEB_AUTH_ENDPOINT,
serverSigningKey: tomlResponse.SIGNING_KEY,
publicKey: custodialPublicKey || publicKey,
homeDomain,
homeDomain: serviceDomain,
clientDomain,
memoId: custodialMemoId,
});
Expand Down
5 changes: 3 additions & 2 deletions packages/demo-wallet-client/src/ducks/sep31Send.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,19 +199,20 @@ export const fetchSendFieldsAction = createAsyncThunk<
authEndpoint,
serverSigningKey,
publicKey,
homeDomain,
kycServer,
senderType,
receiverType,
fields,
} = data;

const serviceDomain = new URL(kycServer).host;

// SEP-10 start
const challengeTransaction = await sep10AuthStart({
authEndpoint,
serverSigningKey,
publicKey,
homeDomain,
homeDomain: serviceDomain,
clientDomain,
});

Expand Down
4 changes: 3 additions & 1 deletion packages/demo-wallet-client/src/ducks/sep6DepositAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,14 @@ export const initiateDepositAction = createAsyncThunk<
"SEP-6 deposit is enabled, and requires authentication so we should go through SEP-10",
});

const serviceDomain = new URL(tomlResponse.TRANSFER_SERVER).host;

// SEP-10 start
const challengeTransaction = await sep10AuthStart({
authEndpoint: webAuthTomlResponse.WEB_AUTH_ENDPOINT,
serverSigningKey: webAuthTomlResponse.SIGNING_KEY,
publicKey,
homeDomain,
homeDomain: serviceDomain,
clientDomain,
});

Expand Down
4 changes: 3 additions & 1 deletion packages/demo-wallet-client/src/ducks/sep6WithdrawAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,14 @@ export const initiateWithdrawAction = createAsyncThunk<
"SEP-6 withdrawal is enabled, and requires authentication so we should go through SEP-10",
});

const serviceDomain = new URL(tomlResponse.TRANSFER_SERVER).host;

// SEP-10 start
const challengeTransaction = await sep10AuthStart({
authEndpoint: webAuthTomlResponse.WEB_AUTH_ENDPOINT,
serverSigningKey: webAuthTomlResponse.SIGNING_KEY,
publicKey,
homeDomain,
homeDomain: serviceDomain,
clientDomain,
});

Expand Down

0 comments on commit d93d543

Please sign in to comment.