Updated on 2026-08-14
This commit is contained in:
parent
d2fd1c94b2
commit
e156fd3ce1
21 changed files with 178 additions and 83 deletions
|
|
@ -21,7 +21,7 @@ interface AuthApi {
|
|||
*
|
||||
* Generates a nonce bound to the device public key for the device registration flow.
|
||||
*/
|
||||
@POST("api/v1/auth/nonce/device")
|
||||
@POST("api/authentication/v1/mobile/nonce/device")
|
||||
suspend fun requestDeviceNonce(@Body request: NonceApiRequest): ApiResponse<NonceApiResponse>
|
||||
|
||||
/**
|
||||
|
|
@ -30,7 +30,7 @@ interface AuthApi {
|
|||
* Registers a new device using its hardware-backed public key and issues the initial
|
||||
* session token pair. Called once per app install.
|
||||
*/
|
||||
@POST("api/v1/auth/register")
|
||||
@POST("api/authentication/v1/mobile/register")
|
||||
suspend fun registerDevice(@Body request: RegisterApiRequest): ApiResponse<TokenApiResponse>
|
||||
|
||||
/**
|
||||
|
|
@ -38,7 +38,7 @@ interface AuthApi {
|
|||
*
|
||||
* Generates a nonce bound to the device public key for the authentication flow.
|
||||
*/
|
||||
@POST("api/v1/auth/nonce/auth")
|
||||
@POST("api/authentication/v1/mobile/nonce/auth")
|
||||
suspend fun requestAuthNonce(@Body request: NonceApiRequest): ApiResponse<NonceApiResponse>
|
||||
|
||||
/**
|
||||
|
|
@ -48,7 +48,7 @@ interface AuthApi {
|
|||
* JWT access token with bound `walletIds[]` and risk tier. All subsequent auth after
|
||||
* registration uses this endpoint.
|
||||
*/
|
||||
@POST("api/v1/auth/authenticate")
|
||||
@POST("api/authentication/v1/mobile/authenticate")
|
||||
suspend fun authenticate(@Body request: AuthApiRequest): ApiResponse<TokenApiResponse>
|
||||
|
||||
/**
|
||||
|
|
@ -58,7 +58,7 @@ interface AuthApi {
|
|||
* with family-based reuse detection — replaying a consumed token revokes the entire token
|
||||
* family (SR-8). Sender-constraint is verified via the DPoP-proof header (`cnf.jkt`).
|
||||
*/
|
||||
@POST("api/v1/auth/refresh")
|
||||
@POST("api/authentication/v1/mobile/token/refresh")
|
||||
@RequiresDpopProof
|
||||
suspend fun refresh(@Body request: RefreshApiRequest): ApiResponse<TokenApiResponse>
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ interface AuthApi {
|
|||
*
|
||||
* Generates a nonce bound to the device public key for the wallet registration flow.
|
||||
*/
|
||||
@POST("api/v1/auth/nonce/wallet")
|
||||
@POST("api/authentication/v1/mobile/nonce/wallet")
|
||||
suspend fun requestWalletNonce(@Body request: NonceApiRequest): ApiResponse<NonceApiResponse>
|
||||
|
||||
/**
|
||||
|
|
@ -77,7 +77,7 @@ interface AuthApi {
|
|||
* wallet is bound as COLD (card-backed); otherwise it is registered as a MOBILE (hot) wallet.
|
||||
* Returns refreshed session tokens reflecting the updated wallet list.
|
||||
*/
|
||||
@POST("api/v1/auth/wallet")
|
||||
@POST("api/authentication/v1/mobile/wallet/register")
|
||||
@RequiresDpopProof
|
||||
suspend fun registerWallet(@Body request: WalletRegistrationRequest): ApiResponse<TokenApiResponse>
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@ import com.squareup.moshi.JsonClass
|
|||
/**
|
||||
* Registration request — registers a new device and establishes initial trust.
|
||||
*
|
||||
* Posted to `POST /api/v1/auth/register`; on success the server returns
|
||||
* On success the server returns
|
||||
* [com.tangem.datasource.api.auth.models.response.TokenApiResponse] (the initial session token pair).
|
||||
*/
|
||||
@JsonClass(generateAdapter = true)
|
||||
|
|
@ -22,7 +22,7 @@ data class RegisterApiRequest(
|
|||
data class RegisterPayload(
|
||||
/** Base64-encoded EC public key of the device. */
|
||||
@Json(name = "devicePublicKey") val devicePublicKey: String,
|
||||
/** Deciphered nonce value from the `/api/v1/auth/nonce/device` endpoint. */
|
||||
/** Deciphered nonce value from the device nonce endpoint. */
|
||||
@Json(name = "nonce") val nonce: String,
|
||||
/** Platform attestation token (Play Integrity / App Attest). Optional; backend accepts `null`. */
|
||||
@Json(name = "attestationToken") val attestationToken: String?,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import com.squareup.moshi.JsonClass
|
|||
*/
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class WalletRegistrationRequest(
|
||||
/** Deciphered nonce value from `/api/v1/auth/nonce/wallet`. */
|
||||
/** Deciphered nonce value from the wallet nonce endpoint. */
|
||||
@Json(name = "nonce") val nonce: String,
|
||||
/**
|
||||
* Wallet identifier — Base64-encoded
|
||||
|
|
|
|||
|
|
@ -43,6 +43,6 @@ internal class Auth : ApiConfig() {
|
|||
private companion object {
|
||||
|
||||
private const val DEV_BASE_URL = "[REDACTED_ENV_URL]"
|
||||
private const val PROD_BASE_URL = "https://authentication.tangem.org/"
|
||||
private const val PROD_BASE_URL = "https://api.tangem.org/"
|
||||
}
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ internal class ProdApiConfigsManagerTest {
|
|||
expected = ApiEnvironmentConfig(
|
||||
environment = environment,
|
||||
baseUrl = when (environment) {
|
||||
ApiEnvironment.PROD -> "https://authentication.tangem.org/"
|
||||
ApiEnvironment.PROD -> "https://api.tangem.org/"
|
||||
else -> "[REDACTED_ENV_URL]"
|
||||
},
|
||||
headers = emptyMap(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue