@bounded-sh/client 0.0.2 → 0.0.3

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 (55) hide show
  1. package/dist/{index-BL-0ZKBl.js → index-2UpSvA7V.js} +2514 -52
  2. package/dist/index-2UpSvA7V.js.map +1 -0
  3. package/dist/{index-CqoP9udN.js → index-C2JpxGAC.js} +1202 -450
  4. package/dist/index-C2JpxGAC.js.map +1 -0
  5. package/dist/{index-BFOmV3Pb.esm.js → index-C2yvle9S.esm.js} +1202 -450
  6. package/dist/index-C2yvle9S.esm.js.map +1 -0
  7. package/dist/{index-BgAygrhE.js → index-CYVVTWs4.js} +1202 -450
  8. package/dist/index-CYVVTWs4.js.map +1 -0
  9. package/dist/{index-B2ytfYTB.esm.js → index-DJg-Dduo.esm.js} +1202 -450
  10. package/dist/index-DJg-Dduo.esm.js.map +1 -0
  11. package/dist/{index-D986s6w7.esm.js → index-DyfiK3_X.esm.js} +2513 -52
  12. package/dist/index-DyfiK3_X.esm.js.map +1 -0
  13. package/dist/{index.browser-D8u31irV.js → index.browser-BTJZmhY1.js} +766 -773
  14. package/dist/index.browser-BTJZmhY1.js.map +1 -0
  15. package/dist/{index.browser-Bd0GwRur.esm.js → index.browser-C_TToxuO.esm.js} +230 -242
  16. package/dist/index.browser-C_TToxuO.esm.js.map +1 -0
  17. package/dist/{index.browser-BeM1bzpe.js → index.browser-DcHalmEf.js} +230 -242
  18. package/dist/index.browser-DcHalmEf.js.map +1 -0
  19. package/dist/{index.browser-D2xm-q6N.esm.js → index.browser-pymH6o1X.esm.js} +766 -773
  20. package/dist/index.browser-pymH6o1X.esm.js.map +1 -0
  21. package/dist/index.esm.js +1 -1
  22. package/dist/index.js +2 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/{index.native-B-cLm_BI.esm.js → index.native-BTjBgNiE.esm.js} +2510 -49
  25. package/dist/index.native-BTjBgNiE.esm.js.map +1 -0
  26. package/dist/{index.native-NgHStPq0.js → index.native-BvsmNFXn.js} +2511 -49
  27. package/dist/index.native-BvsmNFXn.js.map +1 -0
  28. package/dist/index.native.esm.js +1 -1
  29. package/dist/index.native.js +2 -1
  30. package/dist/index.native.js.map +1 -1
  31. package/dist/{phantom-wallet-provider-Dy48LSdU.js → phantom-wallet-provider-BXMvoOrI.js} +3 -3
  32. package/dist/{phantom-wallet-provider-Dy48LSdU.js.map → phantom-wallet-provider-BXMvoOrI.js.map} +1 -1
  33. package/dist/{phantom-wallet-provider-Cy5T9EVd.esm.js → phantom-wallet-provider-CTossIFB.esm.js} +3 -3
  34. package/dist/{phantom-wallet-provider-Cy5T9EVd.esm.js.map → phantom-wallet-provider-CTossIFB.esm.js.map} +1 -1
  35. package/dist/{privy-wallet-provider-BDsrUpk4.esm.js → privy-wallet-provider-1qE_f-DF.esm.js} +4 -4
  36. package/dist/{privy-wallet-provider-BDsrUpk4.esm.js.map → privy-wallet-provider-1qE_f-DF.esm.js.map} +1 -1
  37. package/dist/{privy-wallet-provider-CiKtBJ5M.js → privy-wallet-provider-D64DJ3u4.js} +4 -4
  38. package/dist/{privy-wallet-provider-CiKtBJ5M.js.map → privy-wallet-provider-D64DJ3u4.js.map} +1 -1
  39. package/dist/{solana-mobile-wallet-provider-CSk_FIww.esm.js → solana-mobile-wallet-provider-9M8U6AA7.esm.js} +5 -5
  40. package/dist/{solana-mobile-wallet-provider-CSk_FIww.esm.js.map → solana-mobile-wallet-provider-9M8U6AA7.esm.js.map} +1 -1
  41. package/dist/{solana-mobile-wallet-provider-k_YdrTJZ.js → solana-mobile-wallet-provider-C1wQ1DRK.js} +5 -5
  42. package/dist/{solana-mobile-wallet-provider-k_YdrTJZ.js.map → solana-mobile-wallet-provider-C1wQ1DRK.js.map} +1 -1
  43. package/package.json +2 -2
  44. package/dist/index-B2ytfYTB.esm.js.map +0 -1
  45. package/dist/index-BFOmV3Pb.esm.js.map +0 -1
  46. package/dist/index-BL-0ZKBl.js.map +0 -1
  47. package/dist/index-BgAygrhE.js.map +0 -1
  48. package/dist/index-CqoP9udN.js.map +0 -1
  49. package/dist/index-D986s6w7.esm.js.map +0 -1
  50. package/dist/index.browser-Bd0GwRur.esm.js.map +0 -1
  51. package/dist/index.browser-BeM1bzpe.js.map +0 -1
  52. package/dist/index.browser-D2xm-q6N.esm.js.map +0 -1
  53. package/dist/index.browser-D8u31irV.js.map +0 -1
  54. package/dist/index.native-B-cLm_BI.esm.js.map +0 -1
  55. package/dist/index.native-NgHStPq0.js.map +0 -1
@@ -18,7 +18,7 @@ function commonjsRequire(path) {
18
18
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
19
19
  }
20
20
 
21
- var naclFast = {exports: {}};
21
+ var naclFast$1 = {exports: {}};
22
22
 
23
23
  var _nodeResolve_empty = {};
24
24
 
@@ -29,11 +29,11 @@ var _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({
29
29
 
30
30
  var require$$0 = /*@__PURE__*/getDefaultExportFromNamespaceIfNotNamed(_nodeResolve_empty$1);
31
31
 
32
- var hasRequiredNaclFast;
32
+ var hasRequiredNaclFast$1;
33
33
 
34
- function requireNaclFast () {
35
- if (hasRequiredNaclFast) return naclFast.exports;
36
- hasRequiredNaclFast = 1;
34
+ function requireNaclFast$1 () {
35
+ if (hasRequiredNaclFast$1) return naclFast$1.exports;
36
+ hasRequiredNaclFast$1 = 1;
37
37
  (function (module) {
38
38
  (function(nacl) {
39
39
 
@@ -2425,12 +2425,12 @@ function requireNaclFast () {
2425
2425
  })();
2426
2426
 
2427
2427
  })(module.exports ? module.exports : (self.nacl = self.nacl || {}));
2428
- } (naclFast));
2429
- return naclFast.exports;
2428
+ } (naclFast$1));
2429
+ return naclFast$1.exports;
2430
2430
  }
2431
2431
 
2432
- var naclFastExports = requireNaclFast();
2433
- var nacl = /*@__PURE__*/getDefaultExportFromCjs$1(naclFastExports);
2432
+ var naclFastExports$1 = requireNaclFast$1();
2433
+ var nacl$1 = /*@__PURE__*/getDefaultExportFromCjs$1(naclFastExports$1);
2434
2434
 
2435
2435
  var bn$1 = {exports: {}};
2436
2436
 
@@ -10213,7 +10213,7 @@ class ServerSessionManager {
10213
10213
  const nonce = await genAuthNonce();
10214
10214
  const message = await genSolanaMessage(address, nonce);
10215
10215
  /* sign the message */
10216
- const sigBytes = nacl.sign.detached(new TextEncoder().encode(message), kp.secretKey);
10216
+ const sigBytes = nacl$1.sign.detached(new TextEncoder().encode(message), kp.secretKey);
10217
10217
  const signature = bufferExports$1.Buffer.from(sigBytes).toString("base64");
10218
10218
  /* call auth API */
10219
10219
  const { accessToken, idToken, refreshToken, } = await createSessionWithSignature(address, message, signature);
@@ -11284,6 +11284,13 @@ async function runExpressionMany(many) {
11284
11284
  throw error;
11285
11285
  }
11286
11286
  }
