@openfort/openfort-js 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,27 @@
1
+ ![Openfort Protocol][banner-image]
2
+
3
+ <div align="center">
4
+ <h4>
5
+ <a href="https://www.openfort.xyz/">
6
+ Website
7
+ </a>
8
+ <span> | </span>
9
+ <a href="https://www.openfort.xyz/docs">
10
+ Documentation
11
+ </a>
12
+ <span> | </span>
13
+ <a href="https://www.openfort.xyz/docs/reference/api/authentication">
14
+ API Docs
15
+ </a>
16
+ <span> | </span>
17
+ <a href="https://twitter.com/openfortxyz">
18
+ Twitter
19
+ </a>
20
+ </h4>
21
+ </div>
22
+
23
+ [banner-image]: https://blog-cms.openfort.xyz/uploads/openfortjs_f52fdc3f2d.png
24
+
1
25
  # Openfort.js Library
2
26
 
3
27
  [![Version](https://img.shields.io/npm/v/@openfort/openfort-js.svg)](https://www.npmjs.org/package/@openfort/openfort-js)
@@ -24,6 +48,27 @@ value:
24
48
  import Openfort from '@openfort/openfort-js';
25
49
  const openfort = new Openfort('pk_test_...');
26
50
  ```
51
+ In order to sign messages, you have 4 options to choose from:
52
+ * Let Openfort handle the signing process, dont need to pass any signer to the Openfort instance.
53
+ * Sign yourself and pass the signature to Openfort, dont need to pass any signer to the Openfort instance.
54
+ * Use a Session Key to sign messages, you need to pass a SessionSigner to the Openfort instance.
55
+ * Use Embedded Signer to sign messages, you need to pass an Embedded Signer to the Openfort instance.
56
+
57
+ #### Session Signer
58
+ ```ts
59
+ const sessionSigner = new SessionSigner()
60
+ const openfort = new Openfort('pk_test_...', sessionSigner);
61
+ ```
62
+
63
+ #### Embedded Signer
64
+ For the embedded signer, if your player has an account you can pass it to the embedded signer to use it. If the account is not provided, the embedded signer will check if the localstorage has a device which is already registered, if not, it will create a new device and store it in the localstorage.
65
+ For the recovery process, you can ask the user for a password to encrypt the recovery share.
66
+
67
+ ```ts
68
+ const embeddedSigner = new EmbeddedSigner('pk_test_...', 'acc_...', '********');
69
+ const openfort = new Openfort('pk_test_...', embeddedSigner);
70
+ ```
71
+
27
72
 
28
73
  ### Create and store a new player session key
29
74