@glassly/engine 0.3.2-dev.583 → 0.3.2-dev.595

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 (70) hide show
  1. package/build/engine.d.ts +14 -0
  2. package/build/engine.d.ts.map +1 -1
  3. package/build/engine.js +4 -0
  4. package/build/engine.js.map +1 -1
  5. package/build/facades/glasses.d.ts +20 -0
  6. package/build/facades/glasses.d.ts.map +1 -1
  7. package/build/facades/glasses.js +21 -0
  8. package/build/facades/glasses.js.map +1 -1
  9. package/build/facades/pairing.js +1 -1
  10. package/build/facades/pairing.js.map +1 -1
  11. package/build/generated/releaseMetadata.js +3 -3
  12. package/build/generated/releaseMetadata.js.map +1 -1
  13. package/build/index.d.ts +2 -0
  14. package/build/index.d.ts.map +1 -1
  15. package/build/index.js +2 -0
  16. package/build/index.js.map +1 -1
  17. package/build/services/DeviceEventRouter.d.ts.map +1 -1
  18. package/build/services/DeviceEventRouter.js +5 -0
  19. package/build/services/DeviceEventRouter.js.map +1 -1
  20. package/build/services/GestureDotsService.d.ts +5 -2
  21. package/build/services/GestureDotsService.d.ts.map +1 -1
  22. package/build/services/GestureDotsService.js +28 -14
  23. package/build/services/GestureDotsService.js.map +1 -1
  24. package/build/services/GlassesTouchInput.d.ts +1 -1
  25. package/build/services/GlassesTouchInput.d.ts.map +1 -1
  26. package/build/services/GlassesTouchInput.js +7 -4
  27. package/build/services/GlassesTouchInput.js.map +1 -1
  28. package/build/services/gestureDotGlyphs.d.ts +1 -1
  29. package/build/services/gestureDotGlyphs.d.ts.map +1 -1
  30. package/build/services/gestureDotGlyphs.js +5 -0
  31. package/build/services/gestureDotGlyphs.js.map +1 -1
  32. package/build/services/neuralBand/MetaAuth.d.ts +31 -0
  33. package/build/services/neuralBand/MetaAuth.d.ts.map +1 -0
  34. package/build/services/neuralBand/MetaAuth.js +161 -0
  35. package/build/services/neuralBand/MetaAuth.js.map +1 -0
  36. package/build/services/neuralBand/NeuralBandInput.d.ts +50 -0
  37. package/build/services/neuralBand/NeuralBandInput.d.ts.map +1 -0
  38. package/build/services/neuralBand/NeuralBandInput.js +114 -0
  39. package/build/services/neuralBand/NeuralBandInput.js.map +1 -0
  40. package/build/services/neuralBand/NeuralBandSettingsSync.d.ts +3 -0
  41. package/build/services/neuralBand/NeuralBandSettingsSync.d.ts.map +1 -0
  42. package/build/services/neuralBand/NeuralBandSettingsSync.js +52 -0
  43. package/build/services/neuralBand/NeuralBandSettingsSync.js.map +1 -0
  44. package/build/services/neuralBand/sha256.d.ts +7 -0
  45. package/build/services/neuralBand/sha256.d.ts.map +1 -0
  46. package/build/services/neuralBand/sha256.js +68 -0
  47. package/build/services/neuralBand/sha256.js.map +1 -0
  48. package/build/stores/settings.d.ts.map +1 -1
  49. package/build/stores/settings.js +18 -0
  50. package/build/stores/settings.js.map +1 -1
  51. package/build/types/enums.d.ts +2 -1
  52. package/build/types/enums.d.ts.map +1 -1
  53. package/build/types/enums.js +1 -0
  54. package/build/types/enums.js.map +1 -1
  55. package/package.json +7 -7
  56. package/src/engine.ts +4 -0
  57. package/src/facades/glasses.ts +27 -0
  58. package/src/facades/pairing.ts +1 -1
  59. package/src/generated/releaseMetadata.ts +3 -3
  60. package/src/index.ts +14 -0
  61. package/src/services/DeviceEventRouter.ts +5 -0
  62. package/src/services/GestureDotsService.ts +28 -15
  63. package/src/services/GlassesTouchInput.ts +13 -5
  64. package/src/services/gestureDotGlyphs.ts +6 -1
  65. package/src/services/neuralBand/MetaAuth.ts +192 -0
  66. package/src/services/neuralBand/NeuralBandInput.ts +148 -0
  67. package/src/services/neuralBand/NeuralBandSettingsSync.ts +63 -0
  68. package/src/services/neuralBand/sha256.ts +70 -0
  69. package/src/stores/settings.ts +18 -0
  70. package/src/types/enums.ts +1 -0
