Skip to content

Commit

Permalink
CU-86dthj1c5 - improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
melanke committed Jun 7, 2024
1 parent 1ce7224 commit 034f63c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions packages/neon-dappkit/NEON-SIGNER.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,27 @@ The process of signing and then verifying a message is useful to prove that the
truly signed your specific message.
```ts
// 1) sign a message
const mySignedMessage = await signer.signMessage({ message: 'My message', version: 2 })
const mySignedMessage = await signer.signMessage({ message: 'My message' })
// the signed message contains the message, messageHex, data, publicKey and salt

// 2) store or share these information to be verified later or by someone else

// 3) check if the signature is valid, if the method returns true, it is certain that that specific publicKey signed that messageHex
const valid = await signer.verifyMessage(mySignedMessage)
```
You can use different **versions**:
1. The same format as Neoline, with salt.
2. The more readable version, easier to verify by other means (with salt).
3. The same format as Neoline, without salt.
You can use different signing **versions**:
1. CLASSIC: The same format as Neoline, with salt.
2. DEFAULT: The more human-readable version, easier to verify with neon-js (with salt).
3. WITHOUT_SALT: The same format as Neoline, but without salt.

```ts
import { SignMessageVersion } from '@cityofzion/neon-dappkit-types'
// ...
const mySignedMessage = await signer.signMessage({
message: 'My message',
version: SignMessageVersion.CLASSIC
})
```

### Encrypt and Decrypt data

Expand Down

0 comments on commit 034f63c

Please sign in to comment.