@fivenorth/loop-sdk 0.1.3 → 0.2.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
@@ -146,7 +146,7 @@ try {
146
146
 
147
147
  # API
148
148
 
149
-
149
+ Coming soon
150
150
 
151
151
  # Development Guide
152
152
 
@@ -158,12 +158,14 @@ To install dependencies:
158
158
  bun install
159
159
  ```
160
160
 
161
- To run:
161
+ To run the dev server, that is also auto re-compile the sdk:
162
162
 
163
163
  ```bash
164
- bun run index.ts
164
+ bun start
165
165
  ```
166
166
 
167
+ Upon doing so you can visit http://localhost:3030/ to see the local demo app, serve in `demo/test.html` and SDK is auto compile so you can actively working and trying out the SDK.
168
+
167
169
  # Publish the package to NPM
168
170
 
169
171
 
package/dist/index.js CHANGED
@@ -2213,16 +2213,18 @@ class Provider {
2213
2213
  connection;
2214
2214
  party_id;
2215
2215
  public_key;
2216
+ email;
2216
2217
  auth_token;
2217
2218
  requests = new Map;
2218
2219
  requestTimeout = 30000;
2219
- constructor({ connection, party_id, public_key, auth_token, requestTimeout }) {
2220
+ constructor({ connection, party_id, public_key, auth_token, email, requestTimeout }) {
2220
2221
  if (!connection) {
2221
2222
  throw new Error("Provider requires a connection object.");
2222
2223
  }
2223
2224
  this.connection = connection;
2224
2225
  this.party_id = party_id;
2225
2226
  this.public_key = public_key;
2227
+ this.email = email;
2226
2228
  this.auth_token = auth_token;
2227
2229
  this.requestTimeout = requestTimeout || 30000;
2228
2230
  }
@@ -2308,12 +2310,12 @@ class LoopSDK {
2308
2310
  const existingConnectionRaw = localStorage.getItem("loop_connect");
2309
2311
  if (existingConnectionRaw) {
2310
2312
  try {
2311
- const { ticketId, authToken, partyId, publicKey } = JSON.parse(existingConnectionRaw);
2313
+ const { ticketId, authToken, partyId, publicKey, email } = JSON.parse(existingConnectionRaw);
2312
2314
  if (authToken && partyId && publicKey) {
2313
2315
  try {
2314
2316
  const verifiedAccount = await this.connection.verifySession(authToken);
2315
2317
  if (verifiedAccount.party_id === partyId) {
2316
- this.provider = new Provider({ connection: this.connection, party_id: partyId, auth_token: authToken, public_key: publicKey });
2318
+ this.provider = new Provider({ connection: this.connection, party_id: partyId, auth_token: authToken, public_key: publicKey, email });
2317
2319
  this.onAccept?.(this.provider);
2318
2320
  if (ticketId) {
2319
2321
  this.connection.connectWebSocket(ticketId, this.handleWebSocketMessage.bind(this));
@@ -2352,9 +2354,9 @@ class LoopSDK {
2352
2354
  handleWebSocketMessage(event) {
2353
2355
  const message = JSON.parse(event.data);
2354
2356
  if (message.type === "handshake_accept" /* HANDSHAKE_ACCEPT */) {
2355
- const { authToken, partyId, publicKey } = message.payload || {};
2357
+ const { authToken, partyId, publicKey, email } = message.payload || {};
2356
2358
  if (authToken && partyId && publicKey) {
2357
- this.provider = new Provider({ connection: this.connection, party_id: partyId, auth_token: authToken, public_key: publicKey });
2359
+ this.provider = new Provider({ connection: this.connection, party_id: partyId, auth_token: authToken, public_key: publicKey, email });
2358
2360
  const connectionInfoRaw = localStorage.getItem("loop_connect");
2359
2361
  if (connectionInfoRaw) {
2360
2362
  try {
@@ -2362,6 +2364,7 @@ class LoopSDK {
2362
2364
  connectionInfo.authToken = authToken;
2363
2365
  connectionInfo.partyId = partyId;
2364
2366
  connectionInfo.publicKey = publicKey;
2367
+ connectionInfo.email = email;
2365
2368
  localStorage.setItem("loop_connect", JSON.stringify(connectionInfo));
2366
2369
  this.onAccept?.(this.provider);
2367
2370
  this.hideQrCode();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fivenorth/loop-sdk",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "author": "hello@fivenorth.io",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",