@me.jango/signa 0.0.0-stage → 0.3.8
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 +30 -2
- package/index.d.ts +1553 -0
- package/index.js +3061 -0
- package/package.json +13 -4
package/README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Juicebox Center wallet client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Connect a Juicebox Center passkey account to your app, then request exact payment reviews.
|
|
4
|
+
This is the browser-only slice of the Center client. Bot access and the CLI ship separately as the
|
|
5
|
+
full client archive linked from https://juicebox.center/api/docs/client.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @me.jango/signa
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import { createCenterWalletClient } from '@me.jango/signa';
|
|
13
|
+
const wallet = createCenterWalletClient({
|
|
14
|
+
issuer: 'https://my.juicebox.center', audience: 'https://juicebox.center',
|
|
15
|
+
callbackUri: window.location.origin + '/center/callback',
|
|
16
|
+
});
|
|
17
|
+
const prepared = await wallet.prepareConnection();
|
|
18
|
+
prepared.launch(); // full-page redirect to the account
|
|
19
|
+
// prepared.launch({ target: name }) submits into a window or iframe the app opened under that
|
|
20
|
+
// name; Center serves the sign-in inside an iframe only for apps its operator admits to frame.
|
|
21
|
+
// On /center/callback:
|
|
22
|
+
const connection = await wallet.completeConnection(window.location.href);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Your app origin and exact callback URI must be allowlisted by Center. Allow the issuer in your
|
|
26
|
+
`form-action` CSP directive and send `Referrer-Policy: strict-origin`. `restoreConnection()` reads the
|
|
27
|
+
saved connection, `disconnect()` clears it, and `payments()` prepares, completes and submits reviewed
|
|
28
|
+
payments. Protocol details: https://juicebox.center/api/docs/client
|
|
29
|
+
`refreshPayment({ waitSeconds })` holds a submitted payment's read on Center (up to 20 s) until the
|
|
30
|
+
operation moves, so an app can wait on it instead of polling. A record whose app grant is gone and whose
|
|
31
|
+
signed validity has passed can be cleared; it is archived as unknown and Center keeps the outcome.
|