node_modules/@velas/solana-web3/lib/index.browser.esm.js
/**
   * Create an secp256k1 instruction with a private key. The private key
   * must be a buffer that is 32 bytes long.
   */
Create an secp256k1 instruction with a private key. The private key
must be a buffer that is 32 bytes long.
Create an secp256k1 instruction with a private key . The private key must be a buffer that is 32 bytes long .
static createInstructionWithPrivateKey(params) {
    const {
      privateKey: pkey,
      message
    } = params;
    assert$1(pkey.length === PRIVATE_KEY_BYTES, "Private key must be ".concat(PRIVATE_KEY_BYTES, " bytes but received ").concat(pkey.length, " bytes"));
    let privateKey;
    if (Array.isArray(pkey)) {
      privateKey = Uint8Array.from(pkey);
    } else {
      privateKey = pkey;
    }
    try {
      const publicKey = publicKeyCreate(privateKey, false).slice(1); 
      const messageHash = buffer.Buffer.from(keccak_256.update(toBuffer(message)).digest());
      const {
        signature,
        recid: recoveryId
      } = ecdsaSign(messageHash, privateKey);
      return this.createInstructionWithPublicKey({
        publicKey,
        message,
        signature,
        recoveryId
      });
    } catch (error) {
      throw new Error("Error creating instruction; ".concat(error));
    }
  }
static createInstructionWithPrivateKey ( params ) { const { privateKey : pkey , message } = params ; assert$1 ( pkey . length === PRIVATE_KEY_BYTES , "Private key must be " . concat ( PRIVATE_KEY_BYTES , " bytes but received " ) . concat ( pkey . length , " bytes" ) ) ; let privateKey ; if ( Array . isArray ( pkey ) ) { privateKey = Uint8Array . from ( pkey ) ; } else { privateKey = pkey ; } try { const publicKey = publicKeyCreate ( privateKey , false ) . slice ( 1 ) ; const messageHash = buffer . Buffer . from ( keccak_256 . update ( toBuffer ( message ) ) . digest ( ) ) ; const { signature , recid : recoveryId } = ecdsaSign ( messageHash , privateKey ) ; return this . createInstructionWithPublicKey ( { publicKey , message , signature , recoveryId } ) ; } catch ( error ) { throw new Error ( "Error creating instruction; " . concat ( error ) ) ; } }
Create an secp256k1 instruction with a private key.
Create an secp256k1 instruction with a private key .
// throw away leading byte