github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/docs/reference/tm2-js-client/Signer/key.md (about)

     1  ---
     2  id: tm2-js-key
     3  ---
     4  
     5  # Key Signer
     6  
     7  Private key-based signer instance
     8  
     9  ### new KeySigner
    10  
    11  Creates a new instance of the private-key KeySigner
    12  
    13  #### Parameters
    14  
    15  * `privateKey` **Uint8Array** the raw Secp256k1 private key
    16  * `publicKey` **Uint8Array** the raw Secp256k1 public key
    17  * `addressPrefix` **string** the address prefix
    18  
    19  #### Usage
    20  
    21  ```ts
    22  // Generate the public / private key from somewhere
    23  const {publicKey, privateKey} = await generateKeyPair(
    24      entropyToMnemonic(generateEntropy()),
    25      index ? index : 0
    26  );
    27  
    28  new KeySigner(privateKey, publicKey);
    29  // new Secp256k1 key signer created
    30  ```