-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into main-to-dev
- Loading branch information
Showing
37 changed files
with
989 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Run - Wallet Reference Server - no Docker" type="JetRunConfigurationType"> | ||
<option name="MAIN_CLASS_NAME" value="org.stellar.anchor.platform.run_profiles.RunWalletServer" /> | ||
<module name="java-stellar-anchor-sdk.service-runner.main" /> | ||
<shortenClasspath name="ARGS_FILE" /> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
integration-tests/src/test/kotlin/org/stellar/anchor/platform/CallbackSignatureTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.stellar.anchor.platform | ||
|
||
import org.junit.jupiter.api.Assertions.assertFalse | ||
import org.junit.jupiter.api.Assertions.assertTrue | ||
import org.junit.jupiter.api.Test | ||
import org.stellar.anchor.platform.event.ClientStatusCallbackHandler | ||
import org.stellar.reference.wallet.CallbackService.Companion.verifySignature | ||
import org.stellar.sdk.KeyPair | ||
import org.stellar.sdk.KeyPair.* | ||
|
||
val signerSecret: KeyPair = | ||
fromSecretSeed("SAX3AH622R2XT6DXWWSRIDCMMUCCMATBZ5U6XKJWDO7M2EJUBFC3AW5X") | ||
val signerPublic: KeyPair = | ||
fromAccountId("GCHLHDBOKG2JWMJQBTLSL5XG6NO7ESXI2TAQKZXCXWXB5WI2X6W233PR") | ||
|
||
class CallbackSignatureTest { | ||
@Test | ||
fun `test the SEP24 callback signature creation and verification`() { | ||
// create the request with the secret-key signer | ||
val request = | ||
ClientStatusCallbackHandler.buildHttpRequest( | ||
signerSecret, | ||
"test_payload", | ||
"http://localhost:8092/callbacks" | ||
) | ||
|
||
val signature = request.header("Signature") | ||
// verify the signature with the public-key signer | ||
assertTrue(verifySignature(signature, "test_payload", "localhost:8092", signerPublic)) | ||
assertFalse(verifySignature(signature, "test_payload_bad", "localhost:8092", random())) | ||
} | ||
} |
Oops, something went wrong.