@dydxprotocol/starkex-lib
Advanced tools
Comparing version 0.11.0 to 0.11.1
@@ -17,2 +17,3 @@ /* eslint-disable @typescript-eslint/no-unused-expressions */ | ||
} from '../../src/types'; | ||
import * as cryptoModule from '../../src/signable/crypto'; | ||
import * as hashesModule from '../../src/signable/hashes'; | ||
@@ -34,2 +35,3 @@ import { | ||
let mockPedersen: sinon.SinonSpy; | ||
let proxyquiredCrypto: typeof cryptoModule; | ||
let proxyquiredHashes: typeof hashesModule; | ||
@@ -71,3 +73,3 @@ let mocks: any; | ||
mockPedersen = sinon.spy(pedersen); | ||
proxyquiredHashes = proxyquire('../../src/signable/hashes', { | ||
proxyquiredCrypto = proxyquire('../../src/signable/crypto', { | ||
'../lib/starkex-resources': { | ||
@@ -77,6 +79,7 @@ pedersen: mockPedersen, | ||
}); | ||
proxyquiredHashes = proxyquire('../../src/signable/hashes', { | ||
'./crypto': proxyquiredCrypto, | ||
}); | ||
mocks = { | ||
'../lib/starkex-resources': { | ||
pedersen: mockPedersen, | ||
}, | ||
'./crypto': proxyquiredCrypto, | ||
'./hashes': proxyquiredHashes, | ||
@@ -83,0 +86,0 @@ }; |
@@ -18,2 +18,3 @@ "use strict"; | ||
let mockPedersen; | ||
let proxyquiredCrypto; | ||
let proxyquiredHashes; | ||
@@ -52,3 +53,3 @@ let mocks; | ||
mockPedersen = sinon_1.default.spy(starkex_resources_1.pedersen); | ||
proxyquiredHashes = proxyquire_1.default('../../src/signable/hashes', { | ||
proxyquiredCrypto = proxyquire_1.default('../../src/signable/crypto', { | ||
'../lib/starkex-resources': { | ||
@@ -58,6 +59,7 @@ pedersen: mockPedersen, | ||
}); | ||
proxyquiredHashes = proxyquire_1.default('../../src/signable/hashes', { | ||
'./crypto': proxyquiredCrypto, | ||
}); | ||
mocks = { | ||
'../lib/starkex-resources': { | ||
pedersen: mockPedersen, | ||
}, | ||
'./crypto': proxyquiredCrypto, | ||
'./hashes': proxyquiredHashes, | ||
@@ -111,2 +113,2 @@ }; | ||
});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PQUFPLEVBQUUsQ0FBQztZQUNaLGdCQUFNLENBQUMsWUFBWSxDQUFDLFNBQVMsQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUN6QyxDQUFDLENBQUMsQ0FBQztRQUVILEVBQUUsQ0FBQyxpQkFBaUIsRUFBRSxLQUFLLElBQUksRUFBRTtZQUMvQixNQUFNLEVBQUUsYUFBYSxFQUFFLEdBQUcsb0JBQVUsQ0FBQywwQkFBMEIsRUFBRSxLQUFLLENBQUMsQ0FBQztZQUN4RSxNQUFPLGFBQTBDLENBQUMsU0FBUyxDQUFDLFNBQVMsQ0FBQyxDQUFDLE9BQU8sRUFBRSxDQUFDO1lBQ2pGLGdCQUFNLENBQUMsWUFBYSxDQUFDLFNBQVMsQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUMxQyxDQUFDLENBQUMsQ0FBQztRQUVILEVBQUUsQ0FBQyxvQkFBb0IsRUFBRSxLQUFLLElBQUksRUFBRTtZQUNsQyxNQUFNLEVBQUUsa0JBQWtCLEVBQUUsR0FBRyxvQkFBVSxDQUFDLCtCQUErQixFQUFFLEtBQUssQ0FBQyxDQUFDO1lBQ2xGLE1BQU8sa0JBQW9ELENBQUMsY0FBYyxDQUN4RSxjQUFjLENBQ2YsQ0FBQyxPQUFPLEVBQUUsQ0FBQztZQUNaLGdCQUFNLENBQUMsWUFBWSxDQUFDLFNBQVMsQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUN6QyxDQUFDLENBQUMsQ0FBQztJQUNMLENBQUMsQ0FBQyxDQUFDO0FBQ0wsQ0FBQyxDQUFDLENBQUMifQ== |
@@ -12,2 +12,3 @@ "use strict"; | ||
const constants_2 = require("./constants"); | ||
const crypto_1 = require("./crypto"); | ||
const hashes_1 = require("./hashes"); | ||
@@ -74,3 +75,3 @@ const stark_signable_1 = require("./stark-signable"); | ||
const assetIds = await hashes_1.getCacheablePedersenHash(COLLATERAL_ASSET_ID_BN, FEE_ASSET_ID_BN); | ||
const transferPart1 = await hashes_1.getPedersenHash(await hashes_1.getPedersenHash(assetIds, receiverPublicKeyBn), conditionBn); | ||
const transferPart1 = await crypto_1.getPedersenHash(await crypto_1.getPedersenHash(assetIds, receiverPublicKeyBn), conditionBn); | ||
// Note: Use toString() to avoid mutating senderPositionIdBn. | ||
@@ -86,3 +87,3 @@ const transferPart2 = new bn_js_1.default(senderPositionIdBn.toString(), 10) | ||
.iushln(CONDITIONAL_TRANSFER_PADDING_BITS); | ||
return hashes_1.getPedersenHash(await hashes_1.getPedersenHash(transferPart1, transferPart2), transferPart3); | ||
return crypto_1.getPedersenHash(await crypto_1.getPedersenHash(transferPart1, transferPart2), transferPart3); | ||
} | ||
@@ -94,2 +95,2 @@ toStarkware() { | ||
exports.SignableConditionalTransfer = SignableConditionalTransfer; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZGl0aW9uYWwtdHJhbnNmZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc2lnbmFibGUvY29uZGl0aW9uYWwtdHJhbnNmZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsa0RBQXVCO0FBRXZCLDRDQUdzQjtBQUN0Qix3Q0FJb0I7QUFDcEIsc0NBS3FCO0FBS3JCLDJDQUFxRTtBQUNyRSxxQ0FHa0I7QUFDbEIscURBQWlEO0FBRWpELDBEQUEwRDtBQUMxRCxNQUFNLGlCQUFpQixHQUFHLElBQUksZUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBRXBDLE1BQU0sc0JBQXNCLEdBQUcsY0FBTyxDQUFDLCtCQUFtQixDQUFDLENBQUM7QUFDNUQsTUFBTSxlQUFlLEdBQUcsSUFBSSxlQUFFLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDbEMsTUFBTSwyQ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BSSxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQ3RFLE1BQU0sYUFBYSxHQUFHLElBQUksZUFBRSxDQUFDLDJCQUEyQixDQUFDO2FBQ3RELE1BQU0sQ0FBQyxrREFBc0MsQ0FBQyxjQUFjLENBQUMsQ0FBQyxJQUFJLENBQUMsZ0JBQWdCLENBQUM7YUFDcEYsTUFBTSxDQUFDLGtEQUFzQyxDQUFDLGNBQWMsQ0FBQyxDQUFDLElBQUksQ0FBQyxpQkFBaUIsQ0FBQzthQUNyRixNQUFNLENBQUMsa0RBQXNDLENBQUMsb0JBQW9CLENBQUMsQ0FBQyxJQUFJLENBQ3ZFLHNCQUFzQixDQUN2QjthQUNBLE1BQU0sQ0FBQyxpQ0FBaUMsQ0FBQyxDQUFDO1FBRTdDLE9BQU8sd0JBQWUsQ0FDcEIsTUFBTSx3QkFBZSxDQUNuQixhQUFhLEVBQ2IsYUFBYSxDQUNkLEVBQ0QsYUFBYSxDQUNkLENBQUM7SUFDSixDQUFDO0lBRUQsV0FBVztRQUNULE9BQU8sSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUN0QixDQUFDO0NBQ0Y7QUFsR0Qsa0VBa0dDIn0= |
@@ -5,16 +5,3 @@ /** | ||
import BN from 'bn.js'; | ||
import { HashFunction } from '../types'; | ||
/** | ||
* Set the hash function implementation that will be used for all StarkSignable objects. | ||
*/ | ||
export declare function setGlobalStarkHashImplementationNoSanityCheck(hashFunction: HashFunction): void; | ||
/** | ||
* Set the hash function implementation that will be used for all StarkSignable objects. | ||
*/ | ||
export declare function setGlobalStarkHashImplementation(hashFunction: HashFunction): Promise<void>; | ||
/** | ||
* Calculate a pedersen hash. | ||
*/ | ||
export declare function getPedersenHash(left: BN, right: BN): Promise<BN>; | ||
/** | ||
* Calculate a pedersen hash with commonly used parameters. The hash will be cached. | ||
@@ -21,0 +8,0 @@ */ |
@@ -5,42 +5,11 @@ "use strict"; | ||
*/ | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.preComputeHashes = exports.getCacheablePedersenHash = exports.getPedersenHash = exports.setGlobalStarkHashImplementation = exports.setGlobalStarkHashImplementationNoSanityCheck = void 0; | ||
const bn_js_1 = __importDefault(require("bn.js")); | ||
exports.preComputeHashes = exports.getCacheablePedersenHash = void 0; | ||
const constants_1 = require("../constants"); | ||
const starkex_resources_1 = require("../lib/starkex-resources"); | ||
const util_1 = require("../lib/util"); | ||
const types_1 = require("../types"); | ||
const SANITY_CHECK_EXPECTED_RESULT = new bn_js_1.default('2001140082530619239661729809084578298299223810202097622761632384561112390979'); | ||
const crypto_1 = require("./crypto"); | ||
// Global state for all STARK signables. | ||
const CACHE = {}; | ||
let globalHashFunction = starkex_resources_1.pedersen; | ||
/** | ||
* Set the hash function implementation that will be used for all StarkSignable objects. | ||
*/ | ||
function setGlobalStarkHashImplementationNoSanityCheck(hashFunction) { | ||
globalHashFunction = hashFunction; | ||
} | ||
exports.setGlobalStarkHashImplementationNoSanityCheck = setGlobalStarkHashImplementationNoSanityCheck; | ||
/** | ||
* Set the hash function implementation that will be used for all StarkSignable objects. | ||
*/ | ||
async function setGlobalStarkHashImplementation(hashFunction) { | ||
const result = await hashFunction(new bn_js_1.default(0), new bn_js_1.default(1)); | ||
if (!result.eq(SANITY_CHECK_EXPECTED_RESULT)) { | ||
throw new Error('setGlobalStarkHashImplementation: Sanity check failed'); | ||
} | ||
setGlobalStarkHashImplementationNoSanityCheck(hashFunction); | ||
} | ||
exports.setGlobalStarkHashImplementation = setGlobalStarkHashImplementation; | ||
/** | ||
* Calculate a pedersen hash. | ||
*/ | ||
async function getPedersenHash(left, right) { | ||
return globalHashFunction(left, right); | ||
} | ||
exports.getPedersenHash = getPedersenHash; | ||
/** | ||
* Calculate a pedersen hash with commonly used parameters. The hash will be cached. | ||
@@ -55,3 +24,3 @@ */ | ||
if (!CACHE[leftString][rightString]) { | ||
CACHE[leftString][rightString] = await globalHashFunction(left, right); | ||
CACHE[leftString][rightString] = await crypto_1.getPedersenHash(left, right); | ||
} | ||
@@ -89,2 +58,2 @@ return CACHE[leftString][rightString]; | ||
exports.preComputeHashes = preComputeHashes; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGFzaGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3NpZ25hYmxlL2hhc2hlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7O0dBRUc7Ozs7OztBQUVILGtEQUF1QjtBQUV2Qiw0Q0FJc0I7QUFDdEIsZ0VBQW9EO0FBQ3BELHNDQUFzQztBQUN0QyxvQ0FBbUQ7QUFFbkQsTUFBTSw0QkFBNEIsR0FBRyxJQUFJLGVBQUUsQ0FDekMsOEVBQThFLENBQy9FLENBQUM7QUFFRix3Q0FBd0M7QUFDeEMsTUFBTSxLQUFLLEdBQXVDLEVBQUUsQ0FBQztBQUNyRCxJQUFJLGtCQUFrQixHQUFpQiw0QkFBUSxDQUFDO0FBRWhEOztHQUVHO0FBQ0gsU0FBZ0IsNkNBQTZDLENBQUMsWUFBMEI7SUFDdEYsa0JBQWtCLEdBQUcsWUFBWSxDQUFDO0FBQ3BDLENBQUM7QUFGRCxzR0FFQztBQUVEOztHQUVHO0FBQ0ksS0FBSyxVQUFVLGdDQUFnQyxDQUFDLFlBQTBCO0lBQy9FLE1BQU0sTUFBTSxHQUFHLE1BQU0sWUFBWSxDQUFDLElBQUksZUFBRSxDQUFDLENBQUMsQ0FBQyxFQUFFLElBQUksZUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDeEQsSUFBSSxDQUFDLE1BQU0sQ0FBQyxFQUFFLENBQUMsNEJBQTRCLENBQUMsRUFBRTtRQUM1QyxNQUFNLElBQUksS0FBSyxDQUFDLHVEQUF1RCxDQUFDL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BQUUsU0FBUyxFQUFFLEVBQUU7WUFDM0QsSUFBSSxTQUFTLEtBQUssNEJBQWdCLEVBQUU7Z0JBQ2xDLE9BQU87YUFDUjtZQUNELE1BQU0sV0FBVyxHQUFHLGNBQU8sQ0FBQyx3QkFBWSxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUM7WUFDckQsTUFBTSxDQUFDLE9BQU8sRUFBRSxRQUFRLENBQUMsR0FBRyxNQUFNLE9BQU8sQ0FBQyxHQUFHLENBQUM7Z0JBQzVDLHdCQUF3QixDQUFDLGlCQUFpQixFQUFFLFdBQVcsQ0FBQztnQkFDeEQsd0JBQXdCLENBQUMsV0FBVyxFQUFFLGlCQUFpQixDQUFDO2FBQ3pELENBQUMsQ0FBQztZQUNILE1BQU0sT0FBTyxDQUFDLEdBQUcsQ0FBQztnQkFDaEIsd0JBQXdCLENBQUMsT0FBTyxFQUFFLGlCQUFpQixDQUFDO2dCQUNwRCx3QkFBd0IsQ0FBQyxRQUFRLEVBQUUsaUJBQWlCLENBQUM7YUFDdEQsQ0FBQyxDQUFDO1FBQ0wsQ0FBQyxDQUFDLENBQUM7UUFFSCx5REFBeUQ7UUFDekQsd0JBQXdCLENBQUMsaUJBQWlCLEVBQUUsaUJBQWlCLENBQUM7S0FDL0QsQ0FBQyxDQUFDO0FBQ0wsQ0FBQztBQXZCRCw0Q0F1QkMifQ== |
import { HashFunction } from '../types'; | ||
export { SignableApiRequest } from './api-request'; | ||
export { preComputeHashes, setGlobalStarkHashImplementation, setGlobalStarkHashImplementationNoSanityCheck, } from './hashes'; | ||
export * from './crypto'; | ||
export { preComputeHashes } from './hashes'; | ||
export { SignableOraclePrice } from './oracle-price'; | ||
@@ -5,0 +6,0 @@ export { SignableOrder } from './order'; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.hashInWorkerThread = exports.StarkSignable = exports.SignableConditionalTransfer = exports.SignableWithdrawal = exports.SignableOrder = exports.SignableOraclePrice = exports.setGlobalStarkHashImplementationNoSanityCheck = exports.setGlobalStarkHashImplementation = exports.preComputeHashes = exports.SignableApiRequest = void 0; | ||
exports.hashInWorkerThread = exports.StarkSignable = exports.SignableConditionalTransfer = exports.SignableWithdrawal = exports.SignableOrder = exports.SignableOraclePrice = exports.preComputeHashes = exports.SignableApiRequest = void 0; | ||
var api_request_1 = require("./api-request"); | ||
Object.defineProperty(exports, "SignableApiRequest", { enumerable: true, get: function () { return api_request_1.SignableApiRequest; } }); | ||
__exportStar(require("./crypto"), exports); | ||
var hashes_1 = require("./hashes"); | ||
Object.defineProperty(exports, "preComputeHashes", { enumerable: true, get: function () { return hashes_1.preComputeHashes; } }); | ||
Object.defineProperty(exports, "setGlobalStarkHashImplementation", { enumerable: true, get: function () { return hashes_1.setGlobalStarkHashImplementation; } }); | ||
Object.defineProperty(exports, "setGlobalStarkHashImplementationNoSanityCheck", { enumerable: true, get: function () { return hashes_1.setGlobalStarkHashImplementationNoSanityCheck; } }); | ||
var oracle_price_1 = require("./oracle-price"); | ||
@@ -34,2 +43,2 @@ Object.defineProperty(exports, "SignableOraclePrice", { enumerable: true, get: function () { return oracle_price_1.SignableOraclePrice; } }); | ||
exports.hashInWorkerThread = maybeHashInWorkerThread; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc2lnbmFibGUvaW5kZXgudHMi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mFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7OztBQUlBLDZDQUFtRDtBQUExQyxpSEFBQSxrQkFBa0IsT0FBQTtBQUMzQiwyQ0FBeUI7QUFDekIsbUNBQTRDO0FBQW5DLDBHQUFBLGdCQUFnQixPQUFBO0FBQ3pCLCtDQUFxRDtBQUE1QyxtSEFBQSxtQkFBbUIsT0FBQTtBQUM1QixpQ0FBd0M7QUFBL0Isc0dBQUEsYUFBYSxPQUFBO0FBQ3RCLDJDQUFrRDtBQUF6QyxnSEFBQSxrQkFBa0IsT0FBQTtBQUMzQiwrREFBcUU7QUFBNUQsbUlBQUEsMkJBQTJCLE9BQUE7QUFDcEMsbURBQWlEO0FBQXhDLCtHQUFBLGFBQWEsT0FBQTtBQUV0QixJQUFJLHVCQUF1QixHQUFpQixDQUFDLEVBQU0sRUFBRSxFQUFNLEVBQUUsRUFBRTtJQUM3RCxNQUFNLElBQUksS0FBSyxDQUFDLHVFQUF1RSxDQUFDLENBQUM7QUFDM0YsQ0FBQyxDQUFDO0FBQ0YsSUFBSTtJQUNGLHNFQUFzRTtJQUN0RSxPQUFPLENBQUMsZ0JBQWdCLENBQUMsQ0FBQztJQUMxQiw2RUFBNkU7SUFDN0UsdUJBQXVCLEdBQUcsT0FBTyxDQUFDLHlCQUF5QixDQUFDLENBQUMsa0JBQWtCLENBQUM7SUFDaEYscUVBQXFFO0NBQ3RFO0FBQUMsT0FBTyxLQUFLLEVBQUU7SUFDZCwrQkFBK0I7Q0FDaEM7QUFFWSxRQUFBLGtCQUFrQixHQUFHLHVCQUF1QixDQUFDIn0= |
@@ -11,3 +11,3 @@ "use strict"; | ||
const constants_1 = require("./constants"); | ||
const hashes_1 = require("./hashes"); | ||
const crypto_1 = require("./crypto"); | ||
const stark_signable_1 = require("./stark-signable"); | ||
@@ -67,3 +67,3 @@ /** | ||
.iadd(timestampEpochSecondsBn); | ||
return hashes_1.getPedersenHash(signedAssetId, priceAndTimestamp); | ||
return crypto_1.getPedersenHash(signedAssetId, priceAndTimestamp); | ||
} | ||
@@ -70,0 +70,0 @@ } |
@@ -13,2 +13,3 @@ "use strict"; | ||
const constants_2 = require("./constants"); | ||
const crypto_1 = require("./crypto"); | ||
const hashes_1 = require("./hashes"); | ||
@@ -112,3 +113,3 @@ const stark_signable_1 = require("./stark-signable"); | ||
const assetsBn = await hashes_1.getCacheablePedersenHash(await hashes_1.getCacheablePedersenHash(assetIdSellBn, assetIdBuyBn), assetIdFeeBn); | ||
return hashes_1.getPedersenHash(await hashes_1.getPedersenHash(assetsBn, orderPart1), orderPart2); | ||
return crypto_1.getPedersenHash(await crypto_1.getPedersenHash(assetsBn, orderPart1), orderPart2); | ||
} | ||
@@ -121,2 +122,2 @@ toStarkware() { | ||
SignableOrder.fromOrder = SignableOrder.fromOrderWithClientId; // Alias. | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc2lnbmFibGUvb3JkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsa0RBQXVCO0FBRXZCLDRDQUdzQjtBQUN0Qix3Q0FNb0I7QUFDcEIsc0NBSXFCO0FBQ3JCLG9DQU9rQjtBQUNsQiwyQ0FFcUI7QUFDckIscUNBR2tCO0FBQ2xCLHFEQUFpRDtBQUVqRCxNQUFNLHFCQUFxQixHQUFHLENBQUMsQ0FBQztBQUNoQyxNQUFNLGtCQUFrQixHQUFHLEVBQUUsQ0FBQztBQUU5Qjs7R0FFRztBQUNILE1BQWEsYUFBYyxTQUFRLDhCQUE2QjtJQUk5RCxNQUFNLENBQUMscUJBQXFCLENBQzFCLEtBQTBEO1FBRTFELG9EQUFvRDtRQUNwRCxNQUFNLEtBQUssR0FBRywyQkFBaUIsQ0FBQyxLQUFLLENBQUMsUUFBUSxDQUFDLENBQUM7UUF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EIsQ0FBQzs7QUFqSUgsc0NBa0lDO0FBaElRLHVCQUFTLEdBQUcsYUFBYSxDQUFDLHFCQUFxQixDQUFDLENBQUMsU0FBUyJ9 |
@@ -7,2 +7,3 @@ "use strict"; | ||
const util_1 = require("../lib/util"); | ||
const crypto_2 = require("./crypto"); | ||
/** | ||
@@ -33,3 +34,3 @@ * Base class for a STARK key signable message. | ||
const hashBN = await this.getHashBN(); | ||
const ecSignature = crypto_1.sign(helpers_1.asEcKeyPair(privateKey), hashBN); | ||
const ecSignature = await crypto_2.sign(helpers_1.asEcKeyPair(privateKey), hashBN); | ||
return helpers_1.serializeSignature({ | ||
@@ -48,3 +49,3 @@ r: util_1.bnToHex32(ecSignature.r), | ||
const ecPublicKey = crypto_1.starkEc.keyFromPublic({ x: publicKey, y: publicKeyYCoordinate }); | ||
return crypto_1.verify(ecPublicKey, await this.getHashBN(), signatureStruct); | ||
return crypto_2.verify(ecPublicKey, await this.getHashBN(), signatureStruct); | ||
} | ||
@@ -55,7 +56,8 @@ // Return true if the signature is valid for either of the two possible y-coordinates. | ||
// https://github.com/starkware-libs/starkex-resources/blob/1eb84c6a9069950026768013f748016d3bd51d54/crypto/starkware/crypto/signature/signature.py#L151 | ||
return (crypto_1.verify(helpers_1.asEcKeyPairPublic(publicKey, false), await this.getHashBN(), signatureStruct) || | ||
crypto_1.verify(helpers_1.asEcKeyPairPublic(publicKey, true), await this.getHashBN(), signatureStruct)); | ||
const hashBN = await this.getHashBN(); | ||
return ((await crypto_2.verify(helpers_1.asEcKeyPairPublic(publicKey, false), hashBN, signatureStruct)) || | ||
crypto_2.verify(helpers_1.asEcKeyPairPublic(publicKey, true), hashBN, signatureStruct)); | ||
} | ||
} | ||
exports.StarkSignable = StarkSignable; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Rhcmstc2lnbmFibGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMv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BQ0gsS0FBSyxDQUFDLGVBQWUsQ0FDbkIsU0FBaUIsRUFDakIsU0FBaUIsRUFDakIsdUJBQXNDLElBQUk7UUFFMUMsTUFBTSxlQUFlLEdBQUcsOEJBQW9CLENBQUMsU0FBUyxDQUFDLENBQUM7UUFFeEQsc0ZBQXNGO1FBQ3RGLElBQUksb0JBQW9CLEVBQUU7WUFDeEIsTUFBTSxXQUFXLEdBQUcsZ0JBQU8sQ0FBQyxhQUFhLENBQUMsRUFBRSxDQUFDLEVBQUUsU0FBUyxFQUFFLENBQUMsRUFBRSxvQkFBb0IsRUFBRSxDQUFDLENBQUM7WUFDckYsT0FBTyxlQUFNLENBQUMsV0FBVyxFQUFFLE1BQU0sSUFBSSxDQUFDLFNBQVMsRUFBRSxFQUFFLGVBQWUsQ0FBQyxDQUFDO1NBQ3JFO1FBRUQsc0ZBQXNGO1FBQ3RGLEVBQUU7UUFDRixnQkFBZ0I7UUFDaEIsd0pBQXdKO1FBQ3hKLE1BQU0sTUFBTSxHQUFHLE1BQU0sSUFBSSxDQUFDLFNBQVMsRUFBRSxDQUFDO1FBQ3RDLE9BQU8sQ0FDTCxDQUFDLE1BQU0sZUFBTSxDQUFDLDJCQUFpQixDQUFDLFNBQVMsRUFBRSxLQUFLLENBQUMsRUFBRSxNQUFNLEVBQUUsZUFBZSxDQUFDLENBQUM7WUFDNUUsZUFBTSxDQUFDLDJCQUFpQixDQUFDLFNBQVMsRUFBRSxJQUFJLENBQUMsRUFBRSxNQUFNLEVBQUUsZUFBZSxDQUFDLENBQ3BFLENBQUM7SUFDSixDQUFDO0NBTUY7QUF2RUQsc0NBdUVDIn0= |
@@ -12,3 +12,3 @@ "use strict"; | ||
const constants_2 = require("./constants"); | ||
const hashes_1 = require("./hashes"); | ||
const crypto_1 = require("./crypto"); | ||
const stark_signable_1 = require("./stark-signable"); | ||
@@ -68,3 +68,3 @@ const COLLATERAL_ASSET_ID_BN = util_1.hexToBn(constants_1.COLLATERAL_ASSET_ID); | ||
.iushln(WITHDRAWAL_PADDING_BITS); | ||
return hashes_1.getPedersenHash(COLLATERAL_ASSET_ID_BN, packedWithdrawalBn); | ||
return crypto_1.getPedersenHash(COLLATERAL_ASSET_ID_BN, packedWithdrawalBn); | ||
} | ||
@@ -71,0 +71,0 @@ toStarkware() { |
import BN from 'bn.js'; | ||
import elliptic from 'elliptic'; | ||
export declare enum StarkwareOrderType { | ||
@@ -33,2 +34,4 @@ LIMIT_ORDER_WITH_FEES = "LIMIT_ORDER_WITH_FEES" | ||
export declare type HashFunction = (a: BN, b: BN) => BN | Promise<BN>; | ||
export declare type SigningFunction = (key: elliptic.ec.KeyPair, message: BN) => elliptic.ec.Signature | Promise<elliptic.ec.Signature>; | ||
export declare type VerificationFunction = (key: elliptic.ec.KeyPair, message: BN, signature: SignatureStruct) => boolean | Promise<boolean>; | ||
interface WithdrawalParamsBase { | ||
@@ -35,0 +38,0 @@ positionId: string; |
@@ -35,2 +35,2 @@ "use strict"; | ||
})(ApiMethod = exports.ApiMethod || (exports.ApiMethod = {})); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBRUEsSUFBWSxrQkFFWDtBQUZELFdBQVksa0JBQWtCO0lBQzVCLHFFQUErQyxDQUFBO0FBQ2pELENBQUMsRUFGVyxrQkFBa0IsR0FBbEIsMEJBQWtCLEtBQWxCLDBCQUFrQixRQUU3QjtBQUVELElBQVksa0JBR1g7QUFIRCxXQUFZLGtCQUFrQjtJQUM1QixpQ0FBVyxDQUFBO0lBQ1gsbUNBQWEsQ0FBQTtBQUNmLENBQUMsRUFIVyxrQkFBa0IsR0FBbEIsMEJBQWtCLEtBQWxCLDBCQUFrQixRQUc3QjtBQUVELHVDQUF1QztBQUN2QyxJQUFZLFVBSVg7QU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UFZLFVBSVg7QUFKRCxXQUFZLFVBQVU7SUFDcEIsaUNBQW1CLENBQUE7SUFDbkIsaUNBQW1CLENBQUE7SUFDbkIsbUNBQXFCLENBQUE7QUFDdkIsQ0FBQyxFQUpXLFVBQVUsR0FBVixrQkFBVSxLQUFWLGtCQUFVLFFBSXJCO0FBRUQsSUFBWSxTQUtYO0FBTEQsV0FBWSxTQUFTO0lBQ25CLDBCQUFhLENBQUE7SUFDYix3QkFBVyxDQUFBO0lBQ1gsd0JBQVcsQ0FBQTtJQUNYLDBCQUFhLENBQUE7QUFDZixDQUFDLEVBTFcsU0FBUyxHQUFULGlCQUFTLEtBQVQsaUJBQVMsUUFLcEI7QUFvSEQsbURBQW1EO0FBRW5ELElBQVksU0FLWDtBQUxELFdBQVksU0FBUztJQUNuQiwwQkFBYSxDQUFBO0lBQ2Isd0JBQVcsQ0FBQTtJQUNYLHdCQUFXLENBQUE7SUFDWCw4QkFBaUIsQ0FBQTtBQUNuQixDQUFDLEVBTFcsU0FBUyxHQUFULGlCQUFTLEtBQVQsaUJBQVMsUUFLcEIifQ== |
{ | ||
"name": "@dydxprotocol/starkex-lib", | ||
"version": "0.11.0", | ||
"version": "0.11.1", | ||
"description": "Cryptographic functions for use with StarkEx", | ||
@@ -5,0 +5,0 @@ "main": "build/src/index.js", |
@@ -23,6 +23,4 @@ import BN from 'bn.js'; | ||
import { CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS } from './constants'; | ||
import { | ||
getCacheablePedersenHash, | ||
getPedersenHash, | ||
} from './hashes'; | ||
import { getPedersenHash } from './crypto'; | ||
import { getCacheablePedersenHash } from './hashes'; | ||
import { StarkSignable } from './stark-signable'; | ||
@@ -29,0 +27,0 @@ |
@@ -12,40 +12,10 @@ /** | ||
} from '../constants'; | ||
import { pedersen } from '../lib/starkex-resources'; | ||
import { hexToBn } from '../lib/util'; | ||
import { DydxAsset, HashFunction } from '../types'; | ||
import { DydxAsset } from '../types'; | ||
import { getPedersenHash } from './crypto'; | ||
const SANITY_CHECK_EXPECTED_RESULT = new BN( | ||
'2001140082530619239661729809084578298299223810202097622761632384561112390979', | ||
); | ||
// Global state for all STARK signables. | ||
const CACHE: Record<string, Record<string, BN>> = {}; | ||
let globalHashFunction: HashFunction = pedersen; | ||
/** | ||
* Set the hash function implementation that will be used for all StarkSignable objects. | ||
*/ | ||
export function setGlobalStarkHashImplementationNoSanityCheck(hashFunction: HashFunction) { | ||
globalHashFunction = hashFunction; | ||
} | ||
/** | ||
* Set the hash function implementation that will be used for all StarkSignable objects. | ||
*/ | ||
export async function setGlobalStarkHashImplementation(hashFunction: HashFunction) { | ||
const result = await hashFunction(new BN(0), new BN(1)); | ||
if (!result.eq(SANITY_CHECK_EXPECTED_RESULT)) { | ||
throw new Error('setGlobalStarkHashImplementation: Sanity check failed'); | ||
} | ||
setGlobalStarkHashImplementationNoSanityCheck(hashFunction); | ||
} | ||
/** | ||
* Calculate a pedersen hash. | ||
*/ | ||
export async function getPedersenHash(left: BN, right: BN): Promise<BN> { | ||
return globalHashFunction(left, right); | ||
} | ||
/** | ||
* Calculate a pedersen hash with commonly used parameters. The hash will be cached. | ||
@@ -60,3 +30,3 @@ */ | ||
if (!CACHE[leftString][rightString]) { | ||
CACHE[leftString][rightString] = await globalHashFunction(left, right); | ||
CACHE[leftString][rightString] = await getPedersenHash(left, right); | ||
} | ||
@@ -63,0 +33,0 @@ return CACHE[leftString][rightString]; |
@@ -6,7 +6,4 @@ import BN from 'bn.js'; | ||
export { SignableApiRequest } from './api-request'; | ||
export { | ||
preComputeHashes, | ||
setGlobalStarkHashImplementation, | ||
setGlobalStarkHashImplementationNoSanityCheck, | ||
} from './hashes'; | ||
export * from './crypto'; | ||
export { preComputeHashes } from './hashes'; | ||
export { SignableOraclePrice } from './oracle-price'; | ||
@@ -13,0 +10,0 @@ export { SignableOrder } from './order'; |
@@ -23,3 +23,3 @@ import Big from 'big.js'; | ||
} from './constants'; | ||
import { getPedersenHash } from './hashes'; | ||
import { getPedersenHash } from './crypto'; | ||
import { StarkSignable } from './stark-signable'; | ||
@@ -26,0 +26,0 @@ |
@@ -30,6 +30,4 @@ import BN from 'bn.js'; | ||
} from './constants'; | ||
import { | ||
getCacheablePedersenHash, | ||
getPedersenHash, | ||
} from './hashes'; | ||
import { getPedersenHash } from './crypto'; | ||
import { getCacheablePedersenHash } from './hashes'; | ||
import { StarkSignable } from './stark-signable'; | ||
@@ -36,0 +34,0 @@ |
@@ -9,9 +9,9 @@ import BN from 'bn.js'; | ||
} from '../helpers'; | ||
import { starkEc } from '../lib/starkex-resources/crypto'; | ||
import { bnToHex32 } from '../lib/util'; | ||
import { KeyPair } from '../types'; | ||
import { | ||
sign, | ||
starkEc, | ||
verify, | ||
} from '../lib/starkex-resources/crypto'; | ||
import { bnToHex32 } from '../lib/util'; | ||
import { KeyPair } from '../types'; | ||
} from './crypto'; | ||
@@ -54,3 +54,3 @@ /** | ||
const hashBN = await this.getHashBN(); | ||
const ecSignature = sign(asEcKeyPair(privateKey), hashBN); | ||
const ecSignature = await sign(asEcKeyPair(privateKey), hashBN); | ||
return serializeSignature({ | ||
@@ -82,5 +82,6 @@ r: bnToHex32(ecSignature.r), | ||
// https://github.com/starkware-libs/starkex-resources/blob/1eb84c6a9069950026768013f748016d3bd51d54/crypto/starkware/crypto/signature/signature.py#L151 | ||
const hashBN = await this.getHashBN(); | ||
return ( | ||
verify(asEcKeyPairPublic(publicKey, false), await this.getHashBN(), signatureStruct) || | ||
verify(asEcKeyPairPublic(publicKey, true), await this.getHashBN(), signatureStruct) | ||
(await verify(asEcKeyPairPublic(publicKey, false), hashBN, signatureStruct)) || | ||
verify(asEcKeyPairPublic(publicKey, true), hashBN, signatureStruct) | ||
); | ||
@@ -87,0 +88,0 @@ } |
@@ -23,3 +23,3 @@ import BN from 'bn.js'; | ||
import { WITHDRAWAL_FIELD_BIT_LENGTHS } from './constants'; | ||
import { getPedersenHash } from './hashes'; | ||
import { getPedersenHash } from './crypto'; | ||
import { StarkSignable } from './stark-signable'; | ||
@@ -26,0 +26,0 @@ |
import BN from 'bn.js'; | ||
import elliptic from 'elliptic'; | ||
@@ -44,2 +45,6 @@ export enum StarkwareOrderType { | ||
export type HashFunction = (a: BN, b: BN) => BN | Promise<BN>; | ||
export type SigningFunction = | ||
(key: elliptic.ec.KeyPair, message: BN) => elliptic.ec.Signature | Promise<elliptic.ec.Signature>; | ||
export type VerificationFunction = | ||
(key: elliptic.ec.KeyPair, message: BN, signature: SignatureStruct) => boolean | Promise<boolean>; | ||
@@ -46,0 +51,0 @@ // ============ Withdrawal Parameters ============ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
555715
116
10168