@1sat/connect 0.0.12 → 0.0.14

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.
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Sigma OAuth — PKCE flow helpers for Sigma Identity provider.
3
+ *
4
+ * These are standard OAuth 2.0 + PKCE utilities. No dependency on
5
+ * @sigma-auth/better-auth-plugin — the consuming app's server-side
6
+ * callback route handles the token exchange.
7
+ */
8
+ /** Sigma Identity server URL */
9
+ export declare const SIGMA_URL = "https://auth.sigmaidentity.com";
10
+ export interface SigmaOAuthConfig {
11
+ /** OAuth client ID registered with Sigma */
12
+ clientId: string;
13
+ /** Local callback URL path (default: /auth/sigma/callback) */
14
+ callbackURL?: string;
15
+ /** Scopes to request (default: ['openid', 'profile']) */
16
+ scopes?: string[];
17
+ }
18
+ export interface SigmaOAuthResult {
19
+ /** BAP ID returned from the callback */
20
+ bapId: string;
21
+ /** Public key hex */
22
+ pubkey: string;
23
+ /** Full user object from the server callback */
24
+ user: Record<string, unknown>;
25
+ /** Access token */
26
+ accessToken: string;
27
+ }
28
+ /**
29
+ * Initiate Sigma OAuth by redirecting the browser to the authorize endpoint.
30
+ *
31
+ * Generates PKCE verifier/challenge, stores state in sessionStorage,
32
+ * and navigates the browser away. Returns a never-resolving Promise
33
+ * since the page navigates.
34
+ */
35
+ export declare function initiateSigmaOAuth(config: SigmaOAuthConfig): Promise<never>;
36
+ /**
37
+ * Check if the current URL has Sigma OAuth callback parameters
38
+ * that match a pending OAuth flow.
39
+ */
40
+ export declare function isSigmaCallback(searchParams: URLSearchParams): boolean;
41
+ /**
42
+ * Complete Sigma OAuth by exchanging the authorization code.
43
+ *
44
+ * Validates state from sessionStorage, POSTs the code + verifier to the
45
+ * app's server-side callback route, and returns the user info.
46
+ *
47
+ * @param searchParams - URL search params from the callback
48
+ * @param serverCallbackUrl - Server-side route that exchanges code for tokens
49
+ * (default: /api/auth/sigma/callback)
50
+ */
51
+ export declare function completeSigmaOAuth(searchParams: URLSearchParams, serverCallbackUrl?: string): Promise<SigmaOAuthResult>;
52
+ //# sourceMappingURL=sigma-oauth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sigma-oauth.d.ts","sourceRoot":"","sources":["../src/sigma-oauth.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gCAAgC;AAChC,eAAO,MAAM,SAAS,mCAAmC,CAAA;AAKzD,MAAM,WAAW,gBAAgB;IAChC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAA;IAChB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,gBAAgB;IAChC,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,qBAAqB;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC7B,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAA;CACnB;AAuCD;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,gBAAgB,GACtB,OAAO,CAAC,KAAK,CAAC,CA4BhB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,eAAe,GAAG,OAAO,CAKtE;AAED;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CACvC,YAAY,EAAE,eAAe,EAC7B,iBAAiB,SAA6B,GAC5C,OAAO,CAAC,gBAAgB,CAAC,CAqD3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1sat/connect",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Connection layer for 1Sat wallet - popup flow, events, session management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "keywords": ["1sat", "bsv", "ordinals", "wallet", "sdk", "connect"],
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@1sat/wallet": "0.0.25",
22
+ "@1sat/wallet": "0.0.26",
23
23
  "eventemitter3": "^5.0.1"
24
24
  },
25
25
  "peerDependencies": {