@taquito/timelock 19.2.0-RC.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +64 -0
- package/dist/lib/chest.js +93 -0
- package/dist/lib/interface.js +2 -0
- package/dist/lib/taquito-timelock.js +22 -0
- package/dist/lib/timelock-util.js +237 -0
- package/dist/lib/version.js +8 -0
- package/dist/taquito-timelock.es6.js +316 -0
- package/dist/taquito-timelock.es6.js.map +1 -0
- package/dist/taquito-timelock.umd.js +343 -0
- package/dist/taquito-timelock.umd.js.map +1 -0
- package/dist/types/chest.d.ts +27 -0
- package/dist/types/interface.d.ts +14 -0
- package/dist/types/taquito-timelock.d.ts +3 -0
- package/dist/types/timelock-util.d.ts +33 -0
- package/dist/types/version.d.ts +4 -0
- package/package.json +99 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BigInteger } from 'big-integer';
|
|
2
|
+
export interface RNG {
|
|
3
|
+
getRandomValues: (array: Uint8Array) => Uint8Array;
|
|
4
|
+
}
|
|
5
|
+
export interface TimelockInit {
|
|
6
|
+
lockedValue: BigInteger;
|
|
7
|
+
unlockedValue: BigInteger;
|
|
8
|
+
vdfProof: BigInteger;
|
|
9
|
+
modulus?: BigInteger;
|
|
10
|
+
}
|
|
11
|
+
export interface CipherText {
|
|
12
|
+
nonce: Uint8Array;
|
|
13
|
+
payload: Uint8Array;
|
|
14
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import bigInt, { BigInteger } from 'big-integer';
|
|
2
|
+
import { TimelockInit, RNG } from './interface';
|
|
3
|
+
export declare const RSA_MODULUS: bigInt.BigInteger;
|
|
4
|
+
export declare function prove(time: number, locked: BigInteger, unlocked: BigInteger, mod?: BigInteger): TimelockProof;
|
|
5
|
+
export declare function unlockAndProve(time: number, locked: BigInteger, mod?: BigInteger): TimelockProof;
|
|
6
|
+
export declare function verify(locked: BigInteger, proof: TimelockProof, time: number): boolean;
|
|
7
|
+
export declare class Timelock {
|
|
8
|
+
lockedValue: BigInteger;
|
|
9
|
+
unlockedValue: BigInteger;
|
|
10
|
+
vdfProof: BigInteger;
|
|
11
|
+
modulus: BigInteger;
|
|
12
|
+
constructor({ lockedValue, unlockedValue, vdfProof, modulus }: TimelockInit);
|
|
13
|
+
static precompute(time: number, mod?: BigInteger, rng?: RNG): Timelock;
|
|
14
|
+
getProof(time: number, rng?: RNG): {
|
|
15
|
+
lockedValue: BigInteger;
|
|
16
|
+
proof: TimelockProof;
|
|
17
|
+
};
|
|
18
|
+
encode(): Uint8Array;
|
|
19
|
+
static fromArray(buf: Uint8Array, mod?: BigInteger): [Timelock, number];
|
|
20
|
+
}
|
|
21
|
+
export declare class TimelockProof {
|
|
22
|
+
vdfTuple: Timelock;
|
|
23
|
+
nonce: BigInteger;
|
|
24
|
+
constructor({ vdfTuple, nonce }: {
|
|
25
|
+
vdfTuple: Timelock;
|
|
26
|
+
nonce: BigInteger;
|
|
27
|
+
});
|
|
28
|
+
symmetricKey(): Uint8Array;
|
|
29
|
+
encode(): Uint8Array;
|
|
30
|
+
static fromArray(buf: Uint8Array, mod?: BigInteger): [TimelockProof, number];
|
|
31
|
+
}
|
|
32
|
+
export declare function encodeBigInt(v: BigInteger): number[];
|
|
33
|
+
export declare function decodeBigInt(buf: ArrayLike<number>): [BigInteger, number];
|
package/package.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@taquito/timelock",
|
|
3
|
+
"version": "19.2.0-RC.0",
|
|
4
|
+
"description": "TypeScript implementation of the Timelock feature in Tezos",
|
|
5
|
+
"main": "./dist/taquito-timelock.umd.js",
|
|
6
|
+
"module": "./dist/taquito-timelock.es6.js",
|
|
7
|
+
"typings": "./dist/types/taquito-timelock.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"signature.json"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"author": "Eugene Zagidullin <eugene@ecadlabs.com>",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": ""
|
|
19
|
+
},
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=18"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "jest --coverage",
|
|
26
|
+
"test:watch": "jest --coverage --watch",
|
|
27
|
+
"test:prod": "npm run lint && npm run test -- --no-cache",
|
|
28
|
+
"lint": "eslint --ext .js,.ts .",
|
|
29
|
+
"precommit": "lint-staged",
|
|
30
|
+
"prebuild": "rimraf dist",
|
|
31
|
+
"version-stamp": "node ../taquito/version-stamping.js",
|
|
32
|
+
"build": "tsc --project ./tsconfig.prod.json --module commonjs && rollup -c rollup.config.ts --bundleConfigAsCjs",
|
|
33
|
+
"start": "rollup -c rollup.config.ts --bundleConfigAsCjs -w"
|
|
34
|
+
},
|
|
35
|
+
"lint-staged": {
|
|
36
|
+
"{src,test}/**/*.ts": [
|
|
37
|
+
"prettier --write",
|
|
38
|
+
"eslint --fix"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"jest": {
|
|
42
|
+
"transform": {
|
|
43
|
+
".(ts|tsx)": "ts-jest"
|
|
44
|
+
},
|
|
45
|
+
"testEnvironment": "node",
|
|
46
|
+
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
|
|
47
|
+
"moduleFileExtensions": [
|
|
48
|
+
"ts",
|
|
49
|
+
"tsx",
|
|
50
|
+
"js"
|
|
51
|
+
],
|
|
52
|
+
"moduleNameMapper": {
|
|
53
|
+
"^@taquito/utils$": "<rootDir>/../taquito-utils/src/taquito-utils.ts",
|
|
54
|
+
"^@taquito/signer$": "<rootDir>/../taquito-signer/src/taquito-signer.ts",
|
|
55
|
+
"^@taquito/taquito$": "<rootDir>/../taquito/src/taquito.ts"
|
|
56
|
+
},
|
|
57
|
+
"coveragePathIgnorePatterns": [
|
|
58
|
+
"/node_modules/",
|
|
59
|
+
"/test/"
|
|
60
|
+
],
|
|
61
|
+
"collectCoverageFrom": [
|
|
62
|
+
"src/**/*.{js,ts}"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"dependencies": {
|
|
66
|
+
"@stablelib/blake2b": "^1.0.1",
|
|
67
|
+
"@stablelib/nacl": "^1.0.4",
|
|
68
|
+
"big-integer": "^1.6.52"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@taquito/signer": "^19.2.0-RC.0",
|
|
72
|
+
"@taquito/taquito": "^19.2.0-RC.0",
|
|
73
|
+
"@taquito/utils": "^19.2.0-RC.0",
|
|
74
|
+
"@types/node": "^20.11.20",
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
76
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
77
|
+
"eslint": "^8.56.0",
|
|
78
|
+
"eslint-config-standard-with-typescript": "^43.0.1",
|
|
79
|
+
"eslint-plugin-import": "^2.29.1",
|
|
80
|
+
"eslint-plugin-n": "^16.6.2",
|
|
81
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
82
|
+
"jest": "^29.7.0",
|
|
83
|
+
"jest-config": "^29.7.0",
|
|
84
|
+
"jest-extended": "^4.0.2",
|
|
85
|
+
"lint-staged": "^14.0.1",
|
|
86
|
+
"lodash.camelcase": "^4.3.0",
|
|
87
|
+
"prettier": "^3.0.3",
|
|
88
|
+
"rimraf": "^5.0.5",
|
|
89
|
+
"rollup": "^4.1.4",
|
|
90
|
+
"rollup-plugin-json": "^4.0.0",
|
|
91
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
92
|
+
"ts-jest": "^29.1.1",
|
|
93
|
+
"ts-loader": "^9.5.0",
|
|
94
|
+
"ts-node": "^10.9.1",
|
|
95
|
+
"ts-toolbelt": "^9.6.0",
|
|
96
|
+
"typescript": "^5.3.3"
|
|
97
|
+
},
|
|
98
|
+
"gitHead": "48fdd7dab4204fe36fe2cb87ef3bf4a88ea6a042"
|
|
99
|
+
}
|