You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The snippet code generate two files: `private.pem` and `public.pem`, use the `public.pem`in the configuration `--auth-jwt-key-file public.pem`.
137
+
This snippet generates two files: `private.pem` and `public.pem`. Pass the `public.pem`file to your server using the `--auth-jwt-key-file public.pem` flag.
138
138
139
139
> [!CAUTION]
140
-
> Always keep in mind that the `private.pem` filemust not be shared publicly; you should store it in a secure location, unlike the `public.pem` file, which can be shared without any risk.
140
+
> Never share your `private.pem` file. It must be stored in a secure location. The `public.pem` file, however, is safe to distribute publicly.
141
141
142
142
### Generate a Token using Node/Bun
143
143
144
-
For generate the JWT you can install `jose` library and sign a JWT using the`private.pem`.
144
+
To generate the JWT, install the `jose` library and sign a new token using your`private.pem` file:
145
145
146
146
```console
147
147
npm install jose
@@ -166,8 +166,10 @@ const jwt = await new SignJWT(payload)
166
166
167
167
fs.writeFileSync("token.txt", jwt);
168
168
```
169
+
> [!NOTE]
170
+
> Token Expiration: In the example above, the token is configured to be valid for exactly one hour. Once this hour passes, the token will expire and the client will lose access. You will need to generate and provide a new token to re-authenticate.
169
171
170
-
The generated token could be used for authentication:
172
+
You can now use the generated token to authenticate your `@libsql/client`:
0 commit comments