Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README updated #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)