Three round m-of-m key aggregation for ed25519 using the MuSig signature scheme
npm install @futuretense/ed25519-musig
import * as musig from '@futuretense/ed25519-musig';
const keys1 = ed25519.Keypair.random();
const keys2 = ed25519.Keypair.random();
const config = new musig.Config([
keys1.publicKey,
keys2.publicKey
]);
const publicKey = config.publicKey;
const message = Buffer.from('fshgeytfsdyydtrsred');
const session1 = new musig.Session(config, keys1.secretKey, message);
const session2 = new musig.Session(config, keys2.secretKey, message);
const c1 = session1.getLocalCommitment();
const c2 = session2.getLocalCommitment();
session1.setRemoteCommitment(...c2);
session2.setRemoteCommitment(...c1);
const n1 = session1.getLocalNonce();
const n2 = session2.getLocalNonce();
session1.setRemoteNonce(...n2);
session2.setRemoteNonce(...n1);
const s1 = session1.getLocalSignature();
const s2 = session2.getLocalSignature();
session1.setRemoteSignature(...s2);
session2.setRemoteSignature(...s1);
const signature = session1.aggregateSignature;
const vk = ed25519.VerificationKey.fromPublicKey(publicKey);
console.log(vk.verify(signature, message));
Copyright © 2019 Future Tense, LLC