Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to define what kind of keys are stored prod/staging #347

Conversation

ZIMkaRU
Copy link
Member

@ZIMkaRU ZIMkaRU commented Jan 2, 2024

This PR adds ability to define what kind of keys are stored prod/staging:

  • The prod/staging is detected by existing the staging string in the restUrl config option: https://api-pub.bitfinex.com/https://api.staging.bitfinex.com
  • and isStagingBfxApi flag is set or updated on signUp/signIn to the user table
  • than, getUsers endpoint will return the isStagingBfxApi flag to be shown in the UI for each user on the login stage

Basic changes:

  • Adds isStagingBfxApi endpoint
  • Adds ability to returns isStagingBfxApi flag for signIn endpoint
  • Adds ability to return isStagingBfxApi flag for getUsers endpoint
  • Adds ability to set isStagingBfxApi flag on sign-up/sign-in
  • Adds v39 DB migration
  • Adds corresponding test coverage for isStagingBfxApi

isStagingBfxApi request example:

{
  "method": "isStagingBfxApi"
}

isStagingBfxApi response example:

{
    "jsonrpc": "2.0",
    "result": false,
    "id": null
}

signIn request example:

{
  "auth": {
    "email": "[email protected]",
    "isSubAccount": false
  },
  "method": "signIn"
}

signIn response example:

{
    "jsonrpc": "2.0",
    "result": {
        "email": "[email protected]",
        "isSubAccount": false,
        "token": "559cb736-ffdd-4f7d-9a53-362d913bdc16",
        "shouldNotSyncOnStartupAfterUpdate": false,
        "authTokenTTLSec": null,
        "localUsername": null,
        "lastSyncMts": 1704177514708,
        "isStagingBfxApi": false // The flag
    },
    "id": null
}

getUsers request example:

{
  "method": "getUsers"
}

getUsers response example:

{
    "jsonrpc": "2.0",
    "result": [
        {
            "email": "[email protected]",
            "localUsername": null,
            "isSubAccount": false,
            "isNotProtected": true,
            "subUsers": [],
            "isRestrictedToBeAddedToSubAccount": true,
            "isApiKeysAuth": false,
            "isStagingBfxApi": false // The flag
        },
        {
            "email": "[email protected]",
            "localUsername": null,
            "isSubAccount": false,
            "isNotProtected": true,
            "subUsers": [],
            "isRestrictedToBeAddedToSubAccount": false,
            "isApiKeysAuth": true,
            "isStagingBfxApi": true // The flag
        }
    ],
    "id": null
}

Copy link
Contributor

@ezewer ezewer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants