@0xsequence/wallet-wdk 3.0.0-beta.18 → 3.0.0-beta.19
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +12 -0
- package/dist/dbs/auth-commitments.d.ts.map +1 -1
- package/dist/dbs/auth-keys.d.ts.map +1 -1
- package/dist/dbs/messages.d.ts.map +1 -1
- package/dist/dbs/passkey-credentials.d.ts.map +1 -1
- package/dist/dbs/recovery.d.ts.map +1 -1
- package/dist/dbs/signatures.d.ts.map +1 -1
- package/dist/dbs/transactions.d.ts.map +1 -1
- package/dist/dbs/wallets.d.ts.map +1 -1
- package/dist/identity/signer.d.ts +1 -1
- package/dist/identity/signer.d.ts.map +1 -1
- package/dist/sequence/handlers/devices.d.ts +1 -1
- package/dist/sequence/handlers/devices.d.ts.map +1 -1
- package/dist/sequence/handlers/devices.js +1 -1
- package/dist/sequence/handlers/guard.d.ts +1 -1
- package/dist/sequence/handlers/guard.d.ts.map +1 -1
- package/dist/sequence/handlers/guard.js +22 -19
- package/dist/sequence/handlers/identity.d.ts.map +1 -1
- package/dist/sequence/handlers/mnemonic.d.ts.map +1 -1
- package/dist/sequence/handlers/mnemonic.js +21 -18
- package/dist/sequence/handlers/otp.d.ts.map +1 -1
- package/dist/sequence/handlers/otp.js +2 -1
- package/dist/sequence/handlers/passkeys.d.ts +1 -1
- package/dist/sequence/handlers/passkeys.d.ts.map +1 -1
- package/dist/sequence/handlers/passkeys.js +1 -1
- package/dist/sequence/handlers/recovery.js +1 -1
- package/dist/sequence/manager.js +1 -1
- package/dist/sequence/messages.js +1 -1
- package/dist/sequence/signers.d.ts.map +1 -1
- package/dist/sequence/signers.js +3 -1
- package/dist/sequence/transactions.js +1 -1
- package/dist/sequence/wallets.d.ts +1 -1
- package/dist/sequence/wallets.d.ts.map +1 -1
- package/dist/sequence/wallets.js +17 -18
- package/eslint.config.js +12 -0
- package/package.json +15 -13
- package/src/dbs/auth-commitments.ts +1 -1
- package/src/dbs/auth-keys.ts +1 -1
- package/src/dbs/messages.ts +1 -1
- package/src/dbs/passkey-credentials.ts +1 -1
- package/src/dbs/recovery.ts +1 -1
- package/src/dbs/signatures.ts +1 -1
- package/src/dbs/transactions.ts +1 -1
- package/src/dbs/wallets.ts +1 -1
- package/src/identity/signer.ts +3 -3
- package/src/sequence/handlers/authcode-pkce.ts +1 -1
- package/src/sequence/handlers/devices.ts +1 -1
- package/src/sequence/handlers/guard.ts +6 -4
- package/src/sequence/handlers/identity.ts +1 -1
- package/src/sequence/handlers/mnemonic.ts +5 -3
- package/src/sequence/handlers/otp.ts +2 -1
- package/src/sequence/handlers/passkeys.ts +1 -1
- package/src/sequence/handlers/recovery.ts +1 -1
- package/src/sequence/manager.ts +1 -1
- package/src/sequence/messages.ts +1 -1
- package/src/sequence/signers.ts +3 -1
- package/src/sequence/transactions.ts +1 -1
- package/src/sequence/wallets.ts +19 -20
- package/test/authcode-pkce.test.ts +2 -3
- package/test/authcode.test.ts +6 -8
- package/test/constants.ts +4 -2
- package/test/guard.test.ts +5 -5
- package/test/identity-signer.test.ts +1 -1
- package/test/otp.test.ts +1 -1
- package/test/passkeys.test.ts +1 -1
- package/test/recovery.test.ts +3 -3
- package/test/sessions.test.ts +1 -1
- package/test/{test-ssr-safety.mjs → test-ssr-safety.js} +143 -137
- package/test/transactions.test.ts +3 -3
- package/test/wallets.test.ts +5 -5
package/src/dbs/recovery.ts
CHANGED
package/src/dbs/signatures.ts
CHANGED
package/src/dbs/transactions.ts
CHANGED
package/src/dbs/wallets.ts
CHANGED
package/src/identity/signer.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Address, Signature, Hex, Bytes
|
|
1
|
+
import { Address, Signature, Hex, Bytes } from 'ox'
|
|
2
2
|
import { Signers, State, type CryptoLike } from '@0xsequence/wallet-core'
|
|
3
|
-
import { IdentityInstrument
|
|
3
|
+
import { IdentityInstrument } from '@0xsequence/identity-instrument'
|
|
4
4
|
import { AuthKey } from '../dbs/auth-keys.js'
|
|
5
5
|
import { Payload, Signature as SequenceSignature } from '@0xsequence/wallet-primitives'
|
|
6
6
|
import * as Identity from '@0xsequence/identity-instrument'
|
|
@@ -61,7 +61,7 @@ export class IdentitySigner implements Signers.Signer {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
async witness(stateWriter: State.Writer, wallet: Address.Address, extra?:
|
|
64
|
+
async witness(stateWriter: State.Writer, wallet: Address.Address, extra?: object): Promise<void> {
|
|
65
65
|
const payload = Payload.fromMessage(
|
|
66
66
|
Hex.fromString(
|
|
67
67
|
JSON.stringify({
|
|
@@ -35,7 +35,7 @@ export class GuardHandler implements Handler {
|
|
|
35
35
|
this.onPromptCode = undefined
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
onStatusChange(
|
|
38
|
+
onStatusChange(_cb: () => void): () => void {
|
|
39
39
|
return () => {}
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -87,8 +87,9 @@ export class GuardHandler implements Handler {
|
|
|
87
87
|
address,
|
|
88
88
|
handler: this,
|
|
89
89
|
status: 'ready',
|
|
90
|
-
handle: () =>
|
|
91
|
-
|
|
90
|
+
handle: () => {
|
|
91
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
92
|
+
return new Promise(async (resolve, reject) => {
|
|
92
93
|
try {
|
|
93
94
|
const signature = await guard.signEnvelope(request.envelope)
|
|
94
95
|
await this.signatures.addSignature(request.id, signature)
|
|
@@ -106,7 +107,8 @@ export class GuardHandler implements Handler {
|
|
|
106
107
|
reject(e)
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
|
-
})
|
|
110
|
+
})
|
|
111
|
+
},
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
}
|
|
@@ -93,8 +93,9 @@ export class MnemonicHandler implements Handler {
|
|
|
93
93
|
handler: this,
|
|
94
94
|
status: 'actionable',
|
|
95
95
|
message: 'enter-mnemonic',
|
|
96
|
-
handle: () =>
|
|
97
|
-
|
|
96
|
+
handle: () => {
|
|
97
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
98
|
+
return new Promise(async (resolve, reject) => {
|
|
98
99
|
const respond: RespondFn = async (mnemonic) => {
|
|
99
100
|
const signer = MnemonicHandler.toSigner(mnemonic)
|
|
100
101
|
if (!signer) {
|
|
@@ -117,7 +118,8 @@ export class MnemonicHandler implements Handler {
|
|
|
117
118
|
resolve(true)
|
|
118
119
|
}
|
|
119
120
|
await onPromptMnemonic(respond)
|
|
120
|
-
})
|
|
121
|
+
})
|
|
122
|
+
},
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
}
|
|
@@ -85,7 +85,7 @@ export class OtpHandler extends IdentityHandler implements Handler {
|
|
|
85
85
|
try {
|
|
86
86
|
await this.handleAuth(challenge, onPromptOtp)
|
|
87
87
|
return true
|
|
88
|
-
} catch
|
|
88
|
+
} catch {
|
|
89
89
|
return false
|
|
90
90
|
}
|
|
91
91
|
},
|
|
@@ -96,6 +96,7 @@ export class OtpHandler extends IdentityHandler implements Handler {
|
|
|
96
96
|
challenge: Identity.OtpChallenge,
|
|
97
97
|
onPromptOtp: PromptOtpHandler,
|
|
98
98
|
): Promise<{ signer: Signers.Signer & Signers.Witnessable; email: string }> {
|
|
99
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
99
100
|
return new Promise(async (resolve, reject) => {
|
|
100
101
|
try {
|
|
101
102
|
const { loginHint, challenge: codeChallenge } = await this.nitroCommitVerifier(challenge)
|
package/src/sequence/manager.ts
CHANGED
|
@@ -561,7 +561,7 @@ export class Manager {
|
|
|
561
561
|
const ops = applyManagerOptionsDefaults(options)
|
|
562
562
|
|
|
563
563
|
// Build relayers list
|
|
564
|
-
|
|
564
|
+
const relayers: Relayer.Relayer[] = []
|
|
565
565
|
|
|
566
566
|
// Add EIP-6963 relayers if enabled
|
|
567
567
|
if (ops.multiInjectedProviderDiscovery) {
|
package/src/sequence/messages.ts
CHANGED
|
@@ -242,7 +242,7 @@ export class Messages implements MessagesInterface {
|
|
|
242
242
|
const message = await this.getByMessageOrSignatureId(messageOrSignatureId)
|
|
243
243
|
await this.shared.databases.signatures.del(message.signatureId)
|
|
244
244
|
await this.shared.databases.messages.del(message.id)
|
|
245
|
-
} catch
|
|
245
|
+
} catch {
|
|
246
246
|
// Ignore
|
|
247
247
|
}
|
|
248
248
|
}
|
package/src/sequence/signers.ts
CHANGED
|
@@ -496,7 +496,7 @@ export class Transactions implements TransactionsInterface {
|
|
|
496
496
|
let tx: Transaction | undefined
|
|
497
497
|
try {
|
|
498
498
|
tx = await this.get(transactionOrSignatureId)
|
|
499
|
-
} catch
|
|
499
|
+
} catch {
|
|
500
500
|
// If not found, it might be a signature ID
|
|
501
501
|
const signature = await this.shared.modules.signatures.get(transactionOrSignatureId)
|
|
502
502
|
if (!signature) {
|
package/src/sequence/wallets.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { Wallet as CoreWallet, Envelope, Signers, State } from '@0xsequence/wallet-core'
|
|
2
|
-
import { Config, Constants,
|
|
2
|
+
import { Config, Constants, Payload } from '@0xsequence/wallet-primitives'
|
|
3
3
|
import { Address, Hex, Provider, RpcTransport } from 'ox'
|
|
4
4
|
import { AuthCommitment } from '../dbs/auth-commitments.js'
|
|
5
5
|
import { AuthCodeHandler } from './handlers/authcode.js'
|
|
6
6
|
import { MnemonicHandler } from './handlers/mnemonic.js'
|
|
7
7
|
import { OtpHandler } from './handlers/otp.js'
|
|
8
|
-
import {
|
|
8
|
+
import { Shared } from './manager.js'
|
|
9
9
|
import { Device } from './types/device.js'
|
|
10
10
|
import { Action, Module } from './types/index.js'
|
|
11
11
|
import { Kinds, SignerWithKind, WitnessExtraSignerKind } from './types/signer.js'
|
|
12
12
|
import { Wallet, WalletSelectionUiHandler } from './types/wallet.js'
|
|
13
13
|
import { PasskeysHandler } from './handlers/passkeys.js'
|
|
14
|
-
import { GuardRole } from './guards.js'
|
|
15
14
|
import type { PasskeySigner } from './passkeys-provider.js'
|
|
16
15
|
|
|
17
16
|
export type StartSignUpWithRedirectArgs = {
|
|
@@ -418,17 +417,17 @@ function buildCappedTree(members: { address: Address.Address; imageHash?: Hex.He
|
|
|
418
417
|
} as Config.NestedLeaf
|
|
419
418
|
}
|
|
420
419
|
|
|
421
|
-
function buildCappedTreeFromTopology(weight: bigint, topology: Config.Topology): Config.Topology {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
}
|
|
420
|
+
// function buildCappedTreeFromTopology(weight: bigint, topology: Config.Topology): Config.Topology {
|
|
421
|
+
// // We may optimize this for some topology types
|
|
422
|
+
// // but it is not worth it, because the topology
|
|
423
|
+
// // that we will use for prod won't be optimizable
|
|
424
|
+
// return {
|
|
425
|
+
// type: 'nested',
|
|
426
|
+
// weight: weight,
|
|
427
|
+
// threshold: weight,
|
|
428
|
+
// tree: topology,
|
|
429
|
+
// }
|
|
430
|
+
// }
|
|
432
431
|
|
|
433
432
|
function toConfig(
|
|
434
433
|
checkpoint: bigint,
|
|
@@ -626,7 +625,7 @@ export class Wallets implements WalletsInterface {
|
|
|
626
625
|
loginEmail?: string
|
|
627
626
|
}> {
|
|
628
627
|
switch (args.kind) {
|
|
629
|
-
case 'passkey':
|
|
628
|
+
case 'passkey': {
|
|
630
629
|
const passkeySigner = await this.shared.passkeyProvider.create(this.shared.sequence.extensions, {
|
|
631
630
|
stateProvider: this.shared.sequence.stateProvider,
|
|
632
631
|
credentialName: args.name,
|
|
@@ -639,8 +638,9 @@ export class Wallets implements WalletsInterface {
|
|
|
639
638
|
signerKind: Kinds.LoginPasskey,
|
|
640
639
|
},
|
|
641
640
|
}
|
|
641
|
+
}
|
|
642
642
|
|
|
643
|
-
case 'mnemonic':
|
|
643
|
+
case 'mnemonic': {
|
|
644
644
|
const mnemonicSigner = MnemonicHandler.toSigner(args.mnemonic)
|
|
645
645
|
if (!mnemonicSigner) {
|
|
646
646
|
throw new Error('invalid-mnemonic')
|
|
@@ -654,6 +654,7 @@ export class Wallets implements WalletsInterface {
|
|
|
654
654
|
signerKind: Kinds.LoginMnemonic,
|
|
655
655
|
},
|
|
656
656
|
}
|
|
657
|
+
}
|
|
657
658
|
|
|
658
659
|
case 'email-otp': {
|
|
659
660
|
const handler = this.shared.handlers.get(Kinds.LoginEmailOtp) as OtpHandler
|
|
@@ -835,7 +836,7 @@ export class Wallets implements WalletsInterface {
|
|
|
835
836
|
const sessionsGuardTopology = args.noGuard ? undefined : this.shared.modules.guards.topology('sessions')
|
|
836
837
|
|
|
837
838
|
// Add modules
|
|
838
|
-
|
|
839
|
+
const modules: Module[] = []
|
|
839
840
|
|
|
840
841
|
if (!args.noSessionManager) {
|
|
841
842
|
const identitySigners = [device.address]
|
|
@@ -1044,8 +1045,6 @@ export class Wallets implements WalletsInterface {
|
|
|
1044
1045
|
})
|
|
1045
1046
|
|
|
1046
1047
|
return requestId
|
|
1047
|
-
} catch (error) {
|
|
1048
|
-
throw error
|
|
1049
1048
|
} finally {
|
|
1050
1049
|
this.pendingMnemonicOrPasskeyLogin = undefined
|
|
1051
1050
|
}
|
|
@@ -1235,7 +1234,7 @@ export class Wallets implements WalletsInterface {
|
|
|
1235
1234
|
return requestId
|
|
1236
1235
|
}
|
|
1237
1236
|
|
|
1238
|
-
async completeLogout(requestId: string,
|
|
1237
|
+
async completeLogout(requestId: string, _options?: { skipValidateSave?: boolean }) {
|
|
1239
1238
|
const request = await this.shared.modules.signatures.get(requestId)
|
|
1240
1239
|
const walletEntry = await this.shared.databases.manager.get(request.wallet)
|
|
1241
1240
|
if (!walletEntry) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
-
import { Address, Hex, Bytes } from 'ox'
|
|
3
2
|
import * as Identity from '@0xsequence/identity-instrument'
|
|
4
3
|
import { AuthCodePkceHandler } from '../src/sequence/handlers/authcode-pkce.js'
|
|
5
4
|
import { Signatures } from '../src/sequence/signatures.js'
|
|
@@ -68,7 +67,7 @@ describe('AuthCodePkceHandler', () => {
|
|
|
68
67
|
handler.setRedirectUri('https://example.com/auth/callback')
|
|
69
68
|
|
|
70
69
|
// Mock inherited methods
|
|
71
|
-
vi.spyOn(handler as any, 'nitroCommitVerifier').mockImplementation(async (
|
|
70
|
+
vi.spyOn(handler as any, 'nitroCommitVerifier').mockImplementation(async () => {
|
|
72
71
|
return {
|
|
73
72
|
verifier: 'mock-verifier-code',
|
|
74
73
|
loginHint: 'user@example.com',
|
|
@@ -76,7 +75,7 @@ describe('AuthCodePkceHandler', () => {
|
|
|
76
75
|
}
|
|
77
76
|
})
|
|
78
77
|
|
|
79
|
-
vi.spyOn(handler as any, 'nitroCompleteAuth').mockImplementation(async (
|
|
78
|
+
vi.spyOn(handler as any, 'nitroCompleteAuth').mockImplementation(async () => {
|
|
80
79
|
return {
|
|
81
80
|
signer: mockIdentitySigner,
|
|
82
81
|
email: 'user@example.com',
|
package/test/authcode.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
|
-
import { Address, Hex
|
|
2
|
+
import { Address, Hex } from 'ox'
|
|
3
3
|
import { Network, Payload } from '@0xsequence/wallet-primitives'
|
|
4
4
|
import { IdentityInstrument, IdentityType, KeyType, AuthCodeChallenge } from '@0xsequence/identity-instrument'
|
|
5
5
|
import { AuthCodeHandler } from '../src/sequence/handlers/authcode.js'
|
|
@@ -45,8 +45,8 @@ class MockURLSearchParams {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
//
|
|
49
|
-
|
|
48
|
+
// Override global URLSearchParams for testing
|
|
49
|
+
globalThis.URLSearchParams = MockURLSearchParams as any
|
|
50
50
|
|
|
51
51
|
// Mock dependencies with proper vi.fn() types
|
|
52
52
|
const mockCommitVerifier = vi.fn()
|
|
@@ -285,8 +285,7 @@ describe('AuthCodeHandler', () => {
|
|
|
285
285
|
})
|
|
286
286
|
|
|
287
287
|
it('Should generate random state when not provided', async () => {
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
await authCodeHandler.commitAuth('/target', false)
|
|
290
289
|
const commitmentCall = mockAuthCommitmentsSet.mock.calls[0]![0]!
|
|
291
290
|
expect(commitmentCall.id).toBeDefined()
|
|
292
291
|
expect(typeof commitmentCall.id).toBe('string')
|
|
@@ -316,8 +315,7 @@ describe('AuthCodeHandler', () => {
|
|
|
316
315
|
})
|
|
317
316
|
|
|
318
317
|
it('Should create commitment without signer', async () => {
|
|
319
|
-
|
|
320
|
-
|
|
318
|
+
await authCodeHandler.commitAuth('/target', true)
|
|
321
319
|
const commitmentCall = mockAuthCommitmentsSet.mock.calls[0]![0]!
|
|
322
320
|
expect(commitmentCall.signer).toBeUndefined()
|
|
323
321
|
expect(commitmentCall.isSignUp).toBe(true)
|
|
@@ -329,7 +327,7 @@ describe('AuthCodeHandler', () => {
|
|
|
329
327
|
describe('completeAuth()', () => {
|
|
330
328
|
it('Should complete auth flow with code and return signer', async () => {
|
|
331
329
|
const authCode = 'test-auth-code-123'
|
|
332
|
-
const mockSigner = {} as IdentitySigner
|
|
330
|
+
// const mockSigner = {} as IdentitySigner
|
|
333
331
|
const mockEmail = 'test@example.com'
|
|
334
332
|
|
|
335
333
|
mockCommitVerifier.mockResolvedValueOnce(undefined)
|
package/test/constants.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Relayer } from '@0xsequence/relayer'
|
|
|
7
7
|
import * as Db from '../src/dbs/index.js'
|
|
8
8
|
import { Network } from '@0xsequence/wallet-primitives'
|
|
9
9
|
|
|
10
|
+
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
|
10
11
|
const envFile = process.env.CI ? '.env.test' : '.env.test.local'
|
|
11
12
|
dotenvConfig({ path: envFile })
|
|
12
13
|
|
|
@@ -14,6 +15,7 @@ export const EMITTER_ADDRESS: Address.Address = '0xb7bE532959236170064cf099e1a33
|
|
|
14
15
|
export const EMITTER_ABI = Abi.from(['function explicitEmit()', 'function implicitEmit()'])
|
|
15
16
|
|
|
16
17
|
// Environment variables
|
|
18
|
+
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
|
17
19
|
export const LOCAL_RPC_URL = process.env.LOCAL_RPC_URL || 'http://localhost:8545'
|
|
18
20
|
|
|
19
21
|
let testIdCounter = 0
|
|
@@ -81,8 +83,8 @@ export function newRemoteManager(
|
|
|
81
83
|
? `_${remoteManagerOptions.tag}_testrun_${testIdCounter}`
|
|
82
84
|
: `_testrun_${testIdCounter}`
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
const relayers: Relayer.Relayer[] = []
|
|
87
|
+
const bundlers: Bundler.Bundler[] = []
|
|
86
88
|
|
|
87
89
|
if (remoteManagerOptions.network.relayerPk) {
|
|
88
90
|
const provider = Provider.from(RpcTransport.fromHttp(remoteManagerOptions.network.rpcUrl))
|
package/test/guard.test.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Address, Bytes, Hex, TypedData } from 'ox'
|
|
|
5
5
|
import { Config, Constants, Network, Payload } from '@0xsequence/wallet-primitives'
|
|
6
6
|
import { Kinds } from '../src/sequence/types/signer.js'
|
|
7
7
|
import { newManager } from './constants.js'
|
|
8
|
-
import {
|
|
8
|
+
import { Guards } from '../src/sequence/guards.js'
|
|
9
9
|
|
|
10
10
|
// Mock fetch globally for guard API calls
|
|
11
11
|
const mockFetch = vi.fn()
|
|
@@ -16,8 +16,8 @@ describe('GuardHandler', () => {
|
|
|
16
16
|
let guards: Guards
|
|
17
17
|
let testWallet: Address.Address
|
|
18
18
|
let testPayload: Payload.Payload
|
|
19
|
-
let
|
|
20
|
-
let
|
|
19
|
+
let _testMessageDigest: Bytes.Bytes
|
|
20
|
+
let _testMessage: Hex.Hex
|
|
21
21
|
|
|
22
22
|
beforeEach(async () => {
|
|
23
23
|
vi.clearAllMocks()
|
|
@@ -28,8 +28,8 @@ describe('GuardHandler', () => {
|
|
|
28
28
|
|
|
29
29
|
testWallet = '0x1234567890123456789012345678901234567890' as Address.Address
|
|
30
30
|
testPayload = Payload.fromMessage(Hex.fromString('Test message'))
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
_testMessage = TypedData.encode(Payload.toTyped(testWallet, Network.ChainId.ARBITRUM, testPayload))
|
|
32
|
+
_testMessageDigest = Payload.hash(testWallet, Network.ChainId.ARBITRUM, testPayload)
|
|
33
33
|
})
|
|
34
34
|
|
|
35
35
|
afterEach(async () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it, Mock, vi } from 'vitest'
|
|
2
|
-
import { Address,
|
|
2
|
+
import { Address, Hex } from 'ox'
|
|
3
3
|
import { Network, Payload } from '@0xsequence/wallet-primitives'
|
|
4
4
|
import { IdentityInstrument, KeyType } from '@0xsequence/identity-instrument'
|
|
5
5
|
import { State } from '@0xsequence/wallet-core'
|
package/test/otp.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it, Mock, vi } from 'vitest'
|
|
2
2
|
import { Address, Hex } from 'ox'
|
|
3
3
|
import { Network, Payload } from '@0xsequence/wallet-primitives'
|
|
4
|
-
import { IdentityInstrument, IdentityType, KeyType
|
|
4
|
+
import { IdentityInstrument, IdentityType, KeyType } from '@0xsequence/identity-instrument'
|
|
5
5
|
import { OtpHandler, PromptOtpHandler } from '../src/sequence/handlers/otp.js'
|
|
6
6
|
import { Signatures } from '../src/sequence/signatures.js'
|
|
7
7
|
import * as Db from '../src/dbs/index.js'
|
package/test/passkeys.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
2
2
|
import { Address, Hex } from 'ox'
|
|
3
3
|
import { Network, Payload } from '@0xsequence/wallet-primitives'
|
|
4
|
-
import {
|
|
4
|
+
import { State } from '@0xsequence/wallet-core'
|
|
5
5
|
import { Extensions } from '@0xsequence/wallet-primitives'
|
|
6
6
|
import { PasskeysHandler } from '../src/sequence/handlers/passkeys.js'
|
|
7
7
|
import { Signatures } from '../src/sequence/signatures.js'
|
package/test/recovery.test.ts
CHANGED
|
@@ -174,7 +174,7 @@ describe('Recovery', () => {
|
|
|
174
174
|
const recoverySigner = request4.signers.find((s) => s.handler?.kind === 'recovery-extension')
|
|
175
175
|
expect(recoverySigner).toBeDefined()
|
|
176
176
|
expect(recoverySigner!.status).toBe('ready')
|
|
177
|
-
|
|
177
|
+
|
|
178
178
|
// Handle the recovery signer
|
|
179
179
|
const result4 = await (recoverySigner as SignerReady).handle()
|
|
180
180
|
expect(result4).toBeDefined()
|
|
@@ -303,9 +303,9 @@ describe('Recovery', () => {
|
|
|
303
303
|
})
|
|
304
304
|
|
|
305
305
|
// Set up mnemonic handler and sign the payload
|
|
306
|
-
let
|
|
306
|
+
let _handledMnemonic2 = 0
|
|
307
307
|
const unregisterHandler = manager.registerMnemonicUI(async (respond) => {
|
|
308
|
-
|
|
308
|
+
_handledMnemonic2++
|
|
309
309
|
await respond(mnemonic2)
|
|
310
310
|
})
|
|
311
311
|
|
package/test/sessions.test.ts
CHANGED
|
@@ -358,7 +358,7 @@ for (const extension of ALL_EXTENSIONS) {
|
|
|
358
358
|
throw new Error('Failed to create pk store')
|
|
359
359
|
}
|
|
360
360
|
// Create the initial permissions
|
|
361
|
-
|
|
361
|
+
const explicitSession: ExplicitSession = {
|
|
362
362
|
type: 'explicit',
|
|
363
363
|
sessionAddress: e.address,
|
|
364
364
|
chainId,
|