aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-01-03 14:42:06 +0100
committerFlorian Dold <florian.dold@gmail.com>2018-01-03 14:42:06 +0100
commitfd2cd9c383b07cd681c18137396deae025d98047 (patch)
tree05de454bb6fc0fcb95b66b6ef87bcd555e81b58c /src/crypto
parenteb689d60aca8fc80e27ea60c4e4d7e848b01bea9 (diff)
fix lint issues and separate message types into multiple files
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/cryptoApi-test.ts6
-rw-r--r--src/crypto/cryptoApi.ts19
-rw-r--r--src/crypto/cryptoWorker.ts37
-rw-r--r--src/crypto/emscInterface.ts4
4 files changed, 41 insertions, 25 deletions
diff --git a/src/crypto/cryptoApi-test.ts b/src/crypto/cryptoApi-test.ts
index d96d69e40..88099e3eb 100644
--- a/src/crypto/cryptoApi-test.ts
+++ b/src/crypto/cryptoApi-test.ts
@@ -16,15 +16,15 @@
// tslint:disable:max-line-length
-import {test} from "ava";
+import { test } from "ava";
import {
DenominationRecord,
DenominationStatus,
ReserveRecord,
-} from "../types";
+} from "../dbTypes";
-import {CryptoApi} from "./cryptoApi";
+import { CryptoApi } from "./cryptoApi";
const masterPub1: string = "CQQZ9DY3MZ1ARMN5K1VKDETS04Y2QCKMMCFHZSWJWWVN82BTTH00";
diff --git a/src/crypto/cryptoApi.ts b/src/crypto/cryptoApi.ts
index 12b1c9708..1f45ba8eb 100644
--- a/src/crypto/cryptoApi.ts
+++ b/src/crypto/cryptoApi.ts
@@ -23,20 +23,27 @@
/**
* Imports.
*/
+import { AmountJson } from "../amounts";
+
import {
- AmountJson,
CoinRecord,
- CoinWithDenom,
- ContractTerms,
DenominationRecord,
- PayCoinInfo,
- PaybackRequest,
PreCoinRecord,
RefreshSessionRecord,
ReserveRecord,
TipPlanchet,
WireFee,
-} from "../types";
+} from "../dbTypes";
+
+import {
+ ContractTerms,
+ PaybackRequest,
+} from "../talerTypes";
+
+import {
+ CoinWithDenom,
+ PayCoinInfo,
+} from "../walletTypes";
import * as timer from "../timer";
diff --git a/src/crypto/cryptoWorker.ts b/src/crypto/cryptoWorker.ts
index 3b954811a..1e5f10c20 100644
--- a/src/crypto/cryptoWorker.ts
+++ b/src/crypto/cryptoWorker.ts
@@ -22,27 +22,33 @@
/**
* Imports.
*/
+import * as Amounts from "../amounts";
+import { AmountJson } from "../amounts";
+
import {
- canonicalJson,
-} from "../helpers";
-import {
- AmountJson,
- Amounts,
- CoinPaySig,
CoinRecord,
CoinStatus,
- CoinWithDenom,
- ContractTerms,
DenominationRecord,
- PayCoinInfo,
- PaybackRequest,
PreCoinRecord,
RefreshPreCoinRecord,
RefreshSessionRecord,
ReserveRecord,
TipPlanchet,
WireFee,
-} from "../types";
+} from "../dbTypes";
+
+import {
+ CoinPaySig,
+ ContractTerms,
+ PaybackRequest,
+} from "../talerTypes";
+
+import {
+ CoinWithDenom,
+ PayCoinInfo,
+} from "../walletTypes";
+
+import { canonicalJson } from "../helpers";
import {
Amount,
@@ -112,6 +118,9 @@ namespace RpcFunctions {
}
+ /**
+ * Create a planchet used for tipping, including the private keys.
+ */
export function createTipPlanchet(denom: DenominationRecord): TipPlanchet {
const denomPub = native.RsaPublicKey.fromCrock(denom.denomPub);
const coinPriv = native.EddsaPrivateKey.create();
@@ -134,8 +143,8 @@ namespace RpcFunctions {
coinPriv: coinPriv.toCrock(),
coinPub: coinPub.toCrock(),
coinValue: denom.value,
- denomPubHash: denomPub.encode().hash().toCrock(),
denomPub: denomPub.encode().toCrock(),
+ denomPubHash: denomPub.encode().hash().toCrock(),
};
return tipPlanchet;
}
@@ -263,8 +272,8 @@ namespace RpcFunctions {
cds: CoinWithDenom[]): PayCoinInfo {
const ret: PayCoinInfo = {
originalCoins: [],
- updatedCoins: [],
sigs: [],
+ updatedCoins: [],
};
const contractTermsHash = hashString(canonicalJson(contractTerms));
@@ -325,8 +334,8 @@ namespace RpcFunctions {
const s: CoinPaySig = {
coin_pub: cd.coin.coinPub,
coin_sig: coinSig,
- denom_pub: cd.coin.denomPub,
contribution: coinSpend.toJson(),
+ denom_pub: cd.coin.denomPub,
ub_sig: cd.coin.denomSig,
};
ret.sigs.push(s);
diff --git a/src/crypto/emscInterface.ts b/src/crypto/emscInterface.ts
index 8c9a34132..ce52c88bd 100644
--- a/src/crypto/emscInterface.ts
+++ b/src/crypto/emscInterface.ts
@@ -26,9 +26,9 @@
/**
* Imports.
*/
-import {AmountJson} from "../types";
+import { AmountJson } from "../amounts";
-import {EmscFunGen, getLib} from "./emscLoader";
+import { EmscFunGen, getLib } from "./emscLoader";
const emscLib = getLib();