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

## 29.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

## 29.2.0

* Added: optional `interval` parameter on `functions.create` and `functions.update` to run a function every N minutes
Expand Down
12 changes: 12 additions & 0 deletions docs/examples/account/create-passkey-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const account = new sdk.Account(client);

const result = await account.createPasskeyToken();
```
15 changes: 15 additions & 0 deletions docs/examples/account/create-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const account = new sdk.Account(client);

const result = await account.createPasskey({
passkeyId: '<PASSKEY_ID>', // optional
name: '<NAME>', // optional
});
```
14 changes: 14 additions & 0 deletions docs/examples/account/delete-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const account = new sdk.Account(client);

const result = await account.deletePasskey({
passkeyId: '<PASSKEY_ID>',
});
```
14 changes: 14 additions & 0 deletions docs/examples/account/get-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const account = new sdk.Account(client);

const result = await account.getPasskey({
passkeyId: '<PASSKEY_ID>',
});
```
15 changes: 15 additions & 0 deletions docs/examples/account/list-passkeys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const account = new sdk.Account(client);

const result = await account.listPasskeys({
queries: [], // optional
total: false, // optional
});
```
15 changes: 15 additions & 0 deletions docs/examples/account/update-passkey-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const account = new sdk.Account(client);

const result = await account.updatePasskeyToken({
challengeId: '<CHALLENGE_ID>',
credential: {},
});
```
15 changes: 15 additions & 0 deletions docs/examples/account/update-passkey-verification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const account = new sdk.Account(client);

const result = await account.updatePasskeyVerification({
passkeyId: '<PASSKEY_ID>',
credential: {},
});
```
15 changes: 15 additions & 0 deletions docs/examples/account/update-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const account = new sdk.Account(client);

const result = await account.updatePasskey({
passkeyId: '<PASSKEY_ID>',
name: '<NAME>',
});
```
14 changes: 14 additions & 0 deletions docs/examples/project/update-passkey-policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const project = new sdk.Project(client);

const result = await project.updatePasskeyPolicy({
rpId: '<RP_ID>',
});
```
15 changes: 15 additions & 0 deletions docs/examples/users/delete-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const users = new sdk.Users(client);

const result = await users.deletePasskey({
userId: '<USER_ID>',
passkeyId: '<PASSKEY_ID>',
});
```
15 changes: 15 additions & 0 deletions docs/examples/users/get-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const users = new sdk.Users(client);

const result = await users.getPasskey({
userId: '<USER_ID>',
passkeyId: '<PASSKEY_ID>',
});
```
16 changes: 16 additions & 0 deletions docs/examples/users/list-passkeys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const users = new sdk.Users(client);

const result = await users.listPasskeys({
userId: '<USER_ID>',
queries: [], // optional
total: false, // optional
});
```
16 changes: 16 additions & 0 deletions docs/examples/users/update-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```javascript
const sdk = require('node-appwrite');

const client = new sdk.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

const users = new sdk.Users(client);

const result = await users.updatePasskey({
userId: '<USER_ID>',
passkeyId: '<PASSKEY_ID>',
name: '<NAME>',
});
```
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "node-appwrite",
"homepage": "https://appwrite.io/support",
"description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API",
"version": "29.2.0",
"version": "29.3.0",
"license": "BSD-3-Clause",
"main": "dist/index.js",
"type": "commonjs",
Expand Down
4 changes: 2 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class AppwriteException extends Error {
}

function getUserAgent() {
let ua = 'AppwriteNodeJSSDK/29.2.0';
let ua = 'AppwriteNodeJSSDK/29.3.0';

// `process` is a global in Node.js, but not fully available in all runtimes.
const platform: string[] = [];
Expand Down Expand Up @@ -142,7 +142,7 @@ class Client {
'x-sdk-name': 'Node.js',
'x-sdk-platform': 'server',
'x-sdk-language': 'nodejs',
'x-sdk-version': '29.2.0',
'x-sdk-version': '29.3.0',
'user-agent': getUserAgent(),
'X-Appwrite-Response-Format': '2.0.0',
};
Expand Down
96 changes: 96 additions & 0 deletions src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6760,6 +6760,102 @@ export namespace Models {
code: string;
};

/**
* Token Secret
*/
export type TokenSecret = {
/**
* Token ID.
*/
$id: string;
/**
* Token creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* User ID.
*/
userId: string;
/**
* Token secret key. Exchange it for a session with the create session endpoint.
*/
secret: string;
/**
* Token expiration date in ISO 8601 format.
*/
expire: string;
/**
* Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email.
*/
phrase: string;
};

/**
* Passkey
*/
export type Passkey = {
/**
* Passkey ID.
*/
$id: string;
/**
* Passkey creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* Passkey update date in ISO 8601 format.
*/
$updatedAt: string;
/**
* Passkey name.
*/
name: string;
/**
* Most recent sign-in with this passkey in ISO 8601 format. Empty until the passkey is used to sign in.
*/
accessedAt: string;
};

/**
* Passkey Challenge
*/
export type PasskeyChallenge = {
/**
* Challenge ID. When signing in, pass it back with the credential to receive a token.
*/
$id: string;
/**
* Challenge creation date in ISO 8601 format.
*/
$createdAt: string;
/**
* ID of the passkey being registered. Empty for sign-in challenges.
*/
passkeyId: string;
/**
* Challenge expiration date in ISO 8601 format.
*/
expire: string;
/**
* WebAuthn options in JSON form. Pass them to `PublicKeyCredential.parseCreationOptionsFromJSON()` when registering, or `PublicKeyCredential.parseRequestOptionsFromJSON()` when signing in.
*/
publicKey: object;
};

/**
* Passkeys List
*/
export type PasskeyList = {
/**
* Total number of passkeys that matched your query.
*/
total: number;
/**
* List of passkeys.
*/
passkeys: Passkey[];
};

/**
* MFA Recovery Codes
*/
Expand Down
Loading
Loading