@@ -0,0 +1,70 @@
1
+ /**
2
+ * SHA-256 over a UTF-8 string, hex encoded. The Meta sign-in callback carries the
3
+ * first 16 hex digits of the request token's digest; nothing else here needs a
4
+ * hash, and the app ships no crypto dependency, so this stays small and local.
5
+ */
6
+
7
+ const K = new Uint32Array([
8
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98,
9
+ 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
10
+ 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8,
11
+ 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
12
+ 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,
13
+ 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
14
+ 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7,
15
+ 0xc67178f2,
16
+ ])
17
+
18
+ function rotr(x: number, n: number): number {
19
+ return (x >>> n) | (x << (32 - n))
20
+ }
21
+
22
+ export function sha256Hex(text: string): string {
23
+ const bytes = new TextEncoder().encode(text)
24
+ const bitLength = bytes.length * 8
25
+ const padded = new Uint8Array(Math.ceil((bytes.length + 9) / 64) * 64)
26
+ padded.set(bytes)
27
+ padded[bytes.length] = 0x80
28
+ const view = new DataView(padded.buffer)
29
+ view.setUint32(padded.length - 8, Math.floor(bitLength / 0x100000000))
30
+ view.setUint32(padded.length - 4, bitLength >>> 0)
31
+
32
+ const h = new Uint32Array([
33
+ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
34
+ ])
35
+ const w = new Uint32Array(64)
36
+ for (let offset = 0; offset < padded.length; offset += 64) {
37
+ for (let i = 0; i < 16; i++) w[i] = view.getUint32(offset + i * 4)
38
+ for (let i = 16; i < 64; i++) {
39
+ const s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ (w[i - 15] >>> 3)
40
+ const s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ (w[i - 2] >>> 10)
41
+ w[i] = (w[i - 16] + s0 + w[i - 7] + s1) >>> 0
42
+ }
43
+ let [a, b, c, d, e, f, g, hh] = h
44
+ for (let i = 0; i < 64; i++) {
45
+ const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25)
46
+ const ch = (e & f) ^ (~e & g)
47
+ const t1 = (hh + s1 + ch + K[i] + w[i]) >>> 0
48
+ const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)
49
+ const maj = (a & b) ^ (a & c) ^ (b & c)
50
+ const t2 = (s0 + maj) >>> 0
51
+ hh = g
52
+ g = f
53
+ f = e
54
+ e = (d + t1) >>> 0
55
+ d = c
56
+ c = b
57
+ b = a
58
+ a = (t1 + t2) >>> 0
59
+ }
60
+ h[0] = (h[0] + a) >>> 0
61
+ h[1] = (h[1] + b) >>> 0
62
+ h[2] = (h[2] + c) >>> 0
63
+ h[3] = (h[3] + d) >>> 0
64
+ h[4] = (h[4] + e) >>> 0
65
+ h[5] = (h[5] + f) >>> 0
66
+ h[6] = (h[6] + g) >>> 0
67
+ h[7] = (h[7] + hh) >>> 0
68
+ }
69
+ return Array.from(h, (word) => word.toString(16).padStart(8, "0")).join("")
70
+ }
@@ -755,6 +755,24 @@ export const SETTINGS: Record<string, Setting> = {
755
755
  saveOnServer: false,
756
756
  persist: true,
757
757
  },
758
+ // Meta Neural Band: the air mouse streams the band's orientation at 128 Hz, so it
759
+ // stays off unless asked for. The band side is pushed when the band connects.
760
+ neural_band_air_mouse: {
761
+ key: "neural_band_air_mouse",
762
+ defaultValue: () => false,
763
+ writable: true,
764
+ saveOnServer: false,
765
+ persist: true,
766
+ },
767
+ // Which wrist wears the band: flips the air mouse's forearm axis and is written
768
+ // to the band's own hand setting on connect.
769
+ neural_band_hand: {
770
+ key: "neural_band_hand",
771
+ defaultValue: () => "right",
772
+ writable: true,
773
+ saveOnServer: false,
774
+ persist: true,
775
+ },
758
776
  // Maximum rate at which display updates leave the phone for the glasses.
759
777
  // The Bluetooth SDK paces every scene frame and legacy layout to this,
760
778
  // coalescing faster updates last-wins; clears bypass it. No effect on G2
@@ -17,4 +17,5 @@ export enum DeviceTypes {
17
17
 
18
18
  export enum ControllerTypes {
19
19
  R1 = "Even Realities R1",
20
+ NEURAL_BAND = "Meta Neural Band",
20
21
  }