Create New UserID

This guide will walk-through the easiest way to get started with a new user in Space and Time

Creating a user in Space and Time is very easy, but can be done from several different interfaces, depending on your use case. While the outcome is the same, these workflows can be somewhat different.

These instructions walk you through the simplest workflow.

📘

For more options

To view all the ways you can connect and authenticate to Space and Time, with guided workflows for each, visit the Connect and Authenticate section of the docs.

Create a New User Using SXT Studio

For most cases, the easiest way to create a new user account is via the Space and Time Studio dapp.

On the Studio, you can log in with a username/password to connect to SxT through the Gateway (Secrets Proxy) or connect with your Web3 wallet.

Create a New User with a Web3 Wallet:

  1. Ensure your Web3 wallet browser extension is installed and unlocked.
  2. Navigate to the Space and Time Studio dapp: https://app.spaceandtime.ai/.
  3. Click on the "Sign in" button in the upper right, to open the account pop-out.
  4. Click on "Connect a Wallet"
  5. Select the specific address you'd like to use, if you have more than one. Depending on your wallet, it may present you with an additional information on the request you're approving.
  6. Sign the transaction request in your wallet, which will create the account and sign you in.

👍

Contrags! You've created a Space and Time account!

If you've been provided a Join Code, you can use it to join an organization by following these steps.

Create a New User with Username / Password:

  1. Navigate to the Space and Time Studio dapp: https://app.spaceandtime.ai/.
  2. Click on the "Sign in" button in the upper right.
  3. Click on the "Register" button below the normal username/password text boxes.
  4. On the "Register new account" screen, you're presented with 3 text boxes:
    1. Join Code (optional) - If you've been given a JoinCode by your organization's admin already, you can enter that code here. If you don't have a JoinCode, just leave it blank, you can always add it to your account later.
    2. Username or Email - This is the UserID that you'll use every time you log into SxT, and must be globally unique across the network. You can use special characters, so your email is always a solid choice, but any text will do. Note that usernames are case-sensitive.
    3. Password - The password for your new account, with a minimum of 8 characters. You can change your password at any time.
  1. Click "Create Account."

👍

Congrats! You've created your Space and Time account!

📘

The UserID was created on the Space and Time network using the Space and Time Gateway (Secrets Proxy), which is an open-source middleware designed to manage keys and biscuits for applications using the Space and Time network. It creates a proxy keypair for your account, accessible via the password, but will never transmit this keypair (for obvious security reasons).

Use Cases

Creating your account on the Studio is the best option if you...

  • Want to interact with SxT primarily from the Studio
  • Want to interact with SxT using an API key

Add a New Public/Private Keypair to a UserID

If you're connecting directly to the SxT Network, you'll need a public/private keypair associated with your UserID. You can use an authenticated session (Access Token) to add a new keypair to your UserID's keychain using the steps below:

🚧

Never transmit your private key

Your private key should always remain local to your machine. This prevents web applications or dapps like Space and Time Studio from creating a new keypair and sending to you. You must create the keypair locally on your computer.

The easiest way (by far) to add a new keypair to your UserID is using the Space and Time CLI. Not only does it create the keypair locally, it can then add it directly to your UserID on the network. You will need to log into Space and Time Studio to generate an access token - a key for your current session that can be used outside of Studio (for things like API calls).

Create a new keypair locally:

  1. Download and install the Space and Time CLI (sxtcli).

  2. In a terminal / command window, create a new keypair by entering:

    ~$ sxtcli authenticate keypair
    

    Which will return a new keypair:

    ED25519 KeyPair (base64)  
    Private key: zt1tsBl3Vi_your_key_here_ZBP5sYaxPt7j0o=  
    Public key:  Enh+trGrAU_your_key_here_znsLHSaY3fQE9U=
    
  3. STOP now and save this keypair somewhere safe!
    It will never be displayed again and cannot be recovered - remember, locally created, never transmitted.

Add the new keypair to your UserID on the network

