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
-
To create the userbase database and perform the setup steps, run the following command from the git worktree (e.g. ~/10xresume/34476472.Brilliant)
just createdbSample output
% just createdbdotenvx run -- ./Apps/Cli/dist/10x createdb[dotenvx@1.19.2] injecting env (19) from .envcandidate {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' } +0msAccess init session {} +1msAccess init user undefined +0msAccess init username undefined +0msAccess [Access 'signUpOrIn',Access { username: '34476472candidate', password: 'xxxxxxxxxxxxxxxxxxxx' }Access ] +0msAccess [ 'openDatabase', { databaseName: 'enquiry' } ] +1sAccess [ 'shareDatabase', { databaseName: 'enquiry' } ] +156msAccess [ 'signOut' ] +123msAccess [ 'generateKey' ] +95msAccess [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 ] +6msAccess [Access 'exportKey',Access CryptoKey {Access type: 'secret',Access extractable: true,Access algorithm: { name: 'AES-GCM', length: 128 },Access usages: [ 'encrypt', 'decrypt' ]Access }Access ] +3msAccess [Access 'signUpOrIn',Access { username: '34476472', password: 'EqW6vFqi0yQZ321P' }Access ] +84msAccess [Access 'openDatabase',Access {Access shareToken: 'ZDQ3MDgzZTItMjEwZi00YWExLTkxMzItOGMzOWE1OTRkN2Q1...Access changeHandler: [Function: changeHandler]Access }Access ] +755msAccess [ 'signOut' ] +259msAccess [Access 'writeCodeFile',Access '34476472.enc',Access ArrayBuffer {Access [Uint8Contents]: <c1 ad be da b8 f0 79 bc bf 9d f1 ... more bytes>,Access byteLength: 179Access }Access ] +101ms✔ set RPASSWORD (.env)✔ set KEY (.env)✔ set TOKEN (.env)createdrm -rf __userbase_localStorage
Examine the .env file
Directory34476472.Brilliant e.g. the git worktree for the enquiry
- .env e.g. the .env file
Steps
-
To examine the
.envfile updated by createdb, run the following commandjust envThe 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 envdotenvx run -- ./Apps/Cli/dist/10x env[dotenvx@1.19.2] injecting env (19) from .envDOWNLOAD 34476472.downloadENCFILE 34476472.encDATADIR ./Job/DataBUILDDIR ./Job/Portfolio/buildAPPID ed070b06-62c8-4da8-a162-e42f756371a4DBNAME enquiryCUSERNAME 34476472candidateCPASSWORD xxxxxxxxxxxxxxxxxxxxRUSERNAME 34476472RPASSWORD EqW6vFqi0yQZ321PEMAIL candidate34476472@10xresume.comLINKPREFIX https://localhost:5173/?34476472LINKSUFFIX #/l/nIJfJRGZSgMTcPo-XfJAqALINK https://localhost:5173/?34476472#/l/nIJfJRGZSgMTcPo-XfJAqASTATICLINK https://localhost:5173/static?34476472#/l/nIJfJRGZSgMTcPo-XfJAqABOOKMARK 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
-
Run the following command to decrypt and view the
nnnnnnnn.encfileTerminal window just encSample output
% just encdotenvx run -- ./Apps/Cli/dist/10x test-read-enc[dotenvx@1.19.2] injecting env (18) from .envAccess [ 'importKey', 'nIJfJRGZSgMTcPo-XfJAqA' ] +0msAccess [ 'readCodeFile', '34476472.enc' ] +4msAccess [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 ] +4msverified