signOffchainMessageEnvelope

function signOffchainMessageEnvelope<TOffchainMessageEnvelope>(
    keyPairs,
    offchainMessageEnvelope,
): Promise<
    FullySignedOffchainMessageEnvelope & TOffchainMessageEnvelope
>;

Given an array of CryptoKey objects which are private keys pertaining to addresses that are required to sign an offchain message envelope, this method will return a new signed envelope of type FullySignedOffchainMessageEnvelope.

This function will throw unless the resulting message is fully signed.

Type Parameters

Type Parameter
TOffchainMessageEnvelope extends OffchainMessageEnvelope

Parameters

ParameterType
keyPairsCryptoKeyPair[]
offchainMessageEnvelopeTOffchainMessageEnvelope

Returns

Promise<FullySignedOffchainMessageEnvelope & TOffchainMessageEnvelope>

Example

import { generateKeyPair } from '@solana/keys';
import { signOffchainMessageEnvelope } from '@solana/offchain-messages';
 
const signedOffchainMessage = await signOffchainMessageEnvelope(
    [myPrivateKey],
    offchainMessageEnvelope,
);

See

partiallySignOffchainMessageEnvelope if you want to sign the message without asserting that the resulting message envelope is fully signed.

On this page