11287
+ /**
11288
+ * Write a document at `path`. Sugar for a one-element {@link setMany}.
11289
+ *
11290
+ * **Delete:** pass `null` as the document to delete it — `set(path, null)` is
11291
+ * the delete (there is no separate `del`/`remove`). It is routed through the
11292
+ * collection's policy `delete` rule and broadcasts a delete to subscribers.
11293
+ */
11287
11294
  async function set(path, document, options) {
11288
11295
  const result = await setMany([{ path, document }], options);
11289
11296
  // Clear cache entries that might be affected by this update
@@ -13865,6 +13872,7 @@ const functions = { invoke };
13865
13872
  // collection. This file is the consumer surface around that runtime:
13866
13873
  //
13867
13874
  // bounded.live.intent(roomPath, intent) -> POST {realtime}/live/intent
13875
+ // bounded.live.status(roomPath) -> GET {realtime}/live/status
13868
13876
  //
13869
13877
  // It mirrors `functions.invoke` exactly: it attaches the caller's session token
13870
13878
  // AUTOMATICALLY (the same token the SDK uses for data reads/writes), and throws
@@ -13877,18 +13885,14 @@ const functions = { invoke };
13877
13885
  // Addressing: clients address rooms BY PATH (the `path` field in the body). The
13878
13886
  // worker derives the roomId from `body.path` and sets X-Room-Id internally;
13879
13887
  // clients NEVER set X-Room-Id. The caller's address is taken server-side from
13880
- // the Authorization header (auth.userAddress) — it is NOT sent in the body.
13888
+ // the Authorization header (auth.userId/userAddress) — it is NOT sent in the
13889
+ // body.
13881
13890
  //
13882
13891
  // Subscribing to your view: a per-player view doc lives at
13883
- // `<roomPath>/view/<myAddress>` (the policy declares
13884
- // `rooms/$roomId/view/$addr` ephemeral with `read: $addr == @user.address`).
13885
- // That path has an EVEN segment count, so it is an ordinary document path —
13886
- // plain `subscribe('<roomPath>/view/<myAddress>', { onData })` already works.
13887
- // `subscribeView()` below is thin sugar over that (path construction + address
13888
- // defaulting); it adds zero new transport.
13889
- //
13890
- // Status polling (GET /live/status?path=<sessionCollection>/<roomId>) is out of
13891
- // scope for this piece — see follow-up.
13892
+ // `<roomPath>/view/<myUserId>` (the policy declares
13893
+ // `rooms/$roomId/view/$userId` ephemeral with `read: $userId == @user.id`).
13894
+ // Wallet-address keyed view paths remain supported through opts.address for
13895
+ // older policies, but new live rooms should key views by @user.id.
13892
13896
  // ---------------------------------------------------------------------------
13893
13897
  class LiveIntentError extends Error {
13894
13898
  constructor(message, statusCode, details) {
@@ -13969,7 +13973,7 @@ async function intent(roomPath, intent, opts = {}) {
13969
13973
  res = await fetch(`${base}/live/intent`, {
13970
13974
  method: 'POST',
13971
13975
  headers,
13972
- body: JSON.stringify({ path: roomPath, intent }),
13976
+ body: JSON.stringify({ path: normalizedRoomPath, intent }),
13973
13977
  signal: controller.signal,
13974
13978
  });
13975
13979
  }
@@ -13997,43 +14001,95 @@ async function intent(roomPath, intent, opts = {}) {
13997
14001
  }
13998
14002
  return (body !== null && body !== void 0 ? body : { ok: true });
13999
14003
  }
14004
+ /**
14005
+ * Fetch the runtime status for a live room.
14006
+ *
14007
+ * const s = await bounded.live.status('rooms/abc');
14008
+ * console.log(s.running, s.stopReason, s.generation, s.etag);
14009
+ *
14010
+ * This is diagnostic/ops surface. It reports whether the room facet exists,
14011
+ * whether it is currently ticking, why it last stopped, which module etag is
14012
+ * loaded, and the current generation used after terminal restarts.
14013
+ */
14014
+ async function status(roomPath, opts = {}) {
14015
+ var _a, _b, _c, _d, _e;
14016
+ if (!roomPath || typeof roomPath !== 'string') {
14017
+ throw new LiveIntentError('A room path is required');
14018
+ }
14019
+ const normalizedRoomPath = roomPath.replace(/\/$/, '');
14020
+ const config = await getConfig();
14021
+ const base = realtimeHttpBase(config.wsApiUrl);
14022
+ const headers = Object.assign({ 'X-App-Id': config.appId, 'X-Public-App-Id': config.appId }, ((_a = opts.headers) !== null && _a !== void 0 ? _a : {}));
14023
+ const controller = new AbortController();
14024
+ const timeoutMs = (_b = opts.timeoutMs) !== null && _b !== void 0 ? _b : 15000;
14025
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
14026
+ let res;
14027
+ try {
14028
+ res = await fetch(`${base}/live/status?path=${encodeURIComponent(normalizedRoomPath)}`, {
14029
+ method: 'GET',
14030
+ headers,
14031
+ signal: controller.signal,
14032
+ });
14033
+ }
14034
+ catch (err) {
14035
+ clearTimeout(timer);
14036
+ if ((err === null || err === void 0 ? void 0 : err.name) === 'AbortError') {
14037
+ throw new LiveIntentError(`Live status for "${normalizedRoomPath}" timed out after ${timeoutMs}ms`);
14038
+ }
14039
+ throw new LiveIntentError(`Failed to reach the realtime worker: ${(_c = err === null || err === void 0 ? void 0 : err.message) !== null && _c !== void 0 ? _c : String(err)}`);
14040
+ }
14041
+ clearTimeout(timer);
14042
+ let body = null;
14043
+ const text = await res.text();
14044
+ if (text) {
14045
+ try {
14046
+ body = JSON.parse(text);
14047
+ }
14048
+ catch (_f) {
14049
+ body = { raw: text };
14050
+ }
14051
+ }
14052
+ if (!res.ok) {
14053
+ const message = (_e = (_d = body === null || body === void 0 ? void 0 : body.error) !== null && _d !== void 0 ? _d : body === null || body === void 0 ? void 0 : body.message) !== null && _e !== void 0 ? _e : `Live status failed with HTTP ${res.status}`;
14054
+ throw new LiveIntentError(message, res.status, body);
14055
+ }
14056
+ return body;
14057
+ }
14000
14058
  /**
14001
14059
  * Subscribe to YOUR per-player view of a room. Thin sugar over:
14002
14060
  *
14003
- * subscribe('<roomPath>/view/<myAddress>', { onData, onError })
14061
+ * subscribe('<roomPath>/view/<myUserId>', { onData, onError })
14004
14062
  *
14005
- * The address defaults to the logged-in user's address (from the session
14006
- * token's claims); pass `opts.address` to override. Returns the unsubscribe
14063
+ * The view id defaults to the logged-in user's @user.id (from the session token
14064
+ * claims); pass `opts.userId` to override. `opts.address` is kept as a legacy
14065
+ * alias for older wallet-address keyed policies. Returns the unsubscribe
14007
14066
  * function (a Promise<() => Promise<void>>, same as `subscribe`).
14008
14067
  *
14009
14068
  * Note: this is a browser-first helper (the WS subscription manager is
14010
14069
  * browser-oriented). Server consumers should use `live.intent`.
14011
14070
  */
14012
14071
  async function subscribeView(roomPath, opts) {
14013
- var _a;
14072
+ var _a, _b, _c;
14014
14073
  if (!roomPath || typeof roomPath !== 'string') {
14015
14074
  throw new LiveIntentError('A room path is required');
14016
14075
  }
14017
14076
  if (!opts || typeof opts.onData !== 'function') {
14018
14077
  throw new LiveIntentError('subscribeView requires an onData callback');
14019
14078
  }
14020
- let address = opts.address;
14021
- if (!address) {
14079
+ let viewUserId = (_a = opts.userId) !== null && _a !== void 0 ? _a : opts.address;
14080
+ if (!viewUserId) {
14022
14081
  const config = await getConfig();
14023
14082
  const info = await getUserInfo(config.isServer);
14024
- // getUserInfo returns the RAW idToken payload — the wallet address lives in
14025
- // the `custom:walletAddress` claim, NOT a flat `address` field. Reading only
14026
- // `.address` meant auto-resolution NEVER worked, forcing every caller (browser
14027
- // AND server) to pass opts.address — the client having to hand the backend an
14028
- // identity it already authenticated. Resolve it from the actual claim so a
14029
- // logged-in caller never needs to pass its own address.
14030
- address = (_a = info === null || info === void 0 ? void 0 : info.address) !== null && _a !== void 0 ? _a : info === null || info === void 0 ? void 0 : info['custom:walletAddress'];
14083
+ // getUserInfo returns the RAW idToken payload. The universal live view key
14084
+ // is @user.id (`custom:userId`); wallet-address keyed views are still
14085
+ // resolved as a compatibility fallback for older policies.
14086
+ viewUserId = (_c = (_b = info === null || info === void 0 ? void 0 : info['custom:userId']) !== null && _b !== void 0 ? _b : info === null || info === void 0 ? void 0 : info['custom:walletAddress']) !== null && _c !== void 0 ? _c : info === null || info === void 0 ? void 0 : info.address;
14031
14087
  }
14032
- if (!address || typeof address !== 'string') {
14033
- throw new LiveIntentError('Could not resolve a player address for subscribeView; pass opts.address or log in first');
14088
+ if (!viewUserId || typeof viewUserId !== 'string') {
14089
+ throw new LiveIntentError('Could not resolve a player view id for subscribeView; pass opts.userId or log in first');
14034
14090
  }
14035
14091
  const normalizedRoomPath = roomPath.replace(/\/$/, '');
14036
- const viewPath = `${normalizedRoomPath}/view/${address}`;
14092
+ const viewPath = `${normalizedRoomPath}/view/${viewUserId}`;
14037
14093
  // This is a LIVE/room subscription by construction (the caller hands us the
14038
14094
  // room path), so we route its connection to the per-room DO where the live
14039
14095
  // view fan-out runs. App code passes NO routing — the room path is the helper's
@@ -14044,7 +14100,7 @@ async function subscribeView(roomPath, opts) {
14044
14100
  return subscribeV2(viewPath, { onData: opts.onData, onError: opts.onError }, normalizedRoomPath);
14045
14101
  }
14046
14102
  /** The `bounded.live` namespace surface. */
14047
- const live = { intent, subscribeView };
14103
+ const live = { intent, status, subscribeView };
14048
14104
 
14049
14105
  // ---------------------------------------------------------------------------
14050
14106
  // live-effects.ts -- AUTHOR-facing types + helpers for writing a Bounded live
@@ -17688,13 +17744,2418 @@ var srcExports = requireSrc();
17688
17744
  var basex = /*@__PURE__*/getDefaultExportFromCjs$1(srcExports);
17689
17745
 
17690
17746
  var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
17691
- var base58 = basex(ALPHABET);
17747
+ var bs582 = basex(ALPHABET);
17692
17748
 
17693
17749
  var index = /*#__PURE__*/Object.freeze({
17694
17750
  __proto__: null,
17695
- default: base58
17751
+ default: bs582
17696
17752
  });
17697
17753
 
17754
+ var naclFast = {exports: {}};
17755
+
17756
+ var hasRequiredNaclFast;
17757
+
17758
+ function requireNaclFast () {
17759
+ if (hasRequiredNaclFast) return naclFast.exports;
17760
+ hasRequiredNaclFast = 1;
17761
+ (function (module) {
17762
+ (function(nacl) {
17763
+
17764
+ // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
17765
+ // Public domain.
17766
+ //
17767
+ // Implementation derived from TweetNaCl version 20140427.
17768
+ // See for details: http://tweetnacl.cr.yp.to/
17769
+
17770
+ var gf = function(init) {
17771
+ var i, r = new Float64Array(16);
17772
+ if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
17773
+ return r;
17774
+ };
17775
+
17776
+ // Pluggable, initialized in high-level API below.
17777
+ var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
17778
+
17779
+ var _0 = new Uint8Array(16);
17780
+ var _9 = new Uint8Array(32); _9[0] = 9;
17781
+
17782
+ var gf0 = gf(),
17783
+ gf1 = gf([1]),
17784
+ _121665 = gf([0xdb41, 1]),
17785
+ D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
17786
+ D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
17787
+ X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
17788
+ Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
17789
+ I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
17790
+
17791
+ function ts64(x, i, h, l) {
17792
+ x[i] = (h >> 24) & 0xff;
17793
+ x[i+1] = (h >> 16) & 0xff;
17794
+ x[i+2] = (h >> 8) & 0xff;
17795
+ x[i+3] = h & 0xff;
17796
+ x[i+4] = (l >> 24) & 0xff;
17797
+ x[i+5] = (l >> 16) & 0xff;
17798
+ x[i+6] = (l >> 8) & 0xff;
17799
+ x[i+7] = l & 0xff;
17800
+ }
17801
+
17802
+ function vn(x, xi, y, yi, n) {
17803
+ var i,d = 0;
17804
+ for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
17805
+ return (1 & ((d - 1) >>> 8)) - 1;
17806
+ }
17807
+
17808
+ function crypto_verify_16(x, xi, y, yi) {
17809
+ return vn(x,xi,y,yi,16);
17810
+ }
17811
+
17812
+ function crypto_verify_32(x, xi, y, yi) {
17813
+ return vn(x,xi,y,yi,32);
17814
+ }
17815
+
17816
+ function core_salsa20(o, p, k, c) {
17817
+ var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
17818
+ j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
17819
+ j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
17820
+ j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
17821
+ j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
17822
+ j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
17823
+ j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
17824
+ j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
17825
+ j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
17826
+ j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
17827
+ j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
17828
+ j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
17829
+ j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
17830
+ j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
17831
+ j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
17832
+ j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
17833
+
17834
+ var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
17835
+ x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
17836
+ x15 = j15, u;
17837
+
17838
+ for (var i = 0; i < 20; i += 2) {
17839
+ u = x0 + x12 | 0;
17840
+ x4 ^= u<<7 | u>>>(32-7);
17841
+ u = x4 + x0 | 0;
17842
+ x8 ^= u<<9 | u>>>(32-9);
17843
+ u = x8 + x4 | 0;
17844
+ x12 ^= u<<13 | u>>>(32-13);
17845
+ u = x12 + x8 | 0;
17846
+ x0 ^= u<<18 | u>>>(32-18);
17847
+
17848
+ u = x5 + x1 | 0;
17849
+ x9 ^= u<<7 | u>>>(32-7);
17850
+ u = x9 + x5 | 0;
17851
+ x13 ^= u<<9 | u>>>(32-9);
17852
+ u = x13 + x9 | 0;
17853
+ x1 ^= u<<13 | u>>>(32-13);
17854
+ u = x1 + x13 | 0;
17855
+ x5 ^= u<<18 | u>>>(32-18);
17856
+
17857
+ u = x10 + x6 | 0;
17858
+ x14 ^= u<<7 | u>>>(32-7);
17859
+ u = x14 + x10 | 0;
17860
+ x2 ^= u<<9 | u>>>(32-9);
17861
+ u = x2 + x14 | 0;
17862
+ x6 ^= u<<13 | u>>>(32-13);
17863
+ u = x6 + x2 | 0;
17864
+ x10 ^= u<<18 | u>>>(32-18);
17865
+
17866
+ u = x15 + x11 | 0;
17867
+ x3 ^= u<<7 | u>>>(32-7);
17868
+ u = x3 + x15 | 0;
17869
+ x7 ^= u<<9 | u>>>(32-9);
17870
+ u = x7 + x3 | 0;
17871
+ x11 ^= u<<13 | u>>>(32-13);
17872
+ u = x11 + x7 | 0;
17873
+ x15 ^= u<<18 | u>>>(32-18);
17874
+
17875
+ u = x0 + x3 | 0;
17876
+ x1 ^= u<<7 | u>>>(32-7);
17877
+ u = x1 + x0 | 0;
17878
+ x2 ^= u<<9 | u>>>(32-9);
17879
+ u = x2 + x1 | 0;
17880
+ x3 ^= u<<13 | u>>>(32-13);
17881
+ u = x3 + x2 | 0;
17882
+ x0 ^= u<<18 | u>>>(32-18);
17883
+
17884
+ u = x5 + x4 | 0;
17885
+ x6 ^= u<<7 | u>>>(32-7);
17886
+ u = x6 + x5 | 0;
17887
+ x7 ^= u<<9 | u>>>(32-9);
17888
+ u = x7 + x6 | 0;
17889
+ x4 ^= u<<13 | u>>>(32-13);
17890
+ u = x4 + x7 | 0;
17891
+ x5 ^= u<<18 | u>>>(32-18);
17892
+
17893
+ u = x10 + x9 | 0;
17894
+ x11 ^= u<<7 | u>>>(32-7);
17895
+ u = x11 + x10 | 0;
17896
+ x8 ^= u<<9 | u>>>(32-9);
17897
+ u = x8 + x11 | 0;
17898
+ x9 ^= u<<13 | u>>>(32-13);
17899
+ u = x9 + x8 | 0;
17900
+ x10 ^= u<<18 | u>>>(32-18);
17901
+
17902
+ u = x15 + x14 | 0;
17903
+ x12 ^= u<<7 | u>>>(32-7);
17904
+ u = x12 + x15 | 0;
17905
+ x13 ^= u<<9 | u>>>(32-9);
17906
+ u = x13 + x12 | 0;
17907
+ x14 ^= u<<13 | u>>>(32-13);
17908
+ u = x14 + x13 | 0;
17909
+ x15 ^= u<<18 | u>>>(32-18);
17910
+ }
17911
+ x0 = x0 + j0 | 0;
17912
+ x1 = x1 + j1 | 0;
17913
+ x2 = x2 + j2 | 0;
17914
+ x3 = x3 + j3 | 0;
17915
+ x4 = x4 + j4 | 0;
17916
+ x5 = x5 + j5 | 0;
17917
+ x6 = x6 + j6 | 0;
17918
+ x7 = x7 + j7 | 0;
17919
+ x8 = x8 + j8 | 0;
17920
+ x9 = x9 + j9 | 0;
17921
+ x10 = x10 + j10 | 0;
17922
+ x11 = x11 + j11 | 0;
17923
+ x12 = x12 + j12 | 0;
17924
+ x13 = x13 + j13 | 0;
17925
+ x14 = x14 + j14 | 0;
17926
+ x15 = x15 + j15 | 0;
17927
+
17928
+ o[ 0] = x0 >>> 0 & 0xff;
17929
+ o[ 1] = x0 >>> 8 & 0xff;
17930
+ o[ 2] = x0 >>> 16 & 0xff;
17931
+ o[ 3] = x0 >>> 24 & 0xff;
17932
+
17933
+ o[ 4] = x1 >>> 0 & 0xff;
17934
+ o[ 5] = x1 >>> 8 & 0xff;
17935
+ o[ 6] = x1 >>> 16 & 0xff;
17936
+ o[ 7] = x1 >>> 24 & 0xff;
17937
+
17938
+ o[ 8] = x2 >>> 0 & 0xff;
17939
+ o[ 9] = x2 >>> 8 & 0xff;
17940
+ o[10] = x2 >>> 16 & 0xff;
17941
+ o[11] = x2 >>> 24 & 0xff;
17942
+
17943
+ o[12] = x3 >>> 0 & 0xff;
17944
+ o[13] = x3 >>> 8 & 0xff;
17945
+ o[14] = x3 >>> 16 & 0xff;
17946
+ o[15] = x3 >>> 24 & 0xff;
17947
+
17948
+ o[16] = x4 >>> 0 & 0xff;
17949
+ o[17] = x4 >>> 8 & 0xff;
17950
+ o[18] = x4 >>> 16 & 0xff;
17951
+ o[19] = x4 >>> 24 & 0xff;
17952
+
17953
+ o[20] = x5 >>> 0 & 0xff;
17954
+ o[21] = x5 >>> 8 & 0xff;
17955
+ o[22] = x5 >>> 16 & 0xff;
17956
+ o[23] = x5 >>> 24 & 0xff;
17957
+
17958
+ o[24] = x6 >>> 0 & 0xff;
17959
+ o[25] = x6 >>> 8 & 0xff;
17960
+ o[26] = x6 >>> 16 & 0xff;
17961
+ o[27] = x6 >>> 24 & 0xff;
17962
+
17963
+ o[28] = x7 >>> 0 & 0xff;
17964
+ o[29] = x7 >>> 8 & 0xff;
17965
+ o[30] = x7 >>> 16 & 0xff;
17966
+ o[31] = x7 >>> 24 & 0xff;
17967
+
17968
+ o[32] = x8 >>> 0 & 0xff;
17969
+ o[33] = x8 >>> 8 & 0xff;
17970
+ o[34] = x8 >>> 16 & 0xff;
17971
+ o[35] = x8 >>> 24 & 0xff;
17972
+
17973
+ o[36] = x9 >>> 0 & 0xff;
17974
+ o[37] = x9 >>> 8 & 0xff;
17975
+ o[38] = x9 >>> 16 & 0xff;
17976
+ o[39] = x9 >>> 24 & 0xff;
17977
+
17978
+ o[40] = x10 >>> 0 & 0xff;
17979
+ o[41] = x10 >>> 8 & 0xff;
17980
+ o[42] = x10 >>> 16 & 0xff;
17981
+ o[43] = x10 >>> 24 & 0xff;
17982
+
17983
+ o[44] = x11 >>> 0 & 0xff;
17984
+ o[45] = x11 >>> 8 & 0xff;
17985
+ o[46] = x11 >>> 16 & 0xff;
17986
+ o[47] = x11 >>> 24 & 0xff;
17987
+
17988
+ o[48] = x12 >>> 0 & 0xff;
17989
+ o[49] = x12 >>> 8 & 0xff;
17990
+ o[50] = x12 >>> 16 & 0xff;
17991
+ o[51] = x12 >>> 24 & 0xff;
17992
+
17993
+ o[52] = x13 >>> 0 & 0xff;
17994
+ o[53] = x13 >>> 8 & 0xff;
17995
+ o[54] = x13 >>> 16 & 0xff;
17996
+ o[55] = x13 >>> 24 & 0xff;
17997
+
17998
+ o[56] = x14 >>> 0 & 0xff;
17999
+ o[57] = x14 >>> 8 & 0xff;
18000
+ o[58] = x14 >>> 16 & 0xff;
18001
+ o[59] = x14 >>> 24 & 0xff;
18002
+
18003
+ o[60] = x15 >>> 0 & 0xff;
18004
+ o[61] = x15 >>> 8 & 0xff;
18005
+ o[62] = x15 >>> 16 & 0xff;
18006
+ o[63] = x15 >>> 24 & 0xff;
18007
+ }
18008
+
18009
+ function core_hsalsa20(o,p,k,c) {
18010
+ var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
18011
+ j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
18012
+ j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
18013
+ j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
18014
+ j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
18015
+ j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
18016
+ j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
18017
+ j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
18018
+ j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
18019
+ j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
18020
+ j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
18021
+ j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
18022
+ j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
18023
+ j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
18024
+ j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
18025
+ j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
18026
+
18027
+ var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
18028
+ x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
18029
+ x15 = j15, u;
18030
+
18031
+ for (var i = 0; i < 20; i += 2) {
18032
+ u = x0 + x12 | 0;
18033
+ x4 ^= u<<7 | u>>>(32-7);
18034
+ u = x4 + x0 | 0;
18035
+ x8 ^= u<<9 | u>>>(32-9);
18036
+ u = x8 + x4 | 0;
18037
+ x12 ^= u<<13 | u>>>(32-13);
18038
+ u = x12 + x8 | 0;
18039
+ x0 ^= u<<18 | u>>>(32-18);
18040
+
18041
+ u = x5 + x1 | 0;
18042
+ x9 ^= u<<7 | u>>>(32-7);
18043
+ u = x9 + x5 | 0;
18044
+ x13 ^= u<<9 | u>>>(32-9);
18045
+ u = x13 + x9 | 0;
18046
+ x1 ^= u<<13 | u>>>(32-13);
18047
+ u = x1 + x13 | 0;
18048
+ x5 ^= u<<18 | u>>>(32-18);
18049
+
18050
+ u = x10 + x6 | 0;
18051
+ x14 ^= u<<7 | u>>>(32-7);
18052
+ u = x14 + x10 | 0;
18053
+ x2 ^= u<<9 | u>>>(32-9);
18054
+ u = x2 + x14 | 0;
18055
+ x6 ^= u<<13 | u>>>(32-13);
18056
+ u = x6 + x2 | 0;
18057
+ x10 ^= u<<18 | u>>>(32-18);
18058
+
18059
+ u = x15 + x11 | 0;
18060
+ x3 ^= u<<7 | u>>>(32-7);
18061
+ u = x3 + x15 | 0;
18062
+ x7 ^= u<<9 | u>>>(32-9);
18063
+ u = x7 + x3 | 0;
18064
+ x11 ^= u<<13 | u>>>(32-13);
18065
+ u = x11 + x7 | 0;
18066
+ x15 ^= u<<18 | u>>>(32-18);
18067
+
18068
+ u = x0 + x3 | 0;
18069
+ x1 ^= u<<7 | u>>>(32-7);
18070
+ u = x1 + x0 | 0;
18071
+ x2 ^= u<<9 | u>>>(32-9);
18072
+ u = x2 + x1 | 0;
18073
+ x3 ^= u<<13 | u>>>(32-13);
18074
+ u = x3 + x2 | 0;
18075
+ x0 ^= u<<18 | u>>>(32-18);
18076
+
18077
+ u = x5 + x4 | 0;
18078
+ x6 ^= u<<7 | u>>>(32-7);
18079
+ u = x6 + x5 | 0;
18080
+ x7 ^= u<<9 | u>>>(32-9);
18081
+ u = x7 + x6 | 0;
18082
+ x4 ^= u<<13 | u>>>(32-13);
18083
+ u = x4 + x7 | 0;
18084
+ x5 ^= u<<18 | u>>>(32-18);
18085
+
18086
+ u = x10 + x9 | 0;
18087
+ x11 ^= u<<7 | u>>>(32-7);
18088
+ u = x11 + x10 | 0;
18089
+ x8 ^= u<<9 | u>>>(32-9);
18090
+ u = x8 + x11 | 0;
18091
+ x9 ^= u<<13 | u>>>(32-13);
18092
+ u = x9 + x8 | 0;
18093
+ x10 ^= u<<18 | u>>>(32-18);
18094
+
18095
+ u = x15 + x14 | 0;
18096
+ x12 ^= u<<7 | u>>>(32-7);
18097
+ u = x12 + x15 | 0;
18098
+ x13 ^= u<<9 | u>>>(32-9);
18099
+ u = x13 + x12 | 0;
18100
+ x14 ^= u<<13 | u>>>(32-13);
18101
+ u = x14 + x13 | 0;
18102
+ x15 ^= u<<18 | u>>>(32-18);
18103
+ }
18104
+
18105
+ o[ 0] = x0 >>> 0 & 0xff;
18106
+ o[ 1] = x0 >>> 8 & 0xff;
18107
+ o[ 2] = x0 >>> 16 & 0xff;
18108
+ o[ 3] = x0 >>> 24 & 0xff;
18109
+
18110
+ o[ 4] = x5 >>> 0 & 0xff;
18111
+ o[ 5] = x5 >>> 8 & 0xff;
18112
+ o[ 6] = x5 >>> 16 & 0xff;
18113
+ o[ 7] = x5 >>> 24 & 0xff;
18114
+
18115
+ o[ 8] = x10 >>> 0 & 0xff;
18116
+ o[ 9] = x10 >>> 8 & 0xff;
18117
+ o[10] = x10 >>> 16 & 0xff;
18118
+ o[11] = x10 >>> 24 & 0xff;
18119
+
18120
+ o[12] = x15 >>> 0 & 0xff;
18121
+ o[13] = x15 >>> 8 & 0xff;
18122
+ o[14] = x15 >>> 16 & 0xff;
18123
+ o[15] = x15 >>> 24 & 0xff;
18124
+
18125
+ o[16] = x6 >>> 0 & 0xff;
18126
+ o[17] = x6 >>> 8 & 0xff;
18127
+ o[18] = x6 >>> 16 & 0xff;
18128
+ o[19] = x6 >>> 24 & 0xff;
18129
+
18130
+ o[20] = x7 >>> 0 & 0xff;
18131
+ o[21] = x7 >>> 8 & 0xff;
18132
+ o[22] = x7 >>> 16 & 0xff;
18133
+ o[23] = x7 >>> 24 & 0xff;
18134
+
18135
+ o[24] = x8 >>> 0 & 0xff;
18136
+ o[25] = x8 >>> 8 & 0xff;
18137
+ o[26] = x8 >>> 16 & 0xff;
18138
+ o[27] = x8 >>> 24 & 0xff;
18139
+
18140
+ o[28] = x9 >>> 0 & 0xff;
18141
+ o[29] = x9 >>> 8 & 0xff;
18142
+ o[30] = x9 >>> 16 & 0xff;
18143
+ o[31] = x9 >>> 24 & 0xff;
18144
+ }
18145
+
18146
+ function crypto_core_salsa20(out,inp,k,c) {
18147
+ core_salsa20(out,inp,k,c);
18148
+ }
18149
+
18150
+ function crypto_core_hsalsa20(out,inp,k,c) {
18151
+ core_hsalsa20(out,inp,k,c);
18152
+ }
18153
+
18154
+ var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
18155
+ // "expand 32-byte k"
18156
+
18157
+ function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
18158
+ var z = new Uint8Array(16), x = new Uint8Array(64);
18159
+ var u, i;
18160
+ for (i = 0; i < 16; i++) z[i] = 0;
18161
+ for (i = 0; i < 8; i++) z[i] = n[i];
18162
+ while (b >= 64) {
18163
+ crypto_core_salsa20(x,z,k,sigma);
18164
+ for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
18165
+ u = 1;
18166
+ for (i = 8; i < 16; i++) {
18167
+ u = u + (z[i] & 0xff) | 0;
18168
+ z[i] = u & 0xff;
18169
+ u >>>= 8;
18170
+ }
18171
+ b -= 64;
18172
+ cpos += 64;
18173
+ mpos += 64;
18174
+ }
18175
+ if (b > 0) {
18176
+ crypto_core_salsa20(x,z,k,sigma);
18177
+ for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
18178
+ }
18179
+ return 0;
18180
+ }
18181
+
18182
+ function crypto_stream_salsa20(c,cpos,b,n,k) {
18183
+ var z = new Uint8Array(16), x = new Uint8Array(64);
18184
+ var u, i;
18185
+ for (i = 0; i < 16; i++) z[i] = 0;
18186
+ for (i = 0; i < 8; i++) z[i] = n[i];
18187
+ while (b >= 64) {
18188
+ crypto_core_salsa20(x,z,k,sigma);
18189
+ for (i = 0; i < 64; i++) c[cpos+i] = x[i];
18190
+ u = 1;
18191
+ for (i = 8; i < 16; i++) {
18192
+ u = u + (z[i] & 0xff) | 0;
18193
+ z[i] = u & 0xff;
18194
+ u >>>= 8;
18195
+ }
18196
+ b -= 64;
18197
+ cpos += 64;
18198
+ }
18199
+ if (b > 0) {
18200
+ crypto_core_salsa20(x,z,k,sigma);
18201
+ for (i = 0; i < b; i++) c[cpos+i] = x[i];
18202
+ }
18203
+ return 0;
18204
+ }
18205
+
18206
+ function crypto_stream(c,cpos,d,n,k) {
18207
+ var s = new Uint8Array(32);
18208
+ crypto_core_hsalsa20(s,n,k,sigma);
18209
+ var sn = new Uint8Array(8);
18210
+ for (var i = 0; i < 8; i++) sn[i] = n[i+16];
18211
+ return crypto_stream_salsa20(c,cpos,d,sn,s);
18212
+ }
18213
+
18214
+ function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
18215
+ var s = new Uint8Array(32);
18216
+ crypto_core_hsalsa20(s,n,k,sigma);
18217
+ var sn = new Uint8Array(8);
18218
+ for (var i = 0; i < 8; i++) sn[i] = n[i+16];
18219
+ return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
18220
+ }
18221
+
18222
+ /*
18223
+ * Port of Andrew Moon's Poly1305-donna-16. Public domain.
18224
+ * https://github.com/floodyberry/poly1305-donna
18225
+ */
18226
+
18227
+ var poly1305 = function(key) {
18228
+ this.buffer = new Uint8Array(16);
18229
+ this.r = new Uint16Array(10);
18230
+ this.h = new Uint16Array(10);
18231
+ this.pad = new Uint16Array(8);
18232
+ this.leftover = 0;
18233
+ this.fin = 0;
18234
+
18235
+ var t0, t1, t2, t3, t4, t5, t6, t7;
18236
+
18237
+ t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
18238
+ t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
18239
+ t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
18240
+ t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
18241
+ t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
18242
+ this.r[5] = ((t4 >>> 1)) & 0x1ffe;
18243
+ t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
18244
+ t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
18245
+ t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
18246
+ this.r[9] = ((t7 >>> 5)) & 0x007f;
18247
+
18248
+ this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
18249
+ this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
18250
+ this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
18251
+ this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
18252
+ this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
18253
+ this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
18254
+ this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
18255
+ this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
18256
+ };
18257
+
18258
+ poly1305.prototype.blocks = function(m, mpos, bytes) {
18259
+ var hibit = this.fin ? 0 : (1 << 11);
18260
+ var t0, t1, t2, t3, t4, t5, t6, t7, c;
18261
+ var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
18262
+
18263
+ var h0 = this.h[0],
18264
+ h1 = this.h[1],
18265
+ h2 = this.h[2],
18266
+ h3 = this.h[3],
18267
+ h4 = this.h[4],
18268
+ h5 = this.h[5],
18269
+ h6 = this.h[6],
18270
+ h7 = this.h[7],
18271
+ h8 = this.h[8],
18272
+ h9 = this.h[9];
18273
+
18274
+ var r0 = this.r[0],
18275
+ r1 = this.r[1],
18276
+ r2 = this.r[2],
18277
+ r3 = this.r[3],
18278
+ r4 = this.r[4],
18279
+ r5 = this.r[5],
18280
+ r6 = this.r[6],
18281
+ r7 = this.r[7],
18282
+ r8 = this.r[8],
18283
+ r9 = this.r[9];
18284
+
18285
+ while (bytes >= 16) {
18286
+ t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
18287
+ t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
18288
+ t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
18289
+ t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
18290
+ t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
18291
+ h5 += ((t4 >>> 1)) & 0x1fff;
18292
+ t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
18293
+ t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
18294
+ t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
18295
+ h9 += ((t7 >>> 5)) | hibit;
18296
+
18297
+ c = 0;
18298
+
18299
+ d0 = c;
18300
+ d0 += h0 * r0;
18301
+ d0 += h1 * (5 * r9);
18302
+ d0 += h2 * (5 * r8);
18303
+ d0 += h3 * (5 * r7);
18304
+ d0 += h4 * (5 * r6);
18305
+ c = (d0 >>> 13); d0 &= 0x1fff;
18306
+ d0 += h5 * (5 * r5);
18307
+ d0 += h6 * (5 * r4);
18308
+ d0 += h7 * (5 * r3);
18309
+ d0 += h8 * (5 * r2);
18310
+ d0 += h9 * (5 * r1);
18311
+ c += (d0 >>> 13); d0 &= 0x1fff;
18312
+
18313
+ d1 = c;
18314
+ d1 += h0 * r1;
18315
+ d1 += h1 * r0;
18316
+ d1 += h2 * (5 * r9);
18317
+ d1 += h3 * (5 * r8);
18318
+ d1 += h4 * (5 * r7);
18319
+ c = (d1 >>> 13); d1 &= 0x1fff;
18320
+ d1 += h5 * (5 * r6);
18321
+ d1 += h6 * (5 * r5);
18322
+ d1 += h7 * (5 * r4);
18323
+ d1 += h8 * (5 * r3);
18324
+ d1 += h9 * (5 * r2);
18325
+ c += (d1 >>> 13); d1 &= 0x1fff;
18326
+
18327
+ d2 = c;
18328
+ d2 += h0 * r2;
18329
+ d2 += h1 * r1;
18330
+ d2 += h2 * r0;
18331
+ d2 += h3 * (5 * r9);
18332
+ d2 += h4 * (5 * r8);
18333
+ c = (d2 >>> 13); d2 &= 0x1fff;
18334
+ d2 += h5 * (5 * r7);
18335
+ d2 += h6 * (5 * r6);
18336
+ d2 += h7 * (5 * r5);
18337
+ d2 += h8 * (5 * r4);
18338
+ d2 += h9 * (5 * r3);
18339
+ c += (d2 >>> 13); d2 &= 0x1fff;
18340
+
18341
+ d3 = c;
18342
+ d3 += h0 * r3;
18343
+ d3 += h1 * r2;
18344
+ d3 += h2 * r1;
18345
+ d3 += h3 * r0;
18346
+ d3 += h4 * (5 * r9);
18347
+ c = (d3 >>> 13); d3 &= 0x1fff;
18348
+ d3 += h5 * (5 * r8);
18349
+ d3 += h6 * (5 * r7);
18350
+ d3 += h7 * (5 * r6);
18351
+ d3 += h8 * (5 * r5);
18352
+ d3 += h9 * (5 * r4);
18353
+ c += (d3 >>> 13); d3 &= 0x1fff;
18354
+
18355
+ d4 = c;
18356
+ d4 += h0 * r4;
18357
+ d4 += h1 * r3;
18358
+ d4 += h2 * r2;
18359
+ d4 += h3 * r1;
18360
+ d4 += h4 * r0;
18361
+ c = (d4 >>> 13); d4 &= 0x1fff;
18362
+ d4 += h5 * (5 * r9);
18363
+ d4 += h6 * (5 * r8);
18364
+ d4 += h7 * (5 * r7);
18365
+ d4 += h8 * (5 * r6);
18366
+ d4 += h9 * (5 * r5);
18367
+ c += (d4 >>> 13); d4 &= 0x1fff;
18368
+
18369
+ d5 = c;
18370
+ d5 += h0 * r5;
18371
+ d5 += h1 * r4;
18372
+ d5 += h2 * r3;
18373
+ d5 += h3 * r2;
18374
+ d5 += h4 * r1;
18375
+ c = (d5 >>> 13); d5 &= 0x1fff;
18376
+ d5 += h5 * r0;
18377
+ d5 += h6 * (5 * r9);
18378
+ d5 += h7 * (5 * r8);
18379
+ d5 += h8 * (5 * r7);
18380
+ d5 += h9 * (5 * r6);
18381
+ c += (d5 >>> 13); d5 &= 0x1fff;
18382
+
18383
+ d6 = c;
18384
+ d6 += h0 * r6;
18385
+ d6 += h1 * r5;
18386
+ d6 += h2 * r4;
18387
+ d6 += h3 * r3;
18388
+ d6 += h4 * r2;
18389
+ c = (d6 >>> 13); d6 &= 0x1fff;
18390
+ d6 += h5 * r1;
18391
+ d6 += h6 * r0;
18392
+ d6 += h7 * (5 * r9);
18393
+ d6 += h8 * (5 * r8);
18394
+ d6 += h9 * (5 * r7);
18395
+ c += (d6 >>> 13); d6 &= 0x1fff;
18396
+
18397
+ d7 = c;
18398
+ d7 += h0 * r7;
18399
+ d7 += h1 * r6;
18400
+ d7 += h2 * r5;
18401
+ d7 += h3 * r4;
18402
+ d7 += h4 * r3;
18403
+ c = (d7 >>> 13); d7 &= 0x1fff;
18404
+ d7 += h5 * r2;
18405
+ d7 += h6 * r1;
18406
+ d7 += h7 * r0;
18407
+ d7 += h8 * (5 * r9);
18408
+ d7 += h9 * (5 * r8);
18409
+ c += (d7 >>> 13); d7 &= 0x1fff;
18410
+
18411
+ d8 = c;
18412
+ d8 += h0 * r8;
18413
+ d8 += h1 * r7;
18414
+ d8 += h2 * r6;
18415
+ d8 += h3 * r5;
18416
+ d8 += h4 * r4;
18417
+ c = (d8 >>> 13); d8 &= 0x1fff;
18418
+ d8 += h5 * r3;
18419
+ d8 += h6 * r2;
18420
+ d8 += h7 * r1;
18421
+ d8 += h8 * r0;
18422
+ d8 += h9 * (5 * r9);
18423
+ c += (d8 >>> 13); d8 &= 0x1fff;
18424
+
18425
+ d9 = c;
18426
+ d9 += h0 * r9;
18427
+ d9 += h1 * r8;
18428
+ d9 += h2 * r7;
18429
+ d9 += h3 * r6;
18430
+ d9 += h4 * r5;
18431
+ c = (d9 >>> 13); d9 &= 0x1fff;
18432
+ d9 += h5 * r4;
18433
+ d9 += h6 * r3;
18434
+ d9 += h7 * r2;
18435
+ d9 += h8 * r1;
18436
+ d9 += h9 * r0;
18437
+ c += (d9 >>> 13); d9 &= 0x1fff;
18438
+
18439
+ c = (((c << 2) + c)) | 0;
18440
+ c = (c + d0) | 0;
18441
+ d0 = c & 0x1fff;
18442
+ c = (c >>> 13);
18443
+ d1 += c;
18444
+
18445
+ h0 = d0;
18446
+ h1 = d1;
18447
+ h2 = d2;
18448
+ h3 = d3;
18449
+ h4 = d4;
18450
+ h5 = d5;
18451
+ h6 = d6;
18452
+ h7 = d7;
18453
+ h8 = d8;
18454
+ h9 = d9;
18455
+
18456
+ mpos += 16;
18457
+ bytes -= 16;
18458
+ }
18459
+ this.h[0] = h0;
18460
+ this.h[1] = h1;
18461
+ this.h[2] = h2;
18462
+ this.h[3] = h3;
18463
+ this.h[4] = h4;
18464
+ this.h[5] = h5;
18465
+ this.h[6] = h6;
18466
+ this.h[7] = h7;
18467
+ this.h[8] = h8;
18468
+ this.h[9] = h9;
18469
+ };
18470
+
18471
+ poly1305.prototype.finish = function(mac, macpos) {
18472
+ var g = new Uint16Array(10);
18473
+ var c, mask, f, i;
18474
+
18475
+ if (this.leftover) {
18476
+ i = this.leftover;
18477
+ this.buffer[i++] = 1;
18478
+ for (; i < 16; i++) this.buffer[i] = 0;
18479
+ this.fin = 1;
18480
+ this.blocks(this.buffer, 0, 16);
18481
+ }
18482
+
18483
+ c = this.h[1] >>> 13;
18484
+ this.h[1] &= 0x1fff;
18485
+ for (i = 2; i < 10; i++) {
18486
+ this.h[i] += c;
18487
+ c = this.h[i] >>> 13;
18488
+ this.h[i] &= 0x1fff;
18489
+ }
18490
+ this.h[0] += (c * 5);
18491
+ c = this.h[0] >>> 13;
18492
+ this.h[0] &= 0x1fff;
18493
+ this.h[1] += c;
18494
+ c = this.h[1] >>> 13;
18495
+ this.h[1] &= 0x1fff;
18496
+ this.h[2] += c;
18497
+
18498
+ g[0] = this.h[0] + 5;
18499
+ c = g[0] >>> 13;
18500
+ g[0] &= 0x1fff;
18501
+ for (i = 1; i < 10; i++) {
18502
+ g[i] = this.h[i] + c;
18503
+ c = g[i] >>> 13;
18504
+ g[i] &= 0x1fff;
18505
+ }
18506
+ g[9] -= (1 << 13);
18507
+
18508
+ mask = (c ^ 1) - 1;
18509
+ for (i = 0; i < 10; i++) g[i] &= mask;
18510
+ mask = ~mask;
18511
+ for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
18512
+
18513
+ this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
18514
+ this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
18515
+ this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
18516
+ this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
18517
+ this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
18518
+ this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
18519
+ this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
18520
+ this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
18521
+
18522
+ f = this.h[0] + this.pad[0];
18523
+ this.h[0] = f & 0xffff;
18524
+ for (i = 1; i < 8; i++) {
18525
+ f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
18526
+ this.h[i] = f & 0xffff;
18527
+ }
18528
+
18529
+ mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
18530
+ mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
18531
+ mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
18532
+ mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
18533
+ mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
18534
+ mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
18535
+ mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
18536
+ mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
18537
+ mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
18538
+ mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
18539
+ mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
18540
+ mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
18541
+ mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
18542
+ mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
18543
+ mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
18544
+ mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
18545
+ };
18546
+
18547
+ poly1305.prototype.update = function(m, mpos, bytes) {
18548
+ var i, want;
18549
+
18550
+ if (this.leftover) {
18551
+ want = (16 - this.leftover);
18552
+ if (want > bytes)
18553
+ want = bytes;
18554
+ for (i = 0; i < want; i++)
18555
+ this.buffer[this.leftover + i] = m[mpos+i];
18556
+ bytes -= want;
18557
+ mpos += want;
18558
+ this.leftover += want;
18559
+ if (this.leftover < 16)
18560
+ return;
18561
+ this.blocks(this.buffer, 0, 16);
18562
+ this.leftover = 0;
18563
+ }
18564
+
18565
+ if (bytes >= 16) {
18566
+ want = bytes - (bytes % 16);
18567
+ this.blocks(m, mpos, want);
18568
+ mpos += want;
18569
+ bytes -= want;
18570
+ }
18571
+
18572
+ if (bytes) {
18573
+ for (i = 0; i < bytes; i++)
18574
+ this.buffer[this.leftover + i] = m[mpos+i];
18575
+ this.leftover += bytes;
18576
+ }
18577
+ };
18578
+
18579
+ function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
18580
+ var s = new poly1305(k);
18581
+ s.update(m, mpos, n);
18582
+ s.finish(out, outpos);
18583
+ return 0;
18584
+ }
18585
+
18586
+ function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
18587
+ var x = new Uint8Array(16);
18588
+ crypto_onetimeauth(x,0,m,mpos,n,k);
18589
+ return crypto_verify_16(h,hpos,x,0);
18590
+ }
18591
+
18592
+ function crypto_secretbox(c,m,d,n,k) {
18593
+ var i;
18594
+ if (d < 32) return -1;
18595
+ crypto_stream_xor(c,0,m,0,d,n,k);
18596
+ crypto_onetimeauth(c, 16, c, 32, d - 32, c);
18597
+ for (i = 0; i < 16; i++) c[i] = 0;
18598
+ return 0;
18599
+ }
18600
+
18601
+ function crypto_secretbox_open(m,c,d,n,k) {
18602
+ var i;
18603
+ var x = new Uint8Array(32);
18604
+ if (d < 32) return -1;
18605
+ crypto_stream(x,0,32,n,k);
18606
+ if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
18607
+ crypto_stream_xor(m,0,c,0,d,n,k);
18608
+ for (i = 0; i < 32; i++) m[i] = 0;
18609
+ return 0;
18610
+ }
18611
+
18612
+ function set25519(r, a) {
18613
+ var i;
18614
+ for (i = 0; i < 16; i++) r[i] = a[i]|0;
18615
+ }
18616
+
18617
+ function car25519(o) {
18618
+ var i, v, c = 1;
18619
+ for (i = 0; i < 16; i++) {
18620
+ v = o[i] + c + 65535;
18621
+ c = Math.floor(v / 65536);
18622
+ o[i] = v - c * 65536;
18623
+ }
18624
+ o[0] += c-1 + 37 * (c-1);
18625
+ }
18626
+
18627
+ function sel25519(p, q, b) {
18628
+ var t, c = ~(b-1);
18629
+ for (var i = 0; i < 16; i++) {
18630
+ t = c & (p[i] ^ q[i]);
18631
+ p[i] ^= t;
18632
+ q[i] ^= t;
18633
+ }
18634
+ }
18635
+
18636
+ function pack25519(o, n) {
18637
+ var i, j, b;
18638
+ var m = gf(), t = gf();
18639
+ for (i = 0; i < 16; i++) t[i] = n[i];
18640
+ car25519(t);
18641
+ car25519(t);
18642
+ car25519(t);
18643
+ for (j = 0; j < 2; j++) {
18644
+ m[0] = t[0] - 0xffed;
18645
+ for (i = 1; i < 15; i++) {
18646
+ m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
18647
+ m[i-1] &= 0xffff;
18648
+ }
18649
+ m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
18650
+ b = (m[15]>>16) & 1;
18651
+ m[14] &= 0xffff;
18652
+ sel25519(t, m, 1-b);
18653
+ }
18654
+ for (i = 0; i < 16; i++) {
18655
+ o[2*i] = t[i] & 0xff;
18656
+ o[2*i+1] = t[i]>>8;
18657
+ }
18658
+ }
18659
+
18660
+ function neq25519(a, b) {
18661
+ var c = new Uint8Array(32), d = new Uint8Array(32);
18662
+ pack25519(c, a);
18663
+ pack25519(d, b);
18664
+ return crypto_verify_32(c, 0, d, 0);
18665
+ }
18666
+
18667
+ function par25519(a) {
18668
+ var d = new Uint8Array(32);
18669
+ pack25519(d, a);
18670
+ return d[0] & 1;
18671
+ }
18672
+
18673
+ function unpack25519(o, n) {
18674
+ var i;
18675
+ for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
18676
+ o[15] &= 0x7fff;
18677
+ }
18678
+
18679
+ function A(o, a, b) {
18680
+ for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
18681
+ }
18682
+
18683
+ function Z(o, a, b) {
18684
+ for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
18685
+ }
18686
+
18687
+ function M(o, a, b) {
18688
+ var v, c,
18689
+ t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
18690
+ t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
18691
+ t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
18692
+ t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
18693
+ b0 = b[0],
18694
+ b1 = b[1],
18695
+ b2 = b[2],
18696
+ b3 = b[3],
18697
+ b4 = b[4],
18698
+ b5 = b[5],
18699
+ b6 = b[6],
18700
+ b7 = b[7],
18701
+ b8 = b[8],
18702
+ b9 = b[9],
18703
+ b10 = b[10],
18704
+ b11 = b[11],
18705
+ b12 = b[12],
18706
+ b13 = b[13],
18707
+ b14 = b[14],
18708
+ b15 = b[15];
18709
+
18710
+ v = a[0];
18711
+ t0 += v * b0;
18712
+ t1 += v * b1;
18713
+ t2 += v * b2;
18714
+ t3 += v * b3;
18715
+ t4 += v * b4;
18716
+ t5 += v * b5;
18717
+ t6 += v * b6;
18718
+ t7 += v * b7;
18719
+ t8 += v * b8;
18720
+ t9 += v * b9;
18721
+ t10 += v * b10;
18722
+ t11 += v * b11;
18723
+ t12 += v * b12;
18724
+ t13 += v * b13;
18725
+ t14 += v * b14;
18726
+ t15 += v * b15;
18727
+ v = a[1];
18728
+ t1 += v * b0;
18729
+ t2 += v * b1;
18730
+ t3 += v * b2;
18731
+ t4 += v * b3;
18732
+ t5 += v * b4;
18733
+ t6 += v * b5;
18734
+ t7 += v * b6;
18735
+ t8 += v * b7;
18736
+ t9 += v * b8;
18737
+ t10 += v * b9;
18738
+ t11 += v * b10;
18739
+ t12 += v * b11;
18740
+ t13 += v * b12;
18741
+ t14 += v * b13;
18742
+ t15 += v * b14;
18743
+ t16 += v * b15;
18744
+ v = a[2];
18745
+ t2 += v * b0;
18746
+ t3 += v * b1;
18747
+ t4 += v * b2;
18748
+ t5 += v * b3;
18749
+ t6 += v * b4;
18750
+ t7 += v * b5;
18751
+ t8 += v * b6;
18752
+ t9 += v * b7;
18753
+ t10 += v * b8;
18754
+ t11 += v * b9;
18755
+ t12 += v * b10;
18756
+ t13 += v * b11;
18757
+ t14 += v * b12;
18758
+ t15 += v * b13;
18759
+ t16 += v * b14;
18760
+ t17 += v * b15;
18761
+ v = a[3];
18762
+ t3 += v * b0;
18763
+ t4 += v * b1;
18764
+ t5 += v * b2;
18765
+ t6 += v * b3;
18766
+ t7 += v * b4;
18767
+ t8 += v * b5;
18768
+ t9 += v * b6;
18769
+ t10 += v * b7;
18770
+ t11 += v * b8;
18771
+ t12 += v * b9;
18772
+ t13 += v * b10;
18773
+ t14 += v * b11;
18774
+ t15 += v * b12;
18775
+ t16 += v * b13;
18776
+ t17 += v * b14;
18777
+ t18 += v * b15;
18778
+ v = a[4];
18779
+ t4 += v * b0;
18780
+ t5 += v * b1;
18781
+ t6 += v * b2;
18782
+ t7 += v * b3;
18783
+ t8 += v * b4;
18784
+ t9 += v * b5;
18785
+ t10 += v * b6;
18786
+ t11 += v * b7;
18787
+ t12 += v * b8;
18788
+ t13 += v * b9;
18789
+ t14 += v * b10;
18790
+ t15 += v * b11;
18791
+ t16 += v * b12;
18792
+ t17 += v * b13;
18793
+ t18 += v * b14;
18794
+ t19 += v * b15;
18795
+ v = a[5];
18796
+ t5 += v * b0;
18797
+ t6 += v * b1;
18798
+ t7 += v * b2;
18799
+ t8 += v * b3;
18800
+ t9 += v * b4;
18801
+ t10 += v * b5;
18802
+ t11 += v * b6;
18803
+ t12 += v * b7;
18804
+ t13 += v * b8;
18805
+ t14 += v * b9;
18806
+ t15 += v * b10;
18807
+ t16 += v * b11;
18808
+ t17 += v * b12;
18809
+ t18 += v * b13;
18810
+ t19 += v * b14;
18811
+ t20 += v * b15;
18812
+ v = a[6];
18813
+ t6 += v * b0;
18814
+ t7 += v * b1;
18815
+ t8 += v * b2;
18816
+ t9 += v * b3;
18817
+ t10 += v * b4;
18818
+ t11 += v * b5;
18819
+ t12 += v * b6;
18820
+ t13 += v * b7;
18821
+ t14 += v * b8;
18822
+ t15 += v * b9;
18823
+ t16 += v * b10;
18824
+ t17 += v * b11;
18825
+ t18 += v * b12;
18826
+ t19 += v * b13;
18827
+ t20 += v * b14;
18828
+ t21 += v * b15;
18829
+ v = a[7];
18830
+ t7 += v * b0;
18831
+ t8 += v * b1;
18832
+ t9 += v * b2;
18833
+ t10 += v * b3;
18834
+ t11 += v * b4;
18835
+ t12 += v * b5;
18836
+ t13 += v * b6;
18837
+ t14 += v * b7;
18838
+ t15 += v * b8;
18839
+ t16 += v * b9;
18840
+ t17 += v * b10;
18841
+ t18 += v * b11;
18842
+ t19 += v * b12;
18843
+ t20 += v * b13;
18844
+ t21 += v * b14;
18845
+ t22 += v * b15;
18846
+ v = a[8];
18847
+ t8 += v * b0;
18848
+ t9 += v * b1;
18849
+ t10 += v * b2;
18850
+ t11 += v * b3;
18851
+ t12 += v * b4;
18852
+ t13 += v * b5;
18853
+ t14 += v * b6;
18854
+ t15 += v * b7;
18855
+ t16 += v * b8;
18856
+ t17 += v * b9;
18857
+ t18 += v * b10;
18858
+ t19 += v * b11;
18859
+ t20 += v * b12;
18860
+ t21 += v * b13;
18861
+ t22 += v * b14;
18862
+ t23 += v * b15;
18863
+ v = a[9];
18864
+ t9 += v * b0;
18865
+ t10 += v * b1;
18866
+ t11 += v * b2;
18867
+ t12 += v * b3;
18868
+ t13 += v * b4;
18869
+ t14 += v * b5;
18870
+ t15 += v * b6;
18871
+ t16 += v * b7;
18872
+ t17 += v * b8;
18873
+ t18 += v * b9;
18874
+ t19 += v * b10;
18875
+ t20 += v * b11;
18876
+ t21 += v * b12;
18877
+ t22 += v * b13;
18878
+ t23 += v * b14;
18879
+ t24 += v * b15;
18880
+ v = a[10];
18881
+ t10 += v * b0;
18882
+ t11 += v * b1;
18883
+ t12 += v * b2;
18884
+ t13 += v * b3;
18885
+ t14 += v * b4;
18886
+ t15 += v * b5;
18887
+ t16 += v * b6;
18888
+ t17 += v * b7;
18889
+ t18 += v * b8;
18890
+ t19 += v * b9;
18891
+ t20 += v * b10;
18892
+ t21 += v * b11;
18893
+ t22 += v * b12;
18894
+ t23 += v * b13;
18895
+ t24 += v * b14;
18896
+ t25 += v * b15;
18897
+ v = a[11];
18898
+ t11 += v * b0;
18899
+ t12 += v * b1;
18900
+ t13 += v * b2;
18901
+ t14 += v * b3;
18902
+ t15 += v * b4;
18903
+ t16 += v * b5;
18904
+ t17 += v * b6;
18905
+ t18 += v * b7;
18906
+ t19 += v * b8;
18907
+ t20 += v * b9;
18908
+ t21 += v * b10;
18909
+ t22 += v * b11;
18910
+ t23 += v * b12;
18911
+ t24 += v * b13;
18912
+ t25 += v * b14;
18913
+ t26 += v * b15;
18914
+ v = a[12];
18915
+ t12 += v * b0;
18916
+ t13 += v * b1;
18917
+ t14 += v * b2;
18918
+ t15 += v * b3;
18919
+ t16 += v * b4;
18920
+ t17 += v * b5;
18921
+ t18 += v * b6;
18922
+ t19 += v * b7;
18923
+ t20 += v * b8;
18924
+ t21 += v * b9;
18925
+ t22 += v * b10;
18926
+ t23 += v * b11;
18927
+ t24 += v * b12;
18928
+ t25 += v * b13;
18929
+ t26 += v * b14;
18930
+ t27 += v * b15;
18931
+ v = a[13];
18932
+ t13 += v * b0;
18933
+ t14 += v * b1;
18934
+ t15 += v * b2;
18935
+ t16 += v * b3;
18936
+ t17 += v * b4;
18937
+ t18 += v * b5;
18938
+ t19 += v * b6;
18939
+ t20 += v * b7;
18940
+ t21 += v * b8;
18941
+ t22 += v * b9;
18942
+ t23 += v * b10;
18943
+ t24 += v * b11;
18944
+ t25 += v * b12;
18945
+ t26 += v * b13;
18946
+ t27 += v * b14;
18947
+ t28 += v * b15;
18948
+ v = a[14];
18949
+ t14 += v * b0;
18950
+ t15 += v * b1;
18951
+ t16 += v * b2;
18952
+ t17 += v * b3;
18953
+ t18 += v * b4;
18954
+ t19 += v * b5;
18955
+ t20 += v * b6;
18956
+ t21 += v * b7;
18957
+ t22 += v * b8;
18958
+ t23 += v * b9;
18959
+ t24 += v * b10;
18960
+ t25 += v * b11;
18961
+ t26 += v * b12;
18962
+ t27 += v * b13;
18963
+ t28 += v * b14;
18964
+ t29 += v * b15;
18965
+ v = a[15];
18966
+ t15 += v * b0;
18967
+ t16 += v * b1;
18968
+ t17 += v * b2;
18969
+ t18 += v * b3;
18970
+ t19 += v * b4;
18971
+ t20 += v * b5;
18972
+ t21 += v * b6;
18973
+ t22 += v * b7;
18974
+ t23 += v * b8;
18975
+ t24 += v * b9;
18976
+ t25 += v * b10;
18977
+ t26 += v * b11;
18978
+ t27 += v * b12;
18979
+ t28 += v * b13;
18980
+ t29 += v * b14;
18981
+ t30 += v * b15;
18982
+
18983
+ t0 += 38 * t16;
18984
+ t1 += 38 * t17;
18985
+ t2 += 38 * t18;
18986
+ t3 += 38 * t19;
18987
+ t4 += 38 * t20;
18988
+ t5 += 38 * t21;
18989
+ t6 += 38 * t22;
18990
+ t7 += 38 * t23;
18991
+ t8 += 38 * t24;
18992
+ t9 += 38 * t25;
18993
+ t10 += 38 * t26;
18994
+ t11 += 38 * t27;
18995
+ t12 += 38 * t28;
18996
+ t13 += 38 * t29;
18997
+ t14 += 38 * t30;
18998
+ // t15 left as is
18999
+
19000
+ // first car
19001
+ c = 1;
19002
+ v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
19003
+ v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
19004
+ v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
19005
+ v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
19006
+ v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
19007
+ v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
19008
+ v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
19009
+ v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
19010
+ v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
19011
+ v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
19012
+ v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
19013
+ v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
19014
+ v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
19015
+ v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
19016
+ v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
19017
+ v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
19018
+ t0 += c-1 + 37 * (c-1);
19019
+
19020
+ // second car
19021
+ c = 1;
19022
+ v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
19023
+ v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
19024
+ v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
19025
+ v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
19026
+ v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
19027
+ v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
19028
+ v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
19029
+ v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
19030
+ v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
19031
+ v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
19032
+ v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
19033
+ v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
19034
+ v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
19035
+ v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
19036
+ v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
19037
+ v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
19038
+ t0 += c-1 + 37 * (c-1);
19039
+
19040
+ o[ 0] = t0;
19041
+ o[ 1] = t1;
19042
+ o[ 2] = t2;
19043
+ o[ 3] = t3;
19044
+ o[ 4] = t4;
19045
+ o[ 5] = t5;
19046
+ o[ 6] = t6;
19047
+ o[ 7] = t7;
19048
+ o[ 8] = t8;
19049
+ o[ 9] = t9;
19050
+ o[10] = t10;
19051
+ o[11] = t11;
19052
+ o[12] = t12;
19053
+ o[13] = t13;
19054
+ o[14] = t14;
19055
+ o[15] = t15;
19056
+ }
19057
+
19058
+ function S(o, a) {
19059
+ M(o, a, a);
19060
+ }
19061
+
19062
+ function inv25519(o, i) {
19063
+ var c = gf();
19064
+ var a;
19065
+ for (a = 0; a < 16; a++) c[a] = i[a];
19066
+ for (a = 253; a >= 0; a--) {
19067
+ S(c, c);
19068
+ if(a !== 2 && a !== 4) M(c, c, i);
19069
+ }
19070
+ for (a = 0; a < 16; a++) o[a] = c[a];
19071
+ }
19072
+
19073
+ function pow2523(o, i) {
19074
+ var c = gf();
19075
+ var a;
19076
+ for (a = 0; a < 16; a++) c[a] = i[a];
19077
+ for (a = 250; a >= 0; a--) {
19078
+ S(c, c);
19079
+ if(a !== 1) M(c, c, i);
19080
+ }
19081
+ for (a = 0; a < 16; a++) o[a] = c[a];
19082
+ }
19083
+
19084
+ function crypto_scalarmult(q, n, p) {
19085
+ var z = new Uint8Array(32);
19086
+ var x = new Float64Array(80), r, i;
19087
+ var a = gf(), b = gf(), c = gf(),
19088
+ d = gf(), e = gf(), f = gf();
19089
+ for (i = 0; i < 31; i++) z[i] = n[i];
19090
+ z[31]=(n[31]&127)|64;
19091
+ z[0]&=248;
19092
+ unpack25519(x,p);
19093
+ for (i = 0; i < 16; i++) {
19094
+ b[i]=x[i];
19095
+ d[i]=a[i]=c[i]=0;
19096
+ }
19097
+ a[0]=d[0]=1;
19098
+ for (i=254; i>=0; --i) {
19099
+ r=(z[i>>>3]>>>(i&7))&1;
19100
+ sel25519(a,b,r);
19101
+ sel25519(c,d,r);
19102
+ A(e,a,c);
19103
+ Z(a,a,c);
19104
+ A(c,b,d);
19105
+ Z(b,b,d);
19106
+ S(d,e);
19107
+ S(f,a);
19108
+ M(a,c,a);
19109
+ M(c,b,e);
19110
+ A(e,a,c);
19111
+ Z(a,a,c);
19112
+ S(b,a);
19113
+ Z(c,d,f);
19114
+ M(a,c,_121665);
19115
+ A(a,a,d);
19116
+ M(c,c,a);
19117
+ M(a,d,f);
19118
+ M(d,b,x);
19119
+ S(b,e);
19120
+ sel25519(a,b,r);
19121
+ sel25519(c,d,r);
19122
+ }
19123
+ for (i = 0; i < 16; i++) {
19124
+ x[i+16]=a[i];
19125
+ x[i+32]=c[i];
19126
+ x[i+48]=b[i];
19127
+ x[i+64]=d[i];
19128
+ }
19129
+ var x32 = x.subarray(32);
19130
+ var x16 = x.subarray(16);
19131
+ inv25519(x32,x32);
19132
+ M(x16,x16,x32);
19133
+ pack25519(q,x16);
19134
+ return 0;
19135
+ }
19136
+
19137
+ function crypto_scalarmult_base(q, n) {
19138
+ return crypto_scalarmult(q, n, _9);
19139
+ }
19140
+
19141
+ function crypto_box_keypair(y, x) {
19142
+ randombytes(x, 32);
19143
+ return crypto_scalarmult_base(y, x);
19144
+ }
19145
+
19146
+ function crypto_box_beforenm(k, y, x) {
19147
+ var s = new Uint8Array(32);
19148
+ crypto_scalarmult(s, x, y);
19149
+ return crypto_core_hsalsa20(k, _0, s, sigma);
19150
+ }
19151
+
19152
+ var crypto_box_afternm = crypto_secretbox;
19153
+ var crypto_box_open_afternm = crypto_secretbox_open;
19154
+
19155
+ function crypto_box(c, m, d, n, y, x) {
19156
+ var k = new Uint8Array(32);
19157
+ crypto_box_beforenm(k, y, x);
19158
+ return crypto_box_afternm(c, m, d, n, k);
19159
+ }
19160
+
19161
+ function crypto_box_open(m, c, d, n, y, x) {
19162
+ var k = new Uint8Array(32);
19163
+ crypto_box_beforenm(k, y, x);
19164
+ return crypto_box_open_afternm(m, c, d, n, k);
19165
+ }
19166
+
19167
+ var K = [
19168
+ 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
19169
+ 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
19170
+ 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
19171
+ 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
19172
+ 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
19173
+ 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
19174
+ 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
19175
+ 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
19176
+ 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
19177
+ 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
19178
+ 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
19179
+ 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
19180
+ 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
19181
+ 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
19182
+ 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
19183
+ 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
19184
+ 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
19185
+ 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
19186
+ 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
19187
+ 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
19188
+ 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
19189
+ 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
19190
+ 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
19191
+ 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
19192
+ 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
19193
+ 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
19194
+ 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
19195
+ 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
19196
+ 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
19197
+ 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
19198
+ 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
19199
+ 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
19200
+ 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
19201
+ 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
19202
+ 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
19203
+ 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
19204
+ 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
19205
+ 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
19206
+ 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
19207
+ 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
19208
+ ];
19209
+
19210
+ function crypto_hashblocks_hl(hh, hl, m, n) {
19211
+ var wh = new Int32Array(16), wl = new Int32Array(16),
19212
+ bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
19213
+ bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
19214
+ th, tl, i, j, h, l, a, b, c, d;
19215
+
19216
+ var ah0 = hh[0],
19217
+ ah1 = hh[1],
19218
+ ah2 = hh[2],
19219
+ ah3 = hh[3],
19220
+ ah4 = hh[4],
19221
+ ah5 = hh[5],
19222
+ ah6 = hh[6],
19223
+ ah7 = hh[7],
19224
+
19225
+ al0 = hl[0],
19226
+ al1 = hl[1],
19227
+ al2 = hl[2],
19228
+ al3 = hl[3],
19229
+ al4 = hl[4],
19230
+ al5 = hl[5],
19231
+ al6 = hl[6],
19232
+ al7 = hl[7];
19233
+
19234
+ var pos = 0;
19235
+ while (n >= 128) {
19236
+ for (i = 0; i < 16; i++) {
19237
+ j = 8 * i + pos;
19238
+ wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
19239
+ wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
19240
+ }
19241
+ for (i = 0; i < 80; i++) {
19242
+ bh0 = ah0;
19243
+ bh1 = ah1;
19244
+ bh2 = ah2;
19245
+ bh3 = ah3;
19246
+ bh4 = ah4;
19247
+ bh5 = ah5;
19248
+ bh6 = ah6;
19249
+ bh7 = ah7;
19250
+
19251
+ bl0 = al0;
19252
+ bl1 = al1;
19253
+ bl2 = al2;
19254
+ bl3 = al3;
19255
+ bl4 = al4;
19256
+ bl5 = al5;
19257
+ bl6 = al6;
19258
+ bl7 = al7;
19259
+
19260
+ // add
19261
+ h = ah7;
19262
+ l = al7;
19263
+
19264
+ a = l & 0xffff; b = l >>> 16;
19265
+ c = h & 0xffff; d = h >>> 16;
19266
+
19267
+ // Sigma1
19268
+ h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
19269
+ l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
19270
+
19271
+ a += l & 0xffff; b += l >>> 16;
19272
+ c += h & 0xffff; d += h >>> 16;
19273
+
19274
+ // Ch
19275
+ h = (ah4 & ah5) ^ (~ah4 & ah6);
19276
+ l = (al4 & al5) ^ (~al4 & al6);
19277
+
19278
+ a += l & 0xffff; b += l >>> 16;
19279
+ c += h & 0xffff; d += h >>> 16;
19280
+
19281
+ // K
19282
+ h = K[i*2];
19283
+ l = K[i*2+1];
19284
+
19285
+ a += l & 0xffff; b += l >>> 16;
19286
+ c += h & 0xffff; d += h >>> 16;
19287
+
19288
+ // w
19289
+ h = wh[i%16];
19290
+ l = wl[i%16];
19291
+
19292
+ a += l & 0xffff; b += l >>> 16;
19293
+ c += h & 0xffff; d += h >>> 16;
19294
+
19295
+ b += a >>> 16;
19296
+ c += b >>> 16;
19297
+ d += c >>> 16;
19298
+
19299
+ th = c & 0xffff | d << 16;
19300
+ tl = a & 0xffff | b << 16;
19301
+
19302
+ // add
19303
+ h = th;
19304
+ l = tl;
19305
+
19306
+ a = l & 0xffff; b = l >>> 16;
19307
+ c = h & 0xffff; d = h >>> 16;
19308
+
19309
+ // Sigma0
19310
+ h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
19311
+ l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
19312
+
19313
+ a += l & 0xffff; b += l >>> 16;
19314
+ c += h & 0xffff; d += h >>> 16;
19315
+
19316
+ // Maj
19317
+ h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
19318
+ l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
19319
+
19320
+ a += l & 0xffff; b += l >>> 16;
19321
+ c += h & 0xffff; d += h >>> 16;
19322
+
19323
+ b += a >>> 16;
19324
+ c += b >>> 16;
19325
+ d += c >>> 16;
19326
+
19327
+ bh7 = (c & 0xffff) | (d << 16);
19328
+ bl7 = (a & 0xffff) | (b << 16);
19329
+
19330
+ // add
19331
+ h = bh3;
19332
+ l = bl3;
19333
+
19334
+ a = l & 0xffff; b = l >>> 16;
19335
+ c = h & 0xffff; d = h >>> 16;
19336
+
19337
+ h = th;
19338
+ l = tl;
19339
+
19340
+ a += l & 0xffff; b += l >>> 16;
19341
+ c += h & 0xffff; d += h >>> 16;
19342
+
19343
+ b += a >>> 16;
19344
+ c += b >>> 16;
19345
+ d += c >>> 16;
19346
+
19347
+ bh3 = (c & 0xffff) | (d << 16);
19348
+ bl3 = (a & 0xffff) | (b << 16);
19349
+
19350
+ ah1 = bh0;
19351
+ ah2 = bh1;
19352
+ ah3 = bh2;
19353
+ ah4 = bh3;
19354
+ ah5 = bh4;
19355
+ ah6 = bh5;
19356
+ ah7 = bh6;
19357
+ ah0 = bh7;
19358
+
19359
+ al1 = bl0;
19360
+ al2 = bl1;
19361
+ al3 = bl2;
19362
+ al4 = bl3;
19363
+ al5 = bl4;
19364
+ al6 = bl5;
19365
+ al7 = bl6;
19366
+ al0 = bl7;
19367
+
19368
+ if (i%16 === 15) {
19369
+ for (j = 0; j < 16; j++) {
19370
+ // add
19371
+ h = wh[j];
19372
+ l = wl[j];
19373
+
19374
+ a = l & 0xffff; b = l >>> 16;
19375
+ c = h & 0xffff; d = h >>> 16;
19376
+
19377
+ h = wh[(j+9)%16];
19378
+ l = wl[(j+9)%16];
19379
+
19380
+ a += l & 0xffff; b += l >>> 16;
19381
+ c += h & 0xffff; d += h >>> 16;
19382
+
19383
+ // sigma0
19384
+ th = wh[(j+1)%16];
19385
+ tl = wl[(j+1)%16];
19386
+ h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
19387
+ l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
19388
+
19389
+ a += l & 0xffff; b += l >>> 16;
19390
+ c += h & 0xffff; d += h >>> 16;
19391
+
19392
+ // sigma1
19393
+ th = wh[(j+14)%16];
19394
+ tl = wl[(j+14)%16];
19395
+ h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
19396
+ l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
19397
+
19398
+ a += l & 0xffff; b += l >>> 16;
19399
+ c += h & 0xffff; d += h >>> 16;
19400
+
19401
+ b += a >>> 16;
19402
+ c += b >>> 16;
19403
+ d += c >>> 16;
19404
+
19405
+ wh[j] = (c & 0xffff) | (d << 16);
19406
+ wl[j] = (a & 0xffff) | (b << 16);
19407
+ }
19408
+ }
19409
+ }
19410
+
19411
+ // add
19412
+ h = ah0;
19413
+ l = al0;
19414
+
19415
+ a = l & 0xffff; b = l >>> 16;
19416
+ c = h & 0xffff; d = h >>> 16;
19417
+
19418
+ h = hh[0];
19419
+ l = hl[0];
19420
+
19421
+ a += l & 0xffff; b += l >>> 16;
19422
+ c += h & 0xffff; d += h >>> 16;
19423
+
19424
+ b += a >>> 16;
19425
+ c += b >>> 16;
19426
+ d += c >>> 16;
19427
+
19428
+ hh[0] = ah0 = (c & 0xffff) | (d << 16);
19429
+ hl[0] = al0 = (a & 0xffff) | (b << 16);
19430
+
19431
+ h = ah1;
19432
+ l = al1;
19433
+
19434
+ a = l & 0xffff; b = l >>> 16;
19435
+ c = h & 0xffff; d = h >>> 16;
19436
+
19437
+ h = hh[1];
19438
+ l = hl[1];
19439
+
19440
+ a += l & 0xffff; b += l >>> 16;
19441
+ c += h & 0xffff; d += h >>> 16;
19442
+
19443
+ b += a >>> 16;
19444
+ c += b >>> 16;
19445
+ d += c >>> 16;
19446
+
19447
+ hh[1] = ah1 = (c & 0xffff) | (d << 16);
19448
+ hl[1] = al1 = (a & 0xffff) | (b << 16);
19449
+
19450
+ h = ah2;
19451
+ l = al2;
19452
+
19453
+ a = l & 0xffff; b = l >>> 16;
19454
+ c = h & 0xffff; d = h >>> 16;
19455
+
19456
+ h = hh[2];
19457
+ l = hl[2];
19458
+
19459
+ a += l & 0xffff; b += l >>> 16;
19460
+ c += h & 0xffff; d += h >>> 16;
19461
+
19462
+ b += a >>> 16;
19463
+ c += b >>> 16;
19464
+ d += c >>> 16;
19465
+
19466
+ hh[2] = ah2 = (c & 0xffff) | (d << 16);
19467
+ hl[2] = al2 = (a & 0xffff) | (b << 16);
19468
+
19469
+ h = ah3;
19470
+ l = al3;
19471
+
19472
+ a = l & 0xffff; b = l >>> 16;
19473
+ c = h & 0xffff; d = h >>> 16;
19474
+
19475
+ h = hh[3];
19476
+ l = hl[3];
19477
+
19478
+ a += l & 0xffff; b += l >>> 16;
19479
+ c += h & 0xffff; d += h >>> 16;
19480
+
19481
+ b += a >>> 16;
19482
+ c += b >>> 16;
19483
+ d += c >>> 16;
19484
+
19485
+ hh[3] = ah3 = (c & 0xffff) | (d << 16);
19486
+ hl[3] = al3 = (a & 0xffff) | (b << 16);
19487
+
19488
+ h = ah4;
19489
+ l = al4;
19490
+
19491
+ a = l & 0xffff; b = l >>> 16;
19492
+ c = h & 0xffff; d = h >>> 16;
19493
+
19494
+ h = hh[4];
19495
+ l = hl[4];
19496
+
19497
+ a += l & 0xffff; b += l >>> 16;
19498
+ c += h & 0xffff; d += h >>> 16;
19499
+
19500
+ b += a >>> 16;
19501
+ c += b >>> 16;
19502
+ d += c >>> 16;
19503
+
19504
+ hh[4] = ah4 = (c & 0xffff) | (d << 16);
19505
+ hl[4] = al4 = (a & 0xffff) | (b << 16);
19506
+
19507
+ h = ah5;
19508
+ l = al5;
19509
+
19510
+ a = l & 0xffff; b = l >>> 16;
19511
+ c = h & 0xffff; d = h >>> 16;
19512
+
19513
+ h = hh[5];
19514
+ l = hl[5];
19515
+
19516
+ a += l & 0xffff; b += l >>> 16;
19517
+ c += h & 0xffff; d += h >>> 16;
19518
+
19519
+ b += a >>> 16;
19520
+ c += b >>> 16;
19521
+ d += c >>> 16;
19522
+
19523
+ hh[5] = ah5 = (c & 0xffff) | (d << 16);
19524
+ hl[5] = al5 = (a & 0xffff) | (b << 16);
19525
+
19526
+ h = ah6;
19527
+ l = al6;
19528
+
19529
+ a = l & 0xffff; b = l >>> 16;
19530
+ c = h & 0xffff; d = h >>> 16;
19531
+
19532
+ h = hh[6];
19533
+ l = hl[6];
19534
+
19535
+ a += l & 0xffff; b += l >>> 16;
19536
+ c += h & 0xffff; d += h >>> 16;
19537
+
19538
+ b += a >>> 16;
19539
+ c += b >>> 16;
19540
+ d += c >>> 16;
19541
+
19542
+ hh[6] = ah6 = (c & 0xffff) | (d << 16);
19543
+ hl[6] = al6 = (a & 0xffff) | (b << 16);
19544
+
19545
+ h = ah7;
19546
+ l = al7;
19547
+
19548
+ a = l & 0xffff; b = l >>> 16;
19549
+ c = h & 0xffff; d = h >>> 16;
19550
+
19551
+ h = hh[7];
19552
+ l = hl[7];
19553
+
19554
+ a += l & 0xffff; b += l >>> 16;
19555
+ c += h & 0xffff; d += h >>> 16;
19556
+
19557
+ b += a >>> 16;
19558
+ c += b >>> 16;
19559
+ d += c >>> 16;
19560
+
19561
+ hh[7] = ah7 = (c & 0xffff) | (d << 16);
19562
+ hl[7] = al7 = (a & 0xffff) | (b << 16);
19563
+
19564
+ pos += 128;
19565
+ n -= 128;
19566
+ }
19567
+
19568
+ return n;
19569
+ }
19570
+
19571
+ function crypto_hash(out, m, n) {
19572
+ var hh = new Int32Array(8),
19573
+ hl = new Int32Array(8),
19574
+ x = new Uint8Array(256),
19575
+ i, b = n;
19576
+
19577
+ hh[0] = 0x6a09e667;
19578
+ hh[1] = 0xbb67ae85;
19579
+ hh[2] = 0x3c6ef372;
19580
+ hh[3] = 0xa54ff53a;
19581
+ hh[4] = 0x510e527f;
19582
+ hh[5] = 0x9b05688c;
19583
+ hh[6] = 0x1f83d9ab;
19584
+ hh[7] = 0x5be0cd19;
19585
+
19586
+ hl[0] = 0xf3bcc908;
19587
+ hl[1] = 0x84caa73b;
19588
+ hl[2] = 0xfe94f82b;
19589
+ hl[3] = 0x5f1d36f1;
19590
+ hl[4] = 0xade682d1;
19591
+ hl[5] = 0x2b3e6c1f;
19592
+ hl[6] = 0xfb41bd6b;
19593
+ hl[7] = 0x137e2179;
19594
+
19595
+ crypto_hashblocks_hl(hh, hl, m, n);
19596
+ n %= 128;
19597
+
19598
+ for (i = 0; i < n; i++) x[i] = m[b-n+i];
19599
+ x[n] = 128;
19600
+
19601
+ n = 256-128*(n<112?1:0);
19602
+ x[n-9] = 0;
19603
+ ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
19604
+ crypto_hashblocks_hl(hh, hl, x, n);
19605
+
19606
+ for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
19607
+
19608
+ return 0;
19609
+ }
19610
+
19611
+ function add(p, q) {
19612
+ var a = gf(), b = gf(), c = gf(),
19613
+ d = gf(), e = gf(), f = gf(),
19614
+ g = gf(), h = gf(), t = gf();
19615
+
19616
+ Z(a, p[1], p[0]);
19617
+ Z(t, q[1], q[0]);
19618
+ M(a, a, t);
19619
+ A(b, p[0], p[1]);
19620
+ A(t, q[0], q[1]);
19621
+ M(b, b, t);
19622
+ M(c, p[3], q[3]);
19623
+ M(c, c, D2);
19624
+ M(d, p[2], q[2]);
19625
+ A(d, d, d);
19626
+ Z(e, b, a);
19627
+ Z(f, d, c);
19628
+ A(g, d, c);
19629
+ A(h, b, a);
19630
+
19631
+ M(p[0], e, f);
19632
+ M(p[1], h, g);
19633
+ M(p[2], g, f);
19634
+ M(p[3], e, h);
19635
+ }
19636
+
19637
+ function cswap(p, q, b) {
19638
+ var i;
19639
+ for (i = 0; i < 4; i++) {
19640
+ sel25519(p[i], q[i], b);
19641
+ }
19642
+ }
19643
+
19644
+ function pack(r, p) {
19645
+ var tx = gf(), ty = gf(), zi = gf();
19646
+ inv25519(zi, p[2]);
19647
+ M(tx, p[0], zi);
19648
+ M(ty, p[1], zi);
19649
+ pack25519(r, ty);
19650
+ r[31] ^= par25519(tx) << 7;
19651
+ }
19652
+
19653
+ function scalarmult(p, q, s) {
19654
+ var b, i;
19655
+ set25519(p[0], gf0);
19656
+ set25519(p[1], gf1);
19657
+ set25519(p[2], gf1);
19658
+ set25519(p[3], gf0);
19659
+ for (i = 255; i >= 0; --i) {
19660
+ b = (s[(i/8)|0] >> (i&7)) & 1;
19661
+ cswap(p, q, b);
19662
+ add(q, p);
19663
+ add(p, p);
19664
+ cswap(p, q, b);
19665
+ }
19666
+ }
19667
+
19668
+ function scalarbase(p, s) {
19669
+ var q = [gf(), gf(), gf(), gf()];
19670
+ set25519(q[0], X);
19671
+ set25519(q[1], Y);
19672
+ set25519(q[2], gf1);
19673
+ M(q[3], X, Y);
19674
+ scalarmult(p, q, s);
19675
+ }
19676
+
19677
+ function crypto_sign_keypair(pk, sk, seeded) {
19678
+ var d = new Uint8Array(64);
19679
+ var p = [gf(), gf(), gf(), gf()];
19680
+ var i;
19681
+
19682
+ if (!seeded) randombytes(sk, 32);
19683
+ crypto_hash(d, sk, 32);
19684
+ d[0] &= 248;
19685
+ d[31] &= 127;
19686
+ d[31] |= 64;
19687
+
19688
+ scalarbase(p, d);
19689
+ pack(pk, p);
19690
+
19691
+ for (i = 0; i < 32; i++) sk[i+32] = pk[i];
19692
+ return 0;
19693
+ }
19694
+
19695
+ var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]);
19696
+
19697
+ function modL(r, x) {
19698
+ var carry, i, j, k;
19699
+ for (i = 63; i >= 32; --i) {
19700
+ carry = 0;
19701
+ for (j = i - 32, k = i - 12; j < k; ++j) {
19702
+ x[j] += carry - 16 * x[i] * L[j - (i - 32)];
19703
+ carry = Math.floor((x[j] + 128) / 256);
19704
+ x[j] -= carry * 256;
19705
+ }
19706
+ x[j] += carry;
19707
+ x[i] = 0;
19708
+ }
19709
+ carry = 0;
19710
+ for (j = 0; j < 32; j++) {
19711
+ x[j] += carry - (x[31] >> 4) * L[j];
19712
+ carry = x[j] >> 8;
19713
+ x[j] &= 255;
19714
+ }
19715
+ for (j = 0; j < 32; j++) x[j] -= carry * L[j];
19716
+ for (i = 0; i < 32; i++) {
19717
+ x[i+1] += x[i] >> 8;
19718
+ r[i] = x[i] & 255;
19719
+ }
19720
+ }
19721
+
19722
+ function reduce(r) {
19723
+ var x = new Float64Array(64), i;
19724
+ for (i = 0; i < 64; i++) x[i] = r[i];
19725
+ for (i = 0; i < 64; i++) r[i] = 0;
19726
+ modL(r, x);
19727
+ }
19728
+
19729
+ // Note: difference from C - smlen returned, not passed as argument.
19730
+ function crypto_sign(sm, m, n, sk) {
19731
+ var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
19732
+ var i, j, x = new Float64Array(64);
19733
+ var p = [gf(), gf(), gf(), gf()];
19734
+
19735
+ crypto_hash(d, sk, 32);
19736
+ d[0] &= 248;
19737
+ d[31] &= 127;
19738
+ d[31] |= 64;
19739
+
19740
+ var smlen = n + 64;
19741
+ for (i = 0; i < n; i++) sm[64 + i] = m[i];
19742
+ for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
19743
+
19744
+ crypto_hash(r, sm.subarray(32), n+32);
19745
+ reduce(r);
19746
+ scalarbase(p, r);
19747
+ pack(sm, p);
19748
+
19749
+ for (i = 32; i < 64; i++) sm[i] = sk[i];
19750
+ crypto_hash(h, sm, n + 64);
19751
+ reduce(h);
19752
+
19753
+ for (i = 0; i < 64; i++) x[i] = 0;
19754
+ for (i = 0; i < 32; i++) x[i] = r[i];
19755
+ for (i = 0; i < 32; i++) {
19756
+ for (j = 0; j < 32; j++) {
19757
+ x[i+j] += h[i] * d[j];
19758
+ }
19759
+ }
19760
+
19761
+ modL(sm.subarray(32), x);
19762
+ return smlen;
19763
+ }
19764
+
19765
+ function unpackneg(r, p) {
19766
+ var t = gf(), chk = gf(), num = gf(),
19767
+ den = gf(), den2 = gf(), den4 = gf(),
19768
+ den6 = gf();
19769
+
19770
+ set25519(r[2], gf1);
19771
+ unpack25519(r[1], p);
19772
+ S(num, r[1]);
19773
+ M(den, num, D);
19774
+ Z(num, num, r[2]);
19775
+ A(den, r[2], den);
19776
+
19777
+ S(den2, den);
19778
+ S(den4, den2);
19779
+ M(den6, den4, den2);
19780
+ M(t, den6, num);
19781
+ M(t, t, den);
19782
+
19783
+ pow2523(t, t);
19784
+ M(t, t, num);
19785
+ M(t, t, den);
19786
+ M(t, t, den);
19787
+ M(r[0], t, den);
19788
+
19789
+ S(chk, r[0]);
19790
+ M(chk, chk, den);
19791
+ if (neq25519(chk, num)) M(r[0], r[0], I);
19792
+
19793
+ S(chk, r[0]);
19794
+ M(chk, chk, den);
19795
+ if (neq25519(chk, num)) return -1;
19796
+
19797
+ if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
19798
+
19799
+ M(r[3], r[0], r[1]);
19800
+ return 0;
19801
+ }
19802
+
19803
+ function crypto_sign_open(m, sm, n, pk) {
19804
+ var i;
19805
+ var t = new Uint8Array(32), h = new Uint8Array(64);
19806
+ var p = [gf(), gf(), gf(), gf()],
19807
+ q = [gf(), gf(), gf(), gf()];
19808
+
19809
+ if (n < 64) return -1;
19810
+
19811
+ if (unpackneg(q, pk)) return -1;
19812
+
19813
+ for (i = 0; i < n; i++) m[i] = sm[i];
19814
+ for (i = 0; i < 32; i++) m[i+32] = pk[i];
19815
+ crypto_hash(h, m, n);
19816
+ reduce(h);
19817
+ scalarmult(p, q, h);
19818
+
19819
+ scalarbase(q, sm.subarray(32));
19820
+ add(p, q);
19821
+ pack(t, p);
19822
+
19823
+ n -= 64;
19824
+ if (crypto_verify_32(sm, 0, t, 0)) {
19825
+ for (i = 0; i < n; i++) m[i] = 0;
19826
+ return -1;
19827
+ }
19828
+
19829
+ for (i = 0; i < n; i++) m[i] = sm[i + 64];
19830
+ return n;
19831
+ }
19832
+
19833
+ var crypto_secretbox_KEYBYTES = 32,
19834
+ crypto_secretbox_NONCEBYTES = 24,
19835
+ crypto_secretbox_ZEROBYTES = 32,
19836
+ crypto_secretbox_BOXZEROBYTES = 16,
19837
+ crypto_scalarmult_BYTES = 32,
19838
+ crypto_scalarmult_SCALARBYTES = 32,
19839
+ crypto_box_PUBLICKEYBYTES = 32,
19840
+ crypto_box_SECRETKEYBYTES = 32,
19841
+ crypto_box_BEFORENMBYTES = 32,
19842
+ crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
19843
+ crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
19844
+ crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
19845
+ crypto_sign_BYTES = 64,
19846
+ crypto_sign_PUBLICKEYBYTES = 32,
19847
+ crypto_sign_SECRETKEYBYTES = 64,
19848
+ crypto_sign_SEEDBYTES = 32,
19849
+ crypto_hash_BYTES = 64;
19850
+
19851
+ nacl.lowlevel = {
19852
+ crypto_core_hsalsa20: crypto_core_hsalsa20,
19853
+ crypto_stream_xor: crypto_stream_xor,
19854
+ crypto_stream: crypto_stream,
19855
+ crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
19856
+ crypto_stream_salsa20: crypto_stream_salsa20,
19857
+ crypto_onetimeauth: crypto_onetimeauth,
19858
+ crypto_onetimeauth_verify: crypto_onetimeauth_verify,
19859
+ crypto_verify_16: crypto_verify_16,
19860
+ crypto_verify_32: crypto_verify_32,
19861
+ crypto_secretbox: crypto_secretbox,
19862
+ crypto_secretbox_open: crypto_secretbox_open,
19863
+ crypto_scalarmult: crypto_scalarmult,
19864
+ crypto_scalarmult_base: crypto_scalarmult_base,
19865
+ crypto_box_beforenm: crypto_box_beforenm,
19866
+ crypto_box_afternm: crypto_box_afternm,
19867
+ crypto_box: crypto_box,
19868
+ crypto_box_open: crypto_box_open,
19869
+ crypto_box_keypair: crypto_box_keypair,
19870
+ crypto_hash: crypto_hash,
19871
+ crypto_sign: crypto_sign,
19872
+ crypto_sign_keypair: crypto_sign_keypair,
19873
+ crypto_sign_open: crypto_sign_open,
19874
+
19875
+ crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
19876
+ crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
19877
+ crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
19878
+ crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
19879
+ crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
19880
+ crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
19881
+ crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
19882
+ crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
19883
+ crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
19884
+ crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
19885
+ crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
19886
+ crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
19887
+ crypto_sign_BYTES: crypto_sign_BYTES,
19888
+ crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
19889
+ crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
19890
+ crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
19891
+ crypto_hash_BYTES: crypto_hash_BYTES,
19892
+
19893
+ gf: gf,
19894
+ D: D,
19895
+ L: L,
19896
+ pack25519: pack25519,
19897
+ unpack25519: unpack25519,
19898
+ M: M,
19899
+ A: A,
19900
+ S: S,
19901
+ Z: Z,
19902
+ pow2523: pow2523,
19903
+ add: add,
19904
+ set25519: set25519,
19905
+ modL: modL,
19906
+ scalarmult: scalarmult,
19907
+ scalarbase: scalarbase,
19908
+ };
19909
+
19910
+ /* High-level API */
19911
+
19912
+ function checkLengths(k, n) {
19913
+ if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
19914
+ if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
19915
+ }
19916
+
19917
+ function checkBoxLengths(pk, sk) {
19918
+ if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
19919
+ if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
19920
+ }
19921
+
19922
+ function checkArrayTypes() {
19923
+ for (var i = 0; i < arguments.length; i++) {
19924
+ if (!(arguments[i] instanceof Uint8Array))
19925
+ throw new TypeError('unexpected type, use Uint8Array');
19926
+ }
19927
+ }
19928
+
19929
+ function cleanup(arr) {
19930
+ for (var i = 0; i < arr.length; i++) arr[i] = 0;
19931
+ }
19932
+
19933
+ nacl.randomBytes = function(n) {
19934
+ var b = new Uint8Array(n);
19935
+ randombytes(b, n);
19936
+ return b;
19937
+ };
19938
+
19939
+ nacl.secretbox = function(msg, nonce, key) {
19940
+ checkArrayTypes(msg, nonce, key);
19941
+ checkLengths(key, nonce);
19942
+ var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
19943
+ var c = new Uint8Array(m.length);
19944
+ for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
19945
+ crypto_secretbox(c, m, m.length, nonce, key);
19946
+ return c.subarray(crypto_secretbox_BOXZEROBYTES);
19947
+ };
19948
+
19949
+ nacl.secretbox.open = function(box, nonce, key) {
19950
+ checkArrayTypes(box, nonce, key);
19951
+ checkLengths(key, nonce);
19952
+ var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
19953
+ var m = new Uint8Array(c.length);
19954
+ for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
19955
+ if (c.length < 32) return null;
19956
+ if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
19957
+ return m.subarray(crypto_secretbox_ZEROBYTES);
19958
+ };
19959
+
19960
+ nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
19961
+ nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
19962
+ nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
19963
+
19964
+ nacl.scalarMult = function(n, p) {
19965
+ checkArrayTypes(n, p);
19966
+ if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
19967
+ if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
19968
+ var q = new Uint8Array(crypto_scalarmult_BYTES);
19969
+ crypto_scalarmult(q, n, p);
19970
+ return q;
19971
+ };
19972
+
19973
+ nacl.scalarMult.base = function(n) {
19974
+ checkArrayTypes(n);
19975
+ if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
19976
+ var q = new Uint8Array(crypto_scalarmult_BYTES);
19977
+ crypto_scalarmult_base(q, n);
19978
+ return q;
19979
+ };
19980
+
19981
+ nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
19982
+ nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
19983
+
19984
+ nacl.box = function(msg, nonce, publicKey, secretKey) {
19985
+ var k = nacl.box.before(publicKey, secretKey);
19986
+ return nacl.secretbox(msg, nonce, k);
19987
+ };
19988
+
19989
+ nacl.box.before = function(publicKey, secretKey) {
19990
+ checkArrayTypes(publicKey, secretKey);
19991
+ checkBoxLengths(publicKey, secretKey);
19992
+ var k = new Uint8Array(crypto_box_BEFORENMBYTES);
19993
+ crypto_box_beforenm(k, publicKey, secretKey);
19994
+ return k;
19995
+ };
19996
+
19997
+ nacl.box.after = nacl.secretbox;
19998
+
19999
+ nacl.box.open = function(msg, nonce, publicKey, secretKey) {
20000
+ var k = nacl.box.before(publicKey, secretKey);
20001
+ return nacl.secretbox.open(msg, nonce, k);
20002
+ };
20003
+
20004
+ nacl.box.open.after = nacl.secretbox.open;
20005
+
20006
+ nacl.box.keyPair = function() {
20007
+ var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
20008
+ var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
20009
+ crypto_box_keypair(pk, sk);
20010
+ return {publicKey: pk, secretKey: sk};
20011
+ };
20012
+
20013
+ nacl.box.keyPair.fromSecretKey = function(secretKey) {
20014
+ checkArrayTypes(secretKey);
20015
+ if (secretKey.length !== crypto_box_SECRETKEYBYTES)
20016
+ throw new Error('bad secret key size');
20017
+ var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
20018
+ crypto_scalarmult_base(pk, secretKey);
20019
+ return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
20020
+ };
20021
+
20022
+ nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
20023
+ nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
20024
+ nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
20025
+ nacl.box.nonceLength = crypto_box_NONCEBYTES;
20026
+ nacl.box.overheadLength = nacl.secretbox.overheadLength;
20027
+
20028
+ nacl.sign = function(msg, secretKey) {
20029
+ checkArrayTypes(msg, secretKey);
20030
+ if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
20031
+ throw new Error('bad secret key size');
20032
+ var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
20033
+ crypto_sign(signedMsg, msg, msg.length, secretKey);
20034
+ return signedMsg;
20035
+ };
20036
+
20037
+ nacl.sign.open = function(signedMsg, publicKey) {
20038
+ checkArrayTypes(signedMsg, publicKey);
20039
+ if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
20040
+ throw new Error('bad public key size');
20041
+ var tmp = new Uint8Array(signedMsg.length);
20042
+ var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
20043
+ if (mlen < 0) return null;
20044
+ var m = new Uint8Array(mlen);
20045
+ for (var i = 0; i < m.length; i++) m[i] = tmp[i];
20046
+ return m;
20047
+ };
20048
+
20049
+ nacl.sign.detached = function(msg, secretKey) {
20050
+ var signedMsg = nacl.sign(msg, secretKey);
20051
+ var sig = new Uint8Array(crypto_sign_BYTES);
20052
+ for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
20053
+ return sig;
20054
+ };
20055
+
20056
+ nacl.sign.detached.verify = function(msg, sig, publicKey) {
20057
+ checkArrayTypes(msg, sig, publicKey);
20058
+ if (sig.length !== crypto_sign_BYTES)
20059
+ throw new Error('bad signature size');
20060
+ if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
20061
+ throw new Error('bad public key size');
20062
+ var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
20063
+ var m = new Uint8Array(crypto_sign_BYTES + msg.length);
20064
+ var i;
20065
+ for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
20066
+ for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
20067
+ return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
20068
+ };
20069
+
20070
+ nacl.sign.keyPair = function() {
20071
+ var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
20072
+ var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
20073
+ crypto_sign_keypair(pk, sk);
20074
+ return {publicKey: pk, secretKey: sk};
20075
+ };
20076
+
20077
+ nacl.sign.keyPair.fromSecretKey = function(secretKey) {
20078
+ checkArrayTypes(secretKey);
20079
+ if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
20080
+ throw new Error('bad secret key size');
20081
+ var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
20082
+ for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
20083
+ return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
20084
+ };
20085
+
20086
+ nacl.sign.keyPair.fromSeed = function(seed) {
20087
+ checkArrayTypes(seed);
20088
+ if (seed.length !== crypto_sign_SEEDBYTES)
20089
+ throw new Error('bad seed size');
20090
+ var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
20091
+ var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
20092
+ for (var i = 0; i < 32; i++) sk[i] = seed[i];
20093
+ crypto_sign_keypair(pk, sk, true);
20094
+ return {publicKey: pk, secretKey: sk};
20095
+ };
20096
+
20097
+ nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
20098
+ nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
20099
+ nacl.sign.seedLength = crypto_sign_SEEDBYTES;
20100
+ nacl.sign.signatureLength = crypto_sign_BYTES;
20101
+
20102
+ nacl.hash = function(msg) {
20103
+ checkArrayTypes(msg);
20104
+ var h = new Uint8Array(crypto_hash_BYTES);
20105
+ crypto_hash(h, msg, msg.length);
20106
+ return h;
20107
+ };
20108
+
20109
+ nacl.hash.hashLength = crypto_hash_BYTES;
20110
+
20111
+ nacl.verify = function(x, y) {
20112
+ checkArrayTypes(x, y);
20113
+ // Zero length arguments are considered not equal.
20114
+ if (x.length === 0 || y.length === 0) return false;
20115
+ if (x.length !== y.length) return false;
20116
+ return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
20117
+ };
20118
+
20119
+ nacl.setPRNG = function(fn) {
20120
+ randombytes = fn;
20121
+ };
20122
+
20123
+ (function() {
20124
+ // Initialize PRNG if environment provides CSPRNG.
20125
+ // If not, methods calling randombytes will throw.
20126
+ var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
20127
+ if (crypto && crypto.getRandomValues) {
20128
+ // Browsers.
20129
+ var QUOTA = 65536;
20130
+ nacl.setPRNG(function(x, n) {
20131
+ var i, v = new Uint8Array(n);
20132
+ for (i = 0; i < n; i += QUOTA) {
20133
+ crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
20134
+ }
20135
+ for (i = 0; i < n; i++) x[i] = v[i];
20136
+ cleanup(v);
20137
+ });
20138
+ } else if (typeof commonjsRequire !== 'undefined') {
20139
+ // Node.js.
20140
+ crypto = require$$0;
20141
+ if (crypto && crypto.randomBytes) {
20142
+ nacl.setPRNG(function(x, n) {
20143
+ var i, v = crypto.randomBytes(n);
20144
+ for (i = 0; i < n; i++) x[i] = v[i];
20145
+ cleanup(v);
20146
+ });
20147
+ }
20148
+ }
20149
+ })();
20150
+
20151
+ })(module.exports ? module.exports : (self.nacl = self.nacl || {}));
20152
+ } (naclFast));
20153
+ return naclFast.exports;
20154
+ }
20155
+
20156
+ var naclFastExports = requireNaclFast();
20157
+ var nacl = /*@__PURE__*/getDefaultExportFromCjs$1(naclFastExports);
20158
+
17698
20159
  // guest-keystore.ts — durable per-device keypair for anonymous ("guest") auth.
