Skip to content

Commit

Permalink
another example in the README
Browse files Browse the repository at this point in the history
Signed-off-by: Berend Sliedrecht <[email protected]>
  • Loading branch information
berendsliedrecht committed Nov 28, 2023
1 parent 776f2a1 commit e7e43d0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,25 @@ const msg = b.decode(token, { returnAsString: true })

assert(msg === 'hello')
```

### Separated encoding and decoding

```typescript
import { Bearnet } from 'bearnet'

const b = new Bearnet(new Uint8Array(32).fill(0))

const token = b.encode('hello')
```

> Key and Token transfer happen OOB
```typescript
import { Bearnet } from 'bearnet'

const b = new Bearnet(new Uint8Array(32).fill(0))

const msg = b.decode(token, { returnAsString: true })

assert(msg === 'hello')
```

0 comments on commit e7e43d0

Please sign in to comment.