From e464ea280c362f9485abf14408d4e30bf6215d16 Mon Sep 17 00:00:00 2001 From: Thibaut Date: Tue, 24 Aug 2021 16:57:56 +0200 Subject: [PATCH] README updated --- README.md | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3ef2278..7d54fb7 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,34 @@ cordova plugin add polyfill-crypto ## How to use it? +The `available` function can indicates if the `crypto` plugin is +available in your current execution state, it's recommended to call it +before trying to use any other function of that library in your app. + +Several function takes an `uint_array` value as argument, it's an array +of type `Uint8Array` that you can obtain in this library with the +`Polyfill_crypto.new_array` function that will return an array of length +"len" that you can use in other functions. + ### `Polyfill_crypto.get_random_values` binding to -[polyfill-crypto.getrandomvalues](https://github.com/kumavis/polyfill-crypto.getrandomvalues) +[? polyfill-crypto.getrandomvalues ?](https://github.com/kumavis/polyfill-crypto.getrandomvalues) + +This function takes an `uint_array` value as argument, it will fill the +array with random values. + +### `Polyfill_crypto.set` + +This function takes 2 arguments: *i* and *x*: it will replace *i*-th +value of the `uint_array` given in parameter by the value *x*. + +### `Polyfill_crypto.string_of_array` -[TODO] +This function is binding to the +[Js_of_ocaml.Typed_array.String.of_arrayBuffer](https://ocsigen.org/js_of_ocaml/3.1.0/api/Typed_array.String). It +takes an `uint_array` value as argument (that can be obtain with the +`Polyfill_crypto.buffer` function). This function return an `arrayBuffer +Js.t` value from the *Js_of_ocaml* library. +[Learn more about +Js_of_ocaml](https://ocsigen.org/js_of_ocaml/latest/manual/overview)