17699
20160
  //
17700
20161
  // A guest is an ed25519 keypair generated on the device. Its public key is the
@@ -17765,7 +20226,7 @@ async function tryWebCrypto() {
17765
20226
  await idbPut(db, IDB_KEY, pair); // CryptoKey is structured-cloneable; bytes never exposed
17766
20227
  }
17767
20228
  const raw = new Uint8Array(await s.exportKey('raw', pair.publicKey)); // public is exportable
17768
- const address = base58.encode(raw);
20229
+ const address = bs582.encode(raw);
17769
20230
  return {
17770
20231
  address,
17771
20232
  nonExtractable: true,
@@ -17786,12 +20247,12 @@ function fallbackKey() {
17786
20247
  let secret;
17787
20248
  const saved = store.getItem(FALLBACK_STORE_KEY);
17788
20249
  if (saved) {
17789
- secret = base58.decode(saved);
20250
+ secret = bs582.decode(saved);
17790
20251
  }
17791
20252
  else {
17792
20253
  const kp = Keypair.generate();
17793
20254
  secret = kp.secretKey; // 64 bytes
17794
- store.setItem(FALLBACK_STORE_KEY, base58.encode(secret));
20255
+ store.setItem(FALLBACK_STORE_KEY, bs582.encode(secret));
17795
20256
  }
17796
20257
  const kp = Keypair.fromSecretKey(secret);
17797
20258
  const address = kp.publicKey.toBase58();
@@ -19279,7 +21740,7 @@ async function loadDependencies() {
19279
21740
  const [reactModule, reactDomModule, phantomModule] = await Promise.all([
19280
21741
  import('react'),
19281
21742
  import('react-dom/client'),
19282
- import('./index-B2ytfYTB.esm.js')
21743
+ import('./index-DJg-Dduo.esm.js')
19283
21744
  ]);
19284
21745
  // Extract default export from ESM module namespace
19285
21746
  // Dynamic import() returns { default: Module, ...exports }, not the module directly
@@ -21180,7 +23641,7 @@ async function registerMobileWalletAdapter(config) {
21180
23641
  if (typeof window === 'undefined')
21181
23642
  return;
21182
23643
  try {
21183
- const walletStandardMobile = await import('./index.browser-D2xm-q6N.esm.js');
23644
+ const walletStandardMobile = await import('./index.browser-pymH6o1X.esm.js');
21184
23645
  const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
21185
23646
  if (!registerMwa) {
21186
23647
  console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
@@ -21319,7 +23780,7 @@ class SolanaMobileWalletProvider {
21319
23780
  async ensureWallet() {
21320
23781
  if (this.wallet)
21321
23782
  return this.wallet;
21322
- const mod = await import('./index.browser-D2xm-q6N.esm.js');
23783
+ const mod = await import('./index.browser-pymH6o1X.esm.js');
21323
23784
  const chain = mapChainToWalletStandard(this.cluster);
21324
23785
  this.wallet = new mod.LocalSolanaMobileWalletAdapterWallet({
21325
23786
  appIdentity: this.appIdentity,
@@ -21937,7 +24398,7 @@ class SolanaMobileWalletProvider {
21937
24398
  options: { commitment: 'confirmed' },
21938
24399
  }));
21939
24400
  const { signature: sigBytes } = sendResult;
21940
- const signature = base58.encode(sigBytes);
24401
+ const signature = bs582.encode(sigBytes);
21941
24402
  await confirmAndCheckTransaction(connection, signature);
21942
24403
  return signature;
21943
24404
  }
@@ -22085,7 +24546,7 @@ class SolanaMobileWalletProvider {
22085
24546
  throw new Error('MWA returned no signature');
22086
24547
  }
22087
24548
  const { signature: sigBytes } = sendResult;
22088
- const signature = base58.encode(sigBytes);
24549
+ const signature = bs582.encode(sigBytes);
22089
24550
  const txInfo = await confirmAndCheckTransaction(connection, signature);
22090
24551
  return {
22091
24552
  transactionSignature: signature,
@@ -22922,7 +25383,7 @@ class PrivyWalletProvider {
22922
25383
  // Handle case where signature might be bytes instead of string
22923
25384
  const rawSig = result.signature;
22924
25385
  if (rawSig instanceof Uint8Array || Array.isArray(rawSig)) {
22925
- signature = base58.encode(rawSig instanceof Uint8Array ? rawSig : new Uint8Array(rawSig));
25386
+ signature = bs582.encode(rawSig instanceof Uint8Array ? rawSig : new Uint8Array(rawSig));
22926
25387
  }
22927
25388
  else {
22928
25389
  signature = rawSig;
@@ -23284,7 +25745,7 @@ class PrivyExpoProvider {
23284
25745
  const wallet = await this.getWalletOrThrow();
23285
25746
  const messageBytes = getPlatform().textEncode(message);
23286
25747
  const result = await wallet.signMessage(messageBytes);
23287
- return base58.encode(result.signature);
25748
+ return bs582.encode(result.signature);
23288
25749
  }
23289
25750
  async signTransaction(transaction) {
23290
25751
  await this.ensureReady();
@@ -23452,5 +25913,5 @@ class PrivyExpoProvider {
23452
25913
  }
23453
25914
  }
23454
25915
 
23455
- export { EFFECT_INTENT_ADDRESS as $, getFiles as A, search as B, queryAggregate as C, runQuery as D, runQueryMany as E, runExpression as F, runExpressionMany as G, signMessage as H, signTransaction as I, signAndSubmitTransaction as J, count as K, aggregate as L, subscribe as M, useAuth as N, deserializeTransaction as O, getIdToken as P, setPlatform as Q, getPlatform as R, PhantomWalletProvider as S, MockAuthProvider as T, DEFAULT_TEST_ADDRESS as U, OffchainAuthProvider as V, SolanaMobileWalletProvider as W, isMobileWalletAvailable as X, registerMobileWalletAdapter as Y, PrivyWalletProvider as Z, PrivyExpoProvider as _, base58 as a, FunctionInvokeError as a0, InsufficientBalanceError as a1, LiveIntentError as a2, ReactNativeSessionManager as a3, RealtimeStore as a4, ServerSessionManager as a5, WebSessionManager as a6, buildSetDocumentsTransaction as a7, clearCache as a8, closeAllSubscriptions as a9, wsDelete as aA, wsGet as aB, wsGetMany as aC, wsQuery as aD, wsSet as aE, convertRemainingAccounts as aa, createSessionWithSignature as ab, defineLiveModule as ac, deriveUserIdentityFromIdToken as ad, functions as ae, genAuthNonce as af, genSolanaMessage as ag, getActiveSessionManager as ah, getCachedData as ai, getMany as aj, getRealtimeStore as ak, getWebhookKeysUrl as al, hasActiveConnection as am, increment as an, invoke as ao, isEffectResult as ap, live as aq, intent as ar, reconnectWithNewAuth as as, refreshSession as at, resetRealtimeStore as au, revokeSession as av, serverTimestamp as aw, signSessionCreateMessage as ax, subscribeView as ay, withEffects as az, bufferExports as b, getCurrentUser as c, onAuthLoadingChanged as d, getAuthLoading as e, logout as f, getDefaultExportFromCjs$1 as g, getConfig as h, init as i, getAuthProvider as j, sendEmailOtp as k, login as l, linkEmail as m, loginWithPrivy as n, onAuthStateChanged as o, loginWithRedirect as p, linkWithRedirect as q, completeLoginFromRedirect as r, signInAnonymously as s, loginWithPopup as t, completeLoginInPopup as u, verifyEmailOtp as v, get as w, set as x, setMany as y, setFile as z };
23456
- //# sourceMappingURL=index-D986s6w7.esm.js.map
25916
+ export { EFFECT_INTENT_ADDRESS as $, getFiles as A, search as B, queryAggregate as C, runQuery as D, runQueryMany as E, runExpression as F, runExpressionMany as G, signMessage as H, signTransaction as I, signAndSubmitTransaction as J, count as K, aggregate as L, subscribe as M, useAuth as N, deserializeTransaction as O, getIdToken as P, setPlatform as Q, getPlatform as R, PhantomWalletProvider as S, MockAuthProvider as T, DEFAULT_TEST_ADDRESS as U, OffchainAuthProvider as V, SolanaMobileWalletProvider as W, isMobileWalletAvailable as X, registerMobileWalletAdapter as Y, PrivyWalletProvider as Z, PrivyExpoProvider as _, bs582 as a, FunctionInvokeError as a0, InsufficientBalanceError as a1, LiveIntentError as a2, ReactNativeSessionManager as a3, RealtimeStore as a4, ServerSessionManager as a5, WebSessionManager as a6, buildSetDocumentsTransaction as a7, clearCache as a8, closeAllSubscriptions as a9, withEffects as aA, wsDelete as aB, wsGet as aC, wsGetMany as aD, wsQuery as aE, wsSet as aF, convertRemainingAccounts as aa, createSessionWithSignature as ab, defineLiveModule as ac, deriveUserIdentityFromIdToken as ad, functions as ae, genAuthNonce as af, genSolanaMessage as ag, getActiveSessionManager as ah, getCachedData as ai, getMany as aj, getRealtimeStore as ak, getWebhookKeysUrl as al, hasActiveConnection as am, increment as an, invoke as ao, isEffectResult as ap, live as aq, intent as ar, status as as, reconnectWithNewAuth as at, refreshSession as au, resetRealtimeStore as av, revokeSession as aw, serverTimestamp as ax, signSessionCreateMessage as ay, subscribeView as az, bufferExports as b, getCurrentUser as c, onAuthLoadingChanged as d, getAuthLoading as e, logout as f, getDefaultExportFromCjs$1 as g, getConfig as h, init as i, getAuthProvider as j, sendEmailOtp as k, login as l, linkEmail as m, loginWithPrivy as n, onAuthStateChanged as o, loginWithRedirect as p, linkWithRedirect as q, completeLoginFromRedirect as r, signInAnonymously as s, loginWithPopup as t, completeLoginInPopup as u, verifyEmailOtp as v, get as w, set as x, setMany as y, setFile as z };
25917
+ //# sourceMappingURL=index-DyfiK3_X.esm.js.map