Skip to content

Commit

Permalink
FIX docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pubkey committed Nov 21, 2024
1 parent ebdebc4 commit 568268f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs-src/docs/rx-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const db2 = await createRxDatabase({

### hashFunction

By default, RxDB will use `crypto.subtle.digest('SHA-256', data)` for hashing. If you need a different hash function or the `crypto.subtle` API is not supported in your JavaScript runtime, you can provide an own hash function instead. A hash function gets a string as inpput and returns a `Promise` that resolves a string.
By default, RxDB will use `crypto.subtle.digest('SHA-256', data)` for hashing. If you need a different hash function or the `crypto.subtle` API is not supported in your JavaScript runtime, you can provide an own hash function instead. A hash function gets a string as input and returns a `Promise` that resolves a string.

```ts
// example hash function that runs in plain JavaScript
Expand All @@ -120,6 +120,7 @@ const db = await createRxDatabase({
});
```

If you get the error message `TypeError: Cannot read properties of undefined (reading 'digest')` this likely means that you are neither running on `localhost` nor on `https` which is why your browser might not allow access to `crypto.subtle.digest`.

## Methods

Expand Down

0 comments on commit 568268f

Please sign in to comment.