@sigma-auth/better-auth-plugin 0.0.6 → 0.0.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 +223 -23
- package/dist/client/index.d.ts +56 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +148 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/signer.d.ts +57 -0
- package/dist/client/signer.d.ts.map +1 -0
- package/dist/client/signer.js +247 -0
- package/dist/client/signer.js.map +1 -0
- package/dist/next/index.js +1 -1
- package/dist/next/index.js.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,9 +19,23 @@ This package provides multiple entry points for different use cases:
|
|
|
19
19
|
- **`/next`** - Next.js API route handlers
|
|
20
20
|
- **`/provider`** - Better Auth server plugin for OIDC provider
|
|
21
21
|
|
|
22
|
-
## Architecture
|
|
22
|
+
## Architecture
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
### OAuth Flow (Cross-Domain)
|
|
25
|
+
|
|
26
|
+
When your app authenticates with Sigma Identity (or another Better Auth server on a different domain), you use OAuth/OIDC flow with tokens:
|
|
27
|
+
|
|
28
|
+
1. User clicks sign in → redirects to `auth.sigmaidentity.com`
|
|
29
|
+
2. User authenticates with Bitcoin wallet
|
|
30
|
+
3. Redirects back to your app with authorization code
|
|
31
|
+
4. Your backend exchanges code for access tokens
|
|
32
|
+
5. **Store user data and tokens locally** (Context, Zustand, localStorage, etc.)
|
|
33
|
+
|
|
34
|
+
**Important:** Cross-domain cookies don't work due to browser security. Better Auth's `useSession` hook only works when the auth server is on the **same domain** as your app. For OAuth clients, you manage authentication state locally with tokens.
|
|
35
|
+
|
|
36
|
+
### Wallet Unlock Gate
|
|
37
|
+
|
|
38
|
+
This plugin fronts Better Auth's OIDC authorize endpoint to ensure wallet access is a prerequisite to authentication.
|
|
25
39
|
|
|
26
40
|
The client redirects to `/oauth2/authorize` (custom gate) instead of `/api/auth/oauth2/authorize` (Better Auth directly). The gate checks:
|
|
27
41
|
|
|
@@ -32,38 +46,193 @@ The client redirects to `/oauth2/authorize` (custom gate) instead of `/api/auth/
|
|
|
32
46
|
|
|
33
47
|
This makes Bitcoin identity the foundation of authentication.
|
|
34
48
|
|
|
35
|
-
## Quick Start (
|
|
49
|
+
## Quick Start (OAuth Client)
|
|
36
50
|
|
|
37
|
-
|
|
51
|
+
This is the standard setup for apps authenticating with Sigma Identity.
|
|
52
|
+
|
|
53
|
+
### 1. Environment Variables
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Your registered OAuth client ID
|
|
57
|
+
NEXT_PUBLIC_SIGMA_CLIENT_ID=your-app
|
|
58
|
+
|
|
59
|
+
# Member private key for signing token exchange requests (server-side only)
|
|
60
|
+
SIGMA_MEMBER_PRIVATE_KEY=your-member-wif
|
|
61
|
+
|
|
62
|
+
# Sigma Auth server URL
|
|
63
|
+
NEXT_PUBLIC_SIGMA_AUTH_URL=https://auth.sigmaidentity.com
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 2. Create Auth Client
|
|
38
67
|
|
|
39
68
|
```typescript
|
|
69
|
+
// lib/auth.ts
|
|
40
70
|
import { createAuthClient } from "better-auth/client";
|
|
41
71
|
import { sigmaClient } from "@sigma-auth/better-auth-plugin/client";
|
|
42
72
|
|
|
43
73
|
export const authClient = createAuthClient({
|
|
44
|
-
baseURL: "https://auth.sigmaidentity.com",
|
|
74
|
+
baseURL: process.env.NEXT_PUBLIC_SIGMA_AUTH_URL || "https://auth.sigmaidentity.com",
|
|
45
75
|
plugins: [sigmaClient()],
|
|
46
76
|
});
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### 2. Sign In
|
|
50
77
|
|
|
51
|
-
|
|
52
|
-
authClient.signIn
|
|
53
|
-
clientId: "your-app",
|
|
54
|
-
callbackURL: "/callback",
|
|
55
|
-
});
|
|
78
|
+
// Export sign in method for OAuth flow
|
|
79
|
+
export const signIn = authClient.signIn;
|
|
56
80
|
```
|
|
57
81
|
|
|
58
|
-
### 3.
|
|
82
|
+
### 3. Token Exchange API Route
|
|
83
|
+
|
|
84
|
+
This server-side endpoint exchanges the OAuth code for tokens.
|
|
59
85
|
|
|
60
86
|
```typescript
|
|
87
|
+
// app/api/auth/callback/route.ts
|
|
61
88
|
import { createCallbackHandler } from "@sigma-auth/better-auth-plugin/next";
|
|
62
89
|
|
|
63
90
|
export const runtime = "nodejs";
|
|
64
91
|
export const POST = createCallbackHandler();
|
|
65
92
|
```
|
|
66
93
|
|
|
94
|
+
### 4. OAuth Callback Page
|
|
95
|
+
|
|
96
|
+
This page handles the OAuth redirect and stores the authenticated user.
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
// app/callback/page.tsx
|
|
100
|
+
"use client";
|
|
101
|
+
|
|
102
|
+
import { Suspense, useEffect, useState } from "react";
|
|
103
|
+
import { useRouter, useSearchParams } from "next/navigation";
|
|
104
|
+
import { authClient } from "@/lib/auth";
|
|
105
|
+
|
|
106
|
+
function CallbackContent() {
|
|
107
|
+
const router = useRouter();
|
|
108
|
+
const searchParams = useSearchParams();
|
|
109
|
+
const [error, setError] = useState<string | null>(null);
|
|
110
|
+
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
const handleCallback = async () => {
|
|
113
|
+
try {
|
|
114
|
+
// Exchange code for tokens and get user data
|
|
115
|
+
const result = await authClient.sigma.handleCallback(searchParams);
|
|
116
|
+
|
|
117
|
+
// Store user data in your app's state management
|
|
118
|
+
// Example: Context, Zustand, localStorage, etc.
|
|
119
|
+
localStorage.setItem("sigma_user", JSON.stringify(result.user));
|
|
120
|
+
localStorage.setItem("sigma_access_token", result.access_token);
|
|
121
|
+
localStorage.setItem("sigma_id_token", result.id_token);
|
|
122
|
+
if (result.refresh_token) {
|
|
123
|
+
localStorage.setItem("sigma_refresh_token", result.refresh_token);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Redirect to your app
|
|
127
|
+
router.push("/");
|
|
128
|
+
} catch (err: any) {
|
|
129
|
+
console.error("OAuth callback error:", err);
|
|
130
|
+
setError(err.message || "Authentication failed");
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
handleCallback();
|
|
135
|
+
}, [searchParams, router]);
|
|
136
|
+
|
|
137
|
+
if (error) {
|
|
138
|
+
return (
|
|
139
|
+
<div className="flex min-h-screen items-center justify-center">
|
|
140
|
+
<div className="text-center">
|
|
141
|
+
<h2 className="text-xl font-semibold text-red-600">Authentication Failed</h2>
|
|
142
|
+
<p className="mt-2 text-sm text-gray-600">{error}</p>
|
|
143
|
+
<button
|
|
144
|
+
onClick={() => router.push("/")}
|
|
145
|
+
className="mt-4 px-4 py-2 bg-blue-600 text-white rounded"
|
|
146
|
+
>
|
|
147
|
+
Return Home
|
|
148
|
+
</button>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<div className="flex min-h-screen items-center justify-center">
|
|
156
|
+
<div className="text-center">
|
|
157
|
+
<h2 className="text-xl font-semibold">Completing sign in...</h2>
|
|
158
|
+
<p className="mt-2 text-sm text-gray-600">Please wait</p>
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export default function CallbackPage() {
|
|
165
|
+
return (
|
|
166
|
+
<Suspense fallback={<div>Loading...</div>}>
|
|
167
|
+
<CallbackContent />
|
|
168
|
+
</Suspense>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 5. Sign In
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
// In your sign-in button component
|
|
177
|
+
import { signIn } from "@/lib/auth";
|
|
178
|
+
|
|
179
|
+
const handleSignIn = () => {
|
|
180
|
+
signIn.sigma({
|
|
181
|
+
clientId: process.env.NEXT_PUBLIC_SIGMA_CLIENT_ID || "your-app",
|
|
182
|
+
callbackURL: "/callback",
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 6. Access User Data
|
|
188
|
+
|
|
189
|
+
Since you're managing state locally, access user data from your state management solution:
|
|
190
|
+
|
|
191
|
+
```typescript
|
|
192
|
+
// Example with Context
|
|
193
|
+
import { createContext, useContext, useEffect, useState } from "react";
|
|
194
|
+
|
|
195
|
+
const AuthContext = createContext<{ user: SigmaUserInfo | null }>({ user: null });
|
|
196
|
+
|
|
197
|
+
export function AuthProvider({ children }) {
|
|
198
|
+
const [user, setUser] = useState<SigmaUserInfo | null>(null);
|
|
199
|
+
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
const storedUser = localStorage.getItem("sigma_user");
|
|
202
|
+
if (storedUser) {
|
|
203
|
+
setUser(JSON.parse(storedUser));
|
|
204
|
+
}
|
|
205
|
+
}, []);
|
|
206
|
+
|
|
207
|
+
return <AuthContext.Provider value={{ user }}>{children}</AuthContext.Provider>;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export const useAuth = () => useContext(AuthContext);
|
|
211
|
+
|
|
212
|
+
// In components
|
|
213
|
+
const { user } = useAuth();
|
|
214
|
+
const isAdmin = user?.bap?.idKey === process.env.ADMIN_BAP_ID;
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
## Alternative: Same-Domain Setup
|
|
218
|
+
|
|
219
|
+
If you run your own Better Auth server on the **same domain** as your app, you can use session cookies and the `useSession` hook:
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
// lib/auth.ts
|
|
223
|
+
export const authClient = createAuthClient({
|
|
224
|
+
baseURL: "/api/auth", // Same domain
|
|
225
|
+
plugins: [sigmaClient()],
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
export const { useSession } = authClient;
|
|
229
|
+
|
|
230
|
+
// In components
|
|
231
|
+
const { data: session } = useSession();
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
This requires setting up Better Auth server with the Sigma provider plugin on your domain.
|
|
235
|
+
|
|
67
236
|
## Server Plugin (Auth Provider)
|
|
68
237
|
|
|
69
238
|
For building your own Sigma Identity server:
|
|
@@ -86,6 +255,45 @@ export const auth = betterAuth({
|
|
|
86
255
|
});
|
|
87
256
|
```
|
|
88
257
|
|
|
258
|
+
## Key Concepts
|
|
259
|
+
|
|
260
|
+
### OAuth Endpoints
|
|
261
|
+
|
|
262
|
+
When using OAuth flow, there are **two different endpoints**:
|
|
263
|
+
|
|
264
|
+
1. **OAuth Redirect URI** (`/callback`) - Where the auth server redirects after authorization
|
|
265
|
+
2. **Token Exchange API** (`/api/auth/callback`) - Internal endpoint that exchanges code for tokens
|
|
266
|
+
|
|
267
|
+
The redirect URI is what you configure in your OAuth client settings. The token exchange API is called internally by your callback page.
|
|
268
|
+
|
|
269
|
+
### Authentication Result
|
|
270
|
+
|
|
271
|
+
After successful authentication via `handleCallback()`, you receive:
|
|
272
|
+
|
|
273
|
+
```typescript
|
|
274
|
+
{
|
|
275
|
+
user: {
|
|
276
|
+
sub: string; // User ID
|
|
277
|
+
name?: string; // Display name
|
|
278
|
+
email?: string; // Email (if available)
|
|
279
|
+
picture?: string; // Avatar URL
|
|
280
|
+
pubkey: string; // Bitcoin public key
|
|
281
|
+
bap?: { // BAP identity (if available)
|
|
282
|
+
idKey: string; // BAP ID
|
|
283
|
+
identity: {
|
|
284
|
+
name?: string;
|
|
285
|
+
alternateName?: string;
|
|
286
|
+
description?: string;
|
|
287
|
+
// ... other BAP profile fields
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
access_token: string; // Access token for API calls
|
|
292
|
+
id_token: string; // JWT ID token (OIDC)
|
|
293
|
+
refresh_token?: string; // Refresh token (if issued)
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
89
297
|
## Features
|
|
90
298
|
|
|
91
299
|
- PKCE flow for public clients
|
|
@@ -94,15 +302,7 @@ export const auth = betterAuth({
|
|
|
94
302
|
- Multi-identity wallet support
|
|
95
303
|
- Subscription tier verification via NFT ownership
|
|
96
304
|
- Type-safe with full TypeScript support
|
|
97
|
-
|
|
98
|
-
## Environment Variables
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
# Client App
|
|
102
|
-
NEXT_PUBLIC_SIGMA_CLIENT_ID=your-app
|
|
103
|
-
SIGMA_MEMBER_PRIVATE_KEY=your-member-wif
|
|
104
|
-
NEXT_PUBLIC_SIGMA_AUTH_URL=https://auth.sigmaidentity.com
|
|
105
|
-
```
|
|
305
|
+
- Full OIDC compliance with ID tokens
|
|
106
306
|
|
|
107
307
|
## Documentation
|
|
108
308
|
|
package/dist/client/index.d.ts
CHANGED
|
@@ -75,6 +75,62 @@ export declare const sigmaClient: () => {
|
|
|
75
75
|
* @throws OAuthCallbackError if callback fails
|
|
76
76
|
*/
|
|
77
77
|
handleCallback: (searchParams: URLSearchParams) => Promise<OAuthCallbackResult>;
|
|
78
|
+
/**
|
|
79
|
+
* Sign a request using the Sigma iframe signer
|
|
80
|
+
* Keys stay in Sigma's domain - only the signature is returned
|
|
81
|
+
*
|
|
82
|
+
* @param requestPath - The API path being signed (e.g., "/api/droplits")
|
|
83
|
+
* @param body - Optional request body (string or object)
|
|
84
|
+
* @param signatureType - Signature type: 'bsm' or 'brc77' (default: 'brc77')
|
|
85
|
+
* @returns Promise resolving to auth token string
|
|
86
|
+
* @throws Error if no identity set or signing fails
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* const authToken = await authClient.sigma.sign("/api/droplits", { name: "test" });
|
|
91
|
+
* fetch("/api/droplits", {
|
|
92
|
+
* headers: { "X-Auth-Token": authToken }
|
|
93
|
+
* });
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
sign: (requestPath: string, body?: string | object, signatureType?: "bsm" | "brc77") => Promise<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Sign OP_RETURN data with AIP for Bitcoin transactions
|
|
99
|
+
* Keys stay in Sigma's domain - only the signed ops are returned
|
|
100
|
+
*
|
|
101
|
+
* @param hexArray - Array of hex strings to sign
|
|
102
|
+
* @returns Promise resolving to array of signed hex strings
|
|
103
|
+
* @throws Error if no identity set or signing fails
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```typescript
|
|
107
|
+
* const signedOps = await authClient.sigma.signAIP(["6a", "..."]);
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
signAIP: (hexArray: string[]) => Promise<string[]>;
|
|
111
|
+
/**
|
|
112
|
+
* Get the current identity (BAP ID) being used for signing
|
|
113
|
+
* @returns The current bapId or null if not set
|
|
114
|
+
*/
|
|
115
|
+
getIdentity: () => string | null;
|
|
116
|
+
/**
|
|
117
|
+
* Set the identity (BAP ID) to use for signing
|
|
118
|
+
* This is typically set automatically from OAuth callback,
|
|
119
|
+
* but can be set manually for multi-identity scenarios
|
|
120
|
+
*
|
|
121
|
+
* @param bapId - The BAP identity ID to use
|
|
122
|
+
*/
|
|
123
|
+
setIdentity: (bapId: string) => void;
|
|
124
|
+
/**
|
|
125
|
+
* Clear the stored identity and destroy the signer
|
|
126
|
+
* Call this on logout
|
|
127
|
+
*/
|
|
128
|
+
clearIdentity: () => void;
|
|
129
|
+
/**
|
|
130
|
+
* Check if the signer is ready for signing
|
|
131
|
+
* @returns true if identity is set and signer is initialized
|
|
132
|
+
*/
|
|
133
|
+
isReady: () => boolean;
|
|
78
134
|
};
|
|
79
135
|
};
|
|
80
136
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EAEX,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,mBAAmB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1,3 +1,45 @@
|
|
|
1
|
+
import { SigmaIframeSigner } from "./signer.js";
|
|
2
|
+
// Module-level state for signer (singleton per page)
|
|
3
|
+
let signer = null;
|
|
4
|
+
let storedBapId = null;
|
|
5
|
+
// Storage key for persisting bapId
|
|
6
|
+
const BAP_ID_STORAGE_KEY = "sigma_bap_id";
|
|
7
|
+
/**
|
|
8
|
+
* Get the Sigma auth URL from environment or default
|
|
9
|
+
*/
|
|
10
|
+
const getSigmaUrl = () => {
|
|
11
|
+
if (typeof process !== "undefined" &&
|
|
12
|
+
process.env.NEXT_PUBLIC_SIGMA_AUTH_URL) {
|
|
13
|
+
return process.env.NEXT_PUBLIC_SIGMA_AUTH_URL;
|
|
14
|
+
}
|
|
15
|
+
return "https://auth.sigmaidentity.com";
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Initialize or get the signer instance (lazy singleton)
|
|
19
|
+
*/
|
|
20
|
+
const getOrCreateSigner = async () => {
|
|
21
|
+
if (!signer) {
|
|
22
|
+
signer = new SigmaIframeSigner(getSigmaUrl());
|
|
23
|
+
}
|
|
24
|
+
if (!signer.isReady()) {
|
|
25
|
+
await signer.init();
|
|
26
|
+
}
|
|
27
|
+
return signer;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Load bapId from storage on init
|
|
31
|
+
*/
|
|
32
|
+
const loadStoredBapId = () => {
|
|
33
|
+
if (typeof window === "undefined")
|
|
34
|
+
return null;
|
|
35
|
+
if (storedBapId)
|
|
36
|
+
return storedBapId;
|
|
37
|
+
const stored = localStorage.getItem(BAP_ID_STORAGE_KEY);
|
|
38
|
+
if (stored) {
|
|
39
|
+
storedBapId = stored;
|
|
40
|
+
}
|
|
41
|
+
return storedBapId;
|
|
42
|
+
};
|
|
1
43
|
// PKCE helper functions
|
|
2
44
|
const generateCodeVerifier = () => {
|
|
3
45
|
const array = new Uint8Array(32);
|
|
@@ -239,6 +281,14 @@ export const sigmaClient = () => {
|
|
|
239
281
|
};
|
|
240
282
|
}
|
|
241
283
|
const data = (await response.json());
|
|
284
|
+
// Store bapId from user data for signing (from bap_id claim)
|
|
285
|
+
const bapId = data.user?.bap_id;
|
|
286
|
+
if (bapId) {
|
|
287
|
+
storedBapId = bapId;
|
|
288
|
+
if (typeof window !== "undefined") {
|
|
289
|
+
localStorage.setItem(BAP_ID_STORAGE_KEY, bapId);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
242
292
|
return {
|
|
243
293
|
user: data.user,
|
|
244
294
|
access_token: data.access_token,
|
|
@@ -263,6 +313,104 @@ export const sigmaClient = () => {
|
|
|
263
313
|
};
|
|
264
314
|
}
|
|
265
315
|
},
|
|
316
|
+
/**
|
|
317
|
+
* Sign a request using the Sigma iframe signer
|
|
318
|
+
* Keys stay in Sigma's domain - only the signature is returned
|
|
319
|
+
*
|
|
320
|
+
* @param requestPath - The API path being signed (e.g., "/api/droplits")
|
|
321
|
+
* @param body - Optional request body (string or object)
|
|
322
|
+
* @param signatureType - Signature type: 'bsm' or 'brc77' (default: 'brc77')
|
|
323
|
+
* @returns Promise resolving to auth token string
|
|
324
|
+
* @throws Error if no identity set or signing fails
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```typescript
|
|
328
|
+
* const authToken = await authClient.sigma.sign("/api/droplits", { name: "test" });
|
|
329
|
+
* fetch("/api/droplits", {
|
|
330
|
+
* headers: { "X-Auth-Token": authToken }
|
|
331
|
+
* });
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
sign: async (requestPath, body, signatureType = "brc77") => {
|
|
335
|
+
// Ensure we have a bapId (from callback or storage)
|
|
336
|
+
const bapId = storedBapId || loadStoredBapId();
|
|
337
|
+
if (!bapId) {
|
|
338
|
+
throw new Error("No identity set. Complete OAuth login first or call setIdentity().");
|
|
339
|
+
}
|
|
340
|
+
const signerInstance = await getOrCreateSigner();
|
|
341
|
+
signerInstance.setIdentity(bapId);
|
|
342
|
+
// Serialize body if object
|
|
343
|
+
const bodyString = body && typeof body === "object" ? JSON.stringify(body) : body;
|
|
344
|
+
return signerInstance.sign(requestPath, bodyString, signatureType);
|
|
345
|
+
},
|
|
346
|
+
/**
|
|
347
|
+
* Sign OP_RETURN data with AIP for Bitcoin transactions
|
|
348
|
+
* Keys stay in Sigma's domain - only the signed ops are returned
|
|
349
|
+
*
|
|
350
|
+
* @param hexArray - Array of hex strings to sign
|
|
351
|
+
* @returns Promise resolving to array of signed hex strings
|
|
352
|
+
* @throws Error if no identity set or signing fails
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```typescript
|
|
356
|
+
* const signedOps = await authClient.sigma.signAIP(["6a", "..."]);
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
signAIP: async (hexArray) => {
|
|
360
|
+
const bapId = storedBapId || loadStoredBapId();
|
|
361
|
+
if (!bapId) {
|
|
362
|
+
throw new Error("No identity set. Complete OAuth login first or call setIdentity().");
|
|
363
|
+
}
|
|
364
|
+
const signerInstance = await getOrCreateSigner();
|
|
365
|
+
signerInstance.setIdentity(bapId);
|
|
366
|
+
return signerInstance.signAIP(hexArray);
|
|
367
|
+
},
|
|
368
|
+
/**
|
|
369
|
+
* Get the current identity (BAP ID) being used for signing
|
|
370
|
+
* @returns The current bapId or null if not set
|
|
371
|
+
*/
|
|
372
|
+
getIdentity: () => {
|
|
373
|
+
return storedBapId || loadStoredBapId();
|
|
374
|
+
},
|
|
375
|
+
/**
|
|
376
|
+
* Set the identity (BAP ID) to use for signing
|
|
377
|
+
* This is typically set automatically from OAuth callback,
|
|
378
|
+
* but can be set manually for multi-identity scenarios
|
|
379
|
+
*
|
|
380
|
+
* @param bapId - The BAP identity ID to use
|
|
381
|
+
*/
|
|
382
|
+
setIdentity: (bapId) => {
|
|
383
|
+
storedBapId = bapId;
|
|
384
|
+
if (typeof window !== "undefined") {
|
|
385
|
+
localStorage.setItem(BAP_ID_STORAGE_KEY, bapId);
|
|
386
|
+
}
|
|
387
|
+
// If signer already exists, update it
|
|
388
|
+
if (signer) {
|
|
389
|
+
signer.setIdentity(bapId);
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
/**
|
|
393
|
+
* Clear the stored identity and destroy the signer
|
|
394
|
+
* Call this on logout
|
|
395
|
+
*/
|
|
396
|
+
clearIdentity: () => {
|
|
397
|
+
storedBapId = null;
|
|
398
|
+
if (typeof window !== "undefined") {
|
|
399
|
+
localStorage.removeItem(BAP_ID_STORAGE_KEY);
|
|
400
|
+
}
|
|
401
|
+
if (signer) {
|
|
402
|
+
signer.destroy();
|
|
403
|
+
signer = null;
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
/**
|
|
407
|
+
* Check if the signer is ready for signing
|
|
408
|
+
* @returns true if identity is set and signer is initialized
|
|
409
|
+
*/
|
|
410
|
+
isReady: () => {
|
|
411
|
+
const bapId = storedBapId || loadStoredBapId();
|
|
412
|
+
return !!bapId;
|
|
413
|
+
},
|
|
266
414
|
},
|
|
267
415
|
};
|
|
268
416
|
},
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAShD,qDAAqD;AACrD,IAAI,MAAM,GAA6B,IAAI,CAAC;AAC5C,IAAI,WAAW,GAAkB,IAAI,CAAC;AAEtC,mCAAmC;AACnC,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,GAAG,GAAW,EAAE;IAChC,IACC,OAAO,OAAO,KAAK,WAAW;QAC9B,OAAO,CAAC,GAAG,CAAC,0BAA0B,EACrC,CAAC;QACF,OAAO,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;IAC/C,CAAC;IACD,OAAO,gCAAgC,C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AC,UAAU,CAAC,kBAAkB,CAAC,CAAC;wBAC7C,CAAC;wBACD,IAAI,MAAM,EAAE,CAAC;4BACZ,MAAM,CAAC,OAAO,EAAE,CAAC;4BACjB,MAAM,GAAG,IAAI,CAAC;wBACf,CAAC;oBACF,CAAC;oBAED;;;uBAGG;oBACH,OAAO,EAAE,GAAY,EAAE;wBACtB,MAAM,KAAK,GAAG,WAAW,IAAI,eAAe,EAAE,CAAC;wBAC/C,OAAO,CAAC,CAAC,KAAK,CAAC;oBAChB,CAAC;iBACD;aACD,CAAC;QACH,CAAC;KACgC,CAAC;AACpC,CAAC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sigma Iframe Signer
|
|
3
|
+
*
|
|
4
|
+
* Provides seamless client-side signing via embedded Sigma iframe.
|
|
5
|
+
* Keys stay in auth.sigmaidentity.com - never exposed to client apps.
|
|
6
|
+
*
|
|
7
|
+
* Protocol:
|
|
8
|
+
* - Parent → Iframe: SET_IDENTITY, SIGN_REQUEST, SIGN_AIP_REQUEST
|
|
9
|
+
* - Iframe → Parent: WALLET_LOCKED, WALLET_UNLOCKED, SIGN_RESPONSE, SIGN_AIP_RESPONSE, SIGNER_ERROR
|
|
10
|
+
*/
|
|
11
|
+
export declare class SigmaIframeSigner {
|
|
12
|
+
private iframe;
|
|
13
|
+
private pendingRequests;
|
|
14
|
+
private pendingAIPRequests;
|
|
15
|
+
private initialized;
|
|
16
|
+
private boundMessageHandler;
|
|
17
|
+
private currentBapId;
|
|
18
|
+
private sigmaUrl;
|
|
19
|
+
constructor(sigmaUrl: string);
|
|
20
|
+
/**
|
|
21
|
+
* Initialize the Sigma signer iframe (lazy - called on first sign request)
|
|
22
|
+
*/
|
|
23
|
+
init(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Set the identity for signing
|
|
26
|
+
*/
|
|
27
|
+
setIdentity(bapId: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Sign a request
|
|
30
|
+
*/
|
|
31
|
+
sign(requestPath: string, body?: string, signatureType?: "bsm" | "brc77"): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Sign OP_RETURN data with AIP
|
|
34
|
+
*/
|
|
35
|
+
signAIP(hexArray: string[]): Promise<string[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Handle messages from Sigma iframe
|
|
38
|
+
*/
|
|
39
|
+
private handleMessage;
|
|
40
|
+
/**
|
|
41
|
+
* Reject all pending requests
|
|
42
|
+
*/
|
|
43
|
+
private rejectAllPending;
|
|
44
|
+
/**
|
|
45
|
+
* Check if signer is ready
|
|
46
|
+
*/
|
|
47
|
+
isReady(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get current identity
|
|
50
|
+
*/
|
|
51
|
+
getIdentity(): string | null;
|
|
52
|
+
/**
|
|
53
|
+
* Cleanup
|
|
54
|
+
*/
|
|
55
|
+
destroy(): void;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../src/client/signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAkCH,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,eAAe,CAAkD;IACzE,OAAO,CAAC,kBAAkB,CAAoD;IAC9E,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,mBAAmB,CAAgD;IAC3E,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,EAAE,MAAM;IAI5B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA8C3B;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAWhC;;OAEG;IACG,IAAI,CACT,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,MAAM,EACb,aAAa,GAAE,KAAK,GAAG,OAAiB,GACtC,OAAO,CAAC,MAAM,CAAC;IAgDlB;;OAEG;IACG,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IA0CpD;;OAEG;IACH,OAAO,CAAC,aAAa;IAuErB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAcxB;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,WAAW,IAAI,MAAM,GAAG,IAAI;IAI5B;;OAEG;IACH,OAAO,IAAI,IAAI;CAYf"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sigma Iframe Signer
|
|
3
|
+
*
|
|
4
|
+
* Provides seamless client-side signing via embedded Sigma iframe.
|
|
5
|
+
* Keys stay in auth.sigmaidentity.com - never exposed to client apps.
|
|
6
|
+
*
|
|
7
|
+
* Protocol:
|
|
8
|
+
* - Parent → Iframe: SET_IDENTITY, SIGN_REQUEST, SIGN_AIP_REQUEST
|
|
9
|
+
* - Iframe → Parent: WALLET_LOCKED, WALLET_UNLOCKED, SIGN_RESPONSE, SIGN_AIP_RESPONSE, SIGNER_ERROR
|
|
10
|
+
*/
|
|
11
|
+
export class SigmaIframeSigner {
|
|
12
|
+
iframe = null;
|
|
13
|
+
pendingRequests = new Map();
|
|
14
|
+
pendingAIPRequests = new Map();
|
|
15
|
+
initialized = false;
|
|
16
|
+
boundMessageHandler = null;
|
|
17
|
+
currentBapId = null;
|
|
18
|
+
sigmaUrl;
|
|
19
|
+
constructor(sigmaUrl) {
|
|
20
|
+
this.sigmaUrl = sigmaUrl;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Initialize the Sigma signer iframe (lazy - called on first sign request)
|
|
24
|
+
*/
|
|
25
|
+
async init() {
|
|
26
|
+
if (typeof window === "undefined") {
|
|
27
|
+
throw new Error("SigmaIframeSigner can only be used in browser");
|
|
28
|
+
}
|
|
29
|
+
if (this.initialized)
|
|
30
|
+
return;
|
|
31
|
+
// Create hidden iframe for Sigma signer
|
|
32
|
+
this.iframe = document.createElement("iframe");
|
|
33
|
+
this.iframe.src = `${this.sigmaUrl}/signer`;
|
|
34
|
+
this.iframe.style.cssText = `
|
|
35
|
+
position: fixed;
|
|
36
|
+
inset: 0;
|
|
37
|
+
width: 100vw;
|
|
38
|
+
height: 100vh;
|
|
39
|
+
border: none;
|
|
40
|
+
background: transparent;
|
|
41
|
+
z-index: 10000;
|
|
42
|
+
display: none;
|
|
43
|
+
pointer-events: auto;
|
|
44
|
+
`;
|
|
45
|
+
document.body.appendChild(this.iframe);
|
|
46
|
+
// Set up message listener
|
|
47
|
+
this.boundMessageHandler = this.handleMessage.bind(this);
|
|
48
|
+
window.addEventListener("message", this.boundMessageHandler);
|
|
49
|
+
// Wait for iframe to load
|
|
50
|
+
const iframe = this.iframe;
|
|
51
|
+
await new Promise((resolve, reject) => {
|
|
52
|
+
const timeout = setTimeout(() => reject(new Error("Sigma iframe load timeout")), 10000);
|
|
53
|
+
iframe.addEventListener("load", () => {
|
|
54
|
+
clearTimeout(timeout);
|
|
55
|
+
this.initialized = true;
|
|
56
|
+
resolve();
|
|
57
|
+
});
|
|
58
|
+
iframe.addEventListener("error", () => {
|
|
59
|
+
clearTimeout(timeout);
|
|
60
|
+
reject(new Error("Failed to load Sigma iframe"));
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Set the identity for signing
|
|
66
|
+
*/
|
|
67
|
+
setIdentity(bapId) {
|
|
68
|
+
this.currentBapId = bapId;
|
|
69
|
+
if (this.initialized && this.iframe?.contentWindow) {
|
|
70
|
+
this.iframe.contentWindow.postMessage({ type: "SET_IDENTITY", payload: { bapId } }, this.sigmaUrl);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Sign a request
|
|
75
|
+
*/
|
|
76
|
+
async sign(requestPath, body, signatureType = "brc77") {
|
|
77
|
+
if (!this.initialized) {
|
|
78
|
+
await this.init();
|
|
79
|
+
}
|
|
80
|
+
if (!this.currentBapId) {
|
|
81
|
+
throw new Error("No identity set. Call setIdentity() first.");
|
|
82
|
+
}
|
|
83
|
+
const contentWindow = this.iframe?.contentWindow;
|
|
84
|
+
if (!contentWindow) {
|
|
85
|
+
throw new Error("Sigma iframe not accessible");
|
|
86
|
+
}
|
|
87
|
+
// Ensure identity is set
|
|
88
|
+
contentWindow.postMessage({ type: "SET_IDENTITY", payload: { bapId: this.currentBapId } }, this.sigmaUrl);
|
|
89
|
+
const requestId = `req_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
90
|
+
const request = {
|
|
91
|
+
requestId,
|
|
92
|
+
requestPath,
|
|
93
|
+
signatureType,
|
|
94
|
+
};
|
|
95
|
+
if (body) {
|
|
96
|
+
request.body = body;
|
|
97
|
+
request.bodyEncoding = "utf8";
|
|
98
|
+
}
|
|
99
|
+
return new Promise((resolve, reject) => {
|
|
100
|
+
const timeout = setTimeout(() => {
|
|
101
|
+
this.pendingRequests.delete(requestId);
|
|
102
|
+
reject(new Error("Signature request timeout"));
|
|
103
|
+
}, 30000);
|
|
104
|
+
this.pendingRequests.set(requestId, { resolve, reject, timeout });
|
|
105
|
+
contentWindow.postMessage({ type: "SIGN_REQUEST", payload: request }, this.sigmaUrl);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Sign OP_RETURN data with AIP
|
|
110
|
+
*/
|
|
111
|
+
async signAIP(hexArray) {
|
|
112
|
+
if (!this.initialized) {
|
|
113
|
+
await this.init();
|
|
114
|
+
}
|
|
115
|
+
if (!this.currentBapId) {
|
|
116
|
+
throw new Error("No identity set. Call setIdentity() first.");
|
|
117
|
+
}
|
|
118
|
+
const contentWindow = this.iframe?.contentWindow;
|
|
119
|
+
if (!contentWindow) {
|
|
120
|
+
throw new Error("Sigma iframe not accessible");
|
|
121
|
+
}
|
|
122
|
+
// Ensure identity is set
|
|
123
|
+
contentWindow.postMessage({ type: "SET_IDENTITY", payload: { bapId: this.currentBapId } }, this.sigmaUrl);
|
|
124
|
+
const requestId = `aip_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
125
|
+
const request = {
|
|
126
|
+
requestId,
|
|
127
|
+
hexArray,
|
|
128
|
+
};
|
|
129
|
+
return new Promise((resolve, reject) => {
|
|
130
|
+
const timeout = setTimeout(() => {
|
|
131
|
+
this.pendingAIPRequests.delete(requestId);
|
|
132
|
+
reject(new Error("AIP signature request timeout"));
|
|
133
|
+
}, 30000);
|
|
134
|
+
this.pendingAIPRequests.set(requestId, { resolve, reject, timeout });
|
|
135
|
+
contentWindow.postMessage({ type: "SIGN_AIP_REQUEST", payload: request }, this.sigmaUrl);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Handle messages from Sigma iframe
|
|
140
|
+
*/
|
|
141
|
+
handleMessage(event) {
|
|
142
|
+
// Verify origin
|
|
143
|
+
if (event.origin !== this.sigmaUrl) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const { type, payload } = event.data || {};
|
|
147
|
+
switch (type) {
|
|
148
|
+
case "WALLET_LOCKED":
|
|
149
|
+
// Show iframe for password entry
|
|
150
|
+
if (this.iframe) {
|
|
151
|
+
this.iframe.style.display = "block";
|
|
152
|
+
}
|
|
153
|
+
break;
|
|
154
|
+
case "WALLET_UNLOCKED":
|
|
155
|
+
// Hide iframe
|
|
156
|
+
if (this.iframe) {
|
|
157
|
+
this.iframe.style.display = "none";
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
160
|
+
case "SIGNER_ERROR": {
|
|
161
|
+
// Hide iframe and reject all pending requests
|
|
162
|
+
if (this.iframe) {
|
|
163
|
+
this.iframe.style.display = "none";
|
|
164
|
+
}
|
|
165
|
+
const errorMsg = event.data.error || "Signer error";
|
|
166
|
+
this.rejectAllPending(new Error(`Signer error: ${errorMsg}. Please sign in to Sigma Identity.`));
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
case "SIGN_RESPONSE": {
|
|
170
|
+
const response = payload;
|
|
171
|
+
const pending = this.pendingRequests.get(response.requestId);
|
|
172
|
+
if (pending) {
|
|
173
|
+
clearTimeout(pending.timeout);
|
|
174
|
+
this.pendingRequests.delete(response.requestId);
|
|
175
|
+
if (response.error) {
|
|
176
|
+
pending.reject(new Error(response.error));
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
pending.resolve(response.authToken);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
case "SIGN_AIP_RESPONSE": {
|
|
185
|
+
const response = payload;
|
|
186
|
+
const pending = this.pendingAIPRequests.get(response.requestId);
|
|
187
|
+
if (pending) {
|
|
188
|
+
clearTimeout(pending.timeout);
|
|
189
|
+
this.pendingAIPRequests.delete(response.requestId);
|
|
190
|
+
if (response.error) {
|
|
191
|
+
pending.reject(new Error(response.error));
|
|
192
|
+
}
|
|
193
|
+
else if (response.signedOps) {
|
|
194
|
+
pending.resolve(response.signedOps);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
pending.reject(new Error("No signed ops returned"));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Reject all pending requests
|
|
206
|
+
*/
|
|
207
|
+
rejectAllPending(error) {
|
|
208
|
+
for (const [, pending] of this.pendingRequests) {
|
|
209
|
+
clearTimeout(pending.timeout);
|
|
210
|
+
pending.reject(error);
|
|
211
|
+
}
|
|
212
|
+
this.pendingRequests.clear();
|
|
213
|
+
for (const [, pending] of this.pendingAIPRequests) {
|
|
214
|
+
clearTimeout(pending.timeout);
|
|
215
|
+
pending.reject(error);
|
|
216
|
+
}
|
|
217
|
+
this.pendingAIPRequests.clear();
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Check if signer is ready
|
|
221
|
+
*/
|
|
222
|
+
isReady() {
|
|
223
|
+
return this.initialized && this.iframe !== null;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Get current identity
|
|
227
|
+
*/
|
|
228
|
+
getIdentity() {
|
|
229
|
+
return this.currentBapId;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Cleanup
|
|
233
|
+
*/
|
|
234
|
+
destroy() {
|
|
235
|
+
if (this.iframe) {
|
|
236
|
+
document.body.removeChild(this.iframe);
|
|
237
|
+
this.iframe = null;
|
|
238
|
+
}
|
|
239
|
+
if (this.boundMessageHandler) {
|
|
240
|
+
window.removeEventListener("message", this.boundMessageHandler);
|
|
241
|
+
this.boundMessageHandler = null;
|
|
242
|
+
}
|
|
243
|
+
this.initialized = false;
|
|
244
|
+
this.rejectAllPending(new Error("Signer destroyed"));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=signer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src/client/signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAkCH,MAAM,OAAO,iBAAiB;IACrB,MAAM,GAA6B,IAAI,CAAC;IACxC,eAAe,GAAwC,IAAI,GAAG,EAAE,CAAC;IACjE,kBAAkB,GAA0C,IAAI,GAAG,EAAE,CAAC;IACtE,WAAW,GAAG,KAAK,CAAC;IACpB,mBAAmB,GAA2C,IAAI,CAAC;IACnE,YAAY,GAAkB,IAAI,CAAC;IACnC,QAAQ,CAAS;IAEzB,YAAY,QAAgB;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACT,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAClE,CAAC;QAED,IAAI,IA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ACV,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,OAAO;QACN,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACpB,CAAC;QACD,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC9B,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;YAChE,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACtD,CAAC;CACD"}
|
package/dist/next/index.js
CHANGED
|
@@ -70,7 +70,7 @@ export function createCallbackHandler(config) {
|
|
|
70
70
|
console.log("[Sigma OAuth Callback] Success:", {
|
|
71
71
|
hasBap: !!result.user.bap,
|
|
72
72
|
name: result.user.name,
|
|
73
|
-
bapId: result.user.
|
|
73
|
+
bapId: result.user.bap_id?.substring(0, 20) || "none",
|
|
74
74
|
});
|
|
75
75
|
return Response.json({
|
|
76
76
|
user: result.user,
|
package/dist/next/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/next/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,qBAAqB,GAErB,MAAM,oBAAoB,CAAC;AAwB5B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA4B;IACjE,OAAO,KAAK,EAAE,OAAoB,EAAE,EAAE;QACrC,IAAI,CAAC;YACJ,MAAM,IAAI,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,CAGjC,CAAC;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EAAE,MAAM,CAAC,IAAI;gBACjB,YAAY,EAAE,MAAM,CAAC,YAAY;gBACjC,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,aAAa,EAAE,MAAM,CAAC,aAAa;aACnC,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;YAEtD,qCAAqC;YACrC,IACC,KAAK;gBACL,OAAO,KAAK,KAAK,QAAQ;gBACzB,OAAO,IAAI,KAAK;gBAChB,UAAU,IAAI,KAAK,EAClB,CAAC;gBACF,MAAM,UAAU,GAAG,KAA2B,CAAC;gBAC/C,OAAO,QAAQ,CAAC,IAAI,CACnB;oBACC,KAAK,EAAE,UAAU,CAAC,KAAK;oBACvB,OAAO,EAAE,UAAU,CAAC,OAAO;oBAC3B,MAAM,EAAE,UAAU,CAAC,MAAM;oBACzB,QAAQ,EAAE,UAAU,CAAC,QAAQ;iBAC7B,EACD,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,GAAG,EAAE,CACpC,CAAC;YACH,CAAC;YAED,OAAO,QAAQ,CAAC,IAAI,CACnB;gBACC,KAAK,EAAE,uBAAuB;gBAC9B,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;aACjE,EACD,EAAE,MAAM,EAAE,GAAG,EAAE,CACf,CAAC;QACH,CAAC;IACF,CAAC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -42,7 +42,8 @@ export interface SigmaUserInfo extends Omit<User, "id"> {
|
|
|
42
42
|
family_name?: string | null;
|
|
43
43
|
picture?: string | null;
|
|
44
44
|
pubkey: string;
|
|
45
|
-
|
|
45
|
+
bap_id?: string;
|
|
46
|
+
bap?: BAPProfile | string | null;
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
49
|
* Subscription status from auth server
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpE,QAAQ,CAAC,EAAE;QACV,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACvB,CAAC;IACF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC;IAEtD,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGxB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,UAAU,GAA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