Skip to content

Instantly share code, notes, and snippets.

@yangwao
Created July 25, 2019 14:48
Show Gist options
  • Save yangwao/a132af51a197cf9fa16faa7b76792b1e to your computer and use it in GitHub Desktop.
Save yangwao/a132af51a197cf9fa16faa7b76792b1e to your computer and use it in GitHub Desktop.
import { schnorrkelVerify } from '@polkadot/util-crypto';
public signData(): void {
this.signedData = u8aToHex(
this.currentPair.sign(stringToU8a(this.toSign.data)));
this.toSign.signature = this.signedData;
}
public verifySignature(): void {
if (isHex(this.toVerify.signature)) {
this.isValidSignature = schnorrkelVerify(this.toVerify.data,
this.toVerify.signature,
this.keyringPairPubKey);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment