@acurast/cli
Version:
A cli to interact with the Acurast Cloud.
23 lines • 1.07 kB
JavaScript
function findProcessorEncrypionKey(assignment, type) {
return assignment.assignment.pubKeys
.map((keyObj) => {
const publicKey = keyObj[type[0]];
return publicKey ? { publicKey, curve: type[1] } : undefined;
})
.find((key) => key !== undefined);
}
export function getProcessorEncryptionKey(assignment) {
var _a, _b;
const key = (_b = (_a = findProcessorEncrypionKey(assignment, ['SECP256r1Encryption', 'p256'])) !== null && _a !== void 0 ? _a : findProcessorEncrypionKey(assignment, [
'SECP256k1Encryption',
'secp256k1',
])) !== null && _b !== void 0 ? _b :
/* backwards compatibility */ findProcessorEncrypionKey(assignment, [
'SECP256r1',
'p256',
]);
return key !== undefined
? Object.assign(Object.assign({}, key), { publicKey: key.publicKey.replace('0x', '') }) : undefined;
}
export const sameJobIds = (first, second) => !(first[0].acurast !== second[0].acurast || first[0].tezos !== second[0].tezos) && first[1] === second[1];
//# sourceMappingURL=utils.js.map