To complete this step, you'll need to log into the network and generate a valid access token (aka active session key). Fortunately, Space and Time Studio does just this, and will expose the current access token upon validated request.

  1. Navigate to Space and Time Studio dapp: https://app.spaceandtime.ai/
    and login to Studio, using the credentials for the UserID to which you'd like to add the keypair.

  2. Click on "My account" in the upper-right and scroll to the bottom of the "My Account" tab. There you'll find your active Access Token, which is your current authenticated session:

    Click on the copy icon on the right to copy the token to your clipboard.

  3. Return to the CLI and add the keypair to your UserID by typing:

    ~$ sxtcli authenticate keychain --accessToken=$ACCESS_TOKEN --url=$API_URL  add  --privateKey=$USER_PRIVATE_KEY --publicKey=$USER_PUBLIC_KEY
    
    1. Replace the $ACCESS_TOKEN with the access token copied in step #4
    2. Replace the $API_URL with the URL provided to your subscription when you joined the network
    3. Replace $PRIVATE_KEY with the key generated in step #2
    4. Replace $PUBLIC_KEY with the key generated in step #2

As a best practice, set the variables above first - it makes your CLI command more readable. For example:

ACCESS_TOKEN=eyJ0e__your_access_token_here__XBlIjoiYWNjZXNzIiwia2lkIjoiZTUxNDVkYmQtZGNmYi00ZjI4LTg3NzItZjVmNjNlMzcwM2JlIiwiYWxnIjoiRVMyNTYifQ.eyJpYXQiOjE2OTc2NzM0NjQsIm5iZiI6MTY5NzY3MzQ2NCwiZXhwIjoxNjk3Njc0OTY0LCJ0eXBlIjoiYWNjZXNzIiwidXNlciI6InN0ZXBoZW4iLCJzdWJzY3JpcHRpb24iOiIzMWNiMGI0Yi0xMjZlLTRlM2MtYTdhMS1lNWRmNDc4YTBjMDUiLCJzZXNzaW9uIjoiM2IxOTQzMTBhZTllN2NhNjBlNGVhYmNmIiwic3NuX2V4cCI6MTY5Nzc1ODY2Mzc5MywiaXRlcmF0aW9uIjoiY2NkYWU5NjU5NGViZTMyZTEyNDIzZjBlIn0.YYRu0n
API_URL=http://some.spaceandtime.url
USER_PRIVATE_KEY=zt1tsBl3Vi_your_key_here_ZBP5sYaxPt7j0o=
USER_PUBLIC_KEY=Enh+trGrAU_your_key_here_znsLHSaY3fQE9U=

Even better, store your secrets in a dotenv (.env) file.

🚧

25min Access Tokens

Your access token is only valid for 25 minutes from its creation, after which it must be regenerated. If step #5 fails with an "unauthorized" error, it likely means 25 minutes has elapsed since the access token was created (aka you first logged in) and the access token is now expired. Try repeating step #4 and #5 again. If you want to be really sure, you can also log out / log into SxT Studio (which will generate a new access token and reset the 25 minute timer).


Log Into the Studio with an Existing UserID You Created via APIs

If you already have a UserID with Keypair for running APIs, but it's not registered with the Secrets Proxy, then you have the opposite problem - you can call APIs, but cannot login to the Space and Time Studio dapp. Fortuately, there is a simple solution here too!

To add an existing UserID to the Secrets Proxy for Space and Time Studio:

  1. Login to Space and Time using whatever method you would normally (SDK, CLI, custom program, etc.) and collect the access token.

    For example, you can login using the CLI like so (replacing or setting variables):

    sxtcli authenticate login --url=$PROXY_API_URL --userId=$USERID --publicKey=$USER_PUBLIC_KEY --privateKey=$USER_PRIVATE_KEY
    

    The PROXY_API_URL is the URL to the proxy server attached to your normal API_URL environment. Normally this is identical to your API_URL, but prefixed with "proxy" and a period. So if API_URL=https://my.example.com then the Space and Time Studio Secrets Proxy URL is PROXY_API_URL=https://proxy.my.example.com

  2. Call the "Add account for existing user" API, which requires only the valid access token as a query parameter. You can do this via curl (copied directly from the above API page) or via your favorite API tool.

Congratulations, you've registered your existing UserID with the Space and Time Studio Secrets Proxy!