@pooflabs/server 0.0.4 → 0.0.5
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/dist/index.js +8 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6262,24 +6262,15 @@ async function genSolanaMessage(address, nonce) {
|
|
|
6262
6262
|
const statement = "Sign this message to authenticate with our application.";
|
|
6263
6263
|
const currentDate = new Date();
|
|
6264
6264
|
const issuedAt = currentDate.toISOString();
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
const expirationDate = new Date(currentDate.getTime() + 5 * 60 * 1000);
|
|
6268
|
-
const expirationTime = expirationDate.toISOString();
|
|
6269
|
-
return `${statement}\n\n` +
|
|
6270
|
-
`Wallet address:\n${address}\n\n` +
|
|
6271
|
-
`Domain: ${domain}\n` +
|
|
6272
|
-
`Origin: ${origin}\n` +
|
|
6273
|
-
`Nonce: ${nonce}\n` +
|
|
6274
|
-
`Issued At: ${issuedAt}\n` +
|
|
6275
|
-
`Expiration Time: ${expirationTime}`;
|
|
6276
|
-
}
|
|
6277
|
-
// Backward compatible: without nonce (for server-side usage)
|
|
6265
|
+
const expirationDate = new Date(currentDate.getTime() + 5 * 60 * 1000);
|
|
6266
|
+
const expirationTime = expirationDate.toISOString();
|
|
6278
6267
|
return `${statement}\n\n` +
|
|
6279
6268
|
`Wallet address:\n${address}\n\n` +
|
|
6280
6269
|
`Domain: ${domain}\n` +
|
|
6281
6270
|
`Origin: ${origin}\n` +
|
|
6282
|
-
`
|
|
6271
|
+
`Nonce: ${nonce}\n` +
|
|
6272
|
+
`Issued At: ${issuedAt}\n` +
|
|
6273
|
+
`Expiration Time: ${expirationTime}`;
|
|
6283
6274
|
}
|
|
6284
6275
|
// ─────────────────────────────────────────────────────────────
|
|
6285
6276
|
// Serialization Helpers
|
|
@@ -6447,7 +6438,9 @@ function loadKeypairFromEnv$1() {
|
|
|
6447
6438
|
async function createSession() {
|
|
6448
6439
|
const kp = loadKeypairFromEnv$1();
|
|
6449
6440
|
const address = kp.publicKey.toBase58();
|
|
6450
|
-
|
|
6441
|
+
/* fetch nonce from auth API */
|
|
6442
|
+
const nonce = await genAuthNonce();
|
|
6443
|
+
const message = await genSolanaMessage(address, nonce);
|
|
6451
6444
|
/* sign the message */
|
|
6452
6445
|
const sigBytes = nacl$1.sign.detached(new TextEncoder().encode(message), kp.secretKey);
|
|
6453
6446
|
const signature = Buffer.from(sigBytes).toString("base64");
|