1 | import { u8aToU8a } from '@polkadot/util';
|
2 | import { vrfSign } from '@polkadot/wasm-crypto';
|
3 | const EMPTY_U8A = new Uint8Array();
|
4 | /**
|
5 | * @name sr25519VrfSign
|
6 | * @description Sign with sr25519 vrf signing (deterministic)
|
7 | */
|
8 | export function sr25519VrfSign(message, { secretKey }, context = EMPTY_U8A, extra = EMPTY_U8A) {
|
9 | if (secretKey?.length !== 64) {
|
10 | throw new Error('Invalid secretKey, expected 64-bytes');
|
11 | }
|
12 | return vrfSign(secretKey, u8aToU8a(context), u8aToU8a(message), u8aToU8a(extra));
|
13 | }
|