Skip to content

Creating the Userbase database

10x Resume candidates can use just ↗︎ commands as described below to create the Userbase database for their enquiry.

Create the Userbase database

The 10x Resume .justfile provides a createdb command which takes care of several details:

  • candidate setup

    • connecting to Userbase as the candidate
    • creating a new user if the candidate’s user does not already exist
    • creating the candidates enquiry database
    • generating a share token for the enquiry database
    • disconnecting from Userbase
  • reviewer setup

    • connecting to Userbase as the reviewer
    • creating a new user if the reviewer’s user does not already exist
    • disconnecting from Userbase
  • registration setup

    • generating a AES-GCM key to encrypt the AppID and share token
    • encrypting the AppID and share token with the key
    • writing the encrypted data to the registry file
    • saving the reviewer’s password, key and token in the .env file

Steps

  1. To create the userbase database and perform the setup steps, run the following command from the git worktree (e.g. ~/10xresume/34476472.Brilliant)

    just createdb
    Sample output
    % just createdb
    dotenvx run -- ./Apps/Cli/dist/10x createdb
    [dotenvx@1.19.2] injecting env (19) from .env
    candidate {
    appId: 'ed070b06-62c8-4da8-a162-e42f756371a4',
    email: 'candidate34476472@10xresume.com',
    initArg: { appId: 'ed070b06-62c8-4da8-a162-e42f756371a4' },
    userArg: { username: '34476472candidate', password: 'xxxxxxxxxxxxxxxxxxxx' },
    openArg: { databaseName: 'enquiry' },
    shareArg: { databaseName: 'enquiry' }
    }
    Access init { appId: 'ed070b06-62c8-4da8-a162-e42f756371a4' } +0ms
    Access init session {} +1ms
    Access init user undefined +0ms
    Access init username undefined +0ms
    Access [
    Access 'signUpOrIn',
    Access { username: '34476472candidate', password: 'xxxxxxxxxxxxxxxxxxxx' }
    Access ] +0ms
    Access [ 'openDatabase', { databaseName: 'enquiry' } ] +1s
    Access [ 'shareDatabase', { databaseName: 'enquiry' } ] +156ms
    Access [ 'signOut' ] +123ms
    Access [ 'generateKey' ] +95ms
    Access [
    Access 'encrypt',
    Access '{"appId":"ed070b06-62c8-4da8-a162-e42f756371a4","token":"ZD...
    Access CryptoKey {
    Access type: 'secret',
    Access extractable: true,
    Access algorithm: { name: 'AES-GCM', length: 128 },
    Access usages: [ 'encrypt', 'decrypt' ]
    Access }
    Access ] +6ms
    Access [
    Access 'exportKey',
    Access CryptoKey {
    Access type: 'secret',
    Access extractable: true,
    Access algorithm: { name: 'AES-GCM', length: 128 },
    Access usages: [ 'encrypt', 'decrypt' ]
    Access }
    Access ] +3ms
    Access [
    Access 'signUpOrIn',
    Access { username: '34476472', password: 'EqW6vFqi0yQZ321P' }
    Access ] +84ms
    Access [
    Access 'openDatabase',
    Access {
    Access shareToken: 'ZDQ3MDgzZTItMjEwZi00YWExLTkxMzItOGMzOWE1OTRkN2Q1...
    Access changeHandler: [Function: changeHandler]
    Access }
    Access ] +755ms
    Access [ 'signOut' ] +259ms
    Access [
    Access 'writeCodeFile',
    Access '34476472.enc',
    Access ArrayBuffer {
    Access [Uint8Contents]: <c1 ad be da b8 f0 79 bc bf 9d f1 ... more bytes>,
    Access byteLength: 179
    Access }
    Access ] +101ms
    ✔ set RPASSWORD (.env)
    ✔ set KEY (.env)
    ✔ set TOKEN (.env)
    created
    rm -rf __userbase_localStorage

Examine the .env file

  • Directory34476472.Brilliant        e.g. the git worktree for the enquiry
    • .env                e.g. the .env file

Steps

  1. To examine the .env file updated by createdb, run the following command

    just env

    The reviewer’s RUSERNAME and RPASSWORD should be set and the link should include the encryption KEY. The KEY in the link URL fragment enables the reviewer to decode the registration file with their password when they open the link.

    Sample output
    Terminal window
    % just env
    dotenvx run -- ./Apps/Cli/dist/10x env
    [dotenvx@1.19.2] injecting env (19) from .env
    DOWNLOAD 34476472.download
    ENCFILE 34476472.enc
    DATADIR ./Job/Data
    BUILDDIR ./Job/Portfolio/build
    APPID ed070b06-62c8-4da8-a162-e42f756371a4
    DBNAME enquiry
    CUSERNAME 34476472candidate
    CPASSWORD xxxxxxxxxxxxxxxxxxxx
    RUSERNAME 34476472
    RPASSWORD EqW6vFqi0yQZ321P
    EMAIL candidate34476472@10xresume.com
    LINKPREFIX https://localhost:5173/?34476472
    LINKSUFFIX #/l/nIJfJRGZSgMTcPo-XfJAqA
    LINK https://localhost:5173/?34476472#/l/nIJfJRGZSgMTcPo-XfJAqA
    STATICLINK https://localhost:5173/static?34476472#/l/nIJfJRGZSgMTcPo-XfJAqA
    BOOKMARK https 5173 - 34476472 - nIJfJRGZSgMTcPo-XfJAqA - EqW6vFqi0yQZ321P

Examine the registration file

  • Directory34476472.Brilliant        e.g. the git worktree for the enquiry
    • 34476472.enc        e.g. the registration file

Candidates may use the enc command previously described to examine the .enc registration file generated for the enquiry.

Note: the prefix of the worktree and the registration file should match.

Steps

  1. Run the following command to decrypt and view the nnnnnnnn.enc file

    Terminal window
    just enc
    Sample output
    % just enc
    dotenvx run -- ./Apps/Cli/dist/10x test-read-enc
    [dotenvx@1.19.2] injecting env (18) from .env
    Access [ 'importKey', 'nIJfJRGZSgMTcPo-XfJAqA' ] +0ms
    Access [ 'readCodeFile', '34476472.enc' ] +4ms
    Access [
    Access 'decrypt',
    Access CryptoKey {
    Access type: 'secret',
    Access extractable: false,
    Access algorithm: { name: 'AES-GCM', length: 128 },
    Access usages: [ 'decrypt' ]
    Access },
    Access <Buffer bb 91 c7 d9 0c b7 ... more bytes>
    Access ] +2ms
    ...
    Access [
    Access 'result',
    Access {
    Access appId: '4365e648-a427-4fbb-8f79-70343e58e364',
    Access token: 'ZDQ3MDgzZTItMjEwZi00YWExLTkxMzIWE1OTRkN2Q1...'
    Access }
    Access ] +4ms
    verified