New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@appwrite.io/console

Package Overview
Dependencies
Maintainers
4
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@appwrite.io/console - npm Package Compare versions

Comparing version 0.6.0-rc.14 to 0.6.0-rc.15

docs/examples/account/create-mfa-authenticator.md

2

package.json

@@ -5,3 +5,3 @@ {

"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
"version": "0.6.0-rc.14",
"version": "0.6.0-rc.15",
"license": "BSD-3-Clause",

@@ -8,0 +8,0 @@ "main": "dist/cjs/sdk.js",

@@ -36,3 +36,3 @@ # Appwrite Console SDK

```html
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.6.0-rc.14"></script>
<script src="https://cdn.jsdelivr.net/npm/@appwrite.io/console@0.6.0-rc.15"></script>
```

@@ -39,0 +39,0 @@

@@ -107,3 +107,3 @@ import 'isomorphic-form-data';

'x-sdk-language': 'web',
'x-sdk-version': '0.6.0-rc.14',
'x-sdk-version': '0.6.0-rc.15',
'X-Appwrite-Response-Format': '1.5.0',

@@ -110,0 +110,0 @@ };

@@ -25,4 +25,4 @@ export { Client, Query, AppwriteException } from './client';

export { ID } from './id';
export { AuthenticationFactor } from './enums/authentication-factor';
export { AuthenticatorType } from './enums/authenticator-type';
export { Type } from './enums/type';
export { Factor } from './enums/factor';
export { OAuthProvider } from './enums/o-auth-provider';

@@ -29,0 +29,0 @@ export { Browser } from './enums/browser';

@@ -5,4 +5,4 @@ import { Service } from '../service';

import type { UploadProgress, Payload } from '../client';
import { AuthenticationFactor } from '../enums/authentication-factor';
import { AuthenticatorType } from '../enums/authenticator-type';
import { Type } from '../enums/type';
import { Factor } from '../enums/factor';
import { OAuthProvider } from '../enums/o-auth-provider';

@@ -272,10 +272,105 @@

