@0xsequence/wallet-wdk 3.0.0-beta.9 → 3.0.0
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 +2 -2
- package/.turbo/turbo-lint.log +4 -0
- package/.turbo/turbo-typecheck.log +4 -0
- package/CHANGELOG.md +170 -0
- package/dist/dbs/auth-commitments.d.ts.map +1 -1
- package/dist/dbs/auth-keys.d.ts +3 -1
- package/dist/dbs/auth-keys.d.ts.map +1 -1
- package/dist/dbs/auth-keys.js +16 -4
- 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/env.d.ts +22 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +30 -0
- package/dist/identity/signer.d.ts +5 -4
- package/dist/identity/signer.d.ts.map +1 -1
- package/dist/identity/signer.js +11 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/sequence/cron.d.ts +3 -0
- package/dist/sequence/cron.d.ts.map +1 -1
- package/dist/sequence/cron.js +72 -39
- package/dist/sequence/handlers/authcode-pkce.d.ts +2 -1
- package/dist/sequence/handlers/authcode-pkce.d.ts.map +1 -1
- package/dist/sequence/handlers/authcode-pkce.js +4 -4
- package/dist/sequence/handlers/authcode.d.ts +4 -1
- package/dist/sequence/handlers/authcode.d.ts.map +1 -1
- package/dist/sequence/handlers/authcode.js +23 -6
- 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 +3 -1
- package/dist/sequence/handlers/identity.d.ts.map +1 -1
- package/dist/sequence/handlers/identity.js +14 -7
- 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 +2 -1
- package/dist/sequence/handlers/otp.d.ts.map +1 -1
- package/dist/sequence/handlers/otp.js +4 -3
- package/dist/sequence/handlers/passkeys.d.ts +6 -4
- package/dist/sequence/handlers/passkeys.d.ts.map +1 -1
- package/dist/sequence/handlers/passkeys.js +8 -5
- package/dist/sequence/handlers/recovery.js +1 -1
- package/dist/sequence/index.d.ts +2 -0
- package/dist/sequence/index.d.ts.map +1 -1
- package/dist/sequence/index.js +1 -0
- package/dist/sequence/manager.d.ts +67 -55
- package/dist/sequence/manager.d.ts.map +1 -1
- package/dist/sequence/manager.js +77 -17
- package/dist/sequence/messages.js +1 -1
- package/dist/sequence/passkeys-provider.d.ts +24 -0
- package/dist/sequence/passkeys-provider.d.ts.map +1 -0
- package/dist/sequence/passkeys-provider.js +15 -0
- package/dist/sequence/recovery.d.ts +2 -0
- package/dist/sequence/recovery.d.ts.map +1 -1
- package/dist/sequence/recovery.js +100 -34
- package/dist/sequence/signers.d.ts.map +1 -1
- package/dist/sequence/signers.js +3 -1
- package/dist/sequence/transactions.d.ts.map +1 -1
- package/dist/sequence/transactions.js +5 -2
- package/dist/sequence/wallets.d.ts +2 -1
- package/dist/sequence/wallets.d.ts.map +1 -1
- package/dist/sequence/wallets.js +32 -22
- package/eslint.config.js +12 -0
- package/package.json +16 -14
- package/src/dbs/auth-commitments.ts +1 -1
- package/src/dbs/auth-keys.ts +20 -6
- 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/env.ts +58 -0
- package/src/identity/signer.ts +13 -7
- package/src/index.ts +1 -0
- package/src/sequence/cron.ts +75 -42
- package/src/sequence/handlers/authcode-pkce.ts +6 -4
- package/src/sequence/handlers/authcode.ts +26 -5
- package/src/sequence/handlers/devices.ts +1 -1
- package/src/sequence/handlers/guard.ts +6 -4
- package/src/sequence/handlers/identity.ts +18 -8
- package/src/sequence/handlers/mnemonic.ts +5 -3
- package/src/sequence/handlers/otp.ts +5 -3
- package/src/sequence/handlers/passkeys.ts +13 -13
- package/src/sequence/handlers/recovery.ts +1 -1
- package/src/sequence/index.ts +2 -0
- package/src/sequence/manager.ts +168 -14
- package/src/sequence/messages.ts +1 -1
- package/src/sequence/passkeys-provider.ts +55 -0
- package/src/sequence/recovery.ts +165 -56
- package/src/sequence/signers.ts +3 -1
- package/src/sequence/transactions.ts +6 -2
- package/src/sequence/wallets.ts +39 -25
- 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/sequence/wallets.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
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 {
|
|
14
|
+
import type { PasskeySigner } from './passkeys-provider.js'
|
|
15
15
|
|
|
16
16
|
export type StartSignUpWithRedirectArgs = {
|
|
17
17
|
kind: 'google-pkce' | 'apple' | `custom-${string}`
|
|
@@ -417,17 +417,17 @@ function buildCappedTree(members: { address: Address.Address; imageHash?: Hex.He
|
|
|
417
417
|
} as Config.NestedLeaf
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
function buildCappedTreeFromTopology(weight: bigint, topology: Config.Topology): Config.Topology {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
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
|
+
// }
|
|
431
431
|
|
|
432
432
|
function toConfig(
|
|
433
433
|
checkpoint: bigint,
|
|
@@ -625,8 +625,8 @@ export class Wallets implements WalletsInterface {
|
|
|
625
625
|
loginEmail?: string
|
|
626
626
|
}> {
|
|
627
627
|
switch (args.kind) {
|
|
628
|
-
case 'passkey':
|
|
629
|
-
const passkeySigner = await
|
|
628
|
+
case 'passkey': {
|
|
629
|
+
const passkeySigner = await this.shared.passkeyProvider.create(this.shared.sequence.extensions, {
|
|
630
630
|
stateProvider: this.shared.sequence.stateProvider,
|
|
631
631
|
credentialName: args.name,
|
|
632
632
|
})
|
|
@@ -638,8 +638,9 @@ export class Wallets implements WalletsInterface {
|
|
|
638
638
|
signerKind: Kinds.LoginPasskey,
|
|
639
639
|
},
|
|
640
640
|
}
|
|
641
|
+
}
|
|
641
642
|
|
|
642
|
-
case 'mnemonic':
|
|
643
|
+
case 'mnemonic': {
|
|
643
644
|
const mnemonicSigner = MnemonicHandler.toSigner(args.mnemonic)
|
|
644
645
|
if (!mnemonicSigner) {
|
|
645
646
|
throw new Error('invalid-mnemonic')
|
|
@@ -653,6 +654,7 @@ export class Wallets implements WalletsInterface {
|
|
|
653
654
|
signerKind: Kinds.LoginMnemonic,
|
|
654
655
|
},
|
|
655
656
|
}
|
|
657
|
+
}
|
|
656
658
|
|
|
657
659
|
case 'email-otp': {
|
|
658
660
|
const handler = this.shared.handlers.get(Kinds.LoginEmailOtp) as OtpHandler
|
|
@@ -834,7 +836,7 @@ export class Wallets implements WalletsInterface {
|
|
|
834
836
|
const sessionsGuardTopology = args.noGuard ? undefined : this.shared.modules.guards.topology('sessions')
|
|
835
837
|
|
|
836
838
|
// Add modules
|
|
837
|
-
|
|
839
|
+
const modules: Module[] = []
|
|
838
840
|
|
|
839
841
|
if (!args.noSessionManager) {
|
|
840
842
|
const identitySigners = [device.address]
|
|
@@ -891,7 +893,7 @@ export class Wallets implements WalletsInterface {
|
|
|
891
893
|
}
|
|
892
894
|
|
|
893
895
|
// Store passkey credential ID mapping if this is a passkey signup
|
|
894
|
-
if (args.kind === 'passkey' && loginSigner.signer
|
|
896
|
+
if (args.kind === 'passkey' && this.isPasskeySigner(loginSigner.signer)) {
|
|
895
897
|
try {
|
|
896
898
|
await this.shared.databases.passkeyCredentials.saveCredential(
|
|
897
899
|
loginSigner.signer.credentialId,
|
|
@@ -1043,8 +1045,6 @@ export class Wallets implements WalletsInterface {
|
|
|
1043
1045
|
})
|
|
1044
1046
|
|
|
1045
1047
|
return requestId
|
|
1046
|
-
} catch (error) {
|
|
1047
|
-
throw error
|
|
1048
1048
|
} finally {
|
|
1049
1049
|
this.pendingMnemonicOrPasskeyLogin = undefined
|
|
1050
1050
|
}
|
|
@@ -1075,7 +1075,7 @@ export class Wallets implements WalletsInterface {
|
|
|
1075
1075
|
}
|
|
1076
1076
|
|
|
1077
1077
|
if (isLoginToPasskeyArgs(args)) {
|
|
1078
|
-
let passkeySigner:
|
|
1078
|
+
let passkeySigner: PasskeySigner
|
|
1079
1079
|
|
|
1080
1080
|
if (args.credentialId) {
|
|
1081
1081
|
// Application-controlled login: use the provided credentialId
|
|
@@ -1087,7 +1087,7 @@ export class Wallets implements WalletsInterface {
|
|
|
1087
1087
|
}
|
|
1088
1088
|
|
|
1089
1089
|
// Create passkey signer from stored credential
|
|
1090
|
-
passkeySigner =
|
|
1090
|
+
passkeySigner = this.shared.passkeyProvider.fromCredential({
|
|
1091
1091
|
credentialId: credential.credentialId,
|
|
1092
1092
|
publicKey: credential.publicKey,
|
|
1093
1093
|
extensions: this.shared.sequence.extensions,
|
|
@@ -1098,7 +1098,7 @@ export class Wallets implements WalletsInterface {
|
|
|
1098
1098
|
// Default discovery behavior: use WebAuthn discovery
|
|
1099
1099
|
this.shared.modules.logger.log('No credentialId provided, using discovery method')
|
|
1100
1100
|
|
|
1101
|
-
const foundPasskeySigner = await
|
|
1101
|
+
const foundPasskeySigner = await this.shared.passkeyProvider.find(
|
|
1102
1102
|
this.shared.sequence.stateProvider,
|
|
1103
1103
|
this.shared.sequence.extensions,
|
|
1104
1104
|
)
|
|
@@ -1153,6 +1153,20 @@ export class Wallets implements WalletsInterface {
|
|
|
1153
1153
|
throw new Error('invalid-login-args')
|
|
1154
1154
|
}
|
|
1155
1155
|
|
|
1156
|
+
private isPasskeySigner(signer: unknown): signer is PasskeySigner {
|
|
1157
|
+
const guard = this.shared.passkeyProvider.isSigner
|
|
1158
|
+
if (guard) {
|
|
1159
|
+
return guard(signer)
|
|
1160
|
+
}
|
|
1161
|
+
return (
|
|
1162
|
+
typeof signer === 'object' &&
|
|
1163
|
+
signer !== null &&
|
|
1164
|
+
'credentialId' in signer &&
|
|
1165
|
+
'publicKey' in signer &&
|
|
1166
|
+
'imageHash' in signer
|
|
1167
|
+
)
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1156
1170
|
async completeLogin(requestId: string) {
|
|
1157
1171
|
const request = await this.shared.modules.signatures.get(requestId)
|
|
1158
1172
|
|
|
@@ -1220,7 +1234,7 @@ export class Wallets implements WalletsInterface {
|
|
|
1220
1234
|
return requestId
|
|
1221
1235
|
}
|
|
1222
1236
|
|
|
1223
|
-
async completeLogout(requestId: string,
|
|
1237
|
+
async completeLogout(requestId: string, _options?: { skipValidateSave?: boolean }) {
|
|
1224
1238
|
const request = await this.shared.modules.signatures.get(requestId)
|
|
1225
1239
|
const walletEntry = await this.shared.databases.manager.get(request.wallet)
|
|
1226
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,
|