This commit is contained in:
Sebastian 2022-09-21 15:43:35 -03:00
parent 2caef6dcf2
commit 5d31803c92
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
18 changed files with 206 additions and 652 deletions

View File

@ -21,7 +21,6 @@ import { AbsoluteTime } from "./time.js";
* Implementation of token bucket throttling. * Implementation of token bucket throttling.
*/ */
const logger = new Logger("RequestThrottler.ts"); const logger = new Logger("RequestThrottler.ts");
/** /**

View File

@ -466,6 +466,4 @@ export class Amounts {
} }
return amountFractionalLength - i + 1; return amountFractionalLength - i + 1;
} }
} }

View File

@ -18,7 +18,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
var CHARSET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l'; var CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
var GENERATOR = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3]; var GENERATOR = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3];
const encodings: any = { const encodings: any = {
@ -38,7 +38,7 @@ function getEncodingConst(enc: any) {
} else if (enc == encodings.BECH32M) { } else if (enc == encodings.BECH32M) {
return 0x2bc830a3; return 0x2bc830a3;
} else { } else {
throw new Error('unknown encoding') throw new Error("unknown encoding");
} }
} }
@ -46,7 +46,7 @@ function polymod(values: any) {
var chk = 1; var chk = 1;
for (var p = 0; p < values.length; ++p) { for (var p = 0; p < values.length; ++p) {
var top = chk >> 25; var top = chk >> 25;
chk = (chk & 0x1ffffff) << 5 ^ values[p]; chk = ((chk & 0x1ffffff) << 5) ^ values[p];
for (var i = 0; i < 5; ++i) { for (var i = 0; i < 5; ++i) {
if ((top >> i) & 1) { if ((top >> i) & 1) {
chk ^= GENERATOR[i]; chk ^= GENERATOR[i];
@ -78,14 +78,14 @@ function createChecksum(hrp: any, data: any, enc: any) {
var mod = polymod(values) ^ getEncodingConst(enc); var mod = polymod(values) ^ getEncodingConst(enc);
var ret = []; var ret = [];
for (var p = 0; p < 6; ++p) { for (var p = 0; p < 6; ++p) {
ret.push((mod >> 5 * (5 - p)) & 31); ret.push((mod >> (5 * (5 - p))) & 31);
} }
return ret; return ret;
} }
function encode(hrp: any, data: any, enc: any): string { function encode(hrp: any, data: any, enc: any): string {
var combined = data.concat(createChecksum(hrp, data, enc)); var combined = data.concat(createChecksum(hrp, data, enc));
var ret = hrp + '1'; var ret = hrp + "1";
for (var p = 0; p < combined.length; ++p) { for (var p = 0; p < combined.length; ++p) {
ret += CHARSET.charAt(combined[p]); ret += CHARSET.charAt(combined[p]);
} }
@ -111,7 +111,7 @@ function decode(bechString: any, enc: any) {
return null; return null;
} }
bechString = bechString.toLowerCase(); bechString = bechString.toLowerCase();
var pos = bechString.lastIndexOf('1'); var pos = bechString.lastIndexOf("1");
if (pos < 1 || pos + 7 > bechString.length || bechString.length > 90) { if (pos < 1 || pos + 7 > bechString.length || bechString.length > 90) {
return null; return null;
} }

View File

@ -19,59 +19,90 @@
*/ */
import test from "ava"; import test from "ava";
import { import { generateFakeSegwitAddress } from "./bitcoin.js";
generateFakeSegwitAddress,
} from "./bitcoin.js";
test("generate testnet", (t) => { test("generate testnet", (t) => {
const [addr1, addr2] = generateFakeSegwitAddress("B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XSG", "tb1qhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") const [addr1, addr2] = generateFakeSegwitAddress(
"B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XSG",
"tb1qhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v",
);
t.assert(addr1 === "tb1qtfwqwaj6tsrhdtvuyhflr6nklm8ldqxpf0lfjw"); t.assert(addr1 === "tb1qtfwqwaj6tsrhdtvuyhflr6nklm8ldqxpf0lfjw");
t.assert(addr2 === "tb1qmfwqwa5vr5vdac6wr20ts76aewakzpmns40yuf"); t.assert(addr2 === "tb1qmfwqwa5vr5vdac6wr20ts76aewakzpmns40yuf");
}); });
test("generate mainnet", (t) => { test("generate mainnet", (t) => {
const [addr1, addr2] = generateFakeSegwitAddress("B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XSG", "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq") const [addr1, addr2] = generateFakeSegwitAddress(
"B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XSG",
"bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq",
);
//bc //bc
t.assert(addr1 === "bc1qtfwqwaj6tsrhdtvuyhflr6nklm8ldqxprfy6fa"); t.assert(addr1 === "bc1qtfwqwaj6tsrhdtvuyhflr6nklm8ldqxprfy6fa");
t.assert(addr2 === "bc1qmfwqwa5vr5vdac6wr20ts76aewakzpmn6n5h86"); t.assert(addr2 === "bc1qmfwqwa5vr5vdac6wr20ts76aewakzpmn6n5h86");
}); });
test("generate Regtest", (t) => { test("generate Regtest", (t) => {
const [addr1, addr2] = generateFakeSegwitAddress("B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XSG", "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") const [addr1, addr2] = generateFakeSegwitAddress(
"B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XSG",
"bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v",
);
t.assert(addr1 === "bcrt1qtfwqwaj6tsrhdtvuyhflr6nklm8ldqxptxxy98"); t.assert(addr1 === "bcrt1qtfwqwaj6tsrhdtvuyhflr6nklm8ldqxptxxy98");
t.assert(addr2 === "bcrt1qmfwqwa5vr5vdac6wr20ts76aewakzpmnjukftq"); t.assert(addr2 === "bcrt1qmfwqwa5vr5vdac6wr20ts76aewakzpmnjukftq");
}); });
test("unknown net", (t) => { test("unknown net", (t) => {
t.throws(() => { t.throws(() => {
generateFakeSegwitAddress("B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XSG", "abqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") generateFakeSegwitAddress(
}) "B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XSG",
"abqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v",
);
});
}); });
test("invalid or no reserve", (t) => { test("invalid or no reserve", (t) => {
let result = undefined; let result = undefined;
// empty // empty
result = generateFakeSegwitAddress("", "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") result = generateFakeSegwitAddress(
t.deepEqual(result, []) "",
"bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v",
);
t.deepEqual(result, []);
// small // small
result = generateFakeSegwitAddress("s", "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") result = generateFakeSegwitAddress(
t.deepEqual(result, []) "s",
result = generateFakeSegwitAddress("asdsad", "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v",
t.deepEqual(result, []) );
result = generateFakeSegwitAddress("asdasdasdasdasdasd", "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") t.deepEqual(result, []);
t.deepEqual(result, []) result = generateFakeSegwitAddress(
result = generateFakeSegwitAddress("B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XS", "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") "asdsad",
t.deepEqual(result, []) "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v",
result = generateFakeSegwitAddress("B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XSSSS", "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") );
t.deepEqual(result, []) t.deepEqual(result, []);
result = generateFakeSegwitAddress(
"asdasdasdasdasdasd",
"bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v",
);
t.deepEqual(result, []);
result = generateFakeSegwitAddress(
"B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XS",
"bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v",
);
t.deepEqual(result, []);
result = generateFakeSegwitAddress(
"B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XSSSS",
"bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v",
);
t.deepEqual(result, []);
// no reserve // no reserve
result = generateFakeSegwitAddress(undefined, "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") result = generateFakeSegwitAddress(
t.deepEqual(result, []) undefined,
result = generateFakeSegwitAddress("B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XS-", "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v",
t.deepEqual(result, []) );
t.deepEqual(result, []);
result = generateFakeSegwitAddress(
"B9E0EXNDKGJX7WFAEVZCZXM0R661T66YWD71N7NRFDEWQEV10XS-",
"bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v",
);
t.deepEqual(result, []);
}); });

View File

@ -26,7 +26,6 @@ import { AmountJson, Amounts } from "./amounts.js";
import { decodeCrock } from "./talerCrypto.js"; import { decodeCrock } from "./talerCrypto.js";
import * as segwit from "./segwit_addr.js"; import * as segwit from "./segwit_addr.js";
function buf2hex(buffer: Uint8Array) { function buf2hex(buffer: Uint8Array) {
// buffer is an ArrayBuffer // buffer is an ArrayBuffer
return [...new Uint8Array(buffer)] return [...new Uint8Array(buffer)]
@ -35,24 +34,23 @@ function buf2hex(buffer: Uint8Array) {
} }
const hext2buf = (hexString: string) => const hext2buf = (hexString: string) =>
new Uint8Array(hexString.match(/.{1,2}/g)!.map(byte => parseInt(byte, 16))); new Uint8Array(hexString.match(/.{1,2}/g)!.map((byte) => parseInt(byte, 16)));
export function generateFakeSegwitAddress( export function generateFakeSegwitAddress(
reservePub: string | undefined, reservePub: string | undefined,
addr: string addr: string,
): string[] { ): string[] {
if (!reservePub) return [] if (!reservePub) return [];
let pub; let pub;
try { try {
pub = decodeCrock(reservePub); pub = decodeCrock(reservePub);
} catch { } catch {
// pub = new Uint8Array(0) // pub = new Uint8Array(0)
} }
if (!pub || pub.length !== 32) return [] if (!pub || pub.length !== 32) return [];
const first_rnd = new Uint8Array(4); const first_rnd = new Uint8Array(4);
first_rnd.set(pub.subarray(0, 4)) first_rnd.set(pub.subarray(0, 4));
const second_rnd = new Uint8Array(4); const second_rnd = new Uint8Array(4);
second_rnd.set(pub.subarray(0, 4)); second_rnd.set(pub.subarray(0, 4));
@ -80,7 +78,7 @@ export function generateFakeSegwitAddress(
const addr1 = segwit.default.encode(prefix, 0, first_part); const addr1 = segwit.default.encode(prefix, 0, first_part);
const addr2 = segwit.default.encode(prefix, 0, second_part); const addr2 = segwit.default.encode(prefix, 0, second_part);
return [addr1, addr2] return [addr1, addr2];
} }
// https://github.com/bitcoin/bitcoin/blob/master/src/policy/policy.cpp // https://github.com/bitcoin/bitcoin/blob/master/src/policy/policy.cpp

View File

@ -134,7 +134,7 @@ class UnionCodecBuilder<
TargetType, TargetType,
TagPropertyLabel extends keyof TargetType, TagPropertyLabel extends keyof TargetType,
CommonBaseType, CommonBaseType,
PartialTargetType PartialTargetType,
> { > {
private alternatives = new Map<any, Alternative>(); private alternatives = new Map<any, Alternative>();

View File

@ -27,11 +27,7 @@ import {
const logger = new Logger("contractTerms.ts"); const logger = new Logger("contractTerms.ts");
export namespace ContractTermsUtil { export namespace ContractTermsUtil {
export function forgetAllImpl( export function forgetAllImpl(
anyJson: any, anyJson: any,
path: string[], path: string[],
@ -76,7 +72,6 @@ export namespace ContractTermsUtil {
return dup; return dup;
} }
export type PathPredicate = (path: string[]) => boolean; export type PathPredicate = (path: string[]) => boolean;
/** /**

View File

@ -14,7 +14,7 @@ export function setupI18n(lang: string, strings: { [s: string]: any }): any {
lang = lang.replace("_", "-"); lang = lang.replace("_", "-");
if (!strings[lang]) { if (!strings[lang]) {
strings[lang] = {} strings[lang] = {};
// logger.warn(`language ${lang} not found, defaulting to source strings`); // logger.warn(`language ${lang} not found, defaulting to source strings`);
} }
jed = new jedLib.Jed(strings[lang]); jed = new jedLib.Jed(strings[lang]);
@ -45,7 +45,10 @@ function toI18nString(stringSeq: ReadonlyArray<string>): string {
/** /**
* Internationalize a string template with arbitrary serialized values. * Internationalize a string template with arbitrary serialized values.
*/ */
export function singular(stringSeq: TemplateStringsArray, ...values: any[]): string { export function singular(
stringSeq: TemplateStringsArray,
...values: any[]
): string {
const s = toI18nString(stringSeq); const s = toI18nString(stringSeq);
const tr = jed const tr = jed
.translate(s) .translate(s)
@ -70,13 +73,19 @@ export function translate(
/** /**
* Internationalize a string template without serializing * Internationalize a string template without serializing
*/ */
export function Translate({ children, debug, }: { children: any, debug?: boolean }): any { export function Translate({
children,
debug,
}: {
children: any;
debug?: boolean;
}): any {
const c = [].concat(children); const c = [].concat(children);
const s = stringifyArray(c); const s = stringifyArray(c);
if (!s) return []; if (!s) return [];
const translation: string = jed.ngettext(s, s, 1); const translation: string = jed.ngettext(s, s, 1);
if (debug) { if (debug) {
console.log("looking for ", s, "got", translation) console.log("looking for ", s, "got", translation);
} }
return replacePlaceholderWithValues(translation, c); return replacePlaceholderWithValues(translation, c);
} }
@ -148,4 +157,3 @@ export const i18n = {
Translate, Translate,
translate, translate,
}; };

View File

@ -1,5 +1,21 @@
export declare function sha512(data: Uint8Array): Uint8Array; 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 hmac(
export declare function hmacSha512(key: Uint8Array, message: Uint8Array): Uint8Array; digest: (d: Uint8Array) => Uint8Array,
export declare function hmacSha256(key: Uint8Array, message: Uint8Array): Uint8Array; blockSize: number,
export declare function kdf(outputLength: number, ikm: Uint8Array, salt: Uint8Array, info: Uint8Array): Uint8Array; 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;

View File

@ -59,8 +59,7 @@ export function kdf(outputLength, ikm, salt, info) {
if (i == 0) { if (i == 0) {
buf = new Uint8Array(info.byteLength + 1); buf = new Uint8Array(info.byteLength + 1);
buf.set(info, 0); buf.set(info, 0);
} } else {
else {
buf = new Uint8Array(info.byteLength + 1 + 32); buf = new Uint8Array(info.byteLength + 1 + 32);
for (let j = 0; j < 32; j++) { for (let j = 0; j < 32; j++) {
buf[j] = output[(i - 1) * 32 + j]; buf[j] = output[(i - 1) * 32 + j];

View File

@ -140,16 +140,18 @@ export function parsePaytoUri(s: string): PaytoUri | undefined {
}; };
} }
if (targetType === "bitcoin") { if (targetType === "bitcoin") {
const msg = /\b([A-Z0-9]{52})\b/.exec(params["message"]) const msg = /\b([A-Z0-9]{52})\b/.exec(params["message"]);
const reserve = !msg ? params["subject"] : msg[0]; const reserve = !msg ? params["subject"] : msg[0];
const segwitAddrs = !reserve ? [] : generateFakeSegwitAddress(reserve, targetPath); const segwitAddrs = !reserve
? []
: generateFakeSegwitAddress(reserve, targetPath);
const result: PaytoUriBitcoin = { const result: PaytoUriBitcoin = {
isKnown: true, isKnown: true,
targetPath, targetPath,
targetType, targetType,
params, params,
segwitAddrs segwitAddrs,
}; };
return result; return result;

View File

@ -18,21 +18,26 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
import bech32 from "./bech32.js" import bech32 from "./bech32.js";
export default { export default {
encode: encode, encode: encode,
decode: decode decode: decode,
}; };
function convertbits(data: any, frombits: number, tobits: number, pad: boolean): any[] { function convertbits(
data: any,
frombits: number,
tobits: number,
pad: boolean,
): any[] {
var acc = 0; var acc = 0;
var bits = 0; var bits = 0;
var ret = []; var ret = [];
var maxv = (1 << tobits) - 1; var maxv = (1 << tobits) - 1;
for (var p = 0; p < data.length; ++p) { for (var p = 0; p < data.length; ++p) {
var value = data[p]; var value = data[p];
if (value < 0 || (value >> frombits) !== 0) { if (value < 0 || value >> frombits !== 0) {
return []; //check this, was returning null return []; //check this, was returning null
} }
acc = (acc << frombits) | value; acc = (acc << frombits) | value;
@ -46,7 +51,7 @@ function convertbits(data: any, frombits: number, tobits: number, pad: boolean):
if (bits > 0) { if (bits > 0) {
ret.push((acc << (tobits - bits)) & maxv); ret.push((acc << (tobits - bits)) & maxv);
} }
} else if (bits >= frombits || ((acc << (tobits - bits)) & maxv)) { } else if (bits >= frombits || (acc << (tobits - bits)) & maxv) {
return []; //check this, was returning null return []; //check this, was returning null
} }
return ret; return ret;
@ -59,7 +64,12 @@ function decode(hrp: any, addr: string) {
dec = bech32.decode(addr, bech32.encodings.BECH32M); dec = bech32.decode(addr, bech32.encodings.BECH32M);
bech32m = true; bech32m = true;
} }
if (dec === null || dec.hrp !== hrp || dec.data.length < 1 || dec.data[0] > 16) { if (
dec === null ||
dec.hrp !== hrp ||
dec.data.length < 1 ||
dec.data[0] > 16
) {
return null; return null;
} }
var res = convertbits(dec.data.slice(1), 5, 8, false); var res = convertbits(dec.data.slice(1), 5, 8, false);
@ -83,7 +93,11 @@ function encode(hrp: any, version: number, program: any): string {
if (version > 0) { if (version > 0) {
enc = bech32.encodings.BECH32M; enc = bech32.encodings.BECH32M;
} }
var ret = bech32.encode(hrp, [version].concat(convertbits(program, 8, 5, true)), enc); var ret = bech32.encode(
hrp,
[version].concat(convertbits(program, 8, 5, true)),
enc,
);
if (decode(hrp, ret /*, enc*/) === null) { if (decode(hrp, ret /*, enc*/) === null) {
return ""; //check this was returning null return ""; //check this was returning null
} }

View File

@ -16,70 +16,17 @@ export const blockSize = 64;
// SHA-256 constants // SHA-256 constants
const K = new Uint32Array([ const K = new Uint32Array([
0x428a2f98, 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
0x71374491, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
0xb5c0fbcf, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
0xe9b5dba5, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x3956c25b, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
0x59f111f1, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
0x923f82a4, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
0xab1c5ed5, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0xd807aa98, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
0x12835b01, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
0x243185be, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
0x550c7dc3,
0x72be5d74,
0x80deb1fe,
0x9bdc06a7,
0xc19bf174,
0xe49b69c1,
0xefbe4786,
0x0fc19dc6,
0x240ca1cc,
0x2de92c6f,
0x4a7484aa,
0x5cb0a9dc,
0x76f988da,
0x983e5152,
0xa831c66d,
0xb00327c8,
0xbf597fc7,
0xc6e00bf3,
0xd5a79147,
0x06ca6351,
0x14292967,
0x27b70a85,
0x2e1b2138,
0x4d2c6dfc,
0x53380d13,
0x650a7354,
0x766a0abb,
0x81c2c92e,
0x92722c85,
0xa2bfe8a1,
0xa81a664b,
0xc24b8b70,
0xc76c51a3,
0xd192e819,
0xd6990624,
0xf40e3585,
0x106aa070,
0x19a4c116,
0x1e376c08,
0x2748774c,
0x34b0bcb5,
0x391c0cb3,
0x4ed8aa4a,
0x5b9cca4f,
0x682e6ff3,
0x748f82ee,
0x78a5636f,
0x84c87814,
0x8cc70208,
0x90befffa,
0xa4506ceb,
0xbef9a3f7,
0xc67178f2,
]); ]);
function hashBlocks( function hashBlocks(

File diff suppressed because it is too large Load Diff

View File

@ -56,7 +56,10 @@ export namespace TalerProtocolTimestamp {
t_s: s, t_s: s,
}; };
} }
export function min(t1: TalerProtocolTimestamp, t2: TalerProtocolTimestamp): TalerProtocolTimestamp { export function min(
t1: TalerProtocolTimestamp,
t2: TalerProtocolTimestamp,
): TalerProtocolTimestamp {
if (t1.t_s === "never") { if (t1.t_s === "never") {
return { t_s: t2.t_s }; return { t_s: t2.t_s };
} }
@ -65,7 +68,6 @@ export namespace TalerProtocolTimestamp {
} }
return { t_s: Math.min(t1.t_s, t2.t_s) }; return { t_s: Math.min(t1.t_s, t2.t_s) };
} }
} }
export interface Duration { export interface Duration {