@zerodev/wallet-core 0.0.1-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +310 -0
- package/dist/_cjs/actions/auth/authenticateWithEmail.js +17 -0
- package/dist/_cjs/actions/auth/authenticateWithEmail.js.map +1 -0
- package/dist/_cjs/actions/auth/authenticateWithOAuth.js +13 -0
- package/dist/_cjs/actions/auth/authenticateWithOAuth.js.map +1 -0
- package/dist/_cjs/actions/auth/getAuthProxyConfigId.js +10 -0
- package/dist/_cjs/actions/auth/getAuthProxyConfigId.js.map +1 -0
- package/dist/_cjs/actions/auth/getUserEmail.js +19 -0
- package/dist/_cjs/actions/auth/getUserEmail.js.map +1 -0
- package/dist/_cjs/actions/auth/getWhoami.js +15 -0
- package/dist/_cjs/actions/auth/getWhoami.js.map +1 -0
- package/dist/_cjs/actions/auth/index.js +22 -0
- package/dist/_cjs/actions/auth/index.js.map +1 -0
- package/dist/_cjs/actions/auth/loginWithOTP.js +15 -0
- package/dist/_cjs/actions/auth/loginWithOTP.js.map +1 -0
- package/dist/_cjs/actions/auth/loginWithStamp.js +39 -0
- package/dist/_cjs/actions/auth/loginWithStamp.js.map +1 -0
- package/dist/_cjs/actions/auth/registerWithOTP.js +16 -0
- package/dist/_cjs/actions/auth/registerWithOTP.js.map +1 -0
- package/dist/_cjs/actions/auth/registerWithPasskey.js +17 -0
- package/dist/_cjs/actions/auth/registerWithPasskey.js.map +1 -0
- package/dist/_cjs/actions/index.js +17 -0
- package/dist/_cjs/actions/index.js.map +1 -0
- package/dist/_cjs/actions/wallet/getUserWallet.js +18 -0
- package/dist/_cjs/actions/wallet/getUserWallet.js.map +1 -0
- package/dist/_cjs/actions/wallet/index.js +10 -0
- package/dist/_cjs/actions/wallet/index.js.map +1 -0
- package/dist/_cjs/actions/wallet/signRawPayload.js +27 -0
- package/dist/_cjs/actions/wallet/signRawPayload.js.map +1 -0
- package/dist/_cjs/actions/wallet/signTransaction.js +26 -0
- package/dist/_cjs/actions/wallet/signTransaction.js.map +1 -0
- package/dist/_cjs/adapters/viem.js +92 -0
- package/dist/_cjs/adapters/viem.js.map +1 -0
- package/dist/_cjs/client/authProxy.js +31 -0
- package/dist/_cjs/client/authProxy.js.map +1 -0
- package/dist/_cjs/client/createClient.js +49 -0
- package/dist/_cjs/client/createClient.js.map +1 -0
- package/dist/_cjs/client/decorators/client.js +23 -0
- package/dist/_cjs/client/decorators/client.js.map +1 -0
- package/dist/_cjs/client/index.js +11 -0
- package/dist/_cjs/client/index.js.map +1 -0
- package/dist/_cjs/client/transports/createTransport.js +31 -0
- package/dist/_cjs/client/transports/createTransport.js.map +1 -0
- package/dist/_cjs/client/transports/rest.js +104 -0
- package/dist/_cjs/client/transports/rest.js.map +1 -0
- package/dist/_cjs/client/types.js +3 -0
- package/dist/_cjs/client/types.js.map +1 -0
- package/dist/_cjs/constants.js +9 -0
- package/dist/_cjs/constants.js.map +1 -0
- package/dist/_cjs/core/createZeroDevWallet.js +302 -0
- package/dist/_cjs/core/createZeroDevWallet.js.map +1 -0
- package/dist/_cjs/errors/request.js +61 -0
- package/dist/_cjs/errors/request.js.map +1 -0
- package/dist/_cjs/index.js +35 -0
- package/dist/_cjs/index.js.map +1 -0
- package/dist/_cjs/package.json +1 -0
- package/dist/_cjs/polyfills/window.js +26 -0
- package/dist/_cjs/polyfills/window.js.map +1 -0
- package/dist/_cjs/stampers/iframeStamper.js +35 -0
- package/dist/_cjs/stampers/iframeStamper.js.map +1 -0
- package/dist/_cjs/stampers/index.js +10 -0
- package/dist/_cjs/stampers/index.js.map +1 -0
- package/dist/_cjs/stampers/indexedDbStamper.js +23 -0
- package/dist/_cjs/stampers/indexedDbStamper.js.map +1 -0
- package/dist/_cjs/stampers/types.js +3 -0
- package/dist/_cjs/stampers/types.js.map +1 -0
- package/dist/_cjs/stampers/webauthnStamper.js +17 -0
- package/dist/_cjs/stampers/webauthnStamper.js.map +1 -0
- package/dist/_cjs/storage/adapters.js +18 -0
- package/dist/_cjs/storage/adapters.js.map +1 -0
- package/dist/_cjs/storage/manager.js +108 -0
- package/dist/_cjs/storage/manager.js.map +1 -0
- package/dist/_cjs/types/session.js +9 -0
- package/dist/_cjs/types/session.js.map +1 -0
- package/dist/_cjs/utils/buildClientSignature.js +39 -0
- package/dist/_cjs/utils/buildClientSignature.js.map +1 -0
- package/dist/_cjs/utils/derToRawSignature.js +63 -0
- package/dist/_cjs/utils/derToRawSignature.js.map +1 -0
- package/dist/_cjs/utils/exportPrivateKey.js +55 -0
- package/dist/_cjs/utils/exportPrivateKey.js.map +1 -0
- package/dist/_cjs/utils/exportWallet.js +70 -0
- package/dist/_cjs/utils/exportWallet.js.map +1 -0
- package/dist/_cjs/utils/utils.js +75 -0
- package/dist/_cjs/utils/utils.js.map +1 -0
- package/dist/_esm/actions/auth/authenticateWithEmail.js +18 -0
- package/dist/_esm/actions/auth/authenticateWithEmail.js.map +1 -0
- package/dist/_esm/actions/auth/authenticateWithOAuth.js +29 -0
- package/dist/_esm/actions/auth/authenticateWithOAuth.js.map +1 -0
- package/dist/_esm/actions/auth/getAuthProxyConfigId.js +13 -0
- package/dist/_esm/actions/auth/getAuthProxyConfigId.js.map +1 -0
- package/dist/_esm/actions/auth/getUserEmail.js +33 -0
- package/dist/_esm/actions/auth/getUserEmail.js.map +1 -0
- package/dist/_esm/actions/auth/getWhoami.js +28 -0
- package/dist/_esm/actions/auth/getWhoami.js.map +1 -0
- package/dist/_esm/actions/auth/index.js +10 -0
- package/dist/_esm/actions/auth/index.js.map +1 -0
- package/dist/_esm/actions/auth/loginWithOTP.js +38 -0
- package/dist/_esm/actions/auth/loginWithOTP.js.map +1 -0
- package/dist/_esm/actions/auth/loginWithStamp.js +52 -0
- package/dist/_esm/actions/auth/loginWithStamp.js.map +1 -0
- package/dist/_esm/actions/auth/registerWithOTP.js +35 -0
- package/dist/_esm/actions/auth/registerWithOTP.js.map +1 -0
- package/dist/_esm/actions/auth/registerWithPasskey.js +36 -0
- package/dist/_esm/actions/auth/registerWithPasskey.js.map +1 -0
- package/dist/_esm/actions/index.js +5 -0
- package/dist/_esm/actions/index.js.map +1 -0
- package/dist/_esm/actions/wallet/getUserWallet.js +31 -0
- package/dist/_esm/actions/wallet/getUserWallet.js.map +1 -0
- package/dist/_esm/actions/wallet/index.js +4 -0
- package/dist/_esm/actions/wallet/index.js.map +1 -0
- package/dist/_esm/actions/wallet/signRawPayload.js +42 -0
- package/dist/_esm/actions/wallet/signRawPayload.js.map +1 -0
- package/dist/_esm/actions/wallet/signTransaction.js +41 -0
- package/dist/_esm/actions/wallet/signTransaction.js.map +1 -0
- package/dist/_esm/adapters/viem.js +94 -0
- package/dist/_esm/adapters/viem.js.map +1 -0
- package/dist/_esm/client/authProxy.js +41 -0
- package/dist/_esm/client/authProxy.js.map +1 -0
- package/dist/_esm/client/createClient.js +60 -0
- package/dist/_esm/client/createClient.js.map +1 -0
- package/dist/_esm/client/decorators/client.js +44 -0
- package/dist/_esm/client/decorators/client.js.map +1 -0
- package/dist/_esm/client/index.js +4 -0
- package/dist/_esm/client/index.js.map +1 -0
- package/dist/_esm/client/transports/createTransport.js +33 -0
- package/dist/_esm/client/transports/createTransport.js.map +1 -0
- package/dist/_esm/client/transports/rest.js +103 -0
- package/dist/_esm/client/transports/rest.js.map +1 -0
- package/dist/_esm/client/types.js +2 -0
- package/dist/_esm/client/types.js.map +1 -0
- package/dist/_esm/constants.js +6 -0
- package/dist/_esm/constants.js.map +1 -0
- package/dist/_esm/core/createZeroDevWallet.js +308 -0
- package/dist/_esm/core/createZeroDevWallet.js.map +1 -0
- package/dist/_esm/errors/request.js +60 -0
- package/dist/_esm/errors/request.js.map +1 -0
- package/dist/_esm/index.js +23 -0
- package/dist/_esm/index.js.map +1 -0
- package/dist/_esm/package.json +1 -0
- package/dist/_esm/polyfills/window.js +24 -0
- package/dist/_esm/polyfills/window.js.map +1 -0
- package/dist/_esm/stampers/iframeStamper.js +32 -0
- package/dist/_esm/stampers/iframeStamper.js.map +1 -0
- package/dist/_esm/stampers/index.js +4 -0
- package/dist/_esm/stampers/index.js.map +1 -0
- package/dist/_esm/stampers/indexedDbStamper.js +20 -0
- package/dist/_esm/stampers/indexedDbStamper.js.map +1 -0
- package/dist/_esm/stampers/types.js +2 -0
- package/dist/_esm/stampers/types.js.map +1 -0
- package/dist/_esm/stampers/webauthnStamper.js +15 -0
- package/dist/_esm/stampers/webauthnStamper.js.map +1 -0
- package/dist/_esm/storage/adapters.js +15 -0
- package/dist/_esm/storage/adapters.js.map +1 -0
- package/dist/_esm/storage/manager.js +118 -0
- package/dist/_esm/storage/manager.js.map +1 -0
- package/dist/_esm/types/session.js +6 -0
- package/dist/_esm/types/session.js.map +1 -0
- package/dist/_esm/utils/buildClientSignature.js +64 -0
- package/dist/_esm/utils/buildClientSignature.js.map +1 -0
- package/dist/_esm/utils/derToRawSignature.js +89 -0
- package/dist/_esm/utils/derToRawSignature.js.map +1 -0
- package/dist/_esm/utils/exportPrivateKey.js +83 -0
- package/dist/_esm/utils/exportPrivateKey.js.map +1 -0
- package/dist/_esm/utils/exportWallet.js +98 -0
- package/dist/_esm/utils/exportWallet.js.map +1 -0
- package/dist/_esm/utils/utils.js +105 -0
- package/dist/_esm/utils/utils.js.map +1 -0
- package/dist/_types/actions/auth/authenticateWithEmail.d.ts +33 -0
- package/dist/_types/actions/auth/authenticateWithEmail.d.ts.map +1 -0
- package/dist/_types/actions/auth/authenticateWithOAuth.d.ts +38 -0
- package/dist/_types/actions/auth/authenticateWithOAuth.d.ts.map +1 -0
- package/dist/_types/actions/auth/getAuthProxyConfigId.d.ts +12 -0
- package/dist/_types/actions/auth/getAuthProxyConfigId.d.ts.map +1 -0
- package/dist/_types/actions/auth/getUserEmail.d.ts +32 -0
- package/dist/_types/actions/auth/getUserEmail.d.ts.map +1 -0
- package/dist/_types/actions/auth/getWhoami.d.ts +35 -0
- package/dist/_types/actions/auth/getWhoami.d.ts.map +1 -0
- package/dist/_types/actions/auth/index.d.ts +10 -0
- package/dist/_types/actions/auth/index.d.ts.map +1 -0
- package/dist/_types/actions/auth/loginWithOTP.d.ts +41 -0
- package/dist/_types/actions/auth/loginWithOTP.d.ts.map +1 -0
- package/dist/_types/actions/auth/loginWithStamp.d.ts +37 -0
- package/dist/_types/actions/auth/loginWithStamp.d.ts.map +1 -0
- package/dist/_types/actions/auth/registerWithOTP.d.ts +46 -0
- package/dist/_types/actions/auth/registerWithOTP.d.ts.map +1 -0
- package/dist/_types/actions/auth/registerWithPasskey.d.ts +53 -0
- package/dist/_types/actions/auth/registerWithPasskey.d.ts.map +1 -0
- package/dist/_types/actions/index.d.ts +3 -0
- package/dist/_types/actions/index.d.ts.map +1 -0
- package/dist/_types/actions/wallet/getUserWallet.d.ts +34 -0
- package/dist/_types/actions/wallet/getUserWallet.d.ts.map +1 -0
- package/dist/_types/actions/wallet/index.d.ts +4 -0
- package/dist/_types/actions/wallet/index.d.ts.map +1 -0
- package/dist/_types/actions/wallet/signRawPayload.d.ts +39 -0
- package/dist/_types/actions/wallet/signRawPayload.d.ts.map +1 -0
- package/dist/_types/actions/wallet/signTransaction.d.ts +35 -0
- package/dist/_types/actions/wallet/signTransaction.d.ts.map +1 -0
- package/dist/_types/adapters/viem.d.ts +10 -0
- package/dist/_types/adapters/viem.d.ts.map +1 -0
- package/dist/_types/client/authProxy.d.ts +36 -0
- package/dist/_types/client/authProxy.d.ts.map +1 -0
- package/dist/_types/client/createClient.d.ts +17 -0
- package/dist/_types/client/createClient.d.ts.map +1 -0
- package/dist/_types/client/decorators/client.d.ts +81 -0
- package/dist/_types/client/decorators/client.d.ts.map +1 -0
- package/dist/_types/client/index.d.ts +5 -0
- package/dist/_types/client/index.d.ts.map +1 -0
- package/dist/_types/client/transports/createTransport.d.ts +17 -0
- package/dist/_types/client/transports/createTransport.d.ts.map +1 -0
- package/dist/_types/client/transports/rest.d.ts +35 -0
- package/dist/_types/client/transports/rest.d.ts.map +1 -0
- package/dist/_types/client/types.d.ts +59 -0
- package/dist/_types/client/types.d.ts.map +1 -0
- package/dist/_types/constants.d.ts +6 -0
- package/dist/_types/constants.d.ts.map +1 -0
- package/dist/_types/core/createZeroDevWallet.d.ts +52 -0
- package/dist/_types/core/createZeroDevWallet.d.ts.map +1 -0
- package/dist/_types/errors/request.d.ts +12 -0
- package/dist/_types/errors/request.d.ts.map +1 -0
- package/dist/_types/index.d.ts +20 -0
- package/dist/_types/index.d.ts.map +1 -0
- package/dist/_types/polyfills/window.d.ts +15 -0
- package/dist/_types/polyfills/window.d.ts.map +1 -0
- package/dist/_types/stampers/iframeStamper.d.ts +7 -0
- package/dist/_types/stampers/iframeStamper.d.ts.map +1 -0
- package/dist/_types/stampers/index.d.ts +5 -0
- package/dist/_types/stampers/index.d.ts.map +1 -0
- package/dist/_types/stampers/indexedDbStamper.d.ts +3 -0
- package/dist/_types/stampers/indexedDbStamper.d.ts.map +1 -0
- package/dist/_types/stampers/types.d.ts +25 -0
- package/dist/_types/stampers/types.d.ts.map +1 -0
- package/dist/_types/stampers/webauthnStamper.d.ts +5 -0
- package/dist/_types/stampers/webauthnStamper.d.ts.map +1 -0
- package/dist/_types/storage/adapters.d.ts +3 -0
- package/dist/_types/storage/adapters.d.ts.map +1 -0
- package/dist/_types/storage/manager.d.ts +19 -0
- package/dist/_types/storage/manager.d.ts.map +1 -0
- package/dist/_types/types/session.d.ts +17 -0
- package/dist/_types/types/session.d.ts.map +1 -0
- package/dist/_types/utils/buildClientSignature.d.ts +25 -0
- package/dist/_types/utils/buildClientSignature.d.ts.map +1 -0
- package/dist/_types/utils/derToRawSignature.d.ts +11 -0
- package/dist/_types/utils/derToRawSignature.d.ts.map +1 -0
- package/dist/_types/utils/exportPrivateKey.d.ts +47 -0
- package/dist/_types/utils/exportPrivateKey.d.ts.map +1 -0
- package/dist/_types/utils/exportWallet.d.ts +44 -0
- package/dist/_types/utils/exportWallet.d.ts.map +1 -0
- package/dist/_types/utils/utils.d.ts +52 -0
- package/dist/_types/utils/utils.d.ts.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +74 -0
- package/src/actions/auth/authenticateWithEmail.ts +52 -0
- package/src/actions/auth/authenticateWithOAuth.ts +52 -0
- package/src/actions/auth/getAuthProxyConfigId.ts +20 -0
- package/src/actions/auth/getUserEmail.ts +52 -0
- package/src/actions/auth/getWhoami.ts +51 -0
- package/src/actions/auth/index.ts +47 -0
- package/src/actions/auth/loginWithOTP.ts +57 -0
- package/src/actions/auth/loginWithStamp.ts +79 -0
- package/src/actions/auth/registerWithOTP.ts +64 -0
- package/src/actions/auth/registerWithPasskey.ts +72 -0
- package/src/actions/index.ts +41 -0
- package/src/actions/wallet/getUserWallet.ts +53 -0
- package/src/actions/wallet/index.ts +17 -0
- package/src/actions/wallet/signRawPayload.ts +75 -0
- package/src/actions/wallet/signTransaction.ts +64 -0
- package/src/adapters/viem.ts +162 -0
- package/src/client/authProxy.ts +78 -0
- package/src/client/createClient.ts +90 -0
- package/src/client/decorators/client.ts +171 -0
- package/src/client/index.ts +19 -0
- package/src/client/transports/createTransport.ts +54 -0
- package/src/client/transports/rest.ts +138 -0
- package/src/client/types.ts +64 -0
- package/src/constants.ts +5 -0
- package/src/core/createZeroDevWallet.ts +447 -0
- package/src/errors/request.ts +36 -0
- package/src/index.ts +79 -0
- package/src/polyfills/window.ts +24 -0
- package/src/stampers/iframeStamper.ts +49 -0
- package/src/stampers/index.ts +8 -0
- package/src/stampers/indexedDbStamper.ts +22 -0
- package/src/stampers/types.ts +35 -0
- package/src/stampers/webauthnStamper.ts +21 -0
- package/src/storage/adapters.ts +20 -0
- package/src/storage/manager.ts +170 -0
- package/src/types/session.ts +18 -0
- package/src/utils/buildClientSignature.ts +86 -0
- package/src/utils/derToRawSignature.ts +103 -0
- package/src/utils/exportPrivateKey.ts +116 -0
- package/src/utils/exportWallet.ts +130 -0
- package/src/utils/utils.ts +136 -0
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zerodev/wallet-core",
|
|
3
|
+
"version": "0.0.1-alpha.10",
|
|
4
|
+
"description": "ZeroDev Wallet SDK built on Turnkey",
|
|
5
|
+
"main": "./dist/_cjs/index.js",
|
|
6
|
+
"module": "./dist/_esm/index.js",
|
|
7
|
+
"types": "./dist/_types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/_types/index.d.ts",
|
|
11
|
+
"import": "./dist/_esm/index.js",
|
|
12
|
+
"require": "./dist/_cjs/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./viem": {
|
|
15
|
+
"types": "./dist/_types/adapters/viem.d.ts",
|
|
16
|
+
"import": "./dist/_esm/adapters/viem.js",
|
|
17
|
+
"require": "./dist/_cjs/adapters/viem.js"
|
|
18
|
+
},
|
|
19
|
+
"./actions": {
|
|
20
|
+
"types": "./dist/_types/actions/index.d.ts",
|
|
21
|
+
"import": "./dist/_esm/actions/index.js",
|
|
22
|
+
"require": "./dist/_cjs/actions/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./stampers": {
|
|
25
|
+
"types": "./dist/_types/stampers/index.d.ts",
|
|
26
|
+
"import": "./dist/_esm/stampers/index.js",
|
|
27
|
+
"require": "./dist/_cjs/stampers/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"./src/**/*.ts",
|
|
33
|
+
"!dist/_esm/**/*.tsbuildinfo",
|
|
34
|
+
"!dist/_cjs/**/*.tsbuildinfo",
|
|
35
|
+
"!dist/_types/**/*.tsbuildinfo",
|
|
36
|
+
"!.env",
|
|
37
|
+
"!./**/*.test.ts",
|
|
38
|
+
"!.changeset"
|
|
39
|
+
],
|
|
40
|
+
"keywords": [
|
|
41
|
+
"wallet",
|
|
42
|
+
"offchainlabs",
|
|
43
|
+
"zerodev",
|
|
44
|
+
"wallet",
|
|
45
|
+
"signer",
|
|
46
|
+
"viem",
|
|
47
|
+
"account-abstraction",
|
|
48
|
+
"eip7702"
|
|
49
|
+
],
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"@turnkey/http": "^3.12.1",
|
|
53
|
+
"@turnkey/iframe-stamper": "^2.5.0",
|
|
54
|
+
"@turnkey/indexed-db-stamper": "^1.1.1",
|
|
55
|
+
"@turnkey/webauthn-stamper": "^0.6.0",
|
|
56
|
+
"json-canonicalize": "^2.0.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"viem": "^2.38.0"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@types/node": "^20.0.0",
|
|
63
|
+
"typescript": "5.9.3"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "pnpm run clean && pnpm run build:cjs && pnpm run build:esm && pnpm run build:types",
|
|
67
|
+
"build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --moduleResolution node --outDir ./dist/_cjs --removeComments --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./dist/_cjs/package.json",
|
|
68
|
+
"build:esm": "tsc --project ./tsconfig.build.json --outDir ./dist/_esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./dist/_esm/package.json",
|
|
69
|
+
"build:types": "tsc --project ./tsconfig.build.json --outDir ./dist/_types --emitDeclarationOnly --declaration --declarationMap",
|
|
70
|
+
"dev": "tsc --watch",
|
|
71
|
+
"typecheck": "tsc --noEmit --project ./tsconfig.build.json",
|
|
72
|
+
"clean": "rm -rf dist"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js'
|
|
2
|
+
|
|
3
|
+
export type EmailCustomization = {
|
|
4
|
+
/** A template for the URL to be used in a magic link button, e.g. `https://dapp.xyz/%s`. The auth bundle will be interpolated into the `%s`. */
|
|
5
|
+
magicLinkTemplate?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type AuthenticateWithEmailParameters = {
|
|
9
|
+
/** The email address to authenticate */
|
|
10
|
+
email: string
|
|
11
|
+
/** The project ID for the request */
|
|
12
|
+
projectId: string
|
|
13
|
+
/** Target public key for authentication */
|
|
14
|
+
targetPublicKey: string
|
|
15
|
+
/** Optional email customization settings */
|
|
16
|
+
emailCustomization?: EmailCustomization
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type AuthenticateWithEmailReturnType = {
|
|
20
|
+
/** The user ID */
|
|
21
|
+
userId?: string
|
|
22
|
+
/** The wallet address */
|
|
23
|
+
walletAddress?: string
|
|
24
|
+
/** The sub-organization ID */
|
|
25
|
+
subOrganizationId?: string
|
|
26
|
+
/** Whether magic link is required */
|
|
27
|
+
requiresMagicLink?: boolean
|
|
28
|
+
/** The Turnkey session if available */
|
|
29
|
+
turnkeySession?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use {@link registerWithOTP} instead
|
|
34
|
+
* See {@link registerWithOTP} for more details on how to authenticate with email.
|
|
35
|
+
*/
|
|
36
|
+
export async function authenticateWithEmail(
|
|
37
|
+
client: Client,
|
|
38
|
+
params: AuthenticateWithEmailParameters,
|
|
39
|
+
): Promise<AuthenticateWithEmailReturnType> {
|
|
40
|
+
const { email, projectId, targetPublicKey, emailCustomization } = params
|
|
41
|
+
|
|
42
|
+
return await client.request({
|
|
43
|
+
path: `${projectId}/auth/email-magic`,
|
|
44
|
+
method: 'POST',
|
|
45
|
+
body: {
|
|
46
|
+
email,
|
|
47
|
+
emailCustomization,
|
|
48
|
+
targetPublicKey,
|
|
49
|
+
projectId,
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js'
|
|
2
|
+
|
|
3
|
+
export type AuthenticateWithOAuthParameters = {
|
|
4
|
+
/** The OAuth provider (e.g., 'google') */
|
|
5
|
+
provider: string
|
|
6
|
+
/** The project ID for the request */
|
|
7
|
+
projectId: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type AuthenticateWithOAuthReturnType = {
|
|
11
|
+
/** The user ID */
|
|
12
|
+
userId?: string
|
|
13
|
+
/** The wallet address */
|
|
14
|
+
walletAddress?: string
|
|
15
|
+
/** The sub-organization ID */
|
|
16
|
+
subOrganizationId?: string
|
|
17
|
+
/** The Turnkey session */
|
|
18
|
+
session?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Authenticates a user with OAuth using cookie-based backend flow
|
|
23
|
+
*
|
|
24
|
+
* The backend reads the OAuth session from a cookie set during the OAuth flow.
|
|
25
|
+
* This requires the OAuth popup flow to complete first via the backend's
|
|
26
|
+
* /oauth/google/login endpoint.
|
|
27
|
+
*
|
|
28
|
+
* @param client - The ZeroDev Wallet client
|
|
29
|
+
* @param params - The parameters for OAuth authentication
|
|
30
|
+
* @returns The authentication result
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const result = await authenticateWithOAuth(client, {
|
|
35
|
+
* provider: 'google',
|
|
36
|
+
* projectId: 'proj_456',
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export async function authenticateWithOAuth(
|
|
41
|
+
client: Client,
|
|
42
|
+
params: AuthenticateWithOAuthParameters,
|
|
43
|
+
): Promise<AuthenticateWithOAuthReturnType> {
|
|
44
|
+
const { projectId } = params
|
|
45
|
+
|
|
46
|
+
return await client.request({
|
|
47
|
+
path: `${projectId}/auth/oauth`,
|
|
48
|
+
method: 'POST',
|
|
49
|
+
body: null,
|
|
50
|
+
credentials: 'include',
|
|
51
|
+
})
|
|
52
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js'
|
|
2
|
+
|
|
3
|
+
export type GetAuthProxyConfigIdReturnType = {
|
|
4
|
+
authProxyConfigId: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Fetches the auth proxy config ID from the backend
|
|
9
|
+
*
|
|
10
|
+
* @param client - The ZeroDev Wallet client
|
|
11
|
+
* @returns The auth proxy config ID
|
|
12
|
+
*/
|
|
13
|
+
export async function getAuthProxyConfigId(
|
|
14
|
+
client: Client,
|
|
15
|
+
): Promise<GetAuthProxyConfigIdReturnType> {
|
|
16
|
+
return await client.request({
|
|
17
|
+
path: 'server-info/auth-proxy-id',
|
|
18
|
+
method: 'GET',
|
|
19
|
+
})
|
|
20
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js'
|
|
2
|
+
|
|
3
|
+
export type GetUserEmailParameters = {
|
|
4
|
+
/** The organization ID to query */
|
|
5
|
+
organizationId: string
|
|
6
|
+
/** The project ID for the request */
|
|
7
|
+
projectId: string
|
|
8
|
+
/** The session token for authorization */
|
|
9
|
+
token: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type GetUserEmailReturnType = {
|
|
13
|
+
/** The user's email address */
|
|
14
|
+
email: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Gets the user's email address
|
|
19
|
+
*
|
|
20
|
+
* @param client - The ZeroDev Wallet client
|
|
21
|
+
* @param params - The parameters for the user email request
|
|
22
|
+
* @returns The user's email address
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const userEmail = await getUserEmail(client, {
|
|
27
|
+
* organizationId: 'org_123',
|
|
28
|
+
* projectId: 'proj_456',
|
|
29
|
+
* token: 'session_token_abc',
|
|
30
|
+
* });
|
|
31
|
+
* console.log(userEmail.email); // 'user@example.com'
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export async function getUserEmail(
|
|
35
|
+
client: Client,
|
|
36
|
+
params: GetUserEmailParameters,
|
|
37
|
+
): Promise<GetUserEmailReturnType> {
|
|
38
|
+
const { organizationId, projectId, token } = params
|
|
39
|
+
|
|
40
|
+
return await client.request({
|
|
41
|
+
path: `${projectId}/user-email`,
|
|
42
|
+
method: 'POST',
|
|
43
|
+
body: {
|
|
44
|
+
organizationId,
|
|
45
|
+
},
|
|
46
|
+
headers: {
|
|
47
|
+
Authorization: `Bearer ${token}`,
|
|
48
|
+
},
|
|
49
|
+
stamp: true,
|
|
50
|
+
stampPostion: 'headers',
|
|
51
|
+
})
|
|
52
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js'
|
|
2
|
+
|
|
3
|
+
export type GetWhoamiParameters = {
|
|
4
|
+
/** The organization ID to query */
|
|
5
|
+
organizationId: string
|
|
6
|
+
/** The project ID for the request */
|
|
7
|
+
projectId: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type GetWhoamiReturnType = {
|
|
11
|
+
/** The user's ID */
|
|
12
|
+
userId: string
|
|
13
|
+
/** The organization ID */
|
|
14
|
+
organizationId: string
|
|
15
|
+
/** The organization name */
|
|
16
|
+
organizationName?: string
|
|
17
|
+
/** The username */
|
|
18
|
+
username?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Gets the current user information
|
|
23
|
+
*
|
|
24
|
+
* @param client - The ZeroDev Wallet client
|
|
25
|
+
* @param params - The parameters for the whoami request
|
|
26
|
+
* @returns The user information
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const userInfo = await getWhoami(client, {
|
|
31
|
+
* organizationId: 'org_123',
|
|
32
|
+
* projectId: 'proj_456'
|
|
33
|
+
* });
|
|
34
|
+
* console.log(userInfo.userId); // 'user_789'
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export async function getWhoami(
|
|
38
|
+
client: Client,
|
|
39
|
+
params: GetWhoamiParameters,
|
|
40
|
+
): Promise<GetWhoamiReturnType> {
|
|
41
|
+
const { organizationId, projectId } = params
|
|
42
|
+
|
|
43
|
+
return await client.request({
|
|
44
|
+
path: `${projectId}/whoami`,
|
|
45
|
+
method: 'POST',
|
|
46
|
+
body: {
|
|
47
|
+
organizationId,
|
|
48
|
+
},
|
|
49
|
+
stamp: true,
|
|
50
|
+
})
|
|
51
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export {
|
|
2
|
+
type AuthenticateWithEmailParameters,
|
|
3
|
+
type AuthenticateWithEmailReturnType,
|
|
4
|
+
authenticateWithEmail,
|
|
5
|
+
type EmailCustomization,
|
|
6
|
+
} from './authenticateWithEmail.js'
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
type AuthenticateWithOAuthParameters,
|
|
10
|
+
type AuthenticateWithOAuthReturnType,
|
|
11
|
+
authenticateWithOAuth,
|
|
12
|
+
} from './authenticateWithOAuth.js'
|
|
13
|
+
export {
|
|
14
|
+
type GetAuthProxyConfigIdReturnType,
|
|
15
|
+
getAuthProxyConfigId,
|
|
16
|
+
} from './getAuthProxyConfigId.js'
|
|
17
|
+
export {
|
|
18
|
+
type GetUserEmailParameters,
|
|
19
|
+
type GetUserEmailReturnType,
|
|
20
|
+
getUserEmail,
|
|
21
|
+
} from './getUserEmail.js'
|
|
22
|
+
export {
|
|
23
|
+
type GetWhoamiParameters,
|
|
24
|
+
type GetWhoamiReturnType,
|
|
25
|
+
getWhoami,
|
|
26
|
+
} from './getWhoami.js'
|
|
27
|
+
export {
|
|
28
|
+
type LoginWithOTPParameters,
|
|
29
|
+
type LoginWithOTPReturnType,
|
|
30
|
+
loginWithOTP,
|
|
31
|
+
} from './loginWithOTP.js'
|
|
32
|
+
export {
|
|
33
|
+
type LoginWithStampParameters,
|
|
34
|
+
type LoginWithStampReturnType,
|
|
35
|
+
loginWithStamp,
|
|
36
|
+
} from './loginWithStamp.js'
|
|
37
|
+
export {
|
|
38
|
+
type OtpContact,
|
|
39
|
+
type RegisterWithOTPParameters,
|
|
40
|
+
type RegisterWithOTPReturnType,
|
|
41
|
+
registerWithOTP,
|
|
42
|
+
} from './registerWithOTP.js'
|
|
43
|
+
export {
|
|
44
|
+
type RegisterWithPasskeyParameters,
|
|
45
|
+
type RegisterWithPasskeyReturnType,
|
|
46
|
+
registerWithPasskey,
|
|
47
|
+
} from './registerWithPasskey.js'
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js'
|
|
2
|
+
|
|
3
|
+
export type LoginWithOTPParameters = {
|
|
4
|
+
/** The verification token JWT from Auth Proxy's verifyOtp */
|
|
5
|
+
verificationToken: string
|
|
6
|
+
/** The raw r||s signature hex (64 bytes = 128 chars) */
|
|
7
|
+
clientSignature: string
|
|
8
|
+
/** The project ID for the request */
|
|
9
|
+
projectId: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type LoginWithOTPReturnType = {
|
|
13
|
+
/** The Turnkey session token */
|
|
14
|
+
session: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Logs in a user with OTP (One-Time Password) authentication via the backend.
|
|
19
|
+
*
|
|
20
|
+
* The backend handles:
|
|
21
|
+
* 1. Parsing the verificationToken JWT to extract email and publicKey
|
|
22
|
+
* 2. Creating/retrieving sub-organization for (projectId, email)
|
|
23
|
+
* 3. Reconstructing the message for signature verification
|
|
24
|
+
* 4. Calling Turnkey.OtpLogin with the appropriate parameters
|
|
25
|
+
* 5. Returning the session to the SDK
|
|
26
|
+
*
|
|
27
|
+
* @param client - The ZeroDev Wallet client
|
|
28
|
+
* @param params - The parameters for OTP login
|
|
29
|
+
* @returns The login result with session token
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* // After verifying OTP via Auth Proxy and building client signature
|
|
34
|
+
* const result = await loginWithOTP(client, {
|
|
35
|
+
* verificationToken: '<jwt-from-auth-proxy>',
|
|
36
|
+
* clientSignature: '<raw-signature-hex>',
|
|
37
|
+
* projectId: 'proj_456'
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Use result.session for authenticated requests
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export async function loginWithOTP(
|
|
44
|
+
client: Client,
|
|
45
|
+
params: LoginWithOTPParameters,
|
|
46
|
+
): Promise<LoginWithOTPReturnType> {
|
|
47
|
+
const { verificationToken, clientSignature, projectId } = params
|
|
48
|
+
|
|
49
|
+
return await client.request({
|
|
50
|
+
path: `${projectId}/auth/login/otp`,
|
|
51
|
+
method: 'POST',
|
|
52
|
+
body: {
|
|
53
|
+
verificationToken,
|
|
54
|
+
clientSignature,
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { canonicalizeEx } from 'json-canonicalize'
|
|
2
|
+
import type { Client } from '../../client/types.js'
|
|
3
|
+
import type { Stamp } from '../../stampers/types.js'
|
|
4
|
+
|
|
5
|
+
export type EmailCustomization = {
|
|
6
|
+
/** A template for the URL to be used in a magic link button, e.g. `https://dapp.xyz/%s`. The auth bundle will be interpolated into the `%s`. */
|
|
7
|
+
magicLinkTemplate?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type LoginWithStampParameters = {
|
|
11
|
+
/** The project ID for the request */
|
|
12
|
+
projectId: string
|
|
13
|
+
/** The organization ID for the request */
|
|
14
|
+
organizationId: string
|
|
15
|
+
/** The encoded public key for the request */
|
|
16
|
+
targetPublicKey: string
|
|
17
|
+
/** The stamper type for the request */
|
|
18
|
+
stampWith?: 'indexedDb' | 'webauthn'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type LoginWithStampReturnType = {
|
|
22
|
+
/** The session */
|
|
23
|
+
session: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Logs in a user with a stamp
|
|
28
|
+
*
|
|
29
|
+
* @param client - The ZeroDev Wallet client
|
|
30
|
+
* @param params - The parameters for login with a stamp
|
|
31
|
+
* @returns The login result
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const result = await loginWithStamp(client, {
|
|
36
|
+
* organizationId: 'org_456',
|
|
37
|
+
* projectId: 'proj_456',
|
|
38
|
+
* targetPublicKey: 'encodedPublicKey',
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export async function loginWithStamp(
|
|
43
|
+
client: Client,
|
|
44
|
+
params: LoginWithStampParameters,
|
|
45
|
+
): Promise<LoginWithStampReturnType> {
|
|
46
|
+
const { projectId, targetPublicKey, organizationId, stampWith } = params
|
|
47
|
+
|
|
48
|
+
const timestampMs = Date.now()
|
|
49
|
+
const timestampMsString = timestampMs.toString()
|
|
50
|
+
const timestampIso = new Date(timestampMs).toISOString()
|
|
51
|
+
|
|
52
|
+
const stampPayload = canonicalizeEx({
|
|
53
|
+
organizationId,
|
|
54
|
+
parameters: {
|
|
55
|
+
publicKey: targetPublicKey,
|
|
56
|
+
},
|
|
57
|
+
timestampMs: timestampMsString,
|
|
58
|
+
type: 'ACTIVITY_TYPE_STAMP_LOGIN',
|
|
59
|
+
})
|
|
60
|
+
let stamp: Stamp
|
|
61
|
+
if (stampWith === 'indexedDb') {
|
|
62
|
+
stamp = await client.indexedDbStamper.stamp(stampPayload)
|
|
63
|
+
} else if (stampWith === 'webauthn') {
|
|
64
|
+
stamp = await client.webauthnStamper.stamp(stampPayload)
|
|
65
|
+
} else {
|
|
66
|
+
stamp = await client.indexedDbStamper.stamp(stampPayload)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return client.request({
|
|
70
|
+
path: `${projectId}/auth/login/stamp`,
|
|
71
|
+
method: 'POST',
|
|
72
|
+
body: {
|
|
73
|
+
subOrganizationId: organizationId,
|
|
74
|
+
targetPublicKey,
|
|
75
|
+
timestamp: timestampIso,
|
|
76
|
+
stamp,
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js'
|
|
2
|
+
import type { EmailCustomization } from './authenticateWithEmail.js'
|
|
3
|
+
|
|
4
|
+
export type OtpContact = {
|
|
5
|
+
/** The OTP delivery type (currently only 'email' is supported) */
|
|
6
|
+
type: 'email' | 'sms'
|
|
7
|
+
/** The contact information (email address or phone number) */
|
|
8
|
+
contact: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type RegisterWithOTPParameters = {
|
|
12
|
+
/** The email address to register */
|
|
13
|
+
email: string
|
|
14
|
+
/** The contact information for OTP delivery */
|
|
15
|
+
contact: OtpContact
|
|
16
|
+
/** The project ID for the request */
|
|
17
|
+
projectId: string
|
|
18
|
+
/** Optional email customization settings */
|
|
19
|
+
emailCustomization?: EmailCustomization
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type RegisterWithOTPReturnType = {
|
|
23
|
+
/** The OTP ID needed for verification */
|
|
24
|
+
otpId: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Initiates OTP (One-Time Password) authentication
|
|
29
|
+
* This will send an OTP code to the specified contact method
|
|
30
|
+
*
|
|
31
|
+
* @param client - The ZeroDev Wallet client
|
|
32
|
+
* @param params - The parameters for OTP initiation
|
|
33
|
+
* @returns The result including otpId needed for verification
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const result = await registerWithOTP(client, {
|
|
38
|
+
* email: 'user@example.com',
|
|
39
|
+
* contact: {
|
|
40
|
+
* type: 'email',
|
|
41
|
+
* contact: 'user@example.com'
|
|
42
|
+
* },
|
|
43
|
+
* projectId: 'proj_456'
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* // Use result.otpId for the verification step
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export async function registerWithOTP(
|
|
50
|
+
client: Client,
|
|
51
|
+
params: RegisterWithOTPParameters,
|
|
52
|
+
): Promise<RegisterWithOTPReturnType> {
|
|
53
|
+
const { email, contact, projectId, emailCustomization } = params
|
|
54
|
+
|
|
55
|
+
return await client.request({
|
|
56
|
+
path: `${projectId}/auth/init/otp`,
|
|
57
|
+
method: 'POST',
|
|
58
|
+
body: {
|
|
59
|
+
email,
|
|
60
|
+
contact,
|
|
61
|
+
emailCustomization,
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js'
|
|
2
|
+
|
|
3
|
+
export type EmailCustomization = {
|
|
4
|
+
/** A template for the URL to be used in a magic link button, e.g. `https://dapp.xyz/%s`. The auth bundle will be interpolated into the `%s`. */
|
|
5
|
+
magicLinkTemplate?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type RegisterWithPasskeyParameters = {
|
|
9
|
+
/** The email address to authenticate */
|
|
10
|
+
email: string
|
|
11
|
+
/** The project ID for the request */
|
|
12
|
+
projectId: string
|
|
13
|
+
/** The challenge for the request */
|
|
14
|
+
challenge: string
|
|
15
|
+
/** The attestation for the request */
|
|
16
|
+
attestation: {
|
|
17
|
+
attestationObject: string
|
|
18
|
+
clientDataJson: string
|
|
19
|
+
credentialId: string
|
|
20
|
+
}
|
|
21
|
+
/** The encoded public key for the request */
|
|
22
|
+
encodedPublicKey: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type RegisterWithPasskeyReturnType = {
|
|
26
|
+
/** The user ID */
|
|
27
|
+
userId: string
|
|
28
|
+
/** The wallet address */
|
|
29
|
+
walletAddress: string
|
|
30
|
+
/** The sub-organization ID */
|
|
31
|
+
subOrganizationId: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Registers a passkey with the user's wallet
|
|
36
|
+
*
|
|
37
|
+
* @param client - The ZeroDev Wallet client
|
|
38
|
+
* @param params - The parameters for passkey registration
|
|
39
|
+
* @returns The passkey registration result
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const result = await registerWithPasskey(client, {
|
|
44
|
+
* email: 'user@example.com',
|
|
45
|
+
* projectId: 'proj_456',
|
|
46
|
+
* challenge: 'challenge',
|
|
47
|
+
* attestation: {
|
|
48
|
+
* attestationObject: 'attestationObject',
|
|
49
|
+
* clientDataJson: 'clientDataJson',
|
|
50
|
+
* credentialId: 'credentialId'
|
|
51
|
+
* },
|
|
52
|
+
* encodedPublicKey: 'encodedPublicKey'
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export async function registerWithPasskey(
|
|
57
|
+
client: Client,
|
|
58
|
+
params: RegisterWithPasskeyParameters,
|
|
59
|
+
): Promise<RegisterWithPasskeyReturnType> {
|
|
60
|
+
const { email, projectId, challenge, attestation, encodedPublicKey } = params
|
|
61
|
+
|
|
62
|
+
return client.request({
|
|
63
|
+
path: `${projectId}/auth/register/passkey`,
|
|
64
|
+
method: 'POST',
|
|
65
|
+
body: {
|
|
66
|
+
email,
|
|
67
|
+
attestation,
|
|
68
|
+
challenge,
|
|
69
|
+
encodedPublicKey,
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Auth actions
|
|
2
|
+
export {
|
|
3
|
+
type AuthenticateWithEmailParameters,
|
|
4
|
+
type AuthenticateWithEmailReturnType,
|
|
5
|
+
type AuthenticateWithOAuthParameters,
|
|
6
|
+
type AuthenticateWithOAuthReturnType,
|
|
7
|
+
authenticateWithEmail,
|
|
8
|
+
authenticateWithOAuth,
|
|
9
|
+
type EmailCustomization,
|
|
10
|
+
type GetAuthProxyConfigIdReturnType,
|
|
11
|
+
type GetUserEmailParameters,
|
|
12
|
+
type GetUserEmailReturnType,
|
|
13
|
+
type GetWhoamiParameters,
|
|
14
|
+
type GetWhoamiReturnType,
|
|
15
|
+
getAuthProxyConfigId,
|
|
16
|
+
getUserEmail,
|
|
17
|
+
getWhoami,
|
|
18
|
+
type LoginWithOTPParameters,
|
|
19
|
+
type LoginWithOTPReturnType,
|
|
20
|
+
loginWithOTP,
|
|
21
|
+
type OtpContact,
|
|
22
|
+
type RegisterWithOTPParameters,
|
|
23
|
+
type RegisterWithOTPReturnType,
|
|
24
|
+
type RegisterWithPasskeyParameters,
|
|
25
|
+
type RegisterWithPasskeyReturnType,
|
|
26
|
+
registerWithOTP,
|
|
27
|
+
registerWithPasskey,
|
|
28
|
+
} from './auth/index.js'
|
|
29
|
+
|
|
30
|
+
// Wallet actions
|
|
31
|
+
export {
|
|
32
|
+
type GetUserWalletParameters,
|
|
33
|
+
type GetUserWalletReturnType,
|
|
34
|
+
getUserWallet,
|
|
35
|
+
type SignRawPayloadParameters,
|
|
36
|
+
type SignRawPayloadReturnType,
|
|
37
|
+
type SignTransactionParameters,
|
|
38
|
+
type SignTransactionReturnType,
|
|
39
|
+
signRawPayload,
|
|
40
|
+
signTransaction,
|
|
41
|
+
} from './wallet/index.js'
|