MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / getRandomValues

Method getRandomValues

packages/core/wgc/crypto/index.ts:19–35  ·  view source on GitHub ↗
(typedArray: Exclude<TypedArray, Float32Array | Float64Array>)

Source from the content-addressed store, hash-verified

17 }
18
19 getRandomValues(typedArray: Exclude<TypedArray, Float32Array | Float64Array>) {
20 if (__ANDROID__) {
21 if (typedArray.BYTES_PER_ELEMENT !== 1) {
22 typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset);
23 }
24 (<any>org).nativescript.winter_tc.Crypto.getRandomValues(typedArray);
25 }
26 if (__IOS__) {
27 if (typedArray.BYTES_PER_ELEMENT !== 1) {
28 typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
29 }
30 const data = NSMutableData.dataWithBytesNoCopyLength(typedArray as never, typedArray.byteLength);
31
32 NSCCrypto.getRandomValues(data);
33 }
34 return typedArray;
35 }
36}

Callers 1

runFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected