@layers/amba-core 4.0.10 → 4.0.11

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.
@@ -1,6 +1,7 @@
1
1
  // ---- Hermes polyfills (injected by build-rn.mjs) ----
2
- // Hermes lacks TextDecoder and globalThis.crypto. Without these, the
3
- // wasm-bindgen glue throws at module-init. See DX-13 / DX-14.
2
+ // Hermes lacks TextDecoder, which the wasm-bindgen glue needs at
3
+ // module-init. Random bytes come from the app's own secure
4
+ // globalThis.crypto through __ambaGetRandomValues below. See DX-13 / DX-14.
4
5
  (function() {
5
6
  var g = typeof globalThis !== 'undefined' ? globalThis : (typeof global !== 'undefined' ? global : this);
6
7
  if (typeof g.TextDecoder === 'undefined') {
@@ -43,25 +44,25 @@
43
44
  return out;
44
45
  };
45
46
  }
46
- if (typeof g.crypto === 'undefined' || typeof g.crypto.getRandomValues !== 'function') {
47
- var warned = false;
48
- g.crypto = g.crypto || {};
49
- g.crypto.getRandomValues = function getRandomValues(arr) {
50
- if (!warned) {
51
- warned = true;
52
- if (typeof console !== 'undefined' && console.warn) {
53
- console.warn(
54
- '[@layers/amba-core] Using Math.random fallback for crypto.getRandomValues — ' +
55
- 'install `react-native-get-random-values` and import it before @layers/amba-react-native ' +
56
- 'for cryptographically secure random bytes. See DX-13.'
57
- );
58
- }
59
- }
60
- for (var i = 0; i < arr.length; i++) arr[i] = (Math.random() * 256) | 0;
61
- return arr;
62
- };
63
- }
64
47
  })();
48
+ // Module-private random source for the glue (see build-rn.mjs). Reads the
49
+ // app's secure implementation at call time; never writes to globalThis.
50
+ var __ambaRandomSourceReported = false;
51
+ function __ambaGetRandomValues(arr) {
52
+ var g = typeof globalThis !== 'undefined' ? globalThis : (typeof global !== 'undefined' ? global : this);
53
+ var c = g && g.crypto;
54
+ if (c && typeof c.getRandomValues === 'function') {
55
+ return c.getRandomValues(arr);
56
+ }
57
+ var message =
58
+ '[@layers/amba-core] No secure random source: globalThis.crypto.getRandomValues is missing. ' +
59
+ 'Install react-native-get-random-values and import it once at app startup, before any Amba import.';
60
+ if (!__ambaRandomSourceReported && typeof console !== 'undefined' && console.error) {
61
+ __ambaRandomSourceReported = true;
62
+ console.error(message);
63
+ }
64
+ throw new Error(message);
65
+ }
65
66
  // ---- end Hermes polyfills ----
66
67
 
