-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cde156e
commit 6d17bf3
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Low-level: Making Use of ECDSA with Public and Private Keys | ||
|
||
In this tutorial, we will learn how to use ECDSA with asymmetric public and private key pairs. Note, this is a low-level tutorial and should only be used if you would like to add advanced features to your applications. | ||
|
||
## Getting Started | ||
|
||
First, you will want to make sure you have installed the required dependencies. | ||
|
||
```ts | ||
import { PrivateKey, Utils } from '@bsv/sdk' | ||
``` | ||
|
||
```ts | ||
const privateKey = PrivateKey.fromRandom() | ||
const message = Utils.toArray('Message to sign!') | ||
const signature = privateKey.sign(message) | ||
const valid = privateKey.verify(message, signature) | ||
// console.log(valid) --> true | ||
``` |