Const catapult_crypto
catapult_crypto: any = ((): any => {function clamp(d): void {d[0] &= 248;d[31] &= 127;d[31] |= 64;}function prepareForScalarMult(sk): Uint8Array {const d = new Uint8Array(64);const hash = sha512.arrayBuffer(sk);array.copy(d, array.uint8View(hash), 32);clamp(d);return d;}return {deriveSharedKey: (privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array => {const sharedSecret = catapult_crypto.deriveSharedSecret(privateKey, publicKey);const info = 'catapult';const hash = 'SHA-256';return hkdf(sharedSecret, 32, { salt: Buffer.from(new Uint8Array(32)), info, hash });},deriveSharedSecret: (privateKey: Uint8Array, publicKey: Uint8Array): Uint8Array => {const c = nacl;const d = prepareForScalarMult(privateKey);// sharedKey = pack(p = d (derived from privateKey) * q (derived from publicKey))const q = [c.gf(), c.gf(), c.gf(), c.gf()];const p = [c.gf(), c.gf(), c.gf(), c.gf()];const sharedSecret = new Uint8Array(Key_Size);c.unpack(q, publicKey);c.scalarmult(p, q, d);c.pack(sharedSecret, p);return sharedSecret;},};})()
Convert an Uint8Array to WordArray