Skip to content

Commit

Permalink
upgrade readme
Browse files Browse the repository at this point in the history
  • Loading branch information
wuriyanto48 committed Jan 11, 2023
1 parent 6052a33 commit 4ebbe29
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Just open the `unit test` folder, all available there.

#### Example Generate RSA Private and Public Key

##### Javascript
```javascript
const { rsa, keyUtil } = require('crypsi');
const fs = require('fs');
Expand All @@ -53,6 +54,26 @@ rsa.generateRSAKeyPair(keyUtil.KEY_SIZE_4KB, '').then(pairs => {
});
```

##### Typescript
```javascript
import { digest, rsa, rsaSign, keyUtil } from 'crypsi';
import fs from 'fs';

async function generate() {
const pairs = await rsa.generateRSAKeyPair(keyUtil.KEY_SIZE_2KB);

const publicKeyWriter = fs.createWriteStream('public.key');
publicKeyWriter.write(pairs.publicKey);

const privateKeyWriter = fs.createWriteStream('private.key');
privateKeyWriter.write(pairs.privateKey);

publicKeyWriter.close();
privateKeyWriter.close();
}

generate();
```
Result RSA Public Key
```
-----BEGIN PUBLIC KEY-----
Expand Down

0 comments on commit 4ebbe29

Please sign in to comment.