summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations/backup
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-03-17 17:56:37 +0100
committerFlorian Dold <florian@dold.me>2021-03-17 17:56:37 +0100
commit07cdfb2e4ec761021477271776b81f33af0e731d (patch)
treecb62b1d1a04e1e64b8ee47e78196e858727d2c0a /packages/taler-wallet-core/src/operations/backup
parent42a4d666f42ce94274995bfdae644444ff5f6d53 (diff)
downloadwallet-core-07cdfb2e4ec761021477271776b81f33af0e731d.tar.gz
wallet-core-07cdfb2e4ec761021477271776b81f33af0e731d.tar.bz2
wallet-core-07cdfb2e4ec761021477271776b81f33af0e731d.zip
towards wallet-core / util split
Diffstat (limited to 'packages/taler-wallet-core/src/operations/backup')
-rw-r--r--packages/taler-wallet-core/src/operations/backup/export.ts6
-rw-r--r--packages/taler-wallet-core/src/operations/backup/import.ts37
-rw-r--r--packages/taler-wallet-core/src/operations/backup/index.ts20
-rw-r--r--packages/taler-wallet-core/src/operations/backup/state.ts11
4 files changed, 15 insertions, 59 deletions
diff --git a/packages/taler-wallet-core/src/operations/backup/export.ts b/packages/taler-wallet-core/src/operations/backup/export.ts
index a32aec39..c6e24289 100644
--- a/packages/taler-wallet-core/src/operations/backup/export.ts
+++ b/packages/taler-wallet-core/src/operations/backup/export.ts
@@ -14,12 +14,14 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { Stores, Amounts, CoinSourceType, CoinStatus, RefundState, AbortStatus, ProposalStatus, getTimestampNow, encodeCrock, stringToBytes, getRandomBytes } from "../..";
import { hash } from "../../crypto/primitives/nacl-fast";
-import { WalletBackupContentV1, BackupExchange, BackupCoin, BackupDenomination, BackupReserve, BackupPurchase, BackupProposal, BackupRefreshGroup, BackupBackupProvider, BackupTip, BackupRecoupGroup, BackupWithdrawalGroup, BackupBackupProviderTerms, BackupCoinSource, BackupCoinSourceType, BackupExchangeWireFee, BackupRefundItem, BackupRefundState, BackupProposalStatus, BackupRefreshOldCoin, BackupRefreshSession } from "../../types/backupTypes";
+import { WalletBackupContentV1, BackupExchange, BackupCoin, BackupDenomination, BackupReserve, BackupPurchase, BackupProposal, BackupRefreshGroup, BackupBackupProvider, BackupTip, BackupRecoupGroup, BackupWithdrawalGroup, BackupBackupProviderTerms, BackupCoinSource, BackupCoinSourceType, BackupExchangeWireFee, BackupRefundItem, BackupRefundState, BackupProposalStatus, BackupRefreshOldCoin, BackupRefreshSession } from "@gnu-taler/taler-util";
import { canonicalizeBaseUrl, canonicalJson } from "../../util/helpers";
import { InternalWalletState } from "../state";
import { provideBackupState, getWalletBackupState, WALLET_BACKUP_STATE_KEY } from "./state";
+import { Amounts, getTimestampNow } from "@gnu-taler/taler-util";
+import { Stores, CoinSourceType, CoinStatus, RefundState, AbortStatus, ProposalStatus } from "../../db.js";
+import { encodeCrock, stringToBytes, getRandomBytes } from "../../index.js";
/**
* Implementation of wallet backups (export/import/upload) and sync
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts b/packages/taler-wallet-core/src/operations/backup/import.ts
index 2e33c207..05b6da08 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -14,40 +14,9 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import {
- AbortStatus,
- AmountJson,
- Amounts,
- codecForContractTerms,
- CoinSource,
- CoinSourceType,
- CoinStatus,
- DenominationStatus,
- DenomSelectionState,
- ExchangeUpdateStatus,
- ExchangeWireInfo,
- getTimestampNow,
- ProposalDownload,
- ProposalStatus,
- RefreshReason,
- RefreshSessionRecord,
- RefundState,
- ReserveBankInfo,
- ReserveRecordStatus,
- Stores,
- TransactionHandle,
- WalletContractData,
- WalletRefundItem,
-} from "../..";
-import {
- BackupCoinSourceType,
- BackupDenomSel,
- BackupProposalStatus,
- BackupPurchase,
- BackupRefreshReason,
- BackupRefundState,
- WalletBackupContentV1,
-} from "../../types/backupTypes";
+import { BackupPurchase, AmountJson, Amounts, BackupDenomSel, WalletBackupContentV1, getTimestampNow, BackupCoinSourceType, BackupProposalStatus, codecForContractTerms, BackupRefundState, RefreshReason, BackupRefreshReason } from "@gnu-taler/taler-util";
+import { Stores, WalletContractData, DenomSelectionState, ExchangeWireInfo, ExchangeUpdateStatus, DenominationStatus, CoinSource, CoinSourceType, CoinStatus, ReserveBankInfo, ReserveRecordStatus, ProposalDownload, ProposalStatus, WalletRefundItem, RefundState, AbortStatus, RefreshSessionRecord } from "../../db.js";
+import { TransactionHandle } from "../../index.js";
import { PayCoinSelection } from "../../util/coinSelection";
import { j2s } from "../../util/helpers";
import { checkDbInvariant, checkLogicInvariant } from "../../util/invariants";
diff --git a/packages/taler-wallet-core/src/operations/backup/index.ts b/packages/taler-wallet-core/src/operations/backup/index.ts
index edc5acc1..77a3219a 100644
--- a/packages/taler-wallet-core/src/operations/backup/index.ts
+++ b/packages/taler-wallet-core/src/operations/backup/index.ts
@@ -25,15 +25,14 @@
* Imports.
*/
import { InternalWalletState } from "../state";
-import { WalletBackupContentV1 } from "../../types/backupTypes";
+import { AmountString, BackupRecovery, codecForAmountString, WalletBackupContentV1 } from "@gnu-taler/taler-util";
import { TransactionHandle } from "../../util/query";
import {
BackupProviderRecord,
ConfigRecord,
Stores,
-} from "../../types/dbTypes";
+} from "../../db.js";
import { checkDbInvariant, checkLogicInvariant } from "../../util/invariants";
-import { codecForAmountString } from "../../util/amounts";
import {
bytesToString,
decodeCrock,
@@ -51,9 +50,8 @@ import {
getTimestampNow,
Timestamp,
timestampAddDuration,
-} from "../../util/time";
+} from "@gnu-taler/taler-util";
import { URL } from "../../util/url";
-import { AmountString } from "../../types/talerTypes";
import {
buildCodecForObject,
Codec,
@@ -61,7 +59,7 @@ import {
codecForNumber,
codecForString,
codecOptional,
-} from "../../util/codec";
+} from "@gnu-taler/taler-util";
import {
HttpResponseStatus,
readSuccessResponseJsonOrThrow,
@@ -77,7 +75,7 @@ import {
RecoveryLoadRequest,
RecoveryMergeStrategy,
TalerErrorDetails,
-} from "../../types/walletTypes";
+} from "@gnu-taler/taler-util";
import { CryptoApi } from "../../crypto/workers/cryptoApi";
import { secretbox, secretbox_open } from "../../crypto/primitives/nacl-fast";
import { checkPaymentByProposalId, confirmPay, preparePayForUri } from "../pay";
@@ -89,7 +87,6 @@ import {
getWalletBackupState,
WalletBackupConfState,
} from "./state";
-import { PaymentStatus } from "../../types/transactionsTypes";
const logger = new Logger("operations/backup.ts");
@@ -639,13 +636,6 @@ export async function getBackupInfo(
};
}
-export interface BackupRecovery {
- walletRootPriv: string;
- providers: {
- url: string;
- }[];
-}
-
/**
* Get information about the current state of wallet backups.
*/
diff --git a/packages/taler-wallet-core/src/operations/backup/state.ts b/packages/taler-wallet-core/src/operations/backup/state.ts
index 29c9402c..686c307a 100644
--- a/packages/taler-wallet-core/src/operations/backup/state.ts
+++ b/packages/taler-wallet-core/src/operations/backup/state.ts
@@ -14,14 +14,9 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import {
- ConfigRecord,
- encodeCrock,
- getRandomBytes,
- Stores,
- Timestamp,
- TransactionHandle,
-} from "../..";
+import { Timestamp } from "@gnu-taler/taler-util";
+import { ConfigRecord, Stores } from "../../db.js";
+import { getRandomBytes, encodeCrock, TransactionHandle } from "../../index.js";
import { checkDbInvariant } from "../../util/invariants";
import { InternalWalletState } from "../state";