Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## 30.3.0

* Added: `account` passkey methods `listPasskeys`, `createPasskey`, `getPasskey`, `updatePasskey`, `deletePasskey` and `updatePasskeyVerification`
* Added: `account.createPasskeyToken` and `account.updatePasskeyToken` for passkey sign-in
* Added: `users.listPasskeys`, `users.getPasskey`, `users.updatePasskey` and `users.deletePasskey`
* Added: `project.updatePasskeyPolicy` to configure passkey sign-in
* Added: `Passkey`, `PasskeyList`, `PasskeyChallenge` and `TokenSecret` models

## 30.2.2

* Fixed: a response model fills a missing field from its spec default instead of throwing `Missing required field`, so the SDK reads responses from servers that predate the field, such as `File.folder` and `File.key` from Appwrite 1.x
Expand Down
103 changes: 103 additions & 0 deletions docs/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,88 @@ PATCH https://cloud.appwrite.io/v1/account/name
| name | string | User name. Max length: 128 chars. | |


```http request
GET https://cloud.appwrite.io/v1/account/passkeys
```

** Get the list of verified passkeys registered by the currently logged in user. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| queries | array | Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter and order on the following attributes: $id, $createdAt, $updatedAt, name, accessedAt | [] |
| total | boolean | When set to false, the total count returned will be 0 and will not be calculated. | 1 |


```http request
POST https://cloud.appwrite.io/v1/account/passkeys
```