/**
* Add Authenticator
*
* Add an authenticator app to be used as an MFA factor. Verify the
* authenticator using the [verify
* authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
* method.
*
* @param {Type} type
* @throws {AppwriteException}
* @returns {Promise}
*/
async createMfaAuthenticator(type: Type): Promise<Models.MfaType> {
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
const payload: Payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
return await this.client.call('post', uri, {
'content-type': 'application/json',
}, payload);
}
/**
* Verify Authenticator
*
* Verify an authenticator app after adding it using the [add
* authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
* method.
*
* @param {Type} type
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateMfaAuthenticator<Preferences extends Models.Preferences>(type: Type, otp: string): Promise<Models.User<Preferences>> {
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
if (typeof otp === 'undefined') {
throw new AppwriteException('Missing required parameter: "otp"');
}
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
const payload: Payload = {};
if (typeof otp !== 'undefined') {
payload['otp'] = otp;
}
const uri = new URL(this.client.config.endpoint + apiPath);
return await this.client.call('put', uri, {
'content-type': 'application/json',
}, payload);
}
/**
* Delete Authenticator
*
* Delete an authenticator for a user by ID.
*
* @param {Type} type
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteMfaAuthenticator<Preferences extends Models.Preferences>(type: Type, otp: string): Promise<Models.User<Preferences>> {
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
if (typeof otp === 'undefined') {
throw new AppwriteException('Missing required parameter: "otp"');
}
const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type);
const payload: Payload = {};
if (typeof otp !== 'undefined') {
payload['otp'] = otp;
}
const uri = new URL(this.client.config.endpoint + apiPath);
return await this.client.call('delete', uri, {
'content-type': 'application/json',
}, payload);
}
/**
* Create 2FA Challenge
*
* Begin the process of MFA verification after sign-in. Finish the flow with
* [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
* method.
*
* @param {AuthenticationFactor} factor
* @param {Factor} factor
* @throws {AppwriteException}
* @returns {Promise}
*/
async createChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge> {
async createMfaChallenge(factor: Factor): Promise<Models.MfaChallenge> {
if (typeof factor === 'undefined') {

@@ -301,3 +396,7 @@ throw new AppwriteException('Missing required parameter: "factor"');

*
* Complete the MFA challenge by providing the one-time password.
* Complete the MFA challenge by providing the one-time password. Finish the
* process of MFA verification by providing the one-time password. To begin
* the flow, use
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
* method.
*

@@ -309,3 +408,3 @@ * @param {string} challengeId

*/
async updateChallenge(challengeId: string, otp: string): Promise<{}> {
async updateMfaChallenge(challengeId: string, otp: string): Promise<{}> {
if (typeof challengeId === 'undefined') {

@@ -344,3 +443,3 @@ throw new AppwriteException('Missing required parameter: "challengeId"');

*/
async listFactors(): Promise<Models.MfaFactors> {
async listMfaFactors(): Promise<Models.MfaFactors> {
const apiPath = '/account/mfa/factors';

@@ -356,23 +455,18 @@ const payload: Payload = {};

/**
* Add Authenticator
* Get MFA Recovery Codes
*
* Add an authenticator app to be used as an MFA factor. Verify the
* authenticator using the [verify
* authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
* method.
* Get recovery codes that can be used as backup for MFA flow. Before getting
* codes, they must be generated using
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
* method. An OTP challenge is required to read recovery codes.
*
* @param {AuthenticatorType} type
* @throws {AppwriteException}
* @returns {Promise}
*/
async addAuthenticator(type: AuthenticatorType): Promise<Models.MfaType> {
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
const apiPath = '/account/mfa/{type}'.replace('{type}', type);
async getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
const apiPath = '/account/mfa/recovery-codes';
const payload: Payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
return await this.client.call('post', uri, {
return await this.client.call('get', uri, {
'content-type': 'application/json',

@@ -383,31 +477,19 @@ }, payload);

/**
* Verify Authenticator
* Create MFA Recovery Codes
*
* Verify an authenticator app after adding it using the [add
* authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
* Generate recovery codes as backup for MFA flow. It's recommended to
* generate and show then immediately after user successfully adds their
* authehticator. Recovery codes can be used as a MFA verification type in
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
* method.
*
* @param {AuthenticatorType} type
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise}
*/
async verifyAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
if (typeof otp === 'undefined') {
throw new AppwriteException('Missing required parameter: "otp"');
}
const apiPath = '/account/mfa/{type}'.replace('{type}', type);
async createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
const apiPath = '/account/mfa/recovery-codes';
const payload: Payload = {};
if (typeof otp !== 'undefined') {
payload['otp'] = otp;
}
const uri = new URL(this.client.config.endpoint + apiPath);
return await this.client.call('put', uri, {
return await this.client.call('post', uri, {
'content-type': 'application/json',

@@ -418,29 +500,18 @@ }, payload);

/**
* Delete Authenticator
* Regenerate MFA Recovery Codes
*
* Delete an authenticator for a user by ID.
* Regenerate recovery codes that can be used as backup for MFA flow. Before
* regenerating codes, they must be first generated using
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
* method. An OTP challenge is required to regenreate recovery codes.
*
* @param {AuthenticatorType} type
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>> {
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
if (typeof otp === 'undefined') {
throw new AppwriteException('Missing required parameter: "otp"');
}
const apiPath = '/account/mfa/{type}'.replace('{type}', type);
async updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> {
const apiPath = '/account/mfa/recovery-codes';
const payload: Payload = {};
if (typeof otp !== 'undefined') {
payload['otp'] = otp;
}
const uri = new URL(this.client.config.endpoint + apiPath);
return await this.client.call('delete', uri, {
return await this.client.call('patch', uri, {
'content-type': 'application/json',

@@ -447,0 +518,0 @@ }, payload);

@@ -7,3 +7,3 @@ import { Service } from '../service';

import { UserUsageRange } from '../enums/user-usage-range';
import { AuthenticatorType } from '../enums/authenticator-type';
import { Type } from '../enums/type';
import { MessagingProviderType } from '../enums/messaging-provider-type';

@@ -820,2 +820,30 @@

/**
* Delete Authenticator
*
* Delete an authenticator app.
*
* @param {string} userId
* @param {Type} type
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteMfaAuthenticator<Preferences extends Models.Preferences>(userId: string, type: Type): Promise<Models.User<Preferences>> {
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
}
const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type);
const payload: Payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
return await this.client.call('delete', uri, {
'content-type': 'application/json',
}, payload);
}
/**
* List Factors

@@ -829,3 +857,3 @@ *

*/
async listFactors(userId: string): Promise<Models.MfaFactors> {
async listMfaFactors(userId: string): Promise<Models.MfaFactors> {
if (typeof userId === 'undefined') {

@@ -845,12 +873,14 @@ throw new AppwriteException('Missing required parameter: "userId"');

/**
* Delete Authenticator
* Get MFA Recovery Codes
*
* Delete an authenticator app.
* Get recovery codes that can be used as backup for MFA flow by User ID.
* Before getting codes, they must be generated using
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
* method.
*
* @param {string} userId
* @param {AuthenticatorType} type
* @throws {AppwriteException}
* @returns {Promise}
*/
async deleteAuthenticator<Preferences extends Models.Preferences>(userId: string, type: AuthenticatorType): Promise<Models.User<Preferences>> {
async getMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes> {
if (typeof userId === 'undefined') {

@@ -860,11 +890,33 @@ throw new AppwriteException('Missing required parameter: "userId"');

if (typeof type === 'undefined') {
throw new AppwriteException('Missing required parameter: "type"');
const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
const payload: Payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
return await this.client.call('get', uri, {
'content-type': 'application/json',
}, payload);
}
/**
* Regenerate MFA Recovery Codes
*
* Regenerate recovery codes that can be used as backup for MFA flow by User
* ID. Before regenerating codes, they must be first generated using
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
* method.
*
* @param {string} userId
* @throws {AppwriteException}
* @returns {Promise}
*/
async updateMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes> {
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
const apiPath = '/users/{userId}/mfa/{type}'.replace('{userId}', userId).replace('{type}', type);
const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
const payload: Payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
return await this.client.call('delete', uri, {
return await this.client.call('put', uri, {
'content-type': 'application/json',

@@ -875,2 +927,28 @@ }, payload);

/**
* Create MFA Recovery Codes
*
* Generate recovery codes used as backup for MFA flow for User ID. Recovery
* codes can be used as a MFA verification type in
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
* method by client SDK.
*
* @param {string} userId
* @throws {AppwriteException}
* @returns {Promise}
*/
async createMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes> {
if (typeof userId === 'undefined') {
throw new AppwriteException('Missing required parameter: "userId"');
}
const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId);
const payload: Payload = {};
const uri = new URL(this.client.config.endpoint + apiPath);
return await this.client.call('patch', uri, {
'content-type': 'application/json',
}, payload);
}
/**
* Update name

@@ -877,0 +955,0 @@ *

@@ -25,4 +25,4 @@ export { Client, Query, AppwriteException } from './client';

export { ID } from './id';
export { AuthenticationFactor } from './enums/authentication-factor';
export { AuthenticatorType } from './enums/authenticator-type';
export { Type } from './enums/type';
export { Factor } from './enums/factor';
export { OAuthProvider } from './enums/o-auth-provider';

@@ -29,0 +29,0 @@ export { Browser } from './enums/browser';

import { Service } from '../service';
import { Client } from '../client';
import type { Models } from '../models';
import { AuthenticationFactor } from '../enums/authentication-factor';
import { AuthenticatorType } from '../enums/authenticator-type';
import { Type } from '../enums/type';
import { Factor } from '../enums/factor';
import { OAuthProvider } from '../enums/o-auth-provider';

@@ -119,14 +119,58 @@ export declare class Account extends Service {

/**
* Add Authenticator
*
* Add an authenticator app to be used as an MFA factor. Verify the
* authenticator using the [verify
* authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
* method.
*
* @param {Type} type
* @throws {AppwriteException}
* @returns {Promise}
*/
createMfaAuthenticator(type: Type): Promise<Models.MfaType>;
/**
* Verify Authenticator
*
* Verify an authenticator app after adding it using the [add
* authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
* method.
*
* @param {Type} type
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise}
*/
updateMfaAuthenticator<Preferences extends Models.Preferences>(type: Type, otp: string): Promise<Models.User<Preferences>>;
/**
* Delete Authenticator
*
* Delete an authenticator for a user by ID.
*
* @param {Type} type
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise}
*/
deleteMfaAuthenticator<Preferences extends Models.Preferences>(type: Type, otp: string): Promise<Models.User<Preferences>>;
/**
* Create 2FA Challenge
*
* Begin the process of MFA verification after sign-in. Finish the flow with
* [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
* method.
*
* @param {AuthenticationFactor} factor
* @param {Factor} factor
* @throws {AppwriteException}
* @returns {Promise}
*/
createChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>;
createMfaChallenge(factor: Factor): Promise<Models.MfaChallenge>;
/**
* Create MFA Challenge (confirmation)
*
* Complete the MFA challenge by providing the one-time password.
* Complete the MFA challenge by providing the one-time password. Finish the
* process of MFA verification by providing the one-time password. To begin
* the flow, use
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
* method.
*

@@ -138,3 +182,3 @@ * @param {string} challengeId

*/
updateChallenge(challengeId: string, otp: string): Promise<{}>;
updateMfaChallenge(challengeId: string, otp: string): Promise<{}>;
/**

@@ -148,40 +192,40 @@ * List Factors

*/
listFactors(): Promise<Models.MfaFactors>;
listMfaFactors(): Promise<Models.MfaFactors>;
/**
* Add Authenticator
* Get MFA Recovery Codes
*
* Add an authenticator app to be used as an MFA factor. Verify the
* authenticator using the [verify
* authenticator](/docs/references/cloud/client-web/account#verifyAuthenticator)
* method.
* Get recovery codes that can be used as backup for MFA flow. Before getting
* codes, they must be generated using
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
* method. An OTP challenge is required to read recovery codes.
*
* @param {AuthenticatorType} type
* @throws {AppwriteException}
* @returns {Promise}
*/
addAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>;
getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
/**
* Verify Authenticator
* Create MFA Recovery Codes
*
* Verify an authenticator app after adding it using the [add
* authenticator](/docs/references/cloud/client-web/account#addAuthenticator)
* Generate recovery codes as backup for MFA flow. It's recommended to
* generate and show then immediately after user successfully adds their
* authehticator. Recovery codes can be used as a MFA verification type in
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
* method.
*
* @param {AuthenticatorType} type
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise}
*/
verifyAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
/**
* Delete Authenticator
* Regenerate MFA Recovery Codes
*
* Delete an authenticator for a user by ID.
* Regenerate recovery codes that can be used as backup for MFA flow. Before
* regenerating codes, they must be first generated using
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
* method. An OTP challenge is required to regenreate recovery codes.
*
* @param {AuthenticatorType} type
* @param {string} otp
* @throws {AppwriteException}
* @returns {Promise}
*/
deleteAuthenticator<Preferences extends Models.Preferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>;
updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes>;
/**

@@ -188,0 +232,0 @@ * Update name

@@ -6,3 +6,3 @@ import { Service } from '../service';

import { UserUsageRange } from '../enums/user-usage-range';
import { AuthenticatorType } from '../enums/authenticator-type';
import { Type } from '../enums/type';
import { MessagingProviderType } from '../enums/messaging-provider-type';

@@ -274,2 +274,13 @@ export declare class Users extends Service {

/**
* Delete Authenticator
*
* Delete an authenticator app.
*
* @param {string} userId
* @param {Type} type
* @throws {AppwriteException}
* @returns {Promise}
*/
deleteMfaAuthenticator<Preferences extends Models.Preferences>(userId: string, type: Type): Promise<Models.User<Preferences>>;
/**
* List Factors

@@ -283,15 +294,43 @@ *

*/
listFactors(userId: string): Promise<Models.MfaFactors>;
listMfaFactors(userId: string): Promise<Models.MfaFactors>;
/**
* Delete Authenticator
* Get MFA Recovery Codes
*
* Delete an authenticator app.
* Get recovery codes that can be used as backup for MFA flow by User ID.
* Before getting codes, they must be generated using
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
* method.
*
* @param {string} userId
* @param {AuthenticatorType} type
* @throws {AppwriteException}
* @returns {Promise}
*/
deleteAuthenticator<Preferences extends Models.Preferences>(userId: string, type: AuthenticatorType): Promise<Models.User<Preferences>>;
getMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>;
/**
* Regenerate MFA Recovery Codes
*
* Regenerate recovery codes that can be used as backup for MFA flow by User
* ID. Before regenerating codes, they must be first generated using
* [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes)
* method.
*
* @param {string} userId
* @throws {AppwriteException}
* @returns {Promise}
*/
updateMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>;
/**
* Create MFA Recovery Codes
*
* Generate recovery codes used as backup for MFA flow for User ID. Recovery
* codes can be used as a MFA verification type in
* [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
* method by client SDK.
*
* @param {string} userId
* @throws {AppwriteException}
* @returns {Promise}
*/
createMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>;
/**
* Update name

@@ -298,0 +337,0 @@ *

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc