Skip to content

Commit 9ddaa8c

Browse files
authored
Update README.md
1 parent d7947f2 commit 9ddaa8c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,40 @@ This plugin helps you by generating the assymetric RSA key pair.
44

55
The keys are generated and persisted in android/ios keystore.
66

7+
## Using plugin
78
This plugin exposes the following methods:
89
* `getPublicKey`: returns the RSA public key
910
* `encrypt`: encrypts the plain text using private key from the key pair
1011
* `verify`: verifies a signature and returns a boolean if the signature is signed by the same key pair.
12+
13+
### getPublicKey
14+
This function is used to get the RSA public key which is store the android and ios key store.
15+
This key pair is persisted in key store, i.e it is generated once, and always re used for signing and verification.
16+
17+
usage:
18+
19+
```dart
20+
final String rsaPublicKey = await Cipher.getPublicKey();
21+
```
22+
23+
### sign
24+
This function returns a signature which is signed by the platoform's private key.
25+
26+
usage:
27+
```dart
28+
final String signature = await Cipher.sign('some plain data');
29+
30+
```
31+
32+
### verify
33+
This function returns a boolean, and takes a plain data and signature.
34+
35+
This function verifies the signature against the plain data, it returns `true` if the signature is produced by the same device's private key.
36+
37+
usage:
38+
```dart
39+
final bool result = await Cipher.verify('somePassword', 'SIGNATURE-XX');
40+
```
41+
42+
The above will checks if the `SIGNATURE-XX` matches the `somePassword` or not.
43+

0 commit comments

Comments
 (0)