@pelican-identity/vanilla 1.0.42 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +90 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -215,6 +215,96 @@ interface IdentityResult {
215
215
  }
216
216
  ```
217
217
 
218
+ ## `token`
219
+
220
+ - A **JWT (JSON Web Token)** issued by Pelican after a successful user authentication or action approval.
221
+ - This token represents a **verified user interaction** and can be used to confirm identity and/or intent on your backend.
222
+
223
+ ---
224
+
225
+ ## Verification
226
+
227
+ To verify a Pelican token, your backend must send it to the Pelican Identity API.
228
+
229
+ ### Endpoint
230
+
231
+ ```
232
+ POST https://identityapi.pelicanidentity.com/verify-session
233
+ ```
234
+
235
+ ---
236
+
237
+ ### Headers
238
+
239
+ Include the following headers in your request:
240
+
241
+ - `x-public-key` — Your Pelican public API key
242
+ - `x-project-id` — Your Pelican project ID
243
+
244
+ ---
245
+
246
+ ### Request Body
247
+
248
+ ```json
249
+ {
250
+ "token": "YOUR_PELICAN_JWT_TOKEN"
251
+ }
252
+ ```
253
+
254
+ ---
255
+
256
+ ### Example (Node.js)
257
+
258
+ ```ts
259
+ const response = await fetch(
260
+ "https://identityapi.pelicanidentity.com/verify-session",
261
+ {
262
+ method: "POST",
263
+ headers: {
264
+ "Content-Type": "application/json",
265
+ "x-public-key": process.env.PELICAN_PUBLIC_KEY,
266
+ },
267
+ body: JSON.stringify({
268
+ token: pelicanToken,
269
+ }),
270
+ },
271
+ );
272
+
273
+ const data = await response.json();
274
+ ```
275
+
276
+ ---
277
+
278
+ ### Response
279
+
280
+ A successful response will return a verified payload containing:
281
+
282
+ - `user` — Pelican user identity details
283
+ - `verified` — Boolean indicating token validity
284
+ - `issued_at` — Timestamp of when the token was generated
285
+ - `expires_at` — Token expiration timestamp
286
+
287
+ ---
288
+
289
+ ### Example Response
290
+
291
+ ```json
292
+ {
293
+ "verified": true,
294
+ "pelican_id": "4dbde492db8f64aff80b1dd61754a84bdf2dc87eed1b19fec4cd66569856b134",
295
+ "issued_at": 1714483200,
296
+ "expires_at": 1714483500
297
+ }
298
+ ```
299
+
300
+ ---
301
+
302
+ ### Notes
303
+
304
+ - Always verify the token on your backend before trusting any user action.
305
+ - Tokens are **short-lived** and should not be reused.
306
+ - Never trust tokens directly from the client without verification.
307
+
218
308
  ---
219
309
 
220
310
  ## `user_id`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pelican-identity/vanilla",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "description": "JavaScript components for Pelican Identity authentication",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -19,7 +19,7 @@
19
19
  "package.json"
20
20
  ],
21
21
  "dependencies": {
22
- "@pelican-identity/auth-core": "^1.2.45"
22
+ "@pelican-identity/auth-core": "^1.2.46"
23
23
  },
24
24
  "devDependencies": {
25
25
  "tsup": "^8.0.1",