67
68
  /**
@@ -1754,7 +1755,7 @@ export function __wbg_call_faa0a261f288f846() { return handleError(function (arg
1754
1755
  return addHeapObject(ret);
1755
1756
  }, arguments); }
1756
1757
  export function __wbg_getRandomValues_ef12552bf5acd2fe() { return handleError(function (arg0, arg1) {
1757
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1758
+ __ambaGetRandomValues(getArrayU8FromWasm0(arg0, arg1));
1758
1759
  }, arguments); }
1759
1760
  export function __wbg_getTime_09f1dd40a44edb30(arg0) {
1760
1761
  const ret = getObject(arg0).getTime();
@@ -1803,7 +1804,7 @@ export function __wbg_new_typed_c072c4ce9a2a0cdf(arg0, arg1) {
1803
1804
  const a = state0.a;
1804
1805
  state0.a = 0;
1805
1806
  try {
1806
- return __wasm_bindgen_func_elem_3293_145(a, state0.b, arg0, arg1);
1807
+ return __wasm_bindgen_func_elem_3288_145(a, state0.b, arg0, arg1);
1807
1808
  } finally {
1808
1809
  state0.a = a;
1809
1810
  }
@@ -1874,13 +1875,13 @@ export function __wbg_then_bd927500e8905df2(arg0, arg1, arg2) {
1874
1875
  return addHeapObject(ret);
1875
1876
  }
1876
1877
  export function __wbindgen_cast_0000000000000001(arg0, arg1) {
1877
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref, Externref], shim_idx: 829, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1878
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3293);
1878
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref, Externref], shim_idx: 823, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1879
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3288);
1879
1880
  return addHeapObject(ret);
1880
1881
  }
1881
1882
  export function __wbindgen_cast_0000000000000002(arg0, arg1) {
1882
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 827, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1883
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3291);
1883
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 821, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
1884
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3286);
1884
1885
  return addHeapObject(ret);
1885
1886
  }
1886
1887
  export function __wbindgen_cast_0000000000000003(arg0) {
@@ -1910,14 +1911,14 @@ export function __wbindgen_object_clone_ref(arg0) {
1910
1911
  export function __wbindgen_object_drop_ref(arg0) {
1911
1912
  takeObject(arg0);
1912
1913
  }
1913
- function __wasm_bindgen_func_elem_3293(arg0, arg1, arg2, arg3) {
1914
- wasm.__wasm_bindgen_func_elem_3293(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1914
+ function __wasm_bindgen_func_elem_3288(arg0, arg1, arg2, arg3) {
1915
+ wasm.__wasm_bindgen_func_elem_3288(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1915
1916
  }
1916
1917
 
1917
- function __wasm_bindgen_func_elem_3291(arg0, arg1, arg2) {
1918
+ function __wasm_bindgen_func_elem_3286(arg0, arg1, arg2) {
1918
1919
  try {
1919
1920
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1920
- wasm.__wasm_bindgen_func_elem_3291(retptr, arg0, arg1, addHeapObject(arg2));
1921
+ wasm.__wasm_bindgen_func_elem_3286(retptr, arg0, arg1, addHeapObject(arg2));
1921
1922
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1922
1923
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1923
1924
  if (r1) {
@@ -1928,8 +1929,8 @@ function __wasm_bindgen_func_elem_3291(arg0, arg1, arg2) {
1928
1929
  }
1929
1930
  }
1930
1931
 
1931
- function __wasm_bindgen_func_elem_3293_145(arg0, arg1, arg2, arg3) {
1932
- wasm.__wasm_bindgen_func_elem_3293_145(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1932
+ function __wasm_bindgen_func_elem_3288_145(arg0, arg1, arg2, arg3) {
1933
+ wasm.__wasm_bindgen_func_elem_3288_145(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
1933
1934
  }
1934
1935
 
1935
1936
  const AmbaCoreWasmFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -145,9 +145,9 @@ export const ambacorewasm_verifySmsOtp: (a: number, b: number, c: number, d: num
145
145
  export const ambacorewasm_xpClaim: (a: number, b: number, c: number) => number;
146
146
  export const ambacorewasm_xpGetBalance: (a: number) => number;
147
147
  export const ambacorewasm_xpGetHistory: (a: number, b: number) => number;
148
- export const __wasm_bindgen_func_elem_3293: (a: number, b: number, c: number, d: number) => void;
149
- export const __wasm_bindgen_func_elem_3291: (a: number, b: number, c: number, d: number) => void;
150
- export const __wasm_bindgen_func_elem_3293_145: (a: number, b: number, c: number, d: number) => void;
148
+ export const __wasm_bindgen_func_elem_3288: (a: number, b: number, c: number, d: number) => void;
149
+ export const __wasm_bindgen_func_elem_3286: (a: number, b: number, c: number, d: number) => void;
150
+ export const __wasm_bindgen_func_elem_3288_145: (a: number, b: number, c: number, d: number) => void;
151
151
  export const __wbindgen_export: (a: number, b: number) => number;
152
152
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
153
153
  export const __wbindgen_export3: (a: number) => void;