commit 69a7fe655abee4fcfa357d0448747c186c84e64e
parent cf672c3fc45e4f96b44d0279e189bee9cf2256c5
Author: Florian Dold <florian@dold.me>
Date: Mon, 27 Jan 2025 15:19:15 +0100
build system improvements
- towards a better typescript config structure
- remove files that should never have been committed to the repo
Diffstat:
9 files changed, 71 insertions(+), 193 deletions(-)
diff --git a/packages/taler-util/src/helpers.test.js b/packages/taler-util/src/helpers.test.js
@@ -1,41 +0,0 @@
-/*
- This file is part of TALER
- (C) 2017 Inria and GNUnet e.V.
-
- TALER is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-import test from "ava";
-import * as helpers from "./helpers";
-test("URL canonicalization", (t) => {
- // converts to relative, adds https
- t.is(
- "https://alice.example.com/exchange/",
- helpers.canonicalizeBaseUrl("alice.example.com/exchange"),
- );
- // keeps http, adds trailing slash
- t.is(
- "http://alice.example.com/exchange/",
- helpers.canonicalizeBaseUrl("http://alice.example.com/exchange"),
- );
- // keeps http, adds trailing slash
- t.is(
- "http://alice.example.com/exchange/",
- helpers.canonicalizeBaseUrl("http://alice.example.com/exchange#foobar"),
- );
- // Remove search component
- t.is(
- "http://alice.example.com/exchange/",
- helpers.canonicalizeBaseUrl("http://alice.example.com/exchange?foo=bar"),
- );
- t.pass();
-});
-//# sourceMappingURL=helpers.test.js.map
diff --git a/packages/taler-util/src/helpers.test.js.map b/packages/taler-util/src/helpers.test.js.map
@@ -1 +0,0 @@
-{"version":3,"file":"helpers.test.js","sourceRoot":"","sources":["helpers.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,IAAI,MAAM,KAAK,CAAC;AACvB,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,IAAI,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE,EAAE;IACjC,mCAAmC;IACnC,CAAC,CAAC,EAAE,CACF,qCAAqC,EACrC,OAAO,CAAC,mBAAmB,CAAC,4BAA4B,CAAC,CAC1D,CAAC;IAEF,kCAAkC;IAClC,CAAC,CAAC,EAAE,CACF,oCAAoC,EACpC,OAAO,CAAC,mBAAmB,CAAC,mCAAmC,CAAC,CACjE,CAAC;IAEF,kCAAkC;IAClC,CAAC,CAAC,EAAE,CACF,oCAAoC,EACpC,OAAO,CAAC,mBAAmB,CAAC,0CAA0C,CAAC,CACxE,CAAC;IAEF,0BAA0B;IAC1B,CAAC,CAAC,EAAE,CACF,oCAAoC,EACpC,OAAO,CAAC,mBAAmB,CAAC,2CAA2C,CAAC,CACzE,CAAC;IAEF,CAAC,CAAC,IAAI,EAAE,CAAC;AACX,CAAC,CAAC,CAAC"}
-\ No newline at end of file
diff --git a/packages/taler-util/src/http-impl.node.d.ts b/packages/taler-util/src/http-impl.node.d.ts
@@ -1,25 +0,0 @@
-import { HttpLibArgs } from "./http-common.js";
-import {
- HttpRequestLibrary,
- HttpRequestOptions,
- HttpResponse,
-} from "./http.js";
-/**
- * Implementation of the HTTP request library interface for node.
- */
-export declare class HttpLibImpl implements HttpRequestLibrary {
- private throttle;
- private throttlingEnabled;
- constructor(args?: HttpLibArgs);
- /**
- * Set whether requests should be throttled.
- */
- setThrottling(enabled: boolean): void;
- fetch(url: string, opt?: HttpRequestOptions): Promise<HttpResponse>;
- get(url: string, opt?: HttpRequestOptions): Promise<HttpResponse>;
- postJson(
- url: string,
- body: any,
- opt?: HttpRequestOptions,
- ): Promise<HttpResponse>;
-}
diff --git a/packages/taler-util/src/kdf.d.ts b/packages/taler-util/src/kdf.d.ts
@@ -1,21 +0,0 @@
-export declare function sha512(data: Uint8Array): Uint8Array;
-export declare function hmac(
- digest: (d: Uint8Array) => Uint8Array,
- blockSize: number,
- key: Uint8Array,
- message: Uint8Array,
-): Uint8Array;
-export declare function hmacSha512(
- key: Uint8Array,
- message: Uint8Array,
-): Uint8Array;
-export declare function hmacSha256(
- key: Uint8Array,
- message: Uint8Array,
-): Uint8Array;
-export declare function kdf(
- outputLength: number,
- ikm: Uint8Array,
- salt: Uint8Array,
- info: Uint8Array,
-): Uint8Array;
diff --git a/packages/taler-util/src/kdf.js b/packages/taler-util/src/kdf.js
@@ -1,75 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2019 GNUnet e.V.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-import * as nacl from "./nacl-fast.js";
-import { sha256 } from "./sha256.js";
-export function sha512(data) {
- return nacl.hash(data);
-}
-export function hmac(digest, blockSize, key, message) {
- if (key.byteLength > blockSize) {
- key = digest(key);
- }
- if (key.byteLength < blockSize) {
- const k = key;
- key = new Uint8Array(blockSize);
- key.set(k, 0);
- }
- const okp = new Uint8Array(blockSize);
- const ikp = new Uint8Array(blockSize);
- for (let i = 0; i < blockSize; i++) {
- ikp[i] = key[i] ^ 0x36;
- okp[i] = key[i] ^ 0x5c;
- }
- const b1 = new Uint8Array(blockSize + message.byteLength);
- b1.set(ikp, 0);
- b1.set(message, blockSize);
- const h0 = digest(b1);
- const b2 = new Uint8Array(blockSize + h0.length);
- b2.set(okp, 0);
- b2.set(h0, blockSize);
- return digest(b2);
-}
-export function hmacSha512(key, message) {
- return hmac(sha512, 128, key, message);
-}
-export function hmacSha256(key, message) {
- return hmac(sha256, 64, key, message);
-}
-export function kdf(outputLength, ikm, salt, info) {
- // extract
- const prk = hmacSha512(salt, ikm);
- // expand
- const N = Math.ceil(outputLength / 32);
- const output = new Uint8Array(N * 32);
- for (let i = 0; i < N; i++) {
- let buf;
- if (i == 0) {
- buf = new Uint8Array(info.byteLength + 1);
- buf.set(info, 0);
- } else {
- buf = new Uint8Array(info.byteLength + 1 + 32);
- for (let j = 0; j < 32; j++) {
- buf[j] = output[(i - 1) * 32 + j];
- }
- buf.set(info, 32);
- }
- buf[buf.length - 1] = i + 1;
- const chunk = hmacSha256(prk, buf);
- output.set(chunk, i * 32);
- }
- return output.slice(0, outputLength);
-}
-//# sourceMappingURL=kdf.js.map
diff --git a/packages/taler-util/src/kdf.js.map b/packages/taler-util/src/kdf.js.map
@@ -1 +0,0 @@
-{"version":3,"file":"kdf.js","sourceRoot":"","sources":["kdf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,UAAU,MAAM,CAAC,IAAgB;IACrC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,IAAI,CAClB,MAAqC,EACrC,SAAiB,EACjB,GAAe,EACf,OAAmB;IAEnB,IAAI,GAAG,CAAC,UAAU,GAAG,SAAS,EAAE;QAC9B,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;KACnB;IACD,IAAI,GAAG,CAAC,UAAU,GAAG,SAAS,EAAE;QAC9B,MAAM,CAAC,GAAG,GAAG,CAAC;QACd,GAAG,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC;QAChC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KACf;IACD,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,S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,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC1B,IAAI,GAAG,CAAC;QACR,IAAI,CAAC,IAAI,CAAC,EAAE;YACV,GAAG,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;YAC1C,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;SAClB;aAAM;YACL,GAAG,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;YAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;gBAC3B,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;aACnC;YACD,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;SACnB;QACD,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;KAC3B;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AACvC,CAAC"}
-\ No newline at end of file
diff --git a/packages/taler-util/tsconfig.json b/packages/taler-util/tsconfig.json
@@ -1,27 +1,10 @@
{
- "compileOnSave": true,
+ "extends": "../../tsconfig.defaults.json",
"compilerOptions": {
- "composite": true,
- "declaration": true,
- "declarationMap": false,
- "target": "ES2020",
- "module": "Node16",
- "moduleResolution": "Node16",
- "sourceMap": true,
"lib": ["ES2020"],
"types": ["node"],
- "noImplicitReturns": true,
- "noFallthroughCasesInSwitch": true,
- "strict": true,
- "strictPropertyInitialization": false,
"outDir": "lib",
- "noImplicitAny": true,
- "noImplicitThis": true,
- "incremental": true,
- "esModuleInterop": true,
- "importHelpers": true,
- "rootDir": "./src",
- "typeRoots": ["./node_modules/@types"]
+ "rootDir": "./src"
},
"include": ["src/**/*"]
}
diff --git a/tsconfig.build.json b/tsconfig.build.json
@@ -1,32 +1,66 @@
+// Entry point to compile the whole project
+// via TypeScript's build mode.
+//
+// Use it like this:
+// ./node_modules/.bin/tsc --build tsconfig.build.json
+//
+// All packages in the repository should be listed in the
+// references below.
{
- "compileOnSave": true,
"compilerOptions": {
"composite": true
},
"references": [
{
+ "path": "packages/aml-backoffice-ui/"
+ },
+ {
+ "path": "packages/anastasis-cli/"
+ },
+ {
+ "path": "packages/anastasis-core"
+ },
+ {
+ "path": "packages/auditor-backoffice-ui"
+ },
+ {
+ "path": "packages/bank-ui"
+ },
+ {
+ "path": "packages/challenger-ui/"
+ },
+ {
"path": "packages/idb-bridge/"
},
{
- "path": "packages/taler-wallet-core/"
+ "path": "packages/kyc-ui/"
},
{
- "path": "packages/taler-wallet-cli/"
+ "path": "packages/merchant-backend-ui/"
},
{
- "path": "packages/taler-wallet-embedded/"
+ "path": "packages/merchant-backoffice-ui/"
},
{
- "path": "packages/taler-util/"
+ "path": "packages/pogen"
},
{
- "path": "packages/taler-wallet-webextension//"
+ "path": "packages/taler-harness"
+ },
+ {
+ "path": "packages/taler-util"
+ },
+ {
+ "path": "packages/taler-wallet-cli/"
+ },
+ {
+ "path": "packages/taler-wallet-core/"
},
{
- "path": "packages/anastasis-core/"
+ "path": "packages/taler-wallet-embedded"
},
{
- "path": "packages/taler-harness/"
+ "path": "packages/taler-wallet-webextension"
}
],
"files": []
diff --git a/tsconfig.defaults.json b/tsconfig.defaults.json
@@ -0,0 +1,27 @@
+// Default typescript compiler settings.
+// All other packages in this repo should
+// extend this config.
+{
+ "compileOnSave": true,
+ "compilerOptions": {
+ // General compilation settings
+ "composite": true,
+ "incremental": true,
+ "declaration": true,
+ "declarationMap": false,
+ "sourceMap": true,
+ // Strictness-related settings
+ "noImplicitReturns": true,
+ "noFallthroughCasesInSwitch": true,
+ "strict": true,
+ "strictPropertyInitialization": false,
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ // Settings for module resolution and emit
+ "importHelpers": true,
+ "target": "ES2020",
+ "module": "Node16",
+ "moduleResolution": "Node16",
+ "esModuleInterop": true
+ }
+}