@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
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses a session from a JWT.
|
|
3
|
+
*
|
|
4
|
+
* @param token - The JWT to parse.
|
|
5
|
+
* @returns {PartialBy<ZeroDevWalletSession, "createdAt" | "id" | "stamperType">} - The parsed session.
|
|
6
|
+
*/
|
|
7
|
+
export function parseSession(token) {
|
|
8
|
+
if (typeof token !== 'string') {
|
|
9
|
+
return token;
|
|
10
|
+
}
|
|
11
|
+
const [, payload] = token.split('.');
|
|
12
|
+
if (!payload) {
|
|
13
|
+
throw new Error('Invalid JWT: Missing payload');
|
|
14
|
+
}
|
|
15
|
+
const decoded = JSON.parse(Buffer.from(payload, 'base64').toString());
|
|
16
|
+
const { exp, public_key: publicKey, session_type: sessionType, user_id: userId, organization_id: organizationId, } = decoded;
|
|
17
|
+
if (!exp || !publicKey || !sessionType || !userId || !organizationId) {
|
|
18
|
+
throw new Error('JWT payload missing required fields');
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
sessionType,
|
|
22
|
+
userId,
|
|
23
|
+
organizationId,
|
|
24
|
+
expiry: exp,
|
|
25
|
+
token: publicKey,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Normalizes a timestamp to milliseconds.
|
|
30
|
+
*
|
|
31
|
+
* @param timestamp - The timestamp to normalize.
|
|
32
|
+
* @returns {number} - The normalized timestamp.
|
|
33
|
+
*/
|
|
34
|
+
export function normalizeTimestamp(timestamp) {
|
|
35
|
+
return timestamp < 1e10 ? timestamp * 1_000 : timestamp;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Generates a random buffer of 32 bytes.
|
|
39
|
+
*
|
|
40
|
+
* @returns {ArrayBuffer} - The random buffer.
|
|
41
|
+
*/
|
|
42
|
+
export const generateRandomBuffer = () => {
|
|
43
|
+
const arr = new Uint8Array(32);
|
|
44
|
+
crypto.getRandomValues(arr);
|
|
45
|
+
return arr.buffer;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Encodes a challenge in base64url format.
|
|
49
|
+
*
|
|
50
|
+
* @param challenge - The challenge to encode.
|
|
51
|
+
* @returns {string} - The encoded challenge.
|
|
52
|
+
*/
|
|
53
|
+
export const base64UrlEncode = (challenge) => {
|
|
54
|
+
return Buffer.from(challenge)
|
|
55
|
+
.toString('base64')
|
|
56
|
+
.replace(/\+/g, '-')
|
|
57
|
+
.replace(/\//g, '_')
|
|
58
|
+
.replace(/=/g, '');
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Compresses an uncompressed P-256 public key into its 33-byte compressed form.
|
|
62
|
+
*
|
|
63
|
+
* @param {Uint8Array} raw - The uncompressed public key (65 bytes, starting with 0x04).
|
|
64
|
+
* @returns {Uint8Array} - The compressed public key (33 bytes, starting with 0x02 or 0x03).
|
|
65
|
+
* @throws {Error} - If the input key is not a valid uncompressed P-256 key.
|
|
66
|
+
*/
|
|
67
|
+
export function pointEncode(raw) {
|
|
68
|
+
if (raw.length !== 65 || raw[0] !== 0x04) {
|
|
69
|
+
throw new Error('Invalid uncompressed P-256 key');
|
|
70
|
+
}
|
|
71
|
+
const x = raw.slice(1, 33);
|
|
72
|
+
const y = raw.slice(33, 65);
|
|
73
|
+
if (x.length !== 32 || y.length !== 32) {
|
|
74
|
+
throw new Error('Invalid x or y length');
|
|
75
|
+
}
|
|
76
|
+
const prefix = (y[31] & 1) === 0 ? 0x02 : 0x03;
|
|
77
|
+
const compressed = new Uint8Array(33);
|
|
78
|
+
compressed[0] = prefix;
|
|
79
|
+
compressed.set(x, 1);
|
|
80
|
+
return compressed;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Converts a Uint8Array into a lowercase hex string.
|
|
84
|
+
*
|
|
85
|
+
* @param {Uint8Array} input - The input byte array.
|
|
86
|
+
* @returns {string} - The resulting hex string.
|
|
87
|
+
*/
|
|
88
|
+
export function uint8ArrayToHexString(input) {
|
|
89
|
+
return input.reduce((result, x) => result + x.toString(16).padStart(2, '0'), '');
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Generates a compressed public key from a key pair.
|
|
93
|
+
*
|
|
94
|
+
* @returns {Promise<string>} - The compressed public key.
|
|
95
|
+
*/
|
|
96
|
+
export async function generateCompressedPublicKeyFromKeyPair(keyPair) {
|
|
97
|
+
const rawPubKey = new Uint8Array(await crypto.subtle.exportKey('raw', keyPair.publicKey));
|
|
98
|
+
const compressedPubKey = pointEncode(rawPubKey);
|
|
99
|
+
const compressedHex = uint8ArrayToHexString(compressedPubKey);
|
|
100
|
+
return compressedHex;
|
|
101
|
+
}
|
|
102
|
+
export const humanReadableDateTime = () => {
|
|
103
|
+
return new Date().toLocaleString().replaceAll('/', '-').replaceAll(':', '.');
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/utils/utils.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js';
|
|
2
|
+
export type EmailCustomization = {
|
|
3
|
+
/** 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`. */
|
|
4
|
+
magicLinkTemplate?: string;
|
|
5
|
+
};
|
|
6
|
+
export type AuthenticateWithEmailParameters = {
|
|
7
|
+
/** The email address to authenticate */
|
|
8
|
+
email: string;
|
|
9
|
+
/** The project ID for the request */
|
|
10
|
+
projectId: string;
|
|
11
|
+
/** Target public key for authentication */
|
|
12
|
+
targetPublicKey: string;
|
|
13
|
+
/** Optional email customization settings */
|
|
14
|
+
emailCustomization?: EmailCustomization;
|
|
15
|
+
};
|
|
16
|
+
export type AuthenticateWithEmailReturnType = {
|
|
17
|
+
/** The user ID */
|
|
18
|
+
userId?: string;
|
|
19
|
+
/** The wallet address */
|
|
20
|
+
walletAddress?: string;
|
|
21
|
+
/** The sub-organization ID */
|
|
22
|
+
subOrganizationId?: string;
|
|
23
|
+
/** Whether magic link is required */
|
|
24
|
+
requiresMagicLink?: boolean;
|
|
25
|
+
/** The Turnkey session if available */
|
|
26
|
+
turnkeySession?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use {@link registerWithOTP} instead
|
|
30
|
+
* See {@link registerWithOTP} for more details on how to authenticate with email.
|
|
31
|
+
*/
|
|
32
|
+
export declare function authenticateWithEmail(client: Client, params: AuthenticateWithEmailParameters): Promise<AuthenticateWithEmailReturnType>;
|
|
33
|
+
//# sourceMappingURL=authenticateWithEmail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticateWithEmail.d.ts","sourceRoot":"","sources":["../../../../src/actions/auth/authenticateWithEmail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gJAAgJ;IAChJ,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,2CAA2C;IAC3C,eAAe,EAAE,MAAM,CAAA;IACvB,4CAA4C;IAC5C,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,yBAAyB;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,8BAA8B;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,qCAAqC;IACrC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,uCAAuC;IACvC,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,+BAA+B,CAAC,CAa1C"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js';
|
|
2
|
+
export type AuthenticateWithOAuthParameters = {
|
|
3
|
+
/** The OAuth provider (e.g., 'google') */
|
|
4
|
+
provider: string;
|
|
5
|
+
/** The project ID for the request */
|
|
6
|
+
projectId: string;
|
|
7
|
+
};
|
|
8
|
+
export type AuthenticateWithOAuthReturnType = {
|
|
9
|
+
/** The user ID */
|
|
10
|
+
userId?: string;
|
|
11
|
+
/** The wallet address */
|
|
12
|
+
walletAddress?: string;
|
|
13
|
+
/** The sub-organization ID */
|
|
14
|
+
subOrganizationId?: string;
|
|
15
|
+
/** The Turnkey session */
|
|
16
|
+
session?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Authenticates a user with OAuth using cookie-based backend flow
|
|
20
|
+
*
|
|
21
|
+
* The backend reads the OAuth session from a cookie set during the OAuth flow.
|
|
22
|
+
* This requires the OAuth popup flow to complete first via the backend's
|
|
23
|
+
* /oauth/google/login endpoint.
|
|
24
|
+
*
|
|
25
|
+
* @param client - The ZeroDev Wallet client
|
|
26
|
+
* @param params - The parameters for OAuth authentication
|
|
27
|
+
* @returns The authentication result
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const result = await authenticateWithOAuth(client, {
|
|
32
|
+
* provider: 'google',
|
|
33
|
+
* projectId: 'proj_456',
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function authenticateWithOAuth(client: Client, params: AuthenticateWithOAuthParameters): Promise<AuthenticateWithOAuthReturnType>;
|
|
38
|
+
//# sourceMappingURL=authenticateWithOAuth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticateWithOAuth.d.ts","sourceRoot":"","sources":["../../../../src/actions/auth/authenticateWithOAuth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAA;IAChB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,yBAAyB;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,8BAA8B;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,+BAA+B,GACtC,OAAO,CAAC,+BAA+B,CAAC,CAS1C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js';
|
|
2
|
+
export type GetAuthProxyConfigIdReturnType = {
|
|
3
|
+
authProxyConfigId: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Fetches the auth proxy config ID from the backend
|
|
7
|
+
*
|
|
8
|
+
* @param client - The ZeroDev Wallet client
|
|
9
|
+
* @returns The auth proxy config ID
|
|
10
|
+
*/
|
|
11
|
+
export declare function getAuthProxyConfigId(client: Client): Promise<GetAuthProxyConfigIdReturnType>;
|
|
12
|
+
//# sourceMappingURL=getAuthProxyConfigId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAuthProxyConfigId.d.ts","sourceRoot":"","sources":["../../../../src/actions/auth/getAuthProxyConfigId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,MAAM,8BAA8B,GAAG;IAC3C,iBAAiB,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,8BAA8B,CAAC,CAKzC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js';
|
|
2
|
+
export type GetUserEmailParameters = {
|
|
3
|
+
/** The organization ID to query */
|
|
4
|
+
organizationId: string;
|
|
5
|
+
/** The project ID for the request */
|
|
6
|
+
projectId: string;
|
|
7
|
+
/** The session token for authorization */
|
|
8
|
+
token: string;
|
|
9
|
+
};
|
|
10
|
+
export type GetUserEmailReturnType = {
|
|
11
|
+
/** The user's email address */
|
|
12
|
+
email: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Gets the user's email address
|
|
16
|
+
*
|
|
17
|
+
* @param client - The ZeroDev Wallet client
|
|
18
|
+
* @param params - The parameters for the user email request
|
|
19
|
+
* @returns The user's email address
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const userEmail = await getUserEmail(client, {
|
|
24
|
+
* organizationId: 'org_123',
|
|
25
|
+
* projectId: 'proj_456',
|
|
26
|
+
* token: 'session_token_abc',
|
|
27
|
+
* });
|
|
28
|
+
* console.log(userEmail.email); // 'user@example.com'
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function getUserEmail(client: Client, params: GetUserEmailParameters): Promise<GetUserEmailReturnType>;
|
|
32
|
+
//# sourceMappingURL=getUserEmail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserEmail.d.ts","sourceRoot":"","sources":["../../../../src/actions/auth/getUserEmail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,MAAM,sBAAsB,GAAG;IACnC,mCAAmC;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CAejC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js';
|
|
2
|
+
export type GetWhoamiParameters = {
|
|
3
|
+
/** The organization ID to query */
|
|
4
|
+
organizationId: string;
|
|
5
|
+
/** The project ID for the request */
|
|
6
|
+
projectId: string;
|
|
7
|
+
};
|
|
8
|
+
export type GetWhoamiReturnType = {
|
|
9
|
+
/** The user's ID */
|
|
10
|
+
userId: string;
|
|
11
|
+
/** The organization ID */
|
|
12
|
+
organizationId: string;
|
|
13
|
+
/** The organization name */
|
|
14
|
+
organizationName?: string;
|
|
15
|
+
/** The username */
|
|
16
|
+
username?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Gets the current user information
|
|
20
|
+
*
|
|
21
|
+
* @param client - The ZeroDev Wallet client
|
|
22
|
+
* @param params - The parameters for the whoami request
|
|
23
|
+
* @returns The user information
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const userInfo = await getWhoami(client, {
|
|
28
|
+
* organizationId: 'org_123',
|
|
29
|
+
* projectId: 'proj_456'
|
|
30
|
+
* });
|
|
31
|
+
* console.log(userInfo.userId); // 'user_789'
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function getWhoami(client: Client, params: GetWhoamiParameters): Promise<GetWhoamiReturnType>;
|
|
35
|
+
//# sourceMappingURL=getWhoami.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getWhoami.d.ts","sourceRoot":"","sources":["../../../../src/actions/auth/getWhoami.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,MAAM,mBAAmB,GAAG;IAChC,mCAAmC;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,oBAAoB;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,0BAA0B;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,4BAA4B;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,mBAAmB;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC,CAW9B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { type AuthenticateWithEmailParameters, type AuthenticateWithEmailReturnType, authenticateWithEmail, type EmailCustomization, } from './authenticateWithEmail.js';
|
|
2
|
+
export { type AuthenticateWithOAuthParameters, type AuthenticateWithOAuthReturnType, authenticateWithOAuth, } from './authenticateWithOAuth.js';
|
|
3
|
+
export { type GetAuthProxyConfigIdReturnType, getAuthProxyConfigId, } from './getAuthProxyConfigId.js';
|
|
4
|
+
export { type GetUserEmailParameters, type GetUserEmailReturnType, getUserEmail, } from './getUserEmail.js';
|
|
5
|
+
export { type GetWhoamiParameters, type GetWhoamiReturnType, getWhoami, } from './getWhoami.js';
|
|
6
|
+
export { type LoginWithOTPParameters, type LoginWithOTPReturnType, loginWithOTP, } from './loginWithOTP.js';
|
|
7
|
+
export { type LoginWithStampParameters, type LoginWithStampReturnType, loginWithStamp, } from './loginWithStamp.js';
|
|
8
|
+
export { type OtpContact, type RegisterWithOTPParameters, type RegisterWithOTPReturnType, registerWithOTP, } from './registerWithOTP.js';
|
|
9
|
+
export { type RegisterWithPasskeyParameters, type RegisterWithPasskeyReturnType, registerWithPasskey, } from './registerWithPasskey.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/actions/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACpC,qBAAqB,EACrB,KAAK,kBAAkB,GACxB,MAAM,4BAA4B,CAAA;AAEnC,OAAO,EACL,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACpC,qBAAqB,GACtB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,KAAK,8BAA8B,EACnC,oBAAoB,GACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,YAAY,GACb,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,SAAS,GACV,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,YAAY,GACb,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,cAAc,GACf,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,KAAK,UAAU,EACf,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,eAAe,GAChB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EAClC,mBAAmB,GACpB,MAAM,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js';
|
|
2
|
+
export type LoginWithOTPParameters = {
|
|
3
|
+
/** The verification token JWT from Auth Proxy's verifyOtp */
|
|
4
|
+
verificationToken: string;
|
|
5
|
+
/** The raw r||s signature hex (64 bytes = 128 chars) */
|
|
6
|
+
clientSignature: string;
|
|
7
|
+
/** The project ID for the request */
|
|
8
|
+
projectId: string;
|
|
9
|
+
};
|
|
10
|
+
export type LoginWithOTPReturnType = {
|
|
11
|
+
/** The Turnkey session token */
|
|
12
|
+
session: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Logs in a user with OTP (One-Time Password) authentication via the backend.
|
|
16
|
+
*
|
|
17
|
+
* The backend handles:
|
|
18
|
+
* 1. Parsing the verificationToken JWT to extract email and publicKey
|
|
19
|
+
* 2. Creating/retrieving sub-organization for (projectId, email)
|
|
20
|
+
* 3. Reconstructing the message for signature verification
|
|
21
|
+
* 4. Calling Turnkey.OtpLogin with the appropriate parameters
|
|
22
|
+
* 5. Returning the session to the SDK
|
|
23
|
+
*
|
|
24
|
+
* @param client - The ZeroDev Wallet client
|
|
25
|
+
* @param params - The parameters for OTP login
|
|
26
|
+
* @returns The login result with session token
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* // After verifying OTP via Auth Proxy and building client signature
|
|
31
|
+
* const result = await loginWithOTP(client, {
|
|
32
|
+
* verificationToken: '<jwt-from-auth-proxy>',
|
|
33
|
+
* clientSignature: '<raw-signature-hex>',
|
|
34
|
+
* projectId: 'proj_456'
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // Use result.session for authenticated requests
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function loginWithOTP(client: Client, params: LoginWithOTPParameters): Promise<LoginWithOTPReturnType>;
|
|
41
|
+
//# sourceMappingURL=loginWithOTP.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loginWithOTP.d.ts","sourceRoot":"","sources":["../../../../src/actions/auth/loginWithOTP.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,MAAM,sBAAsB,GAAG;IACnC,6DAA6D;IAC7D,iBAAiB,EAAE,MAAM,CAAA;IACzB,wDAAwD;IACxD,eAAe,EAAE,MAAM,CAAA;IACvB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,sBAAsB,CAAC,CAWjC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js';
|
|
2
|
+
export type EmailCustomization = {
|
|
3
|
+
/** 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`. */
|
|
4
|
+
magicLinkTemplate?: string;
|
|
5
|
+
};
|
|
6
|
+
export type LoginWithStampParameters = {
|
|
7
|
+
/** The project ID for the request */
|
|
8
|
+
projectId: string;
|
|
9
|
+
/** The organization ID for the request */
|
|
10
|
+
organizationId: string;
|
|
11
|
+
/** The encoded public key for the request */
|
|
12
|
+
targetPublicKey: string;
|
|
13
|
+
/** The stamper type for the request */
|
|
14
|
+
stampWith?: 'indexedDb' | 'webauthn';
|
|
15
|
+
};
|
|
16
|
+
export type LoginWithStampReturnType = {
|
|
17
|
+
/** The session */
|
|
18
|
+
session: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Logs in a user with a stamp
|
|
22
|
+
*
|
|
23
|
+
* @param client - The ZeroDev Wallet client
|
|
24
|
+
* @param params - The parameters for login with a stamp
|
|
25
|
+
* @returns The login result
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const result = await loginWithStamp(client, {
|
|
30
|
+
* organizationId: 'org_456',
|
|
31
|
+
* projectId: 'proj_456',
|
|
32
|
+
* targetPublicKey: 'encodedPublicKey',
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function loginWithStamp(client: Client, params: LoginWithStampParameters): Promise<LoginWithStampReturnType>;
|
|
37
|
+
//# sourceMappingURL=loginWithStamp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loginWithStamp.d.ts","sourceRoot":"","sources":["../../../../src/actions/auth/loginWithStamp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAGnD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gJAAgJ;IAChJ,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAA;IACtB,6CAA6C;IAC7C,eAAe,EAAE,MAAM,CAAA;IACvB,uCAAuC;IACvC,SAAS,CAAC,EAAE,WAAW,GAAG,UAAU,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,kBAAkB;IAClB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,wBAAwB,CAAC,CAkCnC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js';
|
|
2
|
+
import type { EmailCustomization } from './authenticateWithEmail.js';
|
|
3
|
+
export type OtpContact = {
|
|
4
|
+
/** The OTP delivery type (currently only 'email' is supported) */
|
|
5
|
+
type: 'email' | 'sms';
|
|
6
|
+
/** The contact information (email address or phone number) */
|
|
7
|
+
contact: string;
|
|
8
|
+
};
|
|
9
|
+
export type RegisterWithOTPParameters = {
|
|
10
|
+
/** The email address to register */
|
|
11
|
+
email: string;
|
|
12
|
+
/** The contact information for OTP delivery */
|
|
13
|
+
contact: OtpContact;
|
|
14
|
+
/** The project ID for the request */
|
|
15
|
+
projectId: string;
|
|
16
|
+
/** Optional email customization settings */
|
|
17
|
+
emailCustomization?: EmailCustomization;
|
|
18
|
+
};
|
|
19
|
+
export type RegisterWithOTPReturnType = {
|
|
20
|
+
/** The OTP ID needed for verification */
|
|
21
|
+
otpId: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Initiates OTP (One-Time Password) authentication
|
|
25
|
+
* This will send an OTP code to the specified contact method
|
|
26
|
+
*
|
|
27
|
+
* @param client - The ZeroDev Wallet client
|
|
28
|
+
* @param params - The parameters for OTP initiation
|
|
29
|
+
* @returns The result including otpId needed for verification
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const result = await registerWithOTP(client, {
|
|
34
|
+
* email: 'user@example.com',
|
|
35
|
+
* contact: {
|
|
36
|
+
* type: 'email',
|
|
37
|
+
* contact: 'user@example.com'
|
|
38
|
+
* },
|
|
39
|
+
* projectId: 'proj_456'
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // Use result.otpId for the verification step
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function registerWithOTP(client: Client, params: RegisterWithOTPParameters): Promise<RegisterWithOTPReturnType>;
|
|
46
|
+
//# sourceMappingURL=registerWithOTP.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerWithOTP.d.ts","sourceRoot":"","sources":["../../../../src/actions/auth/registerWithOTP.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,MAAM,MAAM,UAAU,GAAG;IACvB,kEAAkE;IAClE,IAAI,EAAE,OAAO,GAAG,KAAK,CAAA;IACrB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,+CAA+C;IAC/C,OAAO,EAAE,UAAU,CAAA;IACnB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,4CAA4C;IAC5C,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;CACxC,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,yBAAyB,GAChC,OAAO,CAAC,yBAAyB,CAAC,CAYpC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Client } from '../../client/types.js';
|
|
2
|
+
export type EmailCustomization = {
|
|
3
|
+
/** 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`. */
|
|
4
|
+
magicLinkTemplate?: string;
|
|
5
|
+
};
|
|
6
|
+
export type RegisterWithPasskeyParameters = {
|
|
7
|
+
/** The email address to authenticate */
|
|
8
|
+
email: string;
|
|
9
|
+
/** The project ID for the request */
|
|
10
|
+
projectId: string;
|
|
11
|
+
/** The challenge for the request */
|
|
12
|
+
challenge: string;
|
|
13
|
+
/** The attestation for the request */
|
|
14
|
+
attestation: {
|
|
15
|
+
attestationObject: string;
|
|
16
|
+
clientDataJson: string;
|
|
17
|
+
credentialId: string;
|
|
18
|
+
};
|
|
19
|
+
/** The encoded public key for the request */
|
|
20
|
+
encodedPublicKey: string;
|
|
21
|
+
};
|
|
22
|
+
export type RegisterWithPasskeyReturnType = {
|
|
23
|
+
/** The user ID */
|
|
24
|
+
userId: string;
|
|
25
|
+
/** The wallet address */
|
|
26
|
+
walletAddress: string;
|
|
27
|
+
/** The sub-organization ID */
|
|
28
|
+
subOrganizationId: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Registers a passkey with the user's wallet
|
|
32
|
+
*
|
|
33
|
+
* @param client - The ZeroDev Wallet client
|
|
34
|
+
* @param params - The parameters for passkey registration
|
|
35
|
+
* @returns The passkey registration result
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const result = await registerWithPasskey(client, {
|
|
40
|
+
* email: 'user@example.com',
|
|
41
|
+
* projectId: 'proj_456',
|
|
42
|
+
* challenge: 'challenge',
|
|
43
|
+
* attestation: {
|
|
44
|
+
* attestationObject: 'attestationObject',
|
|
45
|
+
* clientDataJson: 'clientDataJson',
|
|
46
|
+
* credentialId: 'credentialId'
|
|
47
|
+
* },
|
|
48
|
+
* encodedPublicKey: 'encodedPublicKey'
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function registerWithPasskey(client: Client, params: RegisterWithPasskeyParameters): Promise<RegisterWithPasskeyReturnType>;
|
|
53
|
+
//# sourceMappingURL=registerWithPasskey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerWithPasskey.d.ts","sourceRoot":"","sources":["../../../../src/actions/auth/registerWithPasskey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gJAAgJ;IAChJ,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,sCAAsC;IACtC,WAAW,EAAE;QACX,iBAAiB,EAAE,MAAM,CAAA;QACzB,cAAc,EAAE,MAAM,CAAA;QACtB,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,6CAA6C;IAC7C,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,kBAAkB;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,yBAAyB;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,8BAA8B;IAC9B,iBAAiB,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,6BAA6B,CAAC,CAaxC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { type AuthenticateWithEmailParameters, type AuthenticateWithEmailReturnType, type AuthenticateWithOAuthParameters, type AuthenticateWithOAuthReturnType, authenticateWithEmail, authenticateWithOAuth, type EmailCustomization, type GetAuthProxyConfigIdReturnType, type GetUserEmailParameters, type GetUserEmailReturnType, type GetWhoamiParameters, type GetWhoamiReturnType, getAuthProxyConfigId, getUserEmail, getWhoami, type LoginWithOTPParameters, type LoginWithOTPReturnType, loginWithOTP, type OtpContact, type RegisterWithOTPParameters, type RegisterWithOTPReturnType, type RegisterWithPasskeyParameters, type RegisterWithPasskeyReturnType, registerWithOTP, registerWithPasskey, } from './auth/index.js';
|
|
2
|
+
export { type GetUserWalletParameters, type GetUserWalletReturnType, getUserWallet, type SignRawPayloadParameters, type SignRawPayloadReturnType, type SignTransactionParameters, type SignTransactionReturnType, signRawPayload, signTransaction, } from './wallet/index.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/actions/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACpC,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,kBAAkB,EACvB,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,oBAAoB,EACpB,YAAY,EACZ,SAAS,EACT,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,YAAY,EACZ,KAAK,UAAU,EACf,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EAClC,eAAe,EACf,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,aAAa,EACb,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,cAAc,EACd,eAAe,GAChB,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Hex } from 'viem';
|
|
2
|
+
import type { Client } from '../../client/types.js';
|
|
3
|
+
export type GetUserWalletParameters = {
|
|
4
|
+
/** The organization ID */
|
|
5
|
+
organizationId: string;
|
|
6
|
+
/** The project ID for the request */
|
|
7
|
+
projectId: string;
|
|
8
|
+
/** The token for the request */
|
|
9
|
+
token: string;
|
|
10
|
+
};
|
|
11
|
+
export type GetUserWalletReturnType = {
|
|
12
|
+
/** The wallet address */
|
|
13
|
+
walletAddresses: Hex[];
|
|
14
|
+
/** The user ID */
|
|
15
|
+
userId?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Gets the user's wallet information
|
|
19
|
+
*
|
|
20
|
+
* @param client - The ZeroDev Wallet client
|
|
21
|
+
* @param params - The parameters for getting wallet info
|
|
22
|
+
* @returns The wallet information
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const wallet = await getUserWallet(client, {
|
|
27
|
+
* organizationId: 'org_123',
|
|
28
|
+
* projectId: 'proj_456'
|
|
29
|
+
* });
|
|
30
|
+
* console.log(wallet.walletAddresses); // ['0x...', '0x...']
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function getUserWallet(client: Client, params: GetUserWalletParameters): Promise<GetUserWalletReturnType>;
|
|
34
|
+
//# sourceMappingURL=getUserWallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getUserWallet.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/getUserWallet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,MAAM,uBAAuB,GAAG;IACpC,0BAA0B;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,yBAAyB;IACzB,eAAe,EAAE,GAAG,EAAE,CAAA;IACtB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CAclC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { type GetUserWalletParameters, type GetUserWalletReturnType, getUserWallet, } from './getUserWallet.js';
|
|
2
|
+
export { type SignRawPayloadParameters, type SignRawPayloadReturnType, signRawPayload, } from './signRawPayload.js';
|
|
3
|
+
export { type SignTransactionParameters, type SignTransactionReturnType, signTransaction, } from './signTransaction.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,aAAa,GACd,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,cAAc,GACf,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,eAAe,GAChB,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Hex } from 'viem';
|
|
2
|
+
import type { Client } from '../../client/types.js';
|
|
3
|
+
export type SignRawPayloadParameters = {
|
|
4
|
+
/** The organization ID */
|
|
5
|
+
organizationId: string;
|
|
6
|
+
/** The project ID for the request */
|
|
7
|
+
projectId: string;
|
|
8
|
+
/** The session token for authorization */
|
|
9
|
+
token: string;
|
|
10
|
+
/** The address to sign with */
|
|
11
|
+
address: Hex;
|
|
12
|
+
/** The payload hash to sign (without 0x prefix) */
|
|
13
|
+
payload: string;
|
|
14
|
+
/** The encoding type */
|
|
15
|
+
encoding?: 'PAYLOAD_ENCODING_HEXADECIMAL' | 'PAYLOAD_ENCODING_EIP712';
|
|
16
|
+
/** The hash function type */
|
|
17
|
+
hashFunction?: 'HASH_FUNCTION_NO_OP';
|
|
18
|
+
};
|
|
19
|
+
export type SignRawPayloadReturnType = Hex;
|
|
20
|
+
/**
|
|
21
|
+
* Signs a raw payload with the user's wallet
|
|
22
|
+
*
|
|
23
|
+
* @param client - The ZeroDev Wallet client
|
|
24
|
+
* @param params - The parameters for signing
|
|
25
|
+
* @returns The signature
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const result = await signRawPayload(client, {
|
|
30
|
+
* organizationId: 'org_123',
|
|
31
|
+
* projectId: 'proj_456',
|
|
32
|
+
* address: '0x123...',
|
|
33
|
+
* payload: 'abc123...',
|
|
34
|
+
* });
|
|
35
|
+
* console.log(result.signature); // '0x...'
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function signRawPayload(client: Client, params: SignRawPayloadParameters): Promise<SignRawPayloadReturnType>;
|
|
39
|
+
//# sourceMappingURL=signRawPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signRawPayload.d.ts","sourceRoot":"","sources":["../../../../src/actions/wallet/signRawPayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAEnD,MAAM,MAAM,wBAAwB,GAAG;IACrC,0BAA0B;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAA;IACb,+BAA+B;IAC/B,OAAO,EAAE,GAAG,CAAA;IACZ,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAA;IACf,wBAAwB;IACxB,QAAQ,CAAC,EAAE,8BAA8B,GAAG,yBAAyB,CAAA;IACrE,6BAA6B;IAC7B,YAAY,CAAC,EAAE,qBAAqB,CAAA;CACrC,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG,GAAG,CAAA;AAE1C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,wBAAwB,CAAC,CA+BnC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Hex } from 'viem';
|
|
2
|
+
import type { Client } from '../../client/types.js';
|
|
3
|
+
export type SignTransactionParameters = {
|
|
4
|
+
/** The organization ID */
|
|
5
|
+
organizationId: string;
|
|
6
|
+
/** The project ID for the request */
|
|
7
|
+
projectId: string;
|
|
8
|
+
/** The session token for authorization */
|
|
9
|
+
token: string;
|
|
10
|
+
/** The address to sign with */
|
|
11
|
+
address: Hex;
|
|
12
|
+
/** The unsigned transaction to sign */
|
|
13
|
+
unsignedTransaction: string;
|
|
14
|
+
};
|
|
15
|
+
export type SignTransactionReturnType = Hex;
|
|
16
|
+
/**
|
|
17
|
+
* Signs a raw transaction with the user's wallet
|
|
18
|
+
*
|
|
19
|
+
* @param client - The ZeroDev Wallet client
|
|
20
|
+
* @param params - The parameters for signing
|
|
21
|
+
* @returns The signature
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const result = await signTransaction(client, {
|
|
26
|
+
* organizationId: 'org_123',
|
|
27
|
+
* projectId: 'proj_456',
|
|
28
|
+
* address: '0x123...',
|
|
29
|
+
* unsignedTransaction: 'abc123...',
|
|
30
|
+
* });
|
|
31
|
+
* console.log(result.signature); // '0x...'
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function signTransaction(client: Client, params: SignTransactionParameters): Promise<SignTransactionReturnType>;
|
|
35
|
+
//# sourceMappingURL=signTransaction.d.ts.map
|