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

Two FA #337

Merged
merged 37 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
198b426
feat: 2fa api added
siandreev Nov 20, 2024
a338012
feat: 2fa encoder & deploy hooks
siandreev Nov 21, 2024
c61d375
Merge branch 'main' into feature/2fa
siandreev Nov 21, 2024
e165080
feat: 2fa sender created
siandreev Nov 26, 2024
5becfe9
chore: locales updated
siandreev Nov 26, 2024
7bbd38e
feat: 2fa settings page
siandreev Nov 26, 2024
147fc4d
feat: 2fa confirm in tg & sender updates
siandreev Nov 29, 2024
62e8b51
fix: update 2fa sender
siandreev Dec 2, 2024
5f2f1c9
Merge branch 'main' into feature/2fa
siandreev Dec 16, 2024
eee085e
fix: integrate new 2fa backend
siandreev Dec 16, 2024
69544fb
fix: update plugin code
siandreev Dec 16, 2024
62cb888
fix: two fa deactivation page
siandreev Dec 17, 2024
2dbfcce
feat: cancel recovery
siandreev Dec 17, 2024
6d8840a
fix: show cancel recovery banner
siandreev Dec 17, 2024
b9857b5
fix: add auto-refill logic
siandreev Dec 17, 2024
2362afb
chore: regenerate api
siandreev Dec 18, 2024
8841d52
fix: display 2fa actions progress
siandreev Dec 18, 2024
92d79a7
chore: update comments
siandreev Dec 18, 2024
2cb6404
fix: show two-fa page for active-two-fa accounts
siandreev Dec 18, 2024
64e6bf7
Merge branch 'main' into feature/2fa
KuznetsovNikita Dec 19, 2024
5c9b127
fix: 2fa swaps, ton connect, nft and multisigs
siandreev Dec 23, 2024
e935210
fix: locales
siandreev Dec 23, 2024
1c95720
fix: add w5 label to dev menu 2fa activation
siandreev Dec 23, 2024
15f948e
fix(PRO-155): bug 6
siandreev Dec 23, 2024
8adb47b
fix(PRO-155): bug 7
siandreev Dec 23, 2024
c0d009b
fix(PRO-155): hide receive from plugin in ton connect emulation
siandreev Dec 23, 2024
875e581
chore: regenerate api
siandreev Dec 25, 2024
48e10b1
fix: check host wallet balance when multisig signing
siandreev Dec 25, 2024
4c93dd8
fix: extension ton connect fix
siandreev Dec 25, 2024
b1ea81c
Merge branch 'main' into feature/ledger-updates
siandreev Dec 25, 2024
bc1ce3a
Merge branch 'feature/ledger-updates' into feature/2fa
siandreev Dec 25, 2024
36c100c
fix(PRO-156): bugs 1-4, 6
siandreev Dec 25, 2024
3f7cf35
fix(PRO-156): bugs 5, 8
siandreev Dec 25, 2024
b642a8f
fix: new ton proof domain
siandreev Dec 26, 2024
dbd0e74
fix: replace disconnect tg button with change tg button
siandreev Dec 26, 2024
584d47a
fix: infinite loading for ledger
siandreev Dec 26, 2024
580f1c9
fix: support backend disable_2fa flag
siandreev Dec 27, 2024
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
2 changes: 1 addition & 1 deletion apps/extension/src/components/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const Notifications = () => {
} | null) => {
if (!data) return;
if (result) {
sendBackground.message('approveRequest', { id: data.id, payload: result });
sendBackground.message('approveRequest', { id: data.id, payload: result.replyItems });
} else {
sendBackground.message('rejectRequest', data.id);
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"generate:tonConsoleApi": "rm -r ./src/tonConsoleApi || true && npx openapi-typescript-codegen --input 'https://raw.githubusercontent.com/tonkeeper/tonconsole_backend/refs/heads/main/swagger.yaml?token=GHSAT0AAAAAACJYQUOCGQXJBM2BFNOB6XREZ2ZZZCA' --output ./src/tonConsoleApi",
"generate:swapsApi": "rm -r ./src/swapsApi || true && npx openapi-typescript-codegen --input 'https://raw.githubusercontent.com/tonkeeper/swaps-backend/master/swagger.yaml?token=GHSAT0AAAAAACJYQUODBKR67AB7WULZBFWEZSUUGFQ' --output ./src/swapsApi",
"generate:batteryApi": "rm -fr ./src/batteryApi && docker build -f resource/Dockerfile.batteryApi . -t batteryapi && docker run --rm --user=$(id -u):$(id -g) -v \"$PWD\":/local batteryapi",
"generate:2faApi": "rm -fr src/2faApi && docker build -f resource/Dockerfile.2faApi . -t 2faapi && docker run --rm --user=$(id -u):$(id -g) -v \"$PWD\":/local 2faapi",
"build:pkg": "yarn build"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/resource/Dockerfile.2faApi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM openapitools/openapi-generator-cli

CMD ["generate", "-i", "https://raw.githubusercontent.com/tonkeeper/tonkeeper_2fa_backend/refs/heads/main/swagger.yaml?token=GHSAT0AAAAAACJYQUOCG3M3IRKQM3KPJSAUZ3MA5IA", "-g", "typescript-fetch", "-o", "/local/src/2faApi", "-p", "supportsES6=true,withInterfaces=true", "--openapi-normalizer", "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"]
2 changes: 1 addition & 1 deletion packages/core/resource/Dockerfile.apiV2
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM openapitools/openapi-generator-cli

CMD ["generate", "-i", "https://raw.githubusercontent.com/tonkeeper/opentonapi/master/api/openapi.yml", "-g", "typescript-fetch", "-o", "/local/src/tonApiV2", "-p", "supportsES6=true,withInterfaces=true", "--openapi-normalizer", "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true"]
CMD ["generate", "-i", "https://raw.githubusercontent.com/tonkeeper/opentonapi/master/api/openapi.yml", "-g", "typescript-fetch", "-o", "/local/src/tonApiV2", "-p", "supportsES6=true,withInterfaces=true", "--openapi-normalizer", "KEEP_ONLY_FIRST_TAG_IN_OPERATION=true", "--skip-validate-spec"]
23 changes: 23 additions & 0 deletions packages/core/src/2faApi/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
21 changes: 21 additions & 0 deletions packages/core/src/2faApi/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.openapi-generator-ignore
apis/AuthApi.ts
apis/MessageApi.ts
apis/SystemApi.ts
apis/index.ts
index.ts
models/ConnectRequest.ts
models/ErrorCode.ts
models/ExistsExtensionRequest.ts
models/Message.ts
models/MessageID.ts
models/MessageState.ts
models/ModelError.ts
models/Ok.ts
models/Payload.ts
models/PingReadyGet500Response.ts
models/Proof.ts
models/RemoveExtensionRequest.ts
models/Url.ts
models/index.ts
runtime.ts
1 change: 1 addition & 0 deletions packages/core/src/2faApi/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.10.0-SNAPSHOT
292 changes: 292 additions & 0 deletions packages/core/src/2faApi/apis/AuthApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
/* tslint:disable */
/* eslint-disable */
/**
* REST API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.0.1
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


import * as runtime from '../runtime';
import type {
ConnectRequest,
ExistsExtensionRequest,
MessageID,
Ok,
Payload,
PingReadyGet500Response,
RemoveExtensionRequest,
Url,
} from '../models/index';
import {
ConnectRequestFromJSON,
ConnectRequestToJSON,
ExistsExtensionRequestFromJSON,
ExistsExtensionRequestToJSON,
MessageIDFromJSON,
MessageIDToJSON,
OkFromJSON,
OkToJSON,
PayloadFromJSON,
PayloadToJSON,
PingReadyGet500ResponseFromJSON,
PingReadyGet500ResponseToJSON,
RemoveExtensionRequestFromJSON,
RemoveExtensionRequestToJSON,
UrlFromJSON,
UrlToJSON,
} from '../models/index';

export interface ConnectOperationRequest {
connectRequest?: ConnectRequest;
}

export interface ExistsExtensionOperationRequest {
existsExtensionRequest?: ExistsExtensionRequest;
}

export interface ReConnectRequest {
connectRequest?: ConnectRequest;
}

export interface RemoveExtensionOperationRequest {
removeExtensionRequest?: RemoveExtensionRequest;
}

/**
* AuthApi - interface
*
* @export
* @interface AuthApiInterface
*/
export interface AuthApiInterface {
/**
*
* @summary Receive a deep link for the Telegram bot
* @param {ConnectRequest} [connectRequest] Data that is expected
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AuthApiInterface
*/
connectRaw(requestParameters: ConnectOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Url>>;

/**
* Receive a deep link for the Telegram bot
*/
connect(requestParameters: ConnectOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Url>;

/**
*
* @summary Verify if a wallet is linked to a Telegram bot
* @param {ExistsExtensionRequest} [existsExtensionRequest] Data that is expected
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AuthApiInterface
*/
existsExtensionRaw(requestParameters: ExistsExtensionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Ok>>;

/**
* Verify if a wallet is linked to a Telegram bot
*/
existsExtension(requestParameters: ExistsExtensionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Ok>;

/**
*
* @summary Retrieve the payload
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AuthApiInterface
*/
getPayloadRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Payload>>;

/**
* Retrieve the payload
*/
getPayload(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Payload>;

/**
*
* @summary Relink your account with the Telegram bot
* @param {ConnectRequest} [connectRequest] Data that is expected
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AuthApiInterface
*/
reConnectRaw(requestParameters: ReConnectRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Url>>;

/**
* Relink your account with the Telegram bot
*/
reConnect(requestParameters: ReConnectRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Url>;

/**
*
* @summary Disable 2FA for the wallet
* @param {RemoveExtensionRequest} [removeExtensionRequest] Data that is expected
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AuthApiInterface
*/
removeExtensionRaw(requestParameters: RemoveExtensionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MessageID>>;

/**
* Disable 2FA for the wallet
*/
removeExtension(requestParameters: RemoveExtensionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MessageID>;

}

/**
*
*/
export class AuthApi extends runtime.BaseAPI implements AuthApiInterface {

/**
* Receive a deep link for the Telegram bot
*/
async connectRaw(requestParameters: ConnectOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Url>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/api/v1/connect`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ConnectRequestToJSON(requestParameters['connectRequest']),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => UrlFromJSON(jsonValue));
}

/**
* Receive a deep link for the Telegram bot
*/
async connect(requestParameters: ConnectOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Url> {
const response = await this.connectRaw(requestParameters, initOverrides);
return await response.value();
}

/**
* Verify if a wallet is linked to a Telegram bot
*/
async existsExtensionRaw(requestParameters: ExistsExtensionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Ok>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/api/v1/exists`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ExistsExtensionRequestToJSON(requestParameters['existsExtensionRequest']),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => OkFromJSON(jsonValue));
}

/**
* Verify if a wallet is linked to a Telegram bot
*/
async existsExtension(requestParameters: ExistsExtensionOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Ok> {
const response = await this.existsExtensionRaw(requestParameters, initOverrides);
return await response.value();
}

/**
* Retrieve the payload
*/
async getPayloadRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Payload>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

const response = await this.request({
path: `/api/v1/payload`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => PayloadFromJSON(jsonValue));
}

/**
* Retrieve the payload
*/
async getPayload(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Payload> {
const response = await this.getPayloadRaw(initOverrides);
return await response.value();
}

/**
* Relink your account with the Telegram bot
*/
async reConnectRaw(requestParameters: ReConnectRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Url>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/api/v1/reconnect`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ConnectRequestToJSON(requestParameters['connectRequest']),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => UrlFromJSON(jsonValue));
}

/**
* Relink your account with the Telegram bot
*/
async reConnect(requestParameters: ReConnectRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Url> {
const response = await this.reConnectRaw(requestParameters, initOverrides);
return await response.value();
}

/**
* Disable 2FA for the wallet
*/
async removeExtensionRaw(requestParameters: RemoveExtensionOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MessageID>> {
const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

headerParameters['Content-Type'] = 'application/json';

const response = await this.request({
path: `/api/v1/remove`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: RemoveExtensionRequestToJSON(requestParameters['removeExtensionRequest']),
}, initOverrides);

return new runtime.JSONApiResponse(response, (jsonValue) => MessageIDFromJSON(jsonValue));
}

/**
* Disable 2FA for the wallet
*/
async removeExtension(requestParameters: RemoveExtensionOperationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MessageID> {
const response = await this.removeExtensionRaw(requestParameters, initOverrides);
return await response.value();
}

}
Loading
Loading