]> git.ardis.lu - envpass/commitdiff
Provide `challenge` and `exp` in return object
authorArdis Lu <ardisglu@gmail.com>
Sun, 23 Aug 2026 05:24:35 +0000 (22:24 -0700)
committerArdis Lu <ardisglu@gmail.com>
Sun, 23 Aug 2026 05:24:35 +0000 (22:24 -0700)
Being able to get these components easily without parsing `url` sets up the workflow to later expand so users can bring their own bridge.

src/getPrf.js

index 94922c2164239a7682c3cd6f47f1d844a6cb8a47..eaed3f776cdda13a62836923393f74f4f7c4bc8f 100644 (file)
@@ -44,6 +44,10 @@ export const WINDOW_EXPIRATION_DURATION = 2 * 60 * 1000;
 /**
  * @typedef {Object} GetPrfResult
  * @property {string} url URL on `localhost` to open to complete the passkey flow.
+ * @property {string} challenge Randomly generated challenge bytes, as a hex string. This string MUST be included
+ * in the bridge's POST request as the `Envpass-Challenge` header, or the server will reject the request.
+ * @property {number} exp The expiration datetime of this flow in milliseconds. After this datetime, the server will
+ * shut down and not receive any more requests. You can pass this number directly to the `Date` constructor.
  * @property {Promise<Bytes32|null>} prf 32-byte value returned from the user passkey's pseudo random
  * function, or `null` if the flow was aborted or timed out before the PRF was executed.
  */
@@ -201,6 +205,8 @@ export async function getPrf(options = {}) {
 
   return {
     url: await urlPromise,
+    challenge,
+    exp: timeoutExp,
     prf: Promise.any([prfPromise, abortPromise])
   };
 }
\ No newline at end of file
This page took 0.039328 seconds and 4 git commands to generate.