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

docs: add pre-auth readme #277

Merged
merged 1 commit into from
Nov 18, 2024
Merged
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
30 changes: 22 additions & 8 deletions packages/dapp-toolkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ Use our [CLI tool](https://github.com/radixdlt/create-radix-dapp) to scaffold a
npx create-radix-dapp@latest
```

## Using `create-radix-dapp`

You can easily start experimenting with Radix dApp Toolkit and various frameworks by using our [CLI tool](https://github.com/radixdlt/create-radix-dapp) to scaffold a new project. Just paste following command into your terminal and it will walk you through all required steps!

```bash
npx create-radix-dapp@latest
```

# Usage

## Getting started
Expand Down Expand Up @@ -492,6 +484,28 @@ const transactionIntentHash = result.value.transactionIntentHash

</details>

## Preauthorization Requests

It is very similar to a transaction request, but it describes only a part of a final transaction – specifically the part that the user cares about, such as a swap they wish to perform within certain acceptable bounds. The pre-authorization is signed and returned to the dApp, which can then include it in a full transaction. A time bound is put on the pre-authorization, so the user knows for how long their pre-authorization is usable.

Creation of preauthorization request object is abstracted away into `SubintentRequestBuilder`. You can set exipration date in two modes:
- delay in **seconds after preauthorization is signed** by using `.setExpiration('afterDelay', 3600)`
- provided **exact unix timestamp** to function call `.setExpiration('atTime', 1234567890)`

**Example:**
```typescript
const result = await dAppToolkit.walletApi.sendPreAuthorizationRequest(
SubintentRequestBuilder()
.manifest(subintentManifest)
.setExpiration(
'afterDelay',
3600,
)
// .addBlobs('blob1', 'blob2')
.message('This is a message')
)
```

# ROLA (Radix Off-Ledger Authentication)

ROLA is method of authenticating something claimed by the user connected to your dApp with the Radix Wallet. It uses the capabilities of the Radix Network to make this possible in a way that is decentralized and flexible for the user.
Expand Down