Skip to content

Commit

Permalink
docs(init-data-node): add web crypto api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
heyqbnk committed Jun 18, 2024
1 parent 34bd9dc commit 2f860d3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions apps/docs/packages/tma-js-init-data-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,16 @@ This function accepts three arguments:
- **Signing date**: This value will be used as the value of the `authDate` property.

As a result, the function returns signed init data.

## Web Crypto API

If this package is used in an environment other than Node.js, a developer can use the `web`
subdirectory, which exports the same methods as described above but returns promises.

```ts
import { validate, sign, signData } from '@tma.js/init-data-node/web';

await validate(...);
await sign(...);
await signData(...);
```

0 comments on commit 2f860d3

Please sign in to comment.