@dynamic-labs-wallet/node 1.0.60 → 1.0.61
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 +319 -13
- package/index.esm.js +318 -15
- package/package.json +3 -3
- package/src/authClient.d.ts +55 -0
- package/src/authClient.d.ts.map +1 -0
- package/src/client.d.ts +35 -0
- package/src/client.d.ts.map +1 -1
- package/src/index.d.ts +3 -0
- package/src/index.d.ts.map +1 -1
- package/src/sessionKeys.d.ts +27 -0
- package/src/sessionKeys.d.ts.map +1 -0
package/index.cjs
CHANGED
|
@@ -8,6 +8,7 @@ var logger = require('@dynamic-labs/logger');
|
|
|
8
8
|
var forwardMpcClient = require('@dynamic-labs-wallet/forward-mpc-client');
|
|
9
9
|
var uuid = require('uuid');
|
|
10
10
|
var crypto = require('node:crypto');
|
|
11
|
+
var sdkApiCore = require('@dynamic-labs/sdk-api-core');
|
|
11
12
|
|
|
12
13
|
// Removed duplicate exports - these are already exported from #internal/core
|
|
13
14
|
const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl = core$1.MPC_RELAY_PROD_API_URL })=>{
|
|
@@ -314,7 +315,7 @@ const CEREMONY_COMPLETE_WAIT_MS = 5000;
|
|
|
314
315
|
class DynamicWalletClient {
|
|
315
316
|
ensureApiClientAuthenticated() {
|
|
316
317
|
if (!this.isApiClientAuthenticated) {
|
|
317
|
-
throw new Error('Client must be authenticated before making API calls. Call authenticateApiToken first.');
|
|
318
|
+
throw new Error('Client must be authenticated before making API calls. Call authenticateApiToken or authenticateJwt first.');
|
|
318
319
|
}
|
|
319
320
|
}
|
|
320
321
|
/**
|
|
@@ -344,6 +345,24 @@ class DynamicWalletClient {
|
|
|
344
345
|
throw new Error('accountAddress mismatch: parameter does not match walletMetadata.accountAddress. ' + 'Pass them consistently — preferably read from walletMetadata.accountAddress.');
|
|
345
346
|
}
|
|
346
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* Installs a Dynamic JWT as the bearer token for all subsequent API calls
|
|
350
|
+
* and rebuilds the API client, preserving the forward-MPC client.
|
|
351
|
+
*/ setAuthenticatedJwt(jwt) {
|
|
352
|
+
this.baseJWTAuthToken = jwt;
|
|
353
|
+
this.apiClient = new core$1.DynamicApiClient({
|
|
354
|
+
environmentId: this.environmentId,
|
|
355
|
+
authToken: jwt,
|
|
356
|
+
baseApiUrl: this.baseApiUrl,
|
|
357
|
+
forwardMPCClient: this.resolvedForwardMPCClient,
|
|
358
|
+
logger: this.logger
|
|
359
|
+
});
|
|
360
|
+
this.isApiClientAuthenticated = true;
|
|
361
|
+
// Auth context changed — drop session-scoped nonces from the prior session.
|
|
362
|
+
this.nonceCache.length = 0;
|
|
363
|
+
this.nonceRefill = undefined;
|
|
364
|
+
this.nonceAuthGeneration += 1;
|
|
365
|
+
}
|
|
347
366
|
async authenticateApiToken(authToken) {
|
|
348
367
|
const tmpClient = new core$1.DynamicApiClient({
|
|
349
368
|
environmentId: this.environmentId,
|
|
@@ -354,16 +373,95 @@ class DynamicWalletClient {
|
|
|
354
373
|
const response = await tmpClient.authenticateApiToken({
|
|
355
374
|
environmentId: this.environmentId
|
|
356
375
|
});
|
|
357
|
-
|
|
358
|
-
this.
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
376
|
+
this.setAuthenticatedJwt(response.data.encodedJwts.minifiedJwt);
|
|
377
|
+
this.getSessionSignature = undefined; // drop any signer left from a prior authenticateJwt
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Authenticates the client with a Dynamic user JWT obtained outside the SDK —
|
|
381
|
+
* e.g. by an agent that completed a Dynamic sign-in (external auth, email OTP)
|
|
382
|
+
* on behalf of a user. Unlike authenticateApiToken, no token exchange happens:
|
|
383
|
+
* the JWT is used directly as the bearer token. The server validates it on
|
|
384
|
+
* every request; this method only checks the token's structure.
|
|
385
|
+
*
|
|
386
|
+
* `options.getSessionSignature` must return the signature as lowercase hex
|
|
387
|
+
* (raw ECDSA r‖s, as produced by `signSessionMessage`). Other encodings —
|
|
388
|
+
* notably base64, which can contain `/` — corrupt the `/`-delimited
|
|
389
|
+
* signed-session composite sent to the keyshares relay.
|
|
390
|
+
*/ async authenticateJwt(jwt, options) {
|
|
391
|
+
const segments = jwt.split('.');
|
|
392
|
+
if (segments.length !== 3 || segments.some((segment)=>segment.length === 0)) {
|
|
393
|
+
throw new Error('Invalid JWT: expected a compact JWS with three dot-separated segments');
|
|
394
|
+
}
|
|
395
|
+
this.setAuthenticatedJwt(jwt);
|
|
396
|
+
this.getSessionSignature = options == null ? void 0 : options.getSessionSignature;
|
|
397
|
+
}
|
|
398
|
+
async buildSignedSessionId() {
|
|
399
|
+
if (!this.getSessionSignature) {
|
|
400
|
+
throw new Error('Session signature callback not configured');
|
|
401
|
+
}
|
|
402
|
+
if (!this.baseJWTAuthToken) {
|
|
403
|
+
throw new Error('Client is not authenticated');
|
|
404
|
+
}
|
|
405
|
+
let payload;
|
|
406
|
+
try {
|
|
407
|
+
payload = JSON.parse(Buffer.from(this.baseJWTAuthToken.split('.')[1], 'base64url').toString());
|
|
408
|
+
} catch (e) {
|
|
409
|
+
throw new Error('JWT payload is not a valid JSON object');
|
|
410
|
+
}
|
|
411
|
+
if (typeof payload !== 'object' || payload === null || Array.isArray(payload)) {
|
|
412
|
+
throw new Error('JWT payload is not a valid JSON object');
|
|
413
|
+
}
|
|
414
|
+
const parsedPayload = payload;
|
|
415
|
+
const sid = parsedPayload.sid;
|
|
416
|
+
if (typeof sid !== 'string' || sid.length === 0) {
|
|
417
|
+
throw new Error('JWT is missing a valid sid claim required for the signed session');
|
|
418
|
+
}
|
|
419
|
+
const nonce = await this.takeNonce();
|
|
420
|
+
const [sidSig, nonceSig] = await Promise.all([
|
|
421
|
+
this.getSessionSignature(sid),
|
|
422
|
+
this.getSessionSignature(nonce)
|
|
423
|
+
]);
|
|
424
|
+
return `${sidSig}/${nonceSig}/${nonce}`;
|
|
425
|
+
}
|
|
426
|
+
// Nonces are single-use; fetch them in batches and hand out one per signed
|
|
427
|
+
// session so we don't round-trip to the relay on every signature.
|
|
428
|
+
async takeNonce() {
|
|
429
|
+
for(;;){
|
|
430
|
+
const cached = this.nonceCache.shift();
|
|
431
|
+
if (cached) return cached;
|
|
432
|
+
// Cache empty (initial, depleted, or drained by concurrent callers): refill
|
|
433
|
+
// once (coalesced) and retry. Only the server returning no nonces is an error.
|
|
434
|
+
// A refill that lands after a re-auth belongs to the old session — drop it
|
|
435
|
+
// (and leave the new session's refill slot alone) so stale nonces are never used.
|
|
436
|
+
const generation = this.nonceAuthGeneration;
|
|
437
|
+
var _this_nonceRefill;
|
|
438
|
+
(_this_nonceRefill = this.nonceRefill) != null ? _this_nonceRefill : this.nonceRefill = this.apiClient.getNonces({
|
|
439
|
+
count: this.nonceBatchSize
|
|
440
|
+
}).then(({ nonces })=>{
|
|
441
|
+
if (!(nonces == null ? void 0 : nonces.length)) throw new Error('No session nonce available');
|
|
442
|
+
if (generation === this.nonceAuthGeneration) this.nonceCache.push(...nonces);
|
|
443
|
+
}).finally(()=>{
|
|
444
|
+
if (generation === this.nonceAuthGeneration) this.nonceRefill = undefined;
|
|
445
|
+
});
|
|
446
|
+
await this.nonceRefill;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Refreshes the Dynamic JWT using the current session and installs the new
|
|
451
|
+
* token for all subsequent API calls. Returns the new JWT so callers can
|
|
452
|
+
* persist it. The server enforces a hard refresh limit (the JWT's
|
|
453
|
+
* `refreshExp` claim) — once reached, this rejects with a 401 and the user
|
|
454
|
+
* must re-authenticate.
|
|
455
|
+
*/ async refreshAuthToken() {
|
|
456
|
+
this.ensureApiClientAuthenticated();
|
|
457
|
+
const data = await this.apiClient.refreshUser();
|
|
458
|
+
var _data_minifiedJwt;
|
|
459
|
+
const refreshedJwt = (_data_minifiedJwt = data == null ? void 0 : data.minifiedJwt) != null ? _data_minifiedJwt : data == null ? void 0 : data.jwt;
|
|
460
|
+
if (typeof refreshedJwt !== 'string' || refreshedJwt.length === 0) {
|
|
461
|
+
throw new Error('Token refresh returned no JWT. The environment may be configured for cookie-based auth; agent flows require header-based JWTs.');
|
|
462
|
+
}
|
|
463
|
+
this.setAuthenticatedJwt(refreshedJwt);
|
|
464
|
+
return refreshedJwt;
|
|
367
465
|
}
|
|
368
466
|
/**
|
|
369
467
|
* Fetches non-sensitive wallet identity (walletId, accountAddress, chainName,
|
|
@@ -1350,6 +1448,7 @@ class DynamicWalletClient {
|
|
|
1350
1448
|
// Upload first share to Dynamic if requested
|
|
1351
1449
|
if (backUpToDynamic) {
|
|
1352
1450
|
const keyShareToBackupToDynamic = keySharesToBackup[0];
|
|
1451
|
+
const signedSessionId = this.getSessionSignature ? await this.buildSignedSessionId() : undefined;
|
|
1353
1452
|
const data = await this.apiClient.storeEncryptedBackupByWallet({
|
|
1354
1453
|
walletId,
|
|
1355
1454
|
shareSetId: resolvedShareSetId,
|
|
@@ -1358,7 +1457,8 @@ class DynamicWalletClient {
|
|
|
1358
1457
|
],
|
|
1359
1458
|
passwordEncrypted: passwordEncryptedFlag,
|
|
1360
1459
|
encryptionVersion: ENCRYPTION_VERSION_CURRENT,
|
|
1361
|
-
|
|
1460
|
+
signedSessionId,
|
|
1461
|
+
requiresSignedSessionId: Boolean(this.getSessionSignature),
|
|
1362
1462
|
dynamicRequestId
|
|
1363
1463
|
});
|
|
1364
1464
|
const keygenId = await this.getExportId({
|
|
@@ -1605,11 +1705,13 @@ class DynamicWalletClient {
|
|
|
1605
1705
|
this.logger.debug('No DYNAMIC shares available for recovery');
|
|
1606
1706
|
return [];
|
|
1607
1707
|
}
|
|
1708
|
+
const signedSessionId = this.getSessionSignature ? await this.buildSignedSessionId() : undefined;
|
|
1608
1709
|
const data = await this.apiClient.recoverEncryptedBackupByWallet({
|
|
1609
1710
|
walletId,
|
|
1610
1711
|
shareSetId: walletMetadata.shareSetId,
|
|
1611
1712
|
externalKeyShareIds: dynamicKeyShareIds,
|
|
1612
|
-
|
|
1713
|
+
signedSessionId,
|
|
1714
|
+
requiresSignedSessionId: Boolean(this.getSessionSignature)
|
|
1613
1715
|
});
|
|
1614
1716
|
const dynamicKeyShares = data.keyShares.filter((keyShare)=>keyShare.encryptedAccountCredential !== null && keyShare.backupLocation === core$1.BackupLocation.DYNAMIC);
|
|
1615
1717
|
var _externalServerKeySharesBackupInfo_passwordEncrypted;
|
|
@@ -1819,6 +1921,11 @@ class DynamicWalletClient {
|
|
|
1819
1921
|
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, forwardMPCClient, enableMPCAccelerator = true, logger: logger$1 }){
|
|
1820
1922
|
this.isApiClientAuthenticated = false;
|
|
1821
1923
|
this.forwardMPCEnabled = true;
|
|
1924
|
+
// The nonces endpoint caps count at 5 (400 "query/count must be <= 5" above that).
|
|
1925
|
+
this.nonceBatchSize = 5;
|
|
1926
|
+
this.nonceCache = [];
|
|
1927
|
+
// Bumped on every re-auth so an in-flight refill from a prior session is discarded.
|
|
1928
|
+
this.nonceAuthGeneration = 0;
|
|
1822
1929
|
if (logger$1) {
|
|
1823
1930
|
this.logger = logger$1;
|
|
1824
1931
|
} else {
|
|
@@ -1856,6 +1963,67 @@ class DynamicWalletClient {
|
|
|
1856
1963
|
}
|
|
1857
1964
|
}
|
|
1858
1965
|
|
|
1966
|
+
const subtle = crypto.webcrypto.subtle;
|
|
1967
|
+
const ALGO = {
|
|
1968
|
+
name: 'ECDSA',
|
|
1969
|
+
namedCurve: 'P-256'
|
|
1970
|
+
};
|
|
1971
|
+
const SIGN_ALGO = {
|
|
1972
|
+
name: 'ECDSA',
|
|
1973
|
+
hash: 'SHA-256'
|
|
1974
|
+
};
|
|
1975
|
+
/** Compress a 65-byte uncompressed SEC1 P-256 point to 33-byte compressed lowercase hex. */ const compress = (raw)=>{
|
|
1976
|
+
if (raw.length !== 65 || raw[0] !== 0x04) {
|
|
1977
|
+
throw new Error('expected a 65-byte uncompressed P-256 public key');
|
|
1978
|
+
}
|
|
1979
|
+
const x = Buffer.from(raw.slice(1, 33));
|
|
1980
|
+
const prefix = (raw[64] & 1) === 0 ? 0x02 : 0x03;
|
|
1981
|
+
return Buffer.concat([
|
|
1982
|
+
Buffer.from([
|
|
1983
|
+
prefix
|
|
1984
|
+
]),
|
|
1985
|
+
x
|
|
1986
|
+
]).toString('hex');
|
|
1987
|
+
};
|
|
1988
|
+
/**
|
|
1989
|
+
* Generates a P-256 session key pair for the signed-session flow.
|
|
1990
|
+
*
|
|
1991
|
+
* Returns the compressed public-key hex (bind it into the Dynamic JWT via the
|
|
1992
|
+
* `x-dyn-session-public-key` header when you sign in) and the private JWK.
|
|
1993
|
+
*
|
|
1994
|
+
* Stateless and custody-agnostic: the SDK does NOT persist the key. YOU store
|
|
1995
|
+
* `privateKeyJwk` wherever you keep secrets. The returned JWK is extractable
|
|
1996
|
+
* (so it can be handed back to you) and is therefore a convenience path, not a
|
|
1997
|
+
* security boundary — if you need a non-extractable key (so a host/operator
|
|
1998
|
+
* cannot exfiltrate it), generate it in a KMS/HSM/enclave instead and supply a
|
|
1999
|
+
* `getSessionSignature` that signs there.
|
|
2000
|
+
*/ async function generateSessionKeyPair() {
|
|
2001
|
+
const keyPair = await subtle.generateKey(ALGO, true, [
|
|
2002
|
+
'sign',
|
|
2003
|
+
'verify'
|
|
2004
|
+
]);
|
|
2005
|
+
const rawPublicKey = await subtle.exportKey('raw', keyPair.publicKey);
|
|
2006
|
+
const exportedJwk = await subtle.exportKey('jwk', keyPair.privateKey);
|
|
2007
|
+
const privateKeyJwk = exportedJwk;
|
|
2008
|
+
return {
|
|
2009
|
+
publicKeyHex: compress(new Uint8Array(rawPublicKey)),
|
|
2010
|
+
privateKeyJwk
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* Signs a message with a P-256 session private JWK using the exact encoding the
|
|
2015
|
+
* keyshares relay expects: ECDSA P-256 / SHA-256 over UTF-8(message), raw r‖s
|
|
2016
|
+
* (64 bytes), lowercase hex. Use it to implement `getSessionSignature`:
|
|
2017
|
+
* getSessionSignature: (message) => signSessionMessage(message, privateKeyJwk)
|
|
2018
|
+
* The JWK is imported non-extractable for signing.
|
|
2019
|
+
*/ async function signSessionMessage(message, privateKeyJwk) {
|
|
2020
|
+
const key = await subtle.importKey('jwk', privateKeyJwk, ALGO, false, [
|
|
2021
|
+
'sign'
|
|
2022
|
+
]);
|
|
2023
|
+
const signature = await subtle.sign(SIGN_ALGO, key, new TextEncoder().encode(message));
|
|
2024
|
+
return Buffer.from(new Uint8Array(signature)).toString('hex');
|
|
2025
|
+
}
|
|
2026
|
+
|
|
1859
2027
|
const createCore = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug = false, logger: logger$1 })=>{
|
|
1860
2028
|
let coreLogger;
|
|
1861
2029
|
if (logger$1) {
|
|
@@ -2048,6 +2216,141 @@ function decryptDelegatedWebhookData({ privateKeyPem, encryptedDelegatedKeyShare
|
|
|
2048
2216
|
}
|
|
2049
2217
|
}
|
|
2050
2218
|
|
|
2219
|
+
const toAuthResult = (response)=>{
|
|
2220
|
+
var _response_user;
|
|
2221
|
+
if (response.mfaToken && !response.minifiedJwt && !response.jwt) {
|
|
2222
|
+
throw new Error('account requires MFA, which the headless auth client does not support');
|
|
2223
|
+
}
|
|
2224
|
+
var _response_minifiedJwt;
|
|
2225
|
+
const jwt = (_response_minifiedJwt = response.minifiedJwt) != null ? _response_minifiedJwt : response.jwt;
|
|
2226
|
+
if (!jwt) {
|
|
2227
|
+
throw new Error('sign-in returned no JWT in the response body; the environment likely uses cookie auth, which headless clients cannot consume');
|
|
2228
|
+
}
|
|
2229
|
+
return {
|
|
2230
|
+
jwt,
|
|
2231
|
+
expiresAt: response.expiresAt,
|
|
2232
|
+
userId: (_response_user = response.user) == null ? void 0 : _response_user.id
|
|
2233
|
+
};
|
|
2234
|
+
};
|
|
2235
|
+
// The sdk-api-core runtime throws the raw fetch Response on non-2xx; duck-type it.
|
|
2236
|
+
const httpStatus = (error)=>!(error instanceof Error) && typeof error === 'object' && error !== null && 'status' in error && typeof error.status === 'number' ? error.status : undefined;
|
|
2237
|
+
const readServerError = async (error)=>{
|
|
2238
|
+
try {
|
|
2239
|
+
const text = await error.text();
|
|
2240
|
+
const parsed = JSON.parse(text);
|
|
2241
|
+
return typeof parsed.error === 'string' ? parsed.error : undefined;
|
|
2242
|
+
} catch (e) {
|
|
2243
|
+
return undefined;
|
|
2244
|
+
}
|
|
2245
|
+
};
|
|
2246
|
+
const asAuthError = async (error, operation)=>{
|
|
2247
|
+
const status = httpStatus(error);
|
|
2248
|
+
if (status !== undefined) {
|
|
2249
|
+
if (status === 401) return new Error(`${operation} failed: the code or signature is invalid or expired`);
|
|
2250
|
+
const serverError = await readServerError(error);
|
|
2251
|
+
const detail = serverError ? `${serverError} (status ${status})` : `status ${status}`;
|
|
2252
|
+
return new Error(`${operation} failed: ${detail}`);
|
|
2253
|
+
}
|
|
2254
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
2255
|
+
};
|
|
2256
|
+
/**
|
|
2257
|
+
* Headless auth client: mints a Dynamic user JWT (email OTP or SIWE) for use
|
|
2258
|
+
* with authenticateJwt. Holds configuration only — no secrets, no persistence.
|
|
2259
|
+
*/ function createAuthClient(options) {
|
|
2260
|
+
const { environmentId } = options;
|
|
2261
|
+
var _options_baseUrl;
|
|
2262
|
+
const baseUrl = ((_options_baseUrl = options.baseUrl) != null ? _options_baseUrl : core$1.DYNAMIC_AUTH_PROD_BASE_API_URL).replace(/\/$/, '');
|
|
2263
|
+
const api = new sdkApiCore.SDKApi(new sdkApiCore.Configuration({
|
|
2264
|
+
basePath: `${baseUrl}/api/v0`,
|
|
2265
|
+
// Makes the backend return the JWT in the body instead of an httpOnly cookie.
|
|
2266
|
+
headers: {
|
|
2267
|
+
'x-dynamic-platform': 'react-native'
|
|
2268
|
+
},
|
|
2269
|
+
fetchApi: options.fetchApi
|
|
2270
|
+
}));
|
|
2271
|
+
return {
|
|
2272
|
+
email: {
|
|
2273
|
+
async sendOtp (email) {
|
|
2274
|
+
try {
|
|
2275
|
+
const { verificationUUID } = await api.createEmailVerification({
|
|
2276
|
+
environmentId,
|
|
2277
|
+
emailVerificationCreateRequest: {
|
|
2278
|
+
email
|
|
2279
|
+
}
|
|
2280
|
+
});
|
|
2281
|
+
return {
|
|
2282
|
+
verificationUUID
|
|
2283
|
+
};
|
|
2284
|
+
} catch (error) {
|
|
2285
|
+
throw await asAuthError(error, 'email OTP request');
|
|
2286
|
+
}
|
|
2287
|
+
},
|
|
2288
|
+
async verifyOtp ({ verificationUUID, code, sessionPublicKeyHex }) {
|
|
2289
|
+
try {
|
|
2290
|
+
const response = await api.signInWithEmailVerification({
|
|
2291
|
+
environmentId,
|
|
2292
|
+
emailVerificationVerifyRequest: {
|
|
2293
|
+
verificationUUID,
|
|
2294
|
+
verificationToken: code,
|
|
2295
|
+
sessionPublicKey: sessionPublicKeyHex
|
|
2296
|
+
}
|
|
2297
|
+
});
|
|
2298
|
+
return toAuthResult(response);
|
|
2299
|
+
} catch (error) {
|
|
2300
|
+
throw await asAuthError(error, 'email OTP sign-in');
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
},
|
|
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
|
+
}
|
|
2351
|
+
};
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2051
2354
|
Object.defineProperty(exports, "SOLANA_RPC_URL", {
|
|
2052
2355
|
enumerable: true,
|
|
2053
2356
|
get: function () { return core$1.SOLANA_RPC_URL; }
|
|
@@ -2067,6 +2370,7 @@ Object.defineProperty(exports, "getMPCChainConfig", {
|
|
|
2067
2370
|
exports.DynamicWalletClient = DynamicWalletClient;
|
|
2068
2371
|
exports.base64ToBytes = base64ToBytes;
|
|
2069
2372
|
exports.bytesToBase64 = bytesToBase64;
|
|
2373
|
+
exports.createAuthClient = createAuthClient;
|
|
2070
2374
|
exports.createDelegatedWalletClient = createDelegatedWalletClient;
|
|
2071
2375
|
exports.createLogError = createLogError;
|
|
2072
2376
|
exports.decryptDelegatedWebhookData = decryptDelegatedWebhookData;
|
|
@@ -2074,6 +2378,7 @@ exports.delegatedSignMessage = delegatedSignMessage;
|
|
|
2074
2378
|
exports.ensureBase64Padding = ensureBase64Padding;
|
|
2075
2379
|
exports.formatEvmMessage = formatEvmMessage;
|
|
2076
2380
|
exports.formatMessage = formatMessage;
|
|
2381
|
+
exports.generateSessionKeyPair = generateSessionKeyPair;
|
|
2077
2382
|
exports.getExternalServerKeyShareBackupInfo = getExternalServerKeyShareBackupInfo;
|
|
2078
2383
|
exports.getMPCSignatureScheme = getMPCSignatureScheme;
|
|
2079
2384
|
exports.getMPCSigner = getMPCSigner;
|
|
@@ -2082,6 +2387,7 @@ exports.logError = logError;
|
|
|
2082
2387
|
exports.mergeUniqueKeyShares = mergeUniqueKeyShares;
|
|
2083
2388
|
exports.retryPromise = retryPromise;
|
|
2084
2389
|
exports.revokeDelegation = revokeDelegation;
|
|
2390
|
+
exports.signSessionMessage = signSessionMessage;
|
|
2085
2391
|
exports.stringToBytes = stringToBytes;
|
|
2086
2392
|
exports.stripHexPrefix = stripHexPrefix;
|
|
2087
2393
|
Object.keys(core).forEach(function (k) {
|
package/index.esm.js
CHANGED
|
@@ -6,7 +6,8 @@ import { BIP340, ExportableEd25519, Ecdsa, MessageHash, EcdsaSignature, EcdsaKey
|
|
|
6
6
|
import { Logger as Logger$1 } from '@dynamic-labs/logger';
|
|
7
7
|
import { ForwardMPCClientV2 } from '@dynamic-labs-wallet/forward-mpc-client';
|
|
8
8
|
import { v4 } from 'uuid';
|
|
9
|
-
import crypto from 'node:crypto';
|
|
9
|
+
import crypto, { webcrypto } from 'node:crypto';
|
|
10
|
+
import { SDKApi, Configuration, WalletProviderEnum, ChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
10
11
|
|
|
11
12
|
// Removed duplicate exports - these are already exported from #internal/core
|
|
12
13
|
const getMPCSignatureScheme = ({ signingAlgorithm, baseRelayUrl = MPC_RELAY_PROD_API_URL })=>{
|
|
@@ -313,7 +314,7 @@ const CEREMONY_COMPLETE_WAIT_MS = 5000;
|
|
|
313
314
|
class DynamicWalletClient {
|
|
314
315
|
ensureApiClientAuthenticated() {
|
|
315
316
|
if (!this.isApiClientAuthenticated) {
|
|
316
|
-
throw new Error('Client must be authenticated before making API calls. Call authenticateApiToken first.');
|
|
317
|
+
throw new Error('Client must be authenticated before making API calls. Call authenticateApiToken or authenticateJwt first.');
|
|
317
318
|
}
|
|
318
319
|
}
|
|
319
320
|
/**
|
|
@@ -343,6 +344,24 @@ class DynamicWalletClient {
|
|
|
343
344
|
throw new Error('accountAddress mismatch: parameter does not match walletMetadata.accountAddress. ' + 'Pass them consistently — preferably read from walletMetadata.accountAddress.');
|
|
344
345
|
}
|
|
345
346
|
}
|
|
347
|
+
/**
|
|
348
|
+
* Installs a Dynamic JWT as the bearer token for all subsequent API calls
|
|
349
|
+
* and rebuilds the API client, preserving the forward-MPC client.
|
|
350
|
+
*/ setAuthenticatedJwt(jwt) {
|
|
351
|
+
this.baseJWTAuthToken = jwt;
|
|
352
|
+
this.apiClient = new DynamicApiClient({
|
|
353
|
+
environmentId: this.environmentId,
|
|
354
|
+
authToken: jwt,
|
|
355
|
+
baseApiUrl: this.baseApiUrl,
|
|
356
|
+
forwardMPCClient: this.resolvedForwardMPCClient,
|
|
357
|
+
logger: this.logger
|
|
358
|
+
});
|
|
359
|
+
this.isApiClientAuthenticated = true;
|
|
360
|
+
// Auth context changed — drop session-scoped nonces from the prior session.
|
|
361
|
+
this.nonceCache.length = 0;
|
|
362
|
+
this.nonceRefill = undefined;
|
|
363
|
+
this.nonceAuthGeneration += 1;
|
|
364
|
+
}
|
|
346
365
|
async authenticateApiToken(authToken) {
|
|
347
366
|
const tmpClient = new DynamicApiClient({
|
|
348
367
|
environmentId: this.environmentId,
|
|
@@ -353,16 +372,95 @@ class DynamicWalletClient {
|
|
|
353
372
|
const response = await tmpClient.authenticateApiToken({
|
|
354
373
|
environmentId: this.environmentId
|
|
355
374
|
});
|
|
356
|
-
|
|
357
|
-
this.
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
375
|
+
this.setAuthenticatedJwt(response.data.encodedJwts.minifiedJwt);
|
|
376
|
+
this.getSessionSignature = undefined; // drop any signer left from a prior authenticateJwt
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Authenticates the client with a Dynamic user JWT obtained outside the SDK —
|
|
380
|
+
* e.g. by an agent that completed a Dynamic sign-in (external auth, email OTP)
|
|
381
|
+
* on behalf of a user. Unlike authenticateApiToken, no token exchange happens:
|
|
382
|
+
* the JWT is used directly as the bearer token. The server validates it on
|
|
383
|
+
* every request; this method only checks the token's structure.
|
|
384
|
+
*
|
|
385
|
+
* `options.getSessionSignature` must return the signature as lowercase hex
|
|
386
|
+
* (raw ECDSA r‖s, as produced by `signSessionMessage`). Other encodings —
|
|
387
|
+
* notably base64, which can contain `/` — corrupt the `/`-delimited
|
|
388
|
+
* signed-session composite sent to the keyshares relay.
|
|
389
|
+
*/ async authenticateJwt(jwt, options) {
|
|
390
|
+
const segments = jwt.split('.');
|
|
391
|
+
if (segments.length !== 3 || segments.some((segment)=>segment.length === 0)) {
|
|
392
|
+
throw new Error('Invalid JWT: expected a compact JWS with three dot-separated segments');
|
|
393
|
+
}
|
|
394
|
+
this.setAuthenticatedJwt(jwt);
|
|
395
|
+
this.getSessionSignature = options == null ? void 0 : options.getSessionSignature;
|
|
396
|
+
}
|
|
397
|
+
async buildSignedSessionId() {
|
|
398
|
+
if (!this.getSessionSignature) {
|
|
399
|
+
throw new Error('Session signature callback not configured');
|
|
400
|
+
}
|
|
401
|
+
if (!this.baseJWTAuthToken) {
|
|
402
|
+
throw new Error('Client is not authenticated');
|
|
403
|
+
}
|
|
404
|
+
let payload;
|
|
405
|
+
try {
|
|
406
|
+
payload = JSON.parse(Buffer.from(this.baseJWTAuthToken.split('.')[1], 'base64url').toString());
|
|
407
|
+
} catch (e) {
|
|
408
|
+
throw new Error('JWT payload is not a valid JSON object');
|
|
409
|
+
}
|
|
410
|
+
if (typeof payload !== 'object' || payload === null || Array.isArray(payload)) {
|
|
411
|
+
throw new Error('JWT payload is not a valid JSON object');
|
|
412
|
+
}
|
|
413
|
+
const parsedPayload = payload;
|
|
414
|
+
const sid = parsedPayload.sid;
|
|
415
|
+
if (typeof sid !== 'string' || sid.length === 0) {
|
|
416
|
+
throw new Error('JWT is missing a valid sid claim required for the signed session');
|
|
417
|
+
}
|
|
418
|
+
const nonce = await this.takeNonce();
|
|
419
|
+
const [sidSig, nonceSig] = await Promise.all([
|
|
420
|
+
this.getSessionSignature(sid),
|
|
421
|
+
this.getSessionSignature(nonce)
|
|
422
|
+
]);
|
|
423
|
+
return `${sidSig}/${nonceSig}/${nonce}`;
|
|
424
|
+
}
|
|
425
|
+
// Nonces are single-use; fetch them in batches and hand out one per signed
|
|
426
|
+
// session so we don't round-trip to the relay on every signature.
|
|
427
|
+
async takeNonce() {
|
|
428
|
+
for(;;){
|
|
429
|
+
const cached = this.nonceCache.shift();
|
|
430
|
+
if (cached) return cached;
|
|
431
|
+
// Cache empty (initial, depleted, or drained by concurrent callers): refill
|
|
432
|
+
// once (coalesced) and retry. Only the server returning no nonces is an error.
|
|
433
|
+
// A refill that lands after a re-auth belongs to the old session — drop it
|
|
434
|
+
// (and leave the new session's refill slot alone) so stale nonces are never used.
|
|
435
|
+
const generation = this.nonceAuthGeneration;
|
|
436
|
+
var _this_nonceRefill;
|
|
437
|
+
(_this_nonceRefill = this.nonceRefill) != null ? _this_nonceRefill : this.nonceRefill = this.apiClient.getNonces({
|
|
438
|
+
count: this.nonceBatchSize
|
|
439
|
+
}).then(({ nonces })=>{
|
|
440
|
+
if (!(nonces == null ? void 0 : nonces.length)) throw new Error('No session nonce available');
|
|
441
|
+
if (generation === this.nonceAuthGeneration) this.nonceCache.push(...nonces);
|
|
442
|
+
}).finally(()=>{
|
|
443
|
+
if (generation === this.nonceAuthGeneration) this.nonceRefill = undefined;
|
|
444
|
+
});
|
|
445
|
+
await this.nonceRefill;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Refreshes the Dynamic JWT using the current session and installs the new
|
|
450
|
+
* token for all subsequent API calls. Returns the new JWT so callers can
|
|
451
|
+
* persist it. The server enforces a hard refresh limit (the JWT's
|
|
452
|
+
* `refreshExp` claim) — once reached, this rejects with a 401 and the user
|
|
453
|
+
* must re-authenticate.
|
|
454
|
+
*/ async refreshAuthToken() {
|
|
455
|
+
this.ensureApiClientAuthenticated();
|
|
456
|
+
const data = await this.apiClient.refreshUser();
|
|
457
|
+
var _data_minifiedJwt;
|
|
458
|
+
const refreshedJwt = (_data_minifiedJwt = data == null ? void 0 : data.minifiedJwt) != null ? _data_minifiedJwt : data == null ? void 0 : data.jwt;
|
|
459
|
+
if (typeof refreshedJwt !== 'string' || refreshedJwt.length === 0) {
|
|
460
|
+
throw new Error('Token refresh returned no JWT. The environment may be configured for cookie-based auth; agent flows require header-based JWTs.');
|
|
461
|
+
}
|
|
462
|
+
this.setAuthenticatedJwt(refreshedJwt);
|
|
463
|
+
return refreshedJwt;
|
|
366
464
|
}
|
|
367
465
|
/**
|
|
368
466
|
* Fetches non-sensitive wallet identity (walletId, accountAddress, chainName,
|
|
@@ -1349,6 +1447,7 @@ class DynamicWalletClient {
|
|
|
1349
1447
|
// Upload first share to Dynamic if requested
|
|
1350
1448
|
if (backUpToDynamic) {
|
|
1351
1449
|
const keyShareToBackupToDynamic = keySharesToBackup[0];
|
|
1450
|
+
const signedSessionId = this.getSessionSignature ? await this.buildSignedSessionId() : undefined;
|
|
1352
1451
|
const data = await this.apiClient.storeEncryptedBackupByWallet({
|
|
1353
1452
|
walletId,
|
|
1354
1453
|
shareSetId: resolvedShareSetId,
|
|
@@ -1357,7 +1456,8 @@ class DynamicWalletClient {
|
|
|
1357
1456
|
],
|
|
1358
1457
|
passwordEncrypted: passwordEncryptedFlag,
|
|
1359
1458
|
encryptionVersion: ENCRYPTION_VERSION_CURRENT,
|
|
1360
|
-
|
|
1459
|
+
signedSessionId,
|
|
1460
|
+
requiresSignedSessionId: Boolean(this.getSessionSignature),
|
|
1361
1461
|
dynamicRequestId
|
|
1362
1462
|
});
|
|
1363
1463
|
const keygenId = await this.getExportId({
|
|
@@ -1604,11 +1704,13 @@ class DynamicWalletClient {
|
|
|
1604
1704
|
this.logger.debug('No DYNAMIC shares available for recovery');
|
|
1605
1705
|
return [];
|
|
1606
1706
|
}
|
|
1707
|
+
const signedSessionId = this.getSessionSignature ? await this.buildSignedSessionId() : undefined;
|
|
1607
1708
|
const data = await this.apiClient.recoverEncryptedBackupByWallet({
|
|
1608
1709
|
walletId,
|
|
1609
1710
|
shareSetId: walletMetadata.shareSetId,
|
|
1610
1711
|
externalKeyShareIds: dynamicKeyShareIds,
|
|
1611
|
-
|
|
1712
|
+
signedSessionId,
|
|
1713
|
+
requiresSignedSessionId: Boolean(this.getSessionSignature)
|
|
1612
1714
|
});
|
|
1613
1715
|
const dynamicKeyShares = data.keyShares.filter((keyShare)=>keyShare.encryptedAccountCredential !== null && keyShare.backupLocation === BackupLocation.DYNAMIC);
|
|
1614
1716
|
var _externalServerKeySharesBackupInfo_passwordEncrypted;
|
|
@@ -1818,6 +1920,11 @@ class DynamicWalletClient {
|
|
|
1818
1920
|
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, forwardMPCClient, enableMPCAccelerator = true, logger }){
|
|
1819
1921
|
this.isApiClientAuthenticated = false;
|
|
1820
1922
|
this.forwardMPCEnabled = true;
|
|
1923
|
+
// The nonces endpoint caps count at 5 (400 "query/count must be <= 5" above that).
|
|
1924
|
+
this.nonceBatchSize = 5;
|
|
1925
|
+
this.nonceCache = [];
|
|
1926
|
+
// Bumped on every re-auth so an in-flight refill from a prior session is discarded.
|
|
1927
|
+
this.nonceAuthGeneration = 0;
|
|
1821
1928
|
if (logger) {
|
|
1822
1929
|
this.logger = logger;
|
|
1823
1930
|
} else {
|
|
@@ -1855,6 +1962,67 @@ class DynamicWalletClient {
|
|
|
1855
1962
|
}
|
|
1856
1963
|
}
|
|
1857
1964
|
|
|
1965
|
+
const subtle = webcrypto.subtle;
|
|
1966
|
+
const ALGO = {
|
|
1967
|
+
name: 'ECDSA',
|
|
1968
|
+
namedCurve: 'P-256'
|
|
1969
|
+
};
|
|
1970
|
+
const SIGN_ALGO = {
|
|
1971
|
+
name: 'ECDSA',
|
|
1972
|
+
hash: 'SHA-256'
|
|
1973
|
+
};
|
|
1974
|
+
/** Compress a 65-byte uncompressed SEC1 P-256 point to 33-byte compressed lowercase hex. */ const compress = (raw)=>{
|
|
1975
|
+
if (raw.length !== 65 || raw[0] !== 0x04) {
|
|
1976
|
+
throw new Error('expected a 65-byte uncompressed P-256 public key');
|
|
1977
|
+
}
|
|
1978
|
+
const x = Buffer.from(raw.slice(1, 33));
|
|
1979
|
+
const prefix = (raw[64] & 1) === 0 ? 0x02 : 0x03;
|
|
1980
|
+
return Buffer.concat([
|
|
1981
|
+
Buffer.from([
|
|
1982
|
+
prefix
|
|
1983
|
+
]),
|
|
1984
|
+
x
|
|
1985
|
+
]).toString('hex');
|
|
1986
|
+
};
|
|
1987
|
+
/**
|
|
1988
|
+
* Generates a P-256 session key pair for the signed-session flow.
|
|
1989
|
+
*
|
|
1990
|
+
* Returns the compressed public-key hex (bind it into the Dynamic JWT via the
|
|
1991
|
+
* `x-dyn-session-public-key` header when you sign in) and the private JWK.
|
|
1992
|
+
*
|
|
1993
|
+
* Stateless and custody-agnostic: the SDK does NOT persist the key. YOU store
|
|
1994
|
+
* `privateKeyJwk` wherever you keep secrets. The returned JWK is extractable
|
|
1995
|
+
* (so it can be handed back to you) and is therefore a convenience path, not a
|
|
1996
|
+
* security boundary — if you need a non-extractable key (so a host/operator
|
|
1997
|
+
* cannot exfiltrate it), generate it in a KMS/HSM/enclave instead and supply a
|
|
1998
|
+
* `getSessionSignature` that signs there.
|
|
1999
|
+
*/ async function generateSessionKeyPair() {
|
|
2000
|
+
const keyPair = await subtle.generateKey(ALGO, true, [
|
|
2001
|
+
'sign',
|
|
2002
|
+
'verify'
|
|
2003
|
+
]);
|
|
2004
|
+
const rawPublicKey = await subtle.exportKey('raw', keyPair.publicKey);
|
|
2005
|
+
const exportedJwk = await subtle.exportKey('jwk', keyPair.privateKey);
|
|
2006
|
+
const privateKeyJwk = exportedJwk;
|
|
2007
|
+
return {
|
|
2008
|
+
publicKeyHex: compress(new Uint8Array(rawPublicKey)),
|
|
2009
|
+
privateKeyJwk
|
|
2010
|
+
};
|
|
2011
|
+
}
|
|
2012
|
+
/**
|
|
2013
|
+
* Signs a message with a P-256 session private JWK using the exact encoding the
|
|
2014
|
+
* keyshares relay expects: ECDSA P-256 / SHA-256 over UTF-8(message), raw r‖s
|
|
2015
|
+
* (64 bytes), lowercase hex. Use it to implement `getSessionSignature`:
|
|
2016
|
+
* getSessionSignature: (message) => signSessionMessage(message, privateKeyJwk)
|
|
2017
|
+
* The JWK is imported non-extractable for signing.
|
|
2018
|
+
*/ async function signSessionMessage(message, privateKeyJwk) {
|
|
2019
|
+
const key = await subtle.importKey('jwk', privateKeyJwk, ALGO, false, [
|
|
2020
|
+
'sign'
|
|
2021
|
+
]);
|
|
2022
|
+
const signature = await subtle.sign(SIGN_ALGO, key, new TextEncoder().encode(message));
|
|
2023
|
+
return Buffer.from(new Uint8Array(signature)).toString('hex');
|
|
2024
|
+
}
|
|
2025
|
+
|
|
1858
2026
|
const createCore = ({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug = false, logger })=>{
|
|
1859
2027
|
let coreLogger;
|
|
1860
2028
|
if (logger) {
|
|
@@ -2047,4 +2215,139 @@ function decryptDelegatedWebhookData({ privateKeyPem, encryptedDelegatedKeyShare
|
|
|
2047
2215
|
}
|
|
2048
2216
|
}
|
|
2049
2217
|
|
|
2050
|
-
|
|
2218
|
+
const toAuthResult = (response)=>{
|
|
2219
|
+
var _response_user;
|
|
2220
|
+
if (response.mfaToken && !response.minifiedJwt && !response.jwt) {
|
|
2221
|
+
throw new Error('account requires MFA, which the headless auth client does not support');
|
|
2222
|
+
}
|
|
2223
|
+
var _response_minifiedJwt;
|
|
2224
|
+
const jwt = (_response_minifiedJwt = response.minifiedJwt) != null ? _response_minifiedJwt : response.jwt;
|
|
2225
|
+
if (!jwt) {
|
|
2226
|
+
throw new Error('sign-in returned no JWT in the response body; the environment likely uses cookie auth, which headless clients cannot consume');
|
|
2227
|
+
}
|
|
2228
|
+
return {
|
|
2229
|
+
jwt,
|
|
2230
|
+
expiresAt: response.expiresAt,
|
|
2231
|
+
userId: (_response_user = response.user) == null ? void 0 : _response_user.id
|
|
2232
|
+
};
|
|
2233
|
+
};
|
|
2234
|
+
// The sdk-api-core runtime throws the raw fetch Response on non-2xx; duck-type it.
|
|
2235
|
+
const httpStatus = (error)=>!(error instanceof Error) && typeof error === 'object' && error !== null && 'status' in error && typeof error.status === 'number' ? error.status : undefined;
|
|
2236
|
+
const readServerError = async (error)=>{
|
|
2237
|
+
try {
|
|
2238
|
+
const text = await error.text();
|
|
2239
|
+
const parsed = JSON.parse(text);
|
|
2240
|
+
return typeof parsed.error === 'string' ? parsed.error : undefined;
|
|
2241
|
+
} catch (e) {
|
|
2242
|
+
return undefined;
|
|
2243
|
+
}
|
|
2244
|
+
};
|
|
2245
|
+
const asAuthError = async (error, operation)=>{
|
|
2246
|
+
const status = httpStatus(error);
|
|
2247
|
+
if (status !== undefined) {
|
|
2248
|
+
if (status === 401) return new Error(`${operation} failed: the code or signature is invalid or expired`);
|
|
2249
|
+
const serverError = await readServerError(error);
|
|
2250
|
+
const detail = serverError ? `${serverError} (status ${status})` : `status ${status}`;
|
|
2251
|
+
return new Error(`${operation} failed: ${detail}`);
|
|
2252
|
+
}
|
|
2253
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
2254
|
+
};
|
|
2255
|
+
/**
|
|
2256
|
+
* Headless auth client: mints a Dynamic user JWT (email OTP or SIWE) for use
|
|
2257
|
+
* with authenticateJwt. Holds configuration only — no secrets, no persistence.
|
|
2258
|
+
*/ function createAuthClient(options) {
|
|
2259
|
+
const { environmentId } = options;
|
|
2260
|
+
var _options_baseUrl;
|
|
2261
|
+
const baseUrl = ((_options_baseUrl = options.baseUrl) != null ? _options_baseUrl : DYNAMIC_AUTH_PROD_BASE_API_URL).replace(/\/$/, '');
|
|
2262
|
+
const api = new SDKApi(new Configuration({
|
|
2263
|
+
basePath: `${baseUrl}/api/v0`,
|
|
2264
|
+
// Makes the backend return the JWT in the body instead of an httpOnly cookie.
|
|
2265
|
+
headers: {
|
|
2266
|
+
'x-dynamic-platform': 'react-native'
|
|
2267
|
+
},
|
|
2268
|
+
fetchApi: options.fetchApi
|
|
2269
|
+
}));
|
|
2270
|
+
return {
|
|
2271
|
+
email: {
|
|
2272
|
+
async sendOtp (email) {
|
|
2273
|
+
try {
|
|
2274
|
+
const { verificationUUID } = await api.createEmailVerification({
|
|
2275
|
+
environmentId,
|
|
2276
|
+
emailVerificationCreateRequest: {
|
|
2277
|
+
email
|
|
2278
|
+
}
|
|
2279
|
+
});
|
|
2280
|
+
return {
|
|
2281
|
+
verificationUUID
|
|
2282
|
+
};
|
|
2283
|
+
} catch (error) {
|
|
2284
|
+
throw await asAuthError(error, 'email OTP request');
|
|
2285
|
+
}
|
|
2286
|
+
},
|
|
2287
|
+
async verifyOtp ({ verificationUUID, code, sessionPublicKeyHex }) {
|
|
2288
|
+
try {
|
|
2289
|
+
const response = await api.signInWithEmailVerification({
|
|
2290
|
+
environmentId,
|
|
2291
|
+
emailVerificationVerifyRequest: {
|
|
2292
|
+
verificationUUID,
|
|
2293
|
+
verificationToken: code,
|
|
2294
|
+
sessionPublicKey: sessionPublicKeyHex
|
|
2295
|
+
}
|
|
2296
|
+
});
|
|
2297
|
+
return toAuthResult(response);
|
|
2298
|
+
} catch (error) {
|
|
2299
|
+
throw await asAuthError(error, 'email OTP sign-in');
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
},
|
|
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
|
+
}
|
|
2350
|
+
};
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
export { DynamicWalletClient, base64ToBytes, bytesToBase64, createAuthClient, createDelegatedWalletClient, createLogError, decryptDelegatedWebhookData, delegatedSignMessage, ensureBase64Padding, formatEvmMessage, formatMessage, generateSessionKeyPair, getExternalServerKeyShareBackupInfo, getMPCSignatureScheme, getMPCSigner, isHexString, logError, mergeUniqueKeyShares, retryPromise, revokeDelegation, signSessionMessage, stringToBytes, stripHexPrefix };
|
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.61",
|
|
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.61",
|
|
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.61",
|
|
10
10
|
"@dynamic-labs/logger": "^4.81.0",
|
|
11
11
|
"@dynamic-labs/sdk-api-core": "^0.0.984",
|
|
12
12
|
"uuid": "11.1.0",
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ChainEnum, WalletProviderEnum, type FetchAPI } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
export interface CreateAuthClientOptions {
|
|
3
|
+
environmentId: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
/** Custom fetch implementation (tests, proxies). */
|
|
6
|
+
fetchApi?: FetchAPI;
|
|
7
|
+
}
|
|
8
|
+
export interface AuthResult {
|
|
9
|
+
/** Pass to DynamicWalletClient.authenticateJwt. Custody is yours; never log it. */
|
|
10
|
+
jwt: string;
|
|
11
|
+
expiresAt: number;
|
|
12
|
+
userId?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DynamicAuthClient {
|
|
15
|
+
email: {
|
|
16
|
+
sendOtp(email: string): Promise<{
|
|
17
|
+
verificationUUID: string;
|
|
18
|
+
}>;
|
|
19
|
+
verifyOtp(params: {
|
|
20
|
+
verificationUUID: string;
|
|
21
|
+
code: string;
|
|
22
|
+
/** Compressed P-256 hex from generateSessionKeyPair — binds the session key into the minted JWT. */
|
|
23
|
+
sessionPublicKeyHex?: string;
|
|
24
|
+
}): Promise<AuthResult>;
|
|
25
|
+
};
|
|
26
|
+
siwe: {
|
|
27
|
+
getNonce(): Promise<{
|
|
28
|
+
nonce: string;
|
|
29
|
+
}>;
|
|
30
|
+
createMessage(params: {
|
|
31
|
+
domain: string;
|
|
32
|
+
address: string;
|
|
33
|
+
uri: string;
|
|
34
|
+
chainId: number;
|
|
35
|
+
nonce: string;
|
|
36
|
+
statement?: string;
|
|
37
|
+
issuedAt?: string;
|
|
38
|
+
}): string;
|
|
39
|
+
verify(params: {
|
|
40
|
+
message: string;
|
|
41
|
+
signature: string;
|
|
42
|
+
walletAddress: string;
|
|
43
|
+
sessionPublicKeyHex?: string;
|
|
44
|
+
walletName?: string;
|
|
45
|
+
walletProvider?: WalletProviderEnum;
|
|
46
|
+
chain?: ChainEnum;
|
|
47
|
+
}): Promise<AuthResult>;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Headless auth client: mints a Dynamic user JWT (email OTP or SIWE) for use
|
|
52
|
+
* with authenticateJwt. Holds configuration only — no secrets, no persistence.
|
|
53
|
+
*/
|
|
54
|
+
export declare function createAuthClient(options: CreateAuthClientOptions): DynamicAuthClient;
|
|
55
|
+
//# sourceMappingURL=authClient.d.ts.map
|
|
@@ -0,0 +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;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/client.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ export declare class DynamicWalletClient {
|
|
|
17
17
|
protected isApiClientAuthenticated: boolean;
|
|
18
18
|
protected forwardMPCEnabled: boolean;
|
|
19
19
|
protected resolvedForwardMPCClient: ForwardMPCClientV2 | undefined;
|
|
20
|
+
protected getSessionSignature?: (message: string) => Promise<string>;
|
|
21
|
+
private readonly nonceBatchSize;
|
|
22
|
+
private readonly nonceCache;
|
|
23
|
+
private nonceRefill?;
|
|
24
|
+
private nonceAuthGeneration;
|
|
20
25
|
constructor({ environmentId, baseApiUrl, baseMPCRelayApiUrl, debug, forwardMPCClient, enableMPCAccelerator, logger, }: DynamicWalletClientProps);
|
|
21
26
|
private ensureApiClientAuthenticated;
|
|
22
27
|
/**
|
|
@@ -30,7 +35,37 @@ export declare class DynamicWalletClient {
|
|
|
30
35
|
* in case are different addresses.
|
|
31
36
|
*/
|
|
32
37
|
private assertAddressMatchesMetadata;
|
|
38
|
+
/**
|
|
39
|
+
* Installs a Dynamic JWT as the bearer token for all subsequent API calls
|
|
40
|
+
* and rebuilds the API client, preserving the forward-MPC client.
|
|
41
|
+
*/
|
|
42
|
+
private setAuthenticatedJwt;
|
|
33
43
|
authenticateApiToken(authToken: string): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Authenticates the client with a Dynamic user JWT obtained outside the SDK —
|
|
46
|
+
* e.g. by an agent that completed a Dynamic sign-in (external auth, email OTP)
|
|
47
|
+
* on behalf of a user. Unlike authenticateApiToken, no token exchange happens:
|
|
48
|
+
* the JWT is used directly as the bearer token. The server validates it on
|
|
49
|
+
* every request; this method only checks the token's structure.
|
|
50
|
+
*
|
|
51
|
+
* `options.getSessionSignature` must return the signature as lowercase hex
|
|
52
|
+
* (raw ECDSA r‖s, as produced by `signSessionMessage`). Other encodings —
|
|
53
|
+
* notably base64, which can contain `/` — corrupt the `/`-delimited
|
|
54
|
+
* signed-session composite sent to the keyshares relay.
|
|
55
|
+
*/
|
|
56
|
+
authenticateJwt(jwt: string, options?: {
|
|
57
|
+
getSessionSignature?: (message: string) => Promise<string>;
|
|
58
|
+
}): Promise<void>;
|
|
59
|
+
private buildSignedSessionId;
|
|
60
|
+
private takeNonce;
|
|
61
|
+
/**
|
|
62
|
+
* Refreshes the Dynamic JWT using the current session and installs the new
|
|
63
|
+
* token for all subsequent API calls. Returns the new JWT so callers can
|
|
64
|
+
* persist it. The server enforces a hard refresh limit (the JWT's
|
|
65
|
+
* `refreshExp` claim) — once reached, this rejects with a 401 and the user
|
|
66
|
+
* must re-authenticate.
|
|
67
|
+
*/
|
|
68
|
+
refreshAuthToken(): Promise<string>;
|
|
34
69
|
/**
|
|
35
70
|
* Fetches non-sensitive wallet identity (walletId, accountAddress, chainName,
|
|
36
71
|
* derivationPath, thresholdSignatureScheme) from the Dynamic API by
|
package/src/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../packages/src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,EAElB,iBAAiB,EACjB,cAAc,EAGd,WAAW,EACX,KA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AAU,GACX,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,cAAc,EAAE,cAAc,CAAC;QAC/B,UAAU,CAAC,EAAE,kBAAkB,CAAC;KACjC,GAAG,OAAO,CAAC,OAAO,CAAC;IAMpB;;OAEG;IACG,4BAA4B,CAAC,EACjC,cAAc,EACd,eAAiD,EACjD,cAAc,EACd,UAAU,GACX,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;QAClC,cAAc,EAAE,cAAc,CAAC;QAC/B,UAAU,CAAC,EAAE,kBAAkB,CAAC;KACjC,GAAG,OAAO,CAAC,OAAO,CAAC;IAcpB;;OAEG;IACG,uCAAuC,CAAC,EAC5C,cAAc,EACd,eAAiD,EACjD,cAAc,EACd,UAAU,GACX,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,eAAe,CAAC;QAClC,cAAc,EAAE,cAAc,CAAC;QAC/B,UAAU,CAAC,EAAE,kBAAkB,CAAC;KACjC,GAAG,OAAO,CAAC,OAAO,CAAC;IAgCd,yCAAyC,CAAC,EAC9C,cAAc,GACf,EAAE;QACD,cAAc,EAAE,cAAc,CAAC;KAChC,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAK/B;;;;;;;;;;;;;;OAcG;IACG,kBAAkB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IA6ClF;;;OAGG;IACG,UAAU;;;;;;;kCAsB8B,wBAAwB;;CAGvE"}
|
package/src/index.d.ts
CHANGED
|
@@ -7,7 +7,10 @@ export type { ServerInitKeygenResult, ServerKeyShare, SignMessage } from './mpc/
|
|
|
7
7
|
export * from './client.js';
|
|
8
8
|
export * from './types.js';
|
|
9
9
|
export * from './utils.js';
|
|
10
|
+
export { generateSessionKeyPair, signSessionMessage } from './sessionKeys.js';
|
|
10
11
|
export * from './mpc/index.js';
|
|
11
12
|
export { createDelegatedWalletClient, delegatedSignMessage, revokeDelegation, decryptDelegatedWebhookData, } from './delegatedClient/index.js';
|
|
12
13
|
export type { DelegatedWalletClient, DelegatedClientConfig, EncryptedDelegatedPayload, } from './delegatedClient/index.js';
|
|
14
|
+
export { createAuthClient } from './authClient.js';
|
|
15
|
+
export type { AuthResult, CreateAuthClientOptions, DynamicAuthClient } from './authClient.js';
|
|
13
16
|
//# sourceMappingURL=index.d.ts.map
|
package/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG/F,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrE,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG1F,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG/F,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACrE,YAAY,EAAE,sBAAsB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG1F,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,UAAU,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { JsonWebKey } from 'node:crypto';
|
|
2
|
+
/**
|
|
3
|
+
* Generates a P-256 session key pair for the signed-session flow.
|
|
4
|
+
*
|
|
5
|
+
* Returns the compressed public-key hex (bind it into the Dynamic JWT via the
|
|
6
|
+
* `x-dyn-session-public-key` header when you sign in) and the private JWK.
|
|
7
|
+
*
|
|
8
|
+
* Stateless and custody-agnostic: the SDK does NOT persist the key. YOU store
|
|
9
|
+
* `privateKeyJwk` wherever you keep secrets. The returned JWK is extractable
|
|
10
|
+
* (so it can be handed back to you) and is therefore a convenience path, not a
|
|
11
|
+
* security boundary — if you need a non-extractable key (so a host/operator
|
|
12
|
+
* cannot exfiltrate it), generate it in a KMS/HSM/enclave instead and supply a
|
|
13
|
+
* `getSessionSignature` that signs there.
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateSessionKeyPair(): Promise<{
|
|
16
|
+
publicKeyHex: string;
|
|
17
|
+
privateKeyJwk: JsonWebKey;
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Signs a message with a P-256 session private JWK using the exact encoding the
|
|
21
|
+
* keyshares relay expects: ECDSA P-256 / SHA-256 over UTF-8(message), raw r‖s
|
|
22
|
+
* (64 bytes), lowercase hex. Use it to implement `getSessionSignature`:
|
|
23
|
+
* getSessionSignature: (message) => signSessionMessage(message, privateKeyJwk)
|
|
24
|
+
* The JWK is imported non-extractable for signing.
|
|
25
|
+
*/
|
|
26
|
+
export declare function signSessionMessage(message: string, privateKeyJwk: JsonWebKey): Promise<string>;
|
|
27
|
+
//# sourceMappingURL=sessionKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionKeys.d.ts","sourceRoot":"","sources":["../../packages/src/sessionKeys.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAgB9C;;;;;;;;;;;;GAYG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,UAAU,CAAA;CAAE,CAAC,CAM3G;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAIpG"}
|