@pelican-identity/vanilla 1.0.40 → 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.
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/dist/index.min.js CHANGED
@@ -461,13 +461,13 @@ Minimum version required to store current data is: `+u+`.
461
461
  background-color: #f5f5f5 !important;
462
462
  }
463
463
  `,document.head.appendChild(n);}function ei(n,e){wo();let i=document.getElementById(n);if(!i)throw new Error(`Container with id "${n}" not found`);let a=new ti.PelicanAuthentication(e),c={isOpen:e.continuousMode||false,qr:null,deeplink:null,authState:"idle",successMessage:null,error:null},u={isProcessing:()=>["initializing","paired","awaiting-auth"].includes(c.authState),showMobileAuth:()=>!e.forceQRCode&&!!c.deeplink,showQRView:()=>e.forceQRCode&&!!c.qr&&c.authState==="awaiting-pair"||!e.forceQRCode&&!!c.qr&&c.authState==="awaiting-pair",successText:()=>`${e.authType==="login"?"login":e.authType==="signup"?"signup":e.authType==="id-verification"?"verification":"authentication"} complete!`},p=[a.on("qr",ft=>{c.qr=ft,y();}),a.on("deeplink",ft=>{c.deeplink=ft,y();}),a.on("state",ft=>{c.authState=ft,y();}),a.on("success",ft=>{e.onSuccess(ft),e.continuousMode?(c.successMessage=u.successText(),y(),setTimeout(()=>{c.successMessage=null,y();},2e3)):(c.isOpen=false,y());}),a.on("error",ft=>{c.error=ft,e.onError?.(ft),y();})];function y(){if(!i)return;let ft=E();i.innerHTML=ft,wt();}function E(){return `
464
- <section style="max-width: 520px; width: 100%;">
464
+ <section style="width: 100%;">
465
465
  ${z()}
466
466
  ${q()}
467
467
  ${st()}
468
468
  </section>
469
469
  `}function z(){return !e.continuousMode&&c.authState==="idle"?`
470
- <div style="width: 100%; justify-content: space-between; align-items: center; max-width: 300px;">
470
+ <div style="width: 100%; justify-content: space-between; align-items: center;">
471
471
  <div style="width: 100%; display: flex; justify-content: space-between; align-items: center;">
472
472
  <button
473
473
  type="button"