idb-bridge: use lodash cloneDeep

This commit is contained in:
Florian Dold 2021-12-09 18:19:48 +01:00
parent 423af144ee
commit 38d8239f93
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
6 changed files with 14 additions and 11 deletions

View File

@ -19,6 +19,7 @@
"@rollup/plugin-commonjs": "^17.1.0", "@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-json": "^4.1.0", "@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.2.0", "@rollup/plugin-node-resolve": "^11.2.0",
"@types/lodash": "^4.14.178",
"@types/node": "^14.14.22", "@types/node": "^14.14.22",
"ava": "^3.15.0", "ava": "^3.15.0",
"esm": "^3.2.25", "esm": "^3.2.25",
@ -28,6 +29,7 @@
"typescript": "^4.1.3" "typescript": "^4.1.3"
}, },
"dependencies": { "dependencies": {
"lodash": "^4.17.21",
"tslib": "^2.1.0" "tslib": "^2.1.0"
}, },
"ava": { "ava": {

View File

@ -1070,6 +1070,7 @@ export class MemoryBackend implements Backend {
btx: DatabaseTransaction, btx: DatabaseTransaction,
req: RecordGetRequest, req: RecordGetRequest,
): Promise<RecordGetResponse> { ): Promise<RecordGetResponse> {
console.log(`getRecords ${req.objectStoreName}`);
if (this.enableTracing) { if (this.enableTracing) {
console.log(`TRACING: getRecords`); console.log(`TRACING: getRecords`);
console.log("query", req); console.log("query", req);

View File

@ -14,6 +14,8 @@
permissions and limitations under the License. permissions and limitations under the License.
*/ */
import cloneDeep from "lodash/cloneDeep";
const { toString: toStr } = {}; const { toString: toStr } = {};
const hasOwn = {}.hasOwnProperty; const hasOwn = {}.hasOwnProperty;
const getProto = Object.getPrototypeOf; const getProto = Object.getPrototypeOf;
@ -260,5 +262,5 @@ export function structuredRevive(val: any): any {
* Structured clone for IndexedDB. * Structured clone for IndexedDB.
*/ */
export function structuredClone(val: any): any { export function structuredClone(val: any): any {
return structuredRevive(structuredEncapsulate(val)); return cloneDeep(val);
} }

View File

@ -270,7 +270,6 @@ export class CryptoImplementation {
const coinPriv = decodeCrock(coin.coinPriv); const coinPriv = decodeCrock(coin.coinPriv);
const coinSig = eddsaSign(p, coinPriv); const coinSig = eddsaSign(p, coinPriv);
if (coin.denomPub.cipher === DenomKeyType.LegacyRsa) { if (coin.denomPub.cipher === DenomKeyType.LegacyRsa) {
logger.info("creating legacy recoup request");
const paybackRequest: RecoupRequest = { const paybackRequest: RecoupRequest = {
coin_blind_key_secret: coin.blindingKey, coin_blind_key_secret: coin.blindingKey,
coin_pub: coin.coinPub, coin_pub: coin.coinPub,
@ -281,7 +280,6 @@ export class CryptoImplementation {
}; };
return paybackRequest; return paybackRequest;
} else { } else {
logger.info("creating v10 recoup request");
const paybackRequest: RecoupRequest = { const paybackRequest: RecoupRequest = {
coin_blind_key_secret: coin.blindingKey, coin_blind_key_secret: coin.blindingKey,
coin_pub: coin.coinPub, coin_pub: coin.coinPub,
@ -453,7 +451,6 @@ export class CryptoImplementation {
const hExt = new Uint8Array(64); const hExt = new Uint8Array(64);
let d: Uint8Array; let d: Uint8Array;
if (depositInfo.denomKeyType === DenomKeyType.Rsa) { if (depositInfo.denomKeyType === DenomKeyType.Rsa) {
logger.warn("signing v10 deposit permission");
d = buildSigPS(TalerSignaturePurpose.WALLET_COIN_DEPOSIT) d = buildSigPS(TalerSignaturePurpose.WALLET_COIN_DEPOSIT)
.put(decodeCrock(depositInfo.contractTermsHash)) .put(decodeCrock(depositInfo.contractTermsHash))
.put(hExt) .put(hExt)
@ -466,7 +463,6 @@ export class CryptoImplementation {
.put(decodeCrock(depositInfo.merchantPub)) .put(decodeCrock(depositInfo.merchantPub))
.build(); .build();
} else if (depositInfo.denomKeyType === DenomKeyType.LegacyRsa) { } else if (depositInfo.denomKeyType === DenomKeyType.LegacyRsa) {
logger.warn("signing legacy deposit permission");
d = buildSigPS(TalerSignaturePurpose.WALLET_COIN_DEPOSIT) d = buildSigPS(TalerSignaturePurpose.WALLET_COIN_DEPOSIT)
.put(decodeCrock(depositInfo.contractTermsHash)) .put(decodeCrock(depositInfo.contractTermsHash))
.put(decodeCrock(depositInfo.wireInfoHash)) .put(decodeCrock(depositInfo.wireInfoHash))

View File

@ -1658,11 +1658,6 @@ export async function confirmPay(
throw Error("proposal is in invalid state"); throw Error("proposal is in invalid state");
} }
const merchantInfo = await ws.merchantOps.getMerchantInfo(
ws,
d.contractData.merchantBaseUrl,
);
const existingPurchase = await ws.db const existingPurchase = await ws.db
.mktx((x) => ({ purchases: x.purchases })) .mktx((x) => ({ purchases: x.purchases }))
.runReadWrite(async (tx) => { .runReadWrite(async (tx) => {

View File

@ -129,20 +129,24 @@ importers:
'@rollup/plugin-commonjs': ^17.1.0 '@rollup/plugin-commonjs': ^17.1.0
'@rollup/plugin-json': ^4.1.0 '@rollup/plugin-json': ^4.1.0
'@rollup/plugin-node-resolve': ^11.2.0 '@rollup/plugin-node-resolve': ^11.2.0
'@types/lodash': ^4.14.178
'@types/node': ^14.14.22 '@types/node': ^14.14.22
ava: ^3.15.0 ava: ^3.15.0
esm: ^3.2.25 esm: ^3.2.25
lodash: ^4.17.21
prettier: ^2.2.1 prettier: ^2.2.1
rimraf: ^3.0.2 rimraf: ^3.0.2
rollup: ^2.37.1 rollup: ^2.37.1
tslib: ^2.1.0 tslib: ^2.1.0
typescript: ^4.1.3 typescript: ^4.1.3
dependencies: dependencies:
lodash: 4.17.21
tslib: 2.1.0 tslib: 2.1.0
devDependencies: devDependencies:
'@rollup/plugin-commonjs': 17.1.0_rollup@2.37.1 '@rollup/plugin-commonjs': 17.1.0_rollup@2.37.1
'@rollup/plugin-json': 4.1.0_rollup@2.37.1 '@rollup/plugin-json': 4.1.0_rollup@2.37.1
'@rollup/plugin-node-resolve': 11.2.0_rollup@2.37.1 '@rollup/plugin-node-resolve': 11.2.0_rollup@2.37.1
'@types/lodash': 4.14.178
'@types/node': 14.14.22 '@types/node': 14.14.22
ava: 3.15.0 ava: 3.15.0
esm: 3.2.25 esm: 3.2.25
@ -10165,6 +10169,10 @@ packages:
resolution: {integrity: sha1-7ihweulOEdK4J7y+UnC86n8+ce4=} resolution: {integrity: sha1-7ihweulOEdK4J7y+UnC86n8+ce4=}
dev: true dev: true
/@types/lodash/4.14.178:
resolution: {integrity: sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw==}
dev: true
/@types/markdown-to-jsx/6.11.3: /@types/markdown-to-jsx/6.11.3:
resolution: {integrity: sha512-30nFYpceM/ZEvhGiqWjm5quLUxNeld0HCzJEXMZZDpq53FPkS85mTwkWtCXzCqq8s5JYLgM5W392a02xn8Bdaw==} resolution: {integrity: sha512-30nFYpceM/ZEvhGiqWjm5quLUxNeld0HCzJEXMZZDpq53FPkS85mTwkWtCXzCqq8s5JYLgM5W392a02xn8Bdaw==}
dependencies: dependencies:
@ -19327,7 +19335,6 @@ packages:
/lodash/4.17.21: /lodash/4.17.21:
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
dev: true
/log-symbols/4.1.0: /log-symbols/4.1.0:
resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==}