1 | // Copyright 2017-2023 @polkadot/util-crypto authors & contributors
|
2 | // SPDX-License-Identifier: Apache-2.0
|
3 |
|
4 | import { u8aToU8a } from '@polkadot/util';
|
5 | import { vrfSign } from '@polkadot/wasm-crypto';
|
6 | const EMPTY_U8A = new Uint8Array();
|
7 |
|
8 | /**
|
9 | * @name sr25519VrfSign
|
10 | * @description Sign with sr25519 vrf signing (deterministic)
|
11 | */
|
12 | export function sr25519VrfSign(message, {
|
13 | secretKey
|
14 | }, context = EMPTY_U8A, extra = EMPTY_U8A) {
|
15 | if ((secretKey == null ? void 0 : secretKey.length) !== 64) {
|
16 | throw new Error('Invalid secretKey, expected 64-bytes');
|
17 | }
|
18 | return vrfSign(secretKey, u8aToU8a(context), u8aToU8a(message), u8aToU8a(extra));
|
19 | } |
\ | No newline at end of file |