@dynamic-labs-wallet/node 1.0.62 → 1.0.64
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/index.cjs +49 -121
- package/index.esm.js +49 -121
- package/package.json +3 -3
- package/src/authClient.d.ts +3 -18
- package/src/authClient.d.ts.map +1 -1
- package/src/siweUtils.d.ts +0 -25
- package/src/siweUtils.d.ts.map +0 -1
package/index.cjs
CHANGED
|
@@ -2216,49 +2216,6 @@ function decryptDelegatedWebhookData({ privateKeyPem, encryptedDelegatedKeyShare
|
|
|
2216
2216
|
}
|
|
2217
2217
|
}
|
|
2218
2218
|
|
|
2219
|
-
/** Formats an EIP-4361-style sign-in message in the exact shape Dynamic's verifier accepts. */ function formatSiweMessage(params) {
|
|
2220
|
-
var _params_blockchainName;
|
|
2221
|
-
const header = `${params.domain} wants you to sign in with your ${(_params_blockchainName = params.blockchainName) != null ? _params_blockchainName : 'Ethereum'} account:`;
|
|
2222
|
-
var _params_issuedAt;
|
|
2223
|
-
const fields = [
|
|
2224
|
-
`URI: ${params.uri}`,
|
|
2225
|
-
'Version: 1',
|
|
2226
|
-
...params.chainId !== undefined ? [
|
|
2227
|
-
`Chain ID: ${params.chainId}`
|
|
2228
|
-
] : [],
|
|
2229
|
-
`Nonce: ${params.nonce}`,
|
|
2230
|
-
`Issued At: ${(_params_issuedAt = params.issuedAt) != null ? _params_issuedAt : new Date().toISOString()}`
|
|
2231
|
-
].join('\n');
|
|
2232
|
-
// No statement still keeps both blank lines (EIP-4361) — the verifier 400s otherwise.
|
|
2233
|
-
const statement = params.statement ? `${params.statement}\n\n` : '\n';
|
|
2234
|
-
return `${header}\n${params.address}\n\n${statement}${fields}`;
|
|
2235
|
-
}
|
|
2236
|
-
/** Throws unless `address` is a 0x-prefixed 20-byte hex EVM address. SIWS adds a base58 sibling. */ function assertEvmAddress(address) {
|
|
2237
|
-
if (!/^0x[0-9a-fA-F]{40}$/.test(address)) {
|
|
2238
|
-
throw new Error('wallet.signIn requires a 0x-prefixed 20-byte hex address');
|
|
2239
|
-
}
|
|
2240
|
-
}
|
|
2241
|
-
/** Resolves which origin a SIWE sign-in presents as. Throws before any network call. */ function resolveSiweOrigin(appOrigin, params) {
|
|
2242
|
-
if (params.domain && params.uri) return {
|
|
2243
|
-
domain: params.domain,
|
|
2244
|
-
uri: params.uri
|
|
2245
|
-
};
|
|
2246
|
-
if (!appOrigin) {
|
|
2247
|
-
throw new Error('wallet.signIn requires domain/uri — pass them or set appOrigin on createAuthClient');
|
|
2248
|
-
}
|
|
2249
|
-
let parsed;
|
|
2250
|
-
try {
|
|
2251
|
-
parsed = new URL(appOrigin);
|
|
2252
|
-
} catch (e) {
|
|
2253
|
-
throw new Error('createAuthClient appOrigin is not a valid URL');
|
|
2254
|
-
}
|
|
2255
|
-
var _params_domain, _params_uri;
|
|
2256
|
-
return {
|
|
2257
|
-
domain: (_params_domain = params.domain) != null ? _params_domain : parsed.host,
|
|
2258
|
-
uri: (_params_uri = params.uri) != null ? _params_uri : appOrigin
|
|
2259
|
-
};
|
|
2260
|
-
}
|
|
2261
|
-
|
|
2262
2219
|
const toAuthResult = (response)=>{
|
|
2263
2220
|
var _response_user;
|
|
2264
2221
|
if (response.mfaToken && !response.minifiedJwt && !response.jwt) {
|
|
@@ -2311,79 +2268,6 @@ const asAuthError = async (error, operation)=>{
|
|
|
2311
2268
|
},
|
|
2312
2269
|
fetchApi: options.fetchApi
|
|
2313
2270
|
}));
|
|
2314
|
-
const siwePrimitives = {
|
|
2315
|
-
async getNonce () {
|
|
2316
|
-
try {
|
|
2317
|
-
const { nonce } = await api.getNonce({
|
|
2318
|
-
environmentId
|
|
2319
|
-
});
|
|
2320
|
-
if (!nonce) throw new Error('nonce endpoint returned no nonce');
|
|
2321
|
-
return {
|
|
2322
|
-
nonce
|
|
2323
|
-
};
|
|
2324
|
-
} catch (error) {
|
|
2325
|
-
throw await asAuthError(error, 'SIWE nonce request');
|
|
2326
|
-
}
|
|
2327
|
-
},
|
|
2328
|
-
createMessage (params) {
|
|
2329
|
-
return formatSiweMessage(params);
|
|
2330
|
-
},
|
|
2331
|
-
async verify ({ message, signature, walletAddress, sessionPublicKey, walletName = 'unknown', walletProvider = sdkApiCore.WalletProviderEnum.CustodialService, chain = sdkApiCore.ChainEnum.Evm }) {
|
|
2332
|
-
try {
|
|
2333
|
-
const response = await api.verify({
|
|
2334
|
-
environmentId,
|
|
2335
|
-
verifyRequest: {
|
|
2336
|
-
messageToSign: message,
|
|
2337
|
-
signedMessage: signature,
|
|
2338
|
-
publicWalletAddress: walletAddress,
|
|
2339
|
-
chain,
|
|
2340
|
-
walletName,
|
|
2341
|
-
walletProvider,
|
|
2342
|
-
sessionPublicKey
|
|
2343
|
-
}
|
|
2344
|
-
});
|
|
2345
|
-
return toAuthResult(response);
|
|
2346
|
-
} catch (error) {
|
|
2347
|
-
throw await asAuthError(error, 'SIWE sign-in');
|
|
2348
|
-
}
|
|
2349
|
-
}
|
|
2350
|
-
};
|
|
2351
|
-
const signIn = async ({ address, signMessage, sessionPublicKey, domain, uri, chainId = 1, statement, walletName, walletProvider })=>{
|
|
2352
|
-
// A malformed address would only surface as an opaque server-side 400 after signing.
|
|
2353
|
-
assertEvmAddress(address);
|
|
2354
|
-
// Line breaks would corrupt the EIP-4361 message structure (opaque server-side 400).
|
|
2355
|
-
for (const [name, value] of Object.entries({
|
|
2356
|
-
domain,
|
|
2357
|
-
uri,
|
|
2358
|
-
statement
|
|
2359
|
-
})){
|
|
2360
|
-
if (value && /[\r\n]/.test(value)) {
|
|
2361
|
-
throw new Error(`wallet.signIn: ${name} must not contain line breaks`);
|
|
2362
|
-
}
|
|
2363
|
-
}
|
|
2364
|
-
const origin = resolveSiweOrigin(options.appOrigin, {
|
|
2365
|
-
domain,
|
|
2366
|
-
uri
|
|
2367
|
-
});
|
|
2368
|
-
const { nonce } = await siwePrimitives.getNonce();
|
|
2369
|
-
const message = siwePrimitives.createMessage({
|
|
2370
|
-
domain: origin.domain,
|
|
2371
|
-
address,
|
|
2372
|
-
uri: origin.uri,
|
|
2373
|
-
chainId,
|
|
2374
|
-
nonce,
|
|
2375
|
-
statement
|
|
2376
|
-
});
|
|
2377
|
-
const signature = await signMessage(message);
|
|
2378
|
-
return siwePrimitives.verify({
|
|
2379
|
-
message,
|
|
2380
|
-
signature,
|
|
2381
|
-
walletAddress: address,
|
|
2382
|
-
sessionPublicKey,
|
|
2383
|
-
walletName,
|
|
2384
|
-
walletProvider
|
|
2385
|
-
});
|
|
2386
|
-
};
|
|
2387
2271
|
return {
|
|
2388
2272
|
email: {
|
|
2389
2273
|
async sendOtp (email) {
|
|
@@ -2401,14 +2285,14 @@ const asAuthError = async (error, operation)=>{
|
|
|
2401
2285
|
throw await asAuthError(error, 'email OTP request');
|
|
2402
2286
|
}
|
|
2403
2287
|
},
|
|
2404
|
-
async verifyOtp ({ verificationUUID, code,
|
|
2288
|
+
async verifyOtp ({ verificationUUID, code, sessionPublicKeyHex }) {
|
|
2405
2289
|
try {
|
|
2406
2290
|
const response = await api.signInWithEmailVerification({
|
|
2407
2291
|
environmentId,
|
|
2408
2292
|
emailVerificationVerifyRequest: {
|
|
2409
2293
|
verificationUUID,
|
|
2410
2294
|
verificationToken: code,
|
|
2411
|
-
sessionPublicKey
|
|
2295
|
+
sessionPublicKey: sessionPublicKeyHex
|
|
2412
2296
|
}
|
|
2413
2297
|
});
|
|
2414
2298
|
return toAuthResult(response);
|
|
@@ -2417,9 +2301,53 @@ const asAuthError = async (error, operation)=>{
|
|
|
2417
2301
|
}
|
|
2418
2302
|
}
|
|
2419
2303
|
},
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2304
|
+
siwe: {
|
|
2305
|
+
async getNonce () {
|
|
2306
|
+
try {
|
|
2307
|
+
const { nonce } = await api.getNonce({
|
|
2308
|
+
environmentId
|
|
2309
|
+
});
|
|
2310
|
+
if (!nonce) throw new Error('nonce endpoint returned no nonce');
|
|
2311
|
+
return {
|
|
2312
|
+
nonce
|
|
2313
|
+
};
|
|
2314
|
+
} catch (error) {
|
|
2315
|
+
throw await asAuthError(error, 'SIWE nonce request');
|
|
2316
|
+
}
|
|
2317
|
+
},
|
|
2318
|
+
createMessage (params) {
|
|
2319
|
+
const header = `${params.domain} wants you to sign in with your Ethereum account:`;
|
|
2320
|
+
var _params_issuedAt;
|
|
2321
|
+
const fields = [
|
|
2322
|
+
`URI: ${params.uri}`,
|
|
2323
|
+
'Version: 1',
|
|
2324
|
+
`Chain ID: ${params.chainId}`,
|
|
2325
|
+
`Nonce: ${params.nonce}`,
|
|
2326
|
+
`Issued At: ${(_params_issuedAt = params.issuedAt) != null ? _params_issuedAt : new Date().toISOString()}`
|
|
2327
|
+
].join('\n');
|
|
2328
|
+
const statement = params.statement ? `${params.statement}\n\n` : '';
|
|
2329
|
+
return `${header}\n${params.address}\n\n${statement}${fields}`;
|
|
2330
|
+
},
|
|
2331
|
+
async verify ({ message, signature, walletAddress, sessionPublicKeyHex, walletName = 'unknown', walletProvider = sdkApiCore.WalletProviderEnum.BrowserExtension, chain = sdkApiCore.ChainEnum.Evm }) {
|
|
2332
|
+
try {
|
|
2333
|
+
const response = await api.verify({
|
|
2334
|
+
environmentId,
|
|
2335
|
+
verifyRequest: {
|
|
2336
|
+
messageToSign: message,
|
|
2337
|
+
signedMessage: signature,
|
|
2338
|
+
publicWalletAddress: walletAddress,
|
|
2339
|
+
chain,
|
|
2340
|
+
walletName,
|
|
2341
|
+
walletProvider,
|
|
2342
|
+
sessionPublicKey: sessionPublicKeyHex
|
|
2343
|
+
}
|
|
2344
|
+
});
|
|
2345
|
+
return toAuthResult(response);
|
|
2346
|
+
} catch (error) {
|
|
2347
|
+
throw await asAuthError(error, 'SIWE sign-in');
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
}
|
|
2423
2351
|
};
|
|
2424
2352
|
}
|
|
2425
2353
|
|
package/index.esm.js
CHANGED
|
@@ -2215,49 +2215,6 @@ function decryptDelegatedWebhookData({ privateKeyPem, encryptedDelegatedKeyShare
|
|
|
2215
2215
|
}
|
|
2216
2216
|
}
|
|
2217
2217
|
|
|
2218
|
-
/** Formats an EIP-4361-style sign-in message in the exact shape Dynamic's verifier accepts. */ function formatSiweMessage(params) {
|
|
2219
|
-
var _params_blockchainName;
|
|
2220
|
-
const header = `${params.domain} wants you to sign in with your ${(_params_blockchainName = params.blockchainName) != null ? _params_blockchainName : 'Ethereum'} account:`;
|
|
2221
|
-
var _params_issuedAt;
|
|
2222
|
-
const fields = [
|
|
2223
|
-
`URI: ${params.uri}`,
|
|
2224
|
-
'Version: 1',
|
|
2225
|
-
...params.chainId !== undefined ? [
|
|
2226
|
-
`Chain ID: ${params.chainId}`
|
|
2227
|
-
] : [],
|
|
2228
|
-
`Nonce: ${params.nonce}`,
|
|
2229
|
-
`Issued At: ${(_params_issuedAt = params.issuedAt) != null ? _params_issuedAt : new Date().toISOString()}`
|
|
2230
|
-
].join('\n');
|
|
2231
|
-
// No statement still keeps both blank lines (EIP-4361) — the verifier 400s otherwise.
|
|
2232
|
-
const statement = params.statement ? `${params.statement}\n\n` : '\n';
|
|
2233
|
-
return `${header}\n${params.address}\n\n${statement}${fields}`;
|
|
2234
|
-
}
|
|
2235
|
-
/** Throws unless `address` is a 0x-prefixed 20-byte hex EVM address. SIWS adds a base58 sibling. */ function assertEvmAddress(address) {
|
|
2236
|
-
if (!/^0x[0-9a-fA-F]{40}$/.test(address)) {
|
|
2237
|
-
throw new Error('wallet.signIn requires a 0x-prefixed 20-byte hex address');
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
/** Resolves which origin a SIWE sign-in presents as. Throws before any network call. */ function resolveSiweOrigin(appOrigin, params) {
|
|
2241
|
-
if (params.domain && params.uri) return {
|
|
2242
|
-
domain: params.domain,
|
|
2243
|
-
uri: params.uri
|
|
2244
|
-
};
|
|
2245
|
-
if (!appOrigin) {
|
|
2246
|
-
throw new Error('wallet.signIn requires domain/uri — pass them or set appOrigin on createAuthClient');
|
|
2247
|
-
}
|
|
2248
|
-
let parsed;
|
|
2249
|
-
try {
|
|
2250
|
-
parsed = new URL(appOrigin);
|
|
2251
|
-
} catch (e) {
|
|
2252
|
-
throw new Error('createAuthClient appOrigin is not a valid URL');
|
|
2253
|
-
}
|
|
2254
|
-
var _params_domain, _params_uri;
|
|
2255
|
-
return {
|
|
2256
|
-
domain: (_params_domain = params.domain) != null ? _params_domain : parsed.host,
|
|
2257
|
-
uri: (_params_uri = params.uri) != null ? _params_uri : appOrigin
|
|
2258
|
-
};
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
2218
|
const toAuthResult = (response)=>{
|
|
2262
2219
|
var _response_user;
|
|
2263
2220
|
if (response.mfaToken && !response.minifiedJwt && !response.jwt) {
|
|
@@ -2310,79 +2267,6 @@ const asAuthError = async (error, operation)=>{
|
|
|
2310
2267
|
},
|
|
2311
2268
|
fetchApi: options.fetchApi
|
|
2312
2269
|
}));
|
|
2313
|
-
const siwePrimitives = {
|
|
2314
|
-
async getNonce () {
|
|
2315
|
-
try {
|
|
2316
|
-
const { nonce } = await api.getNonce({
|
|
2317
|
-
environmentId
|
|
2318
|
-
});
|
|
2319
|
-
if (!nonce) throw new Error('nonce endpoint returned no nonce');
|
|
2320
|
-
return {
|
|
2321
|
-
nonce
|
|
2322
|
-
};
|
|
2323
|
-
} catch (error) {
|
|
2324
|
-
throw await asAuthError(error, 'SIWE nonce request');
|
|
2325
|
-
}
|
|
2326
|
-
},
|
|
2327
|
-
createMessage (params) {
|
|
2328
|
-
return formatSiweMessage(params);
|
|
2329
|
-
},
|
|
2330
|
-
async verify ({ message, signature, walletAddress, sessionPublicKey, walletName = 'unknown', walletProvider = WalletProviderEnum.CustodialService, chain = ChainEnum.Evm }) {
|
|
2331
|
-
try {
|
|
2332
|
-
const response = await api.verify({
|
|
2333
|
-
environmentId,
|
|
2334
|
-
verifyRequest: {
|
|
2335
|
-
messageToSign: message,
|
|
2336
|
-
signedMessage: signature,
|
|
2337
|
-
publicWalletAddress: walletAddress,
|
|
2338
|
-
chain,
|
|
2339
|
-
walletName,
|
|
2340
|
-
walletProvider,
|
|
2341
|
-
sessionPublicKey
|
|
2342
|
-
}
|
|
2343
|
-
});
|
|
2344
|
-
return toAuthResult(response);
|
|
2345
|
-
} catch (error) {
|
|
2346
|
-
throw await asAuthError(error, 'SIWE sign-in');
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
};
|
|
2350
|
-
const signIn = async ({ address, signMessage, sessionPublicKey, domain, uri, chainId = 1, statement, walletName, walletProvider })=>{
|
|
2351
|
-
// A malformed address would only surface as an opaque server-side 400 after signing.
|
|
2352
|
-
assertEvmAddress(address);
|
|
2353
|
-
// Line breaks would corrupt the EIP-4361 message structure (opaque server-side 400).
|
|
2354
|
-
for (const [name, value] of Object.entries({
|
|
2355
|
-
domain,
|
|
2356
|
-
uri,
|
|
2357
|
-
statement
|
|
2358
|
-
})){
|
|
2359
|
-
if (value && /[\r\n]/.test(value)) {
|
|
2360
|
-
throw new Error(`wallet.signIn: ${name} must not contain line breaks`);
|
|
2361
|
-
}
|
|
2362
|
-
}
|
|
2363
|
-
const origin = resolveSiweOrigin(options.appOrigin, {
|
|
2364
|
-
domain,
|
|
2365
|
-
uri
|
|
2366
|
-
});
|
|
2367
|
-
const { nonce } = await siwePrimitives.getNonce();
|
|
2368
|
-
const message = siwePrimitives.createMessage({
|
|
2369
|
-
domain: origin.domain,
|
|
2370
|
-
address,
|
|
2371
|
-
uri: origin.uri,
|
|
2372
|
-
chainId,
|
|
2373
|
-
nonce,
|
|
2374
|
-
statement
|
|
2375
|
-
});
|
|
2376
|
-
const signature = await signMessage(message);
|
|
2377
|
-
return siwePrimitives.verify({
|
|
2378
|
-
message,
|
|
2379
|
-
signature,
|
|
2380
|
-
walletAddress: address,
|
|
2381
|
-
sessionPublicKey,
|
|
2382
|
-
walletName,
|
|
2383
|
-
walletProvider
|
|
2384
|
-
});
|
|
2385
|
-
};
|
|
2386
2270
|
return {
|
|
2387
2271
|
email: {
|
|
2388
2272
|
async sendOtp (email) {
|
|
@@ -2400,14 +2284,14 @@ const asAuthError = async (error, operation)=>{
|
|
|
2400
2284
|
throw await asAuthError(error, 'email OTP request');
|
|
2401
2285
|
}
|
|
2402
2286
|
},
|
|
2403
|
-
async verifyOtp ({ verificationUUID, code,
|
|
2287
|
+
async verifyOtp ({ verificationUUID, code, sessionPublicKeyHex }) {
|
|
2404
2288
|
try {
|
|
2405
2289
|
const response = await api.signInWithEmailVerification({
|
|
2406
2290
|
environmentId,
|
|
2407
2291
|
emailVerificationVerifyRequest: {
|
|
2408
2292
|
verificationUUID,
|
|
2409
2293
|
verificationToken: code,
|
|
2410
|
-
sessionPublicKey
|
|
2294
|
+
sessionPublicKey: sessionPublicKeyHex
|
|
2411
2295
|
}
|
|
2412
2296
|
});
|
|
2413
2297
|
return toAuthResult(response);
|
|
@@ -2416,9 +2300,53 @@ const asAuthError = async (error, operation)=>{
|
|
|
2416
2300
|
}
|
|
2417
2301
|
}
|
|
2418
2302
|
},
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2303
|
+
siwe: {
|
|
2304
|
+
async getNonce () {
|
|
2305
|
+
try {
|
|
2306
|
+
const { nonce } = await api.getNonce({
|
|
2307
|
+
environmentId
|
|
2308
|
+
});
|
|
2309
|
+
if (!nonce) throw new Error('nonce endpoint returned no nonce');
|
|
2310
|
+
return {
|
|
2311
|
+
nonce
|
|
2312
|
+
};
|
|
2313
|
+
} catch (error) {
|
|
2314
|
+
throw await asAuthError(error, 'SIWE nonce request');
|
|
2315
|
+
}
|
|
2316
|
+
},
|
|
2317
|
+
createMessage (params) {
|
|
2318
|
+
const header = `${params.domain} wants you to sign in with your Ethereum account:`;
|
|
2319
|
+
var _params_issuedAt;
|
|
2320
|
+
const fields = [
|
|
2321
|
+
`URI: ${params.uri}`,
|
|
2322
|
+
'Version: 1',
|
|
2323
|
+
`Chain ID: ${params.chainId}`,
|
|
2324
|
+
`Nonce: ${params.nonce}`,
|
|
2325
|
+
`Issued At: ${(_params_issuedAt = params.issuedAt) != null ? _params_issuedAt : new Date().toISOString()}`
|
|
2326
|
+
].join('\n');
|
|
2327
|
+
const statement = params.statement ? `${params.statement}\n\n` : '';
|
|
2328
|
+
return `${header}\n${params.address}\n\n${statement}${fields}`;
|
|
2329
|
+
},
|
|
2330
|
+
async verify ({ message, signature, walletAddress, sessionPublicKeyHex, walletName = 'unknown', walletProvider = WalletProviderEnum.BrowserExtension, chain = ChainEnum.Evm }) {
|
|
2331
|
+
try {
|
|
2332
|
+
const response = await api.verify({
|
|
2333
|
+
environmentId,
|
|
2334
|
+
verifyRequest: {
|
|
2335
|
+
messageToSign: message,
|
|
2336
|
+
signedMessage: signature,
|
|
2337
|
+
publicWalletAddress: walletAddress,
|
|
2338
|
+
chain,
|
|
2339
|
+
walletName,
|
|
2340
|
+
walletProvider,
|
|
2341
|
+
sessionPublicKey: sessionPublicKeyHex
|
|
2342
|
+
}
|
|
2343
|
+
});
|
|
2344
|
+
return toAuthResult(response);
|
|
2345
|
+
} catch (error) {
|
|
2346
|
+
throw await asAuthError(error, 'SIWE sign-in');
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2422
2350
|
};
|
|
2423
2351
|
}
|
|
2424
2352
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-wallet/node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.64",
|
|
4
4
|
"license": "Licensed under the Dynamic Labs, Inc. Terms Of Service (https://www.dynamic.xyz/terms-conditions)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@dynamic-labs-wallet/core": "1.0.
|
|
7
|
+
"@dynamic-labs-wallet/core": "1.0.64",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.1",
|
|
9
|
-
"@dynamic-labs-wallet/primitives": "1.0.
|
|
9
|
+
"@dynamic-labs-wallet/primitives": "1.0.64",
|
|
10
10
|
"@dynamic-labs/logger": "^4.81.0",
|
|
11
11
|
"@dynamic-labs/sdk-api-core": "^0.0.984",
|
|
12
12
|
"uuid": "11.1.0",
|
package/src/authClient.d.ts
CHANGED
|
@@ -4,8 +4,6 @@ export interface CreateAuthClientOptions {
|
|
|
4
4
|
baseUrl?: string;
|
|
5
5
|
/** Custom fetch implementation (tests, proxies). */
|
|
6
6
|
fetchApi?: FetchAPI;
|
|
7
|
-
/** Origin SIWE sign-ins present as — must be on the environment's allowlisted CORS origins. signIn derives domain/uri from it; per-call params override. */
|
|
8
|
-
appOrigin?: string;
|
|
9
7
|
}
|
|
10
8
|
export interface AuthResult {
|
|
11
9
|
/** Pass to DynamicWalletClient.authenticateJwt. Custody is yours; never log it. */
|
|
@@ -22,10 +20,10 @@ export interface DynamicAuthClient {
|
|
|
22
20
|
verificationUUID: string;
|
|
23
21
|
code: string;
|
|
24
22
|
/** Compressed P-256 hex from generateSessionKeyPair — binds the session key into the minted JWT. */
|
|
25
|
-
|
|
23
|
+
sessionPublicKeyHex?: string;
|
|
26
24
|
}): Promise<AuthResult>;
|
|
27
25
|
};
|
|
28
|
-
|
|
26
|
+
siwe: {
|
|
29
27
|
getNonce(): Promise<{
|
|
30
28
|
nonce: string;
|
|
31
29
|
}>;
|
|
@@ -42,24 +40,11 @@ export interface DynamicAuthClient {
|
|
|
42
40
|
message: string;
|
|
43
41
|
signature: string;
|
|
44
42
|
walletAddress: string;
|
|
45
|
-
|
|
43
|
+
sessionPublicKeyHex?: string;
|
|
46
44
|
walletName?: string;
|
|
47
45
|
walletProvider?: WalletProviderEnum;
|
|
48
46
|
chain?: ChainEnum;
|
|
49
47
|
}): Promise<AuthResult>;
|
|
50
|
-
/** One-call SIWE sign-in: nonce → message (built internally) → your signMessage callback → verify. Key custody stays behind the callback. */
|
|
51
|
-
signIn(params: {
|
|
52
|
-
address: string;
|
|
53
|
-
signMessage: (message: string) => Promise<string>;
|
|
54
|
-
sessionPublicKey?: string;
|
|
55
|
-
domain?: string;
|
|
56
|
-
uri?: string;
|
|
57
|
-
/** EVM-specific. Default 1. */
|
|
58
|
-
chainId?: number;
|
|
59
|
-
statement?: string;
|
|
60
|
-
walletName?: string;
|
|
61
|
-
walletProvider?: WalletProviderEnum;
|
|
62
|
-
}): Promise<AuthResult>;
|
|
63
48
|
};
|
|
64
49
|
}
|
|
65
50
|
/**
|
package/src/authClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authClient.d.ts","sourceRoot":"","sources":["../../packages/src/authClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,kBAAkB,EAClB,KAAK,QAAQ,EAEd,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"authClient.d.ts","sourceRoot":"","sources":["../../packages/src/authClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,kBAAkB,EAClB,KAAK,QAAQ,EAEd,MAAM,4BAA4B,CAAC;AAGpC,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,mFAAmF;IACnF,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE;QACL,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;YAAE,gBAAgB,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC9D,SAAS,CAAC,MAAM,EAAE;YAChB,gBAAgB,EAAE,MAAM,CAAC;YACzB,IAAI,EAAE,MAAM,CAAC;YACb,oGAAoG;YACpG,mBAAmB,CAAC,EAAE,MAAM,CAAC;SAC9B,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;KACzB,CAAC;IACF,IAAI,EAAE;QACJ,QAAQ,IAAI,OAAO,CAAC;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACvC,aAAa,CAAC,MAAM,EAAE;YACpB,MAAM,EAAE,MAAM,CAAC;YACf,OAAO,EAAE,MAAM,CAAC;YAChB,GAAG,EAAE,MAAM,CAAC;YACZ,OAAO,EAAE,MAAM,CAAC;YAChB,KAAK,EAAE,MAAM,CAAC;YACd,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB,GAAG,MAAM,CAAC;QACX,MAAM,CAAC,MAAM,EAAE;YACb,OAAO,EAAE,MAAM,CAAC;YAChB,SAAS,EAAE,MAAM,CAAC;YAClB,aAAa,EAAE,MAAM,CAAC;YACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;YAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB,cAAc,CAAC,EAAE,kBAAkB,CAAC;YACpC,KAAK,CAAC,EAAE,SAAS,CAAC;SACnB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;KACzB,CAAC;CACH;AA8CD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,iBAAiB,CA4FpF"}
|
package/src/siweUtils.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface SiweMessageParams {
|
|
2
|
-
domain: string;
|
|
3
|
-
address: string;
|
|
4
|
-
uri: string;
|
|
5
|
-
/** EVM-specific; omitted from the message when absent (e.g. Solana). */
|
|
6
|
-
chainId?: number;
|
|
7
|
-
nonce: string;
|
|
8
|
-
statement?: string;
|
|
9
|
-
issuedAt?: string;
|
|
10
|
-
/** Chain the account lives on, per the JS SDK's chain-generic formatter. Default 'Ethereum'. */
|
|
11
|
-
blockchainName?: string;
|
|
12
|
-
}
|
|
13
|
-
/** Formats an EIP-4361-style sign-in message in the exact shape Dynamic's verifier accepts. */
|
|
14
|
-
export declare function formatSiweMessage(params: SiweMessageParams): string;
|
|
15
|
-
/** Throws unless `address` is a 0x-prefixed 20-byte hex EVM address. SIWS adds a base58 sibling. */
|
|
16
|
-
export declare function assertEvmAddress(address: string): void;
|
|
17
|
-
/** Resolves which origin a SIWE sign-in presents as. Throws before any network call. */
|
|
18
|
-
export declare function resolveSiweOrigin(appOrigin: string | undefined, params: {
|
|
19
|
-
domain?: string;
|
|
20
|
-
uri?: string;
|
|
21
|
-
}): {
|
|
22
|
-
domain: string;
|
|
23
|
-
uri: string;
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=siweUtils.d.ts.map
|
package/src/siweUtils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"siweUtils.d.ts","sourceRoot":"","sources":["../../packages/src/siweUtils.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gGAAgG;IAChG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAYnE;AAED,oGAAoG;AACpG,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAItD;AAED,wFAAwF;AACxF,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAYjC"}
|