** Start registering a passkey for the currently logged in user. The session must have signed in or completed an MFA challenge within the last 10 minutes. Pass the returned `publicKey` options to `navigator.credentials.create()`, then complete the registration with [Update passkey verification](/docs/references/cloud/client-web/account#updatePasskeyVerification). The passkey stays pending until verified, and the challenge expires after 5 minutes. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| passkeyId | string | Passkey ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars. | unique() |
| name | string | Passkey name, shown when listing passkeys. Max length: 128 chars. | |


```http request
GET https://cloud.appwrite.io/v1/account/passkeys/{passkeyId}
```

** Get a verified passkey of the currently logged in user by its unique ID. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| passkeyId | string | **Required** Passkey ID. | |


```http request
PATCH https://cloud.appwrite.io/v1/account/passkeys/{passkeyId}
```

** Rename a passkey of the currently logged in user. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| passkeyId | string | **Required** Passkey ID. | |
| name | string | Passkey name. Max length: 128 chars. | |


```http request
DELETE https://cloud.appwrite.io/v1/account/passkeys/{passkeyId}
```

** Delete a passkey from the currently logged in user. The passkey can no longer be used to sign in, although it may remain stored on the user's device. The session must have signed in or completed an MFA challenge within the last 10 minutes. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| passkeyId | string | **Required** Passkey ID. | |


```http request
PUT https://cloud.appwrite.io/v1/account/passkeys/{passkeyId}/verification
```

** Complete a passkey registration started with [Create passkey](/docs/references/cloud/client-web/account#createPasskey). Pass the JSON form of the credential returned by `navigator.credentials.create()`, for example `credential.toJSON()`. Each registration can be verified once; a failed attempt requires starting it again. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| passkeyId | string | **Required** Passkey ID. | |
| credential | object | Registration credential returned by the authenticator, in the JSON form produced by `PublicKeyCredential.toJSON()`. | {} |


```http request
PATCH https://cloud.appwrite.io/v1/account/password
```
Expand Down Expand Up @@ -642,6 +724,27 @@ A user is limited to 10 active sessions at a time by default. [Learn more about
| state | string | An opaque value your app generates and keeps, for example in a cookie. It is returned unchanged as the `state` query parameter on the success and failure URLs, so your app can check that the sign-in it receives is one it started. Printable ASCII only (RFC 6749 Appendix A.5). Max length: 256 chars. | |


```http request
POST https://cloud.appwrite.io/v1/account/tokens/passkey
```

** Start signing in with a passkey. No email or user ID is needed: pass the returned `publicKey` options to `navigator.credentials.get()` and the user picks one of their passkeys. Then call [Update passkey token](/docs/references/cloud/client-web/account#updatePasskeyToken) with the credential to receive a token, and exchange it with [Create session](/docs/references/cloud/client-web/account#createSession). The challenge expires after 5 minutes. **


```http request
PUT https://cloud.appwrite.io/v1/account/tokens/passkey
```

** Complete a passkey sign-in started with [Create passkey token](/docs/references/cloud/client-web/account#createPasskeyToken). Pass the challenge ID and the JSON form of the credential returned by `navigator.credentials.get()`, for example `credential.toJSON()`. The returned token includes its secret and expires after 1 minute: exchange it for a session with [Create session](/docs/references/cloud/client-web/account#createSession). Passkeys require user verification, so the session also satisfies MFA. Each challenge can only be used once. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| challengeId | string | Challenge ID returned by createPasskeyToken. | |
| credential | object | Authentication credential returned by the authenticator, in the JSON form produced by `PublicKeyCredential.toJSON()`. | {} |


```http request
POST https://cloud.appwrite.io/v1/account/tokens/phone
```
Expand Down
15 changes: 15 additions & 0 deletions docs/examples/account/create-passkey-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Account;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setSession(''); // The user session to authenticate with

$account = new Account($client);

$result = $account->createPasskeyToken();
```
18 changes: 18 additions & 0 deletions docs/examples/account/create-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Account;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setSession(''); // The user session to authenticate with

$account = new Account($client);

$result = $account->createPasskey(
passkeyId: '<PASSKEY_ID>', // optional
name: '<NAME>' // optional
);
```
17 changes: 17 additions & 0 deletions docs/examples/account/delete-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Account;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setSession(''); // The user session to authenticate with

$account = new Account($client);

$result = $account->deletePasskey(
passkeyId: '<PASSKEY_ID>'
);
```
17 changes: 17 additions & 0 deletions docs/examples/account/get-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Account;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setSession(''); // The user session to authenticate with

$account = new Account($client);

$result = $account->getPasskey(
passkeyId: '<PASSKEY_ID>'
);
```
18 changes: 18 additions & 0 deletions docs/examples/account/list-passkeys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Account;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setSession(''); // The user session to authenticate with

$account = new Account($client);

$result = $account->listPasskeys(
queries: [], // optional
total: false // optional
);
```
18 changes: 18 additions & 0 deletions docs/examples/account/update-passkey-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Account;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setSession(''); // The user session to authenticate with

$account = new Account($client);

$result = $account->updatePasskeyToken(
challengeId: '<CHALLENGE_ID>',
credential: []
);
```
18 changes: 18 additions & 0 deletions docs/examples/account/update-passkey-verification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Account;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setSession(''); // The user session to authenticate with

$account = new Account($client);

$result = $account->updatePasskeyVerification(
passkeyId: '<PASSKEY_ID>',
credential: []
);
```
18 changes: 18 additions & 0 deletions docs/examples/account/update-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Account;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setSession(''); // The user session to authenticate with

$account = new Account($client);

$result = $account->updatePasskey(
passkeyId: '<PASSKEY_ID>',
name: '<NAME>'
);
```
17 changes: 17 additions & 0 deletions docs/examples/project/update-passkey-policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Project;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your secret API key

$project = new Project($client);

$result = $project->updatePasskeyPolicy(
rpId: '<RP_ID>'
);
```
18 changes: 18 additions & 0 deletions docs/examples/users/delete-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Users;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your secret API key

$users = new Users($client);

$result = $users->deletePasskey(
userId: '<USER_ID>',
passkeyId: '<PASSKEY_ID>'
);
```
18 changes: 18 additions & 0 deletions docs/examples/users/get-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Users;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your secret API key

$users = new Users($client);

$result = $users->getPasskey(
userId: '<USER_ID>',
passkeyId: '<PASSKEY_ID>'
);
```
19 changes: 19 additions & 0 deletions docs/examples/users/list-passkeys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Users;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your secret API key

$users = new Users($client);

$result = $users->listPasskeys(
userId: '<USER_ID>',
queries: [], // optional
total: false // optional
);
```
19 changes: 19 additions & 0 deletions docs/examples/users/update-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
```php
<?php

use Appwrite\Client;
use Appwrite\Services\Users;

$client = (new Client())
->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
->setProject('<YOUR_PROJECT_ID>') // Your project ID
->setKey('<YOUR_API_KEY>'); // Your secret API key

$users = new Users($client);

$result = $users->updatePasskey(
userId: '<USER_ID>',
passkeyId: '<PASSKEY_ID>',
name: '<NAME>'
);
```
13 changes: 13 additions & 0 deletions docs/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,19 @@ PATCH https://cloud.appwrite.io/v1/project/policies/mfa-factors
| custom | boolean | Set to true to allow the custom factor to complete an MFA challenge, or false to disable it. | |


```http request
PATCH https://cloud.appwrite.io/v1/project/policies/passkey
```

** Set the relying party ID passkeys are bound to: the domain of your application. Passkeys work on the project's web platforms on that domain or its subdomains, and on the domain itself for Apple apps. A localhost web platform enables passkeys for local development without a relying party ID. The relying party ID cannot change while users have passkeys, and any change invalidates ceremonies in progress. **

### Parameters

| Field Name | Type | Description | Default |
| --- | --- | --- | --- |
| rpId | string | Relying party ID: the domain of your application, such as `example.com`. Use `localhost` for local development, or an empty string to unset it. | |


```http request
PATCH https://cloud.appwrite.io/v1/project/policies/password-dictionary
```
Expand Down
Loading
Loading