@moon-x/core 0.2.0 → 0.4.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/README.md +2 -2
- package/dist/{chunk-CDT4MC7S.mjs → chunk-6LTEG7VN.mjs} +0 -39
- package/dist/{chunk-SOKLPX7V.mjs → chunk-VVL65GIB.mjs} +10 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +10 -0
- package/dist/index.mjs +1 -1
- package/dist/interfaces-cdKh3sLA.d.mts +192 -0
- package/dist/interfaces-pNTEOKaK.d.ts +192 -0
- package/dist/lib/index.d.mts +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +2 -47
- package/dist/lib/index.mjs +3 -15
- package/dist/passkey-cache-WnDFQ-v4.d.mts +26 -0
- package/dist/passkey-cache-WnDFQ-v4.d.ts +26 -0
- package/dist/{post-message-C_99BCBh.d.mts → post-message-CmgAfkOS.d.mts} +2 -0
- package/dist/{post-message-C_99BCBh.d.ts → post-message-CmgAfkOS.d.ts} +2 -0
- package/dist/react/index.d.mts +1 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +2 -1
- package/dist/react/index.mjs +3 -2
- package/dist/sdk/index.d.mts +52 -21
- package/dist/sdk/index.d.ts +52 -21
- package/dist/sdk/index.js +252 -102
- package/dist/sdk/index.mjs +241 -80
- package/dist/types/index.d.mts +19 -12
- package/dist/types/index.d.ts +19 -12
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +10 -0
- package/dist/utils/index.mjs +1 -1
- package/dist/web/index.d.mts +2 -2
- package/dist/web/index.d.ts +2 -2
- package/dist/web/index.js +50 -114
- package/dist/web/index.mjs +51 -58
- package/package.json +6 -2
- package/dist/interfaces-9k0eKCc4.d.ts +0 -120
- package/dist/interfaces-fNhwnCeY.d.mts +0 -120
- package/dist/passkey-cache-B9PT3AWX.d.mts +0 -47
- package/dist/passkey-cache-B9PT3AWX.d.ts +0 -47
package/dist/lib/index.mjs
CHANGED
|
@@ -9,14 +9,12 @@ import {
|
|
|
9
9
|
broadcastSolanaSigned,
|
|
10
10
|
bs58ToBytes,
|
|
11
11
|
buildUrl,
|
|
12
|
-
clearParentAssertCache,
|
|
13
12
|
createManualSiweMessage,
|
|
14
13
|
estimateEvmGas,
|
|
15
14
|
estimateEvmGasReserve,
|
|
16
15
|
formatPasskeyLabel,
|
|
17
16
|
fromB64url,
|
|
18
17
|
generatePasskeyUserId,
|
|
19
|
-
getAssertCacheTtlMs,
|
|
20
18
|
getChainById,
|
|
21
19
|
getDefaultChain,
|
|
22
20
|
getEvmGasPrice,
|
|
@@ -29,19 +27,15 @@ import {
|
|
|
29
27
|
isChainSupported,
|
|
30
28
|
prepareEvmSendTransaction,
|
|
31
29
|
prepareEvmSignTransaction,
|
|
32
|
-
readParentAssertCache,
|
|
33
30
|
resolveEvmChain,
|
|
34
31
|
resolvePasskeyMetadata,
|
|
35
32
|
sanitizeUserData,
|
|
36
33
|
serializeEthereumTransaction,
|
|
37
|
-
setAssertCacheTtlMs,
|
|
38
34
|
setChainRpcUrl,
|
|
39
35
|
toB64url,
|
|
40
36
|
validateChainConfig,
|
|
41
|
-
verifyIdToken
|
|
42
|
-
|
|
43
|
-
writeParentAssertCache
|
|
44
|
-
} from "../chunk-CDT4MC7S.mjs";
|
|
37
|
+
verifyIdToken
|
|
38
|
+
} from "../chunk-6LTEG7VN.mjs";
|
|
45
39
|
import "../chunk-GQKIA37O.mjs";
|
|
46
40
|
export {
|
|
47
41
|
DEFAULT_AUTH_URL,
|
|
@@ -54,14 +48,12 @@ export {
|
|
|
54
48
|
broadcastSolanaSigned,
|
|
55
49
|
bs58ToBytes,
|
|
56
50
|
buildUrl,
|
|
57
|
-
clearParentAssertCache,
|
|
58
51
|
createManualSiweMessage,
|
|
59
52
|
estimateEvmGas,
|
|
60
53
|
estimateEvmGasReserve,
|
|
61
54
|
formatPasskeyLabel,
|
|
62
55
|
fromB64url,
|
|
63
56
|
generatePasskeyUserId,
|
|
64
|
-
getAssertCacheTtlMs,
|
|
65
57
|
getChainById,
|
|
66
58
|
getDefaultChain,
|
|
67
59
|
getEvmGasPrice,
|
|
@@ -74,16 +66,12 @@ export {
|
|
|
74
66
|
isChainSupported,
|
|
75
67
|
prepareEvmSendTransaction,
|
|
76
68
|
prepareEvmSignTransaction,
|
|
77
|
-
readParentAssertCache,
|
|
78
69
|
resolveEvmChain,
|
|
79
70
|
resolvePasskeyMetadata,
|
|
80
71
|
sanitizeUserData,
|
|
81
72
|
serializeEthereumTransaction,
|
|
82
|
-
setAssertCacheTtlMs,
|
|
83
73
|
setChainRpcUrl,
|
|
84
74
|
toB64url,
|
|
85
75
|
validateChainConfig,
|
|
86
|
-
verifyIdToken
|
|
87
|
-
withClearOnFailure,
|
|
88
|
-
writeParentAssertCache
|
|
76
|
+
verifyIdToken
|
|
89
77
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface CachedAssertion {
|
|
2
|
+
userHandleB64url: string;
|
|
3
|
+
credentialIdB64url: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Generate fresh user.id bytes for a new WebAuthn credential. The
|
|
7
|
+
* caller overrides `options.user.id` with these bytes before
|
|
8
|
+
* navigator.credentials.create so the authenticator persists them as
|
|
9
|
+
* the credential's user.id; on every subsequent assertion they come
|
|
10
|
+
* back as response.userHandle and serve as the AES-GCM key for that
|
|
11
|
+
* credential's DEK wrap.
|
|
12
|
+
*
|
|
13
|
+
* Returns the bytes both as base64url (what the WebAuthn options
|
|
14
|
+
* accept and what we ship over postMessage) and as raw bytes (for
|
|
15
|
+
* any caller that prefers direct binary).
|
|
16
|
+
*
|
|
17
|
+
* Requires a working `crypto.getRandomValues`. On RN this is provided
|
|
18
|
+
* by the `react-native-get-random-values` polyfill that the SDK's
|
|
19
|
+
* docs ask consumers to import at app entry.
|
|
20
|
+
*/
|
|
21
|
+
declare const generatePasskeyUserId: () => {
|
|
22
|
+
userIdB64url: string;
|
|
23
|
+
userIdBytes: Uint8Array;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { type CachedAssertion as C, generatePasskeyUserId as g };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface CachedAssertion {
|
|
2
|
+
userHandleB64url: string;
|
|
3
|
+
credentialIdB64url: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Generate fresh user.id bytes for a new WebAuthn credential. The
|
|
7
|
+
* caller overrides `options.user.id` with these bytes before
|
|
8
|
+
* navigator.credentials.create so the authenticator persists them as
|
|
9
|
+
* the credential's user.id; on every subsequent assertion they come
|
|
10
|
+
* back as response.userHandle and serve as the AES-GCM key for that
|
|
11
|
+
* credential's DEK wrap.
|
|
12
|
+
*
|
|
13
|
+
* Returns the bytes both as base64url (what the WebAuthn options
|
|
14
|
+
* accept and what we ship over postMessage) and as raw bytes (for
|
|
15
|
+
* any caller that prefers direct binary).
|
|
16
|
+
*
|
|
17
|
+
* Requires a working `crypto.getRandomValues`. On RN this is provided
|
|
18
|
+
* by the `react-native-get-random-values` polyfill that the SDK's
|
|
19
|
+
* docs ask consumers to import at app entry.
|
|
20
|
+
*/
|
|
21
|
+
declare const generatePasskeyUserId: () => {
|
|
22
|
+
userIdB64url: string;
|
|
23
|
+
userIdBytes: Uint8Array;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { type CachedAssertion as C, generatePasskeyUserId as g };
|
|
@@ -40,6 +40,8 @@ declare const PostMessageMethod: {
|
|
|
40
40
|
readonly DETACH_OAUTH: "DETACH_OAUTH";
|
|
41
41
|
readonly PASSKEY_REGISTER_BEGIN: "PASSKEY_REGISTER_BEGIN";
|
|
42
42
|
readonly PASSKEY_REGISTER_VERIFY: "PASSKEY_REGISTER_VERIFY";
|
|
43
|
+
readonly PASSKEY_PRESENCE_BEGIN: "PASSKEY_PRESENCE_BEGIN";
|
|
44
|
+
readonly PASSKEY_PRESENCE_VERIFY: "PASSKEY_PRESENCE_VERIFY";
|
|
43
45
|
readonly GET_PASSKEY_STATUS: "GET_PASSKEY_STATUS";
|
|
44
46
|
readonly GET_DEK_INFO: "GET_DEK_INFO";
|
|
45
47
|
readonly ADD_PASSKEY_WRAP: "ADD_PASSKEY_WRAP";
|
|
@@ -40,6 +40,8 @@ declare const PostMessageMethod: {
|
|
|
40
40
|
readonly DETACH_OAUTH: "DETACH_OAUTH";
|
|
41
41
|
readonly PASSKEY_REGISTER_BEGIN: "PASSKEY_REGISTER_BEGIN";
|
|
42
42
|
readonly PASSKEY_REGISTER_VERIFY: "PASSKEY_REGISTER_VERIFY";
|
|
43
|
+
readonly PASSKEY_PRESENCE_BEGIN: "PASSKEY_PRESENCE_BEGIN";
|
|
44
|
+
readonly PASSKEY_PRESENCE_VERIFY: "PASSKEY_PRESENCE_VERIFY";
|
|
43
45
|
readonly GET_PASSKEY_STATUS: "GET_PASSKEY_STATUS";
|
|
44
46
|
readonly GET_DEK_INFO: "GET_DEK_INFO";
|
|
45
47
|
readonly ADD_PASSKEY_WRAP: "ADD_PASSKEY_WRAP";
|
package/dist/react/index.d.mts
CHANGED
|
@@ -16,6 +16,7 @@ interface MoonKeyHookSDK {
|
|
|
16
16
|
isAuthenticated?: boolean;
|
|
17
17
|
ready?: boolean;
|
|
18
18
|
refreshUser?: () => Promise<unknown>;
|
|
19
|
+
revalidatedAt?: number;
|
|
19
20
|
signEthereumMessageHeadless: (params: unknown) => Promise<unknown>;
|
|
20
21
|
signEthereumTransactionHeadless: (params: unknown) => Promise<unknown>;
|
|
21
22
|
signEthereumTypedDataHeadless: (params: unknown) => Promise<unknown>;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ interface MoonKeyHookSDK {
|
|
|
16
16
|
isAuthenticated?: boolean;
|
|
17
17
|
ready?: boolean;
|
|
18
18
|
refreshUser?: () => Promise<unknown>;
|
|
19
|
+
revalidatedAt?: number;
|
|
19
20
|
signEthereumMessageHeadless: (params: unknown) => Promise<unknown>;
|
|
20
21
|
signEthereumTransactionHeadless: (params: unknown) => Promise<unknown>;
|
|
21
22
|
signEthereumTypedDataHeadless: (params: unknown) => Promise<unknown>;
|
package/dist/react/index.js
CHANGED
|
@@ -174,6 +174,7 @@ var useWallets = (walletType) => {
|
|
|
174
174
|
const [loading, setLoading] = (0, import_react5.useState)(false);
|
|
175
175
|
const [error, setError] = (0, import_react5.useState)(null);
|
|
176
176
|
const isAuthenticated = !!sdk.isAuthenticated;
|
|
177
|
+
const revalidatedAt = sdk.revalidatedAt ?? 0;
|
|
177
178
|
const refresh = (0, import_react5.useCallback)(async () => {
|
|
178
179
|
setLoading(true);
|
|
179
180
|
setError(null);
|
|
@@ -192,7 +193,7 @@ var useWallets = (walletType) => {
|
|
|
192
193
|
return;
|
|
193
194
|
}
|
|
194
195
|
refresh();
|
|
195
|
-
}, [isAuthenticated, refresh]);
|
|
196
|
+
}, [isAuthenticated, revalidatedAt, refresh]);
|
|
196
197
|
return { wallets, loading, error, refresh, refetch: refresh };
|
|
197
198
|
};
|
|
198
199
|
|
package/dist/react/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatPasskeyLabel,
|
|
3
3
|
resolvePasskeyMetadata
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-6LTEG7VN.mjs";
|
|
5
5
|
import "../chunk-GQKIA37O.mjs";
|
|
6
6
|
import {
|
|
7
7
|
SDKProvider,
|
|
@@ -123,6 +123,7 @@ var useWallets = (walletType) => {
|
|
|
123
123
|
const [loading, setLoading] = useState4(false);
|
|
124
124
|
const [error, setError] = useState4(null);
|
|
125
125
|
const isAuthenticated = !!sdk.isAuthenticated;
|
|
126
|
+
const revalidatedAt = sdk.revalidatedAt ?? 0;
|
|
126
127
|
const refresh = useCallback4(async () => {
|
|
127
128
|
setLoading(true);
|
|
128
129
|
setError(null);
|
|
@@ -141,7 +142,7 @@ var useWallets = (walletType) => {
|
|
|
141
142
|
return;
|
|
142
143
|
}
|
|
143
144
|
refresh();
|
|
144
|
-
}, [isAuthenticated, refresh]);
|
|
145
|
+
}, [isAuthenticated, revalidatedAt, refresh]);
|
|
145
146
|
return { wallets, loading, error, refresh, refetch: refresh };
|
|
146
147
|
};
|
|
147
148
|
|
package/dist/sdk/index.d.mts
CHANGED
|
@@ -1,22 +1,52 @@
|
|
|
1
|
-
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-
|
|
2
|
-
export { O as OAuthOpener, a as PlatformImpls } from '../interfaces-
|
|
3
|
-
import { C as CachedAssertion } from '../passkey-cache-
|
|
4
|
-
import { EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumGetTokenAccountsByOwnerParams, EthereumGetTokenAccountsByOwnerResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, PublicWallet } from '../types/index.mjs';
|
|
5
|
-
import '../post-message-
|
|
1
|
+
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-cdKh3sLA.mjs';
|
|
2
|
+
export { O as OAuthOpener, a as PlatformImpls, W as WebAuthnAssertionResponse, b as WebAuthnRequestOptions } from '../interfaces-cdKh3sLA.mjs';
|
|
3
|
+
import { C as CachedAssertion } from '../passkey-cache-WnDFQ-v4.mjs';
|
|
4
|
+
import { EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumGetTokenAccountsByOwnerParams, EthereumGetTokenAccountsByOwnerResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, SendEmailOtpResponse, PublicWallet } from '../types/index.mjs';
|
|
5
|
+
import '../post-message-CmgAfkOS.mjs';
|
|
6
6
|
import '../chain-C9dvKXUY.mjs';
|
|
7
7
|
|
|
8
8
|
type AssertPasskeyInParentResult = CachedAssertion;
|
|
9
|
-
declare const assertPasskeyInParent: ({ transport, passkey, publishableKey,
|
|
9
|
+
declare const assertPasskeyInParent: ({ transport, passkey, publishableKey, validateCredentialInAllowList, }: {
|
|
10
10
|
transport: Transport;
|
|
11
11
|
passkey: PasskeyAssertor;
|
|
12
12
|
publishableKey: string;
|
|
13
|
-
|
|
13
|
+
validateCredentialInAllowList?: boolean;
|
|
14
14
|
}) => Promise<AssertPasskeyInParentResult>;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
interface GetPresenceTokenResult {
|
|
17
|
+
presenceToken: string;
|
|
18
|
+
expiresAt: number;
|
|
19
|
+
}
|
|
20
|
+
declare const getPresenceToken: ({ transport, passkey, publishableKey, relyingPartyOrigin, }: {
|
|
21
|
+
transport: Transport;
|
|
22
|
+
passkey: PasskeyAssertor;
|
|
23
|
+
publishableKey: string;
|
|
24
|
+
relyingPartyOrigin: string;
|
|
25
|
+
}) => Promise<GetPresenceTokenResult>;
|
|
26
|
+
|
|
27
|
+
interface ScopedPresenceToken {
|
|
28
|
+
token: string;
|
|
29
|
+
expiresAt: number;
|
|
30
|
+
}
|
|
31
|
+
interface GetInternalPresenceTokensResult {
|
|
32
|
+
tokens: Record<string, ScopedPresenceToken>;
|
|
33
|
+
userHandleB64url: string;
|
|
34
|
+
credentialIdB64url: string;
|
|
35
|
+
}
|
|
36
|
+
declare const getInternalPresenceTokens: ({ transport, passkey, publishableKey, relyingPartyOrigin, scopes, }: {
|
|
17
37
|
transport: Transport;
|
|
18
38
|
passkey: PasskeyAssertor;
|
|
19
39
|
publishableKey: string;
|
|
40
|
+
relyingPartyOrigin: string;
|
|
41
|
+
scopes: string[];
|
|
42
|
+
}) => Promise<GetInternalPresenceTokensResult>;
|
|
43
|
+
declare const flattenPresenceTokens: (result: GetInternalPresenceTokensResult) => Record<string, string>;
|
|
44
|
+
|
|
45
|
+
declare const getHeadlessEthereumMethods: ({ transport, passkey, publishableKey, relyingPartyOrigin, }: {
|
|
46
|
+
transport: Transport;
|
|
47
|
+
passkey: PasskeyAssertor;
|
|
48
|
+
publishableKey: string;
|
|
49
|
+
relyingPartyOrigin: string;
|
|
20
50
|
}) => {
|
|
21
51
|
signEthereumMessageHeadless: (params: EthereumSignMessageParams) => Promise<EthereumSignMessageResult>;
|
|
22
52
|
signEthereumTransactionHeadless: (params: EthereumSignTransactionParams) => Promise<EthereumSignTransactionResult>;
|
|
@@ -34,10 +64,11 @@ declare const getHeadlessEthereumMethods: ({ transport, passkey, publishableKey,
|
|
|
34
64
|
}) => Promise<unknown>;
|
|
35
65
|
};
|
|
36
66
|
|
|
37
|
-
declare const getHeadlessSolanaMethods: ({ transport, passkey, publishableKey, }: {
|
|
67
|
+
declare const getHeadlessSolanaMethods: ({ transport, passkey, publishableKey, relyingPartyOrigin, }: {
|
|
38
68
|
transport: Transport;
|
|
39
69
|
passkey: PasskeyAssertor;
|
|
40
70
|
publishableKey: string;
|
|
71
|
+
relyingPartyOrigin: string;
|
|
41
72
|
}) => {
|
|
42
73
|
signSolanaMessageHeadless: (params: SolanaSignMessageParams) => Promise<SolanaSignMessageResult>;
|
|
43
74
|
signSolanaTransactionHeadless: (params: SolanaSignTransactionParams) => Promise<SolanaSignTransactionResult>;
|
|
@@ -59,17 +90,19 @@ interface VerifyOAuthParams {
|
|
|
59
90
|
token?: string;
|
|
60
91
|
state?: string;
|
|
61
92
|
}
|
|
62
|
-
declare const getHeadlessAuthenticationMethods: ({ transport, publishableKey,
|
|
93
|
+
declare const getHeadlessAuthenticationMethods: ({ transport, publishableKey, setIsAuthenticated, setUser, }: {
|
|
63
94
|
transport: Transport;
|
|
64
95
|
publishableKey: string;
|
|
65
|
-
emailConfig?: {
|
|
66
|
-
expiresIn?: number;
|
|
67
|
-
};
|
|
68
96
|
setIsAuthenticated?: (isAuth: boolean) => void;
|
|
69
97
|
setUser?: (user: unknown | null) => void;
|
|
70
98
|
}) => {
|
|
71
|
-
/**
|
|
72
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Send a one-time passcode to the user's email address. Returns the
|
|
101
|
+
* server's response — most importantly `expires_at` (unix seconds),
|
|
102
|
+
* which the UI uses to render a countdown that cannot drift from the
|
|
103
|
+
* authoritative server-side TTL.
|
|
104
|
+
*/
|
|
105
|
+
sendCode: (params: SendCodeParams) => Promise<SendEmailOtpResponse>;
|
|
73
106
|
/**
|
|
74
107
|
* Verify the OTP and complete the login. The iframe-app handles
|
|
75
108
|
* session persistence; on success the SDK flips isAuthenticated and
|
|
@@ -84,11 +117,12 @@ declare const getHeadlessAuthenticationMethods: ({ transport, publishableKey, em
|
|
|
84
117
|
verifyOAuth: (params: VerifyOAuthParams) => Promise<unknown>;
|
|
85
118
|
};
|
|
86
119
|
|
|
87
|
-
declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publishableKey, setIsAuthenticated, setUser, }: {
|
|
120
|
+
declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publishableKey, relyingPartyOrigin, setIsAuthenticated, setUser, }: {
|
|
88
121
|
transport: Transport;
|
|
89
122
|
passkey: PasskeyAssertor;
|
|
90
123
|
storage: KvStorage;
|
|
91
124
|
publishableKey: string;
|
|
125
|
+
relyingPartyOrigin: string;
|
|
92
126
|
setIsAuthenticated?: (isAuth: boolean) => void;
|
|
93
127
|
setUser?: (user: unknown | null) => void;
|
|
94
128
|
}) => {
|
|
@@ -97,13 +131,10 @@ declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publish
|
|
|
97
131
|
createWallet: (walletType: "solana" | "ethereum", options?: {
|
|
98
132
|
createAdditional?: boolean;
|
|
99
133
|
walletIndex?: number;
|
|
100
|
-
requireFreshAssertion?: boolean;
|
|
101
134
|
}) => Promise<{
|
|
102
135
|
wallet: PublicWallet;
|
|
103
136
|
}>;
|
|
104
|
-
importKey: (walletType: "solana" | "ethereum", key: string
|
|
105
|
-
requireFreshAssertion?: boolean;
|
|
106
|
-
}) => Promise<{
|
|
137
|
+
importKey: (walletType: "solana" | "ethereum", key: string) => Promise<{
|
|
107
138
|
wallet: PublicWallet;
|
|
108
139
|
}>;
|
|
109
140
|
getWallets: (walletType: "solana" | "ethereum") => Promise<{
|
|
@@ -123,4 +154,4 @@ declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publish
|
|
|
123
154
|
getUser: () => Promise<unknown>;
|
|
124
155
|
};
|
|
125
156
|
|
|
126
|
-
export { type AssertPasskeyInParentResult, KvStorage, type LoginWithCodeParams, PasskeyAssertor, type SendCodeParams, Transport, type VerifyOAuthParams, assertPasskeyInParent, getHeadlessAuthenticationMethods, getHeadlessEthereumMethods, getHeadlessGeneralMethods, getHeadlessSolanaMethods };
|
|
157
|
+
export { type AssertPasskeyInParentResult, type GetInternalPresenceTokensResult, type GetPresenceTokenResult, KvStorage, type LoginWithCodeParams, PasskeyAssertor, type ScopedPresenceToken, type SendCodeParams, Transport, type VerifyOAuthParams, assertPasskeyInParent, flattenPresenceTokens, getHeadlessAuthenticationMethods, getHeadlessEthereumMethods, getHeadlessGeneralMethods, getHeadlessSolanaMethods, getInternalPresenceTokens, getPresenceToken };
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,22 +1,52 @@
|
|
|
1
|
-
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-
|
|
2
|
-
export { O as OAuthOpener, a as PlatformImpls } from '../interfaces-
|
|
3
|
-
import { C as CachedAssertion } from '../passkey-cache-
|
|
4
|
-
import { EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumGetTokenAccountsByOwnerParams, EthereumGetTokenAccountsByOwnerResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, PublicWallet } from '../types/index.js';
|
|
5
|
-
import '../post-message-
|
|
1
|
+
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-pNTEOKaK.js';
|
|
2
|
+
export { O as OAuthOpener, a as PlatformImpls, W as WebAuthnAssertionResponse, b as WebAuthnRequestOptions } from '../interfaces-pNTEOKaK.js';
|
|
3
|
+
import { C as CachedAssertion } from '../passkey-cache-WnDFQ-v4.js';
|
|
4
|
+
import { EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumGetTokenAccountsByOwnerParams, EthereumGetTokenAccountsByOwnerResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, SendEmailOtpResponse, PublicWallet } from '../types/index.js';
|
|
5
|
+
import '../post-message-CmgAfkOS.js';
|
|
6
6
|
import '../chain-C9dvKXUY.js';
|
|
7
7
|
|
|
8
8
|
type AssertPasskeyInParentResult = CachedAssertion;
|
|
9
|
-
declare const assertPasskeyInParent: ({ transport, passkey, publishableKey,
|
|
9
|
+
declare const assertPasskeyInParent: ({ transport, passkey, publishableKey, validateCredentialInAllowList, }: {
|
|
10
10
|
transport: Transport;
|
|
11
11
|
passkey: PasskeyAssertor;
|
|
12
12
|
publishableKey: string;
|
|
13
|
-
|
|
13
|
+
validateCredentialInAllowList?: boolean;
|
|
14
14
|
}) => Promise<AssertPasskeyInParentResult>;
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
interface GetPresenceTokenResult {
|
|
17
|
+
presenceToken: string;
|
|
18
|
+
expiresAt: number;
|
|
19
|
+
}
|
|
20
|
+
declare const getPresenceToken: ({ transport, passkey, publishableKey, relyingPartyOrigin, }: {
|
|
21
|
+
transport: Transport;
|
|
22
|
+
passkey: PasskeyAssertor;
|
|
23
|
+
publishableKey: string;
|
|
24
|
+
relyingPartyOrigin: string;
|
|
25
|
+
}) => Promise<GetPresenceTokenResult>;
|
|
26
|
+
|
|
27
|
+
interface ScopedPresenceToken {
|
|
28
|
+
token: string;
|
|
29
|
+
expiresAt: number;
|
|
30
|
+
}
|
|
31
|
+
interface GetInternalPresenceTokensResult {
|
|
32
|
+
tokens: Record<string, ScopedPresenceToken>;
|
|
33
|
+
userHandleB64url: string;
|
|
34
|
+
credentialIdB64url: string;
|
|
35
|
+
}
|
|
36
|
+
declare const getInternalPresenceTokens: ({ transport, passkey, publishableKey, relyingPartyOrigin, scopes, }: {
|
|
17
37
|
transport: Transport;
|
|
18
38
|
passkey: PasskeyAssertor;
|
|
19
39
|
publishableKey: string;
|
|
40
|
+
relyingPartyOrigin: string;
|
|
41
|
+
scopes: string[];
|
|
42
|
+
}) => Promise<GetInternalPresenceTokensResult>;
|
|
43
|
+
declare const flattenPresenceTokens: (result: GetInternalPresenceTokensResult) => Record<string, string>;
|
|
44
|
+
|
|
45
|
+
declare const getHeadlessEthereumMethods: ({ transport, passkey, publishableKey, relyingPartyOrigin, }: {
|
|
46
|
+
transport: Transport;
|
|
47
|
+
passkey: PasskeyAssertor;
|
|
48
|
+
publishableKey: string;
|
|
49
|
+
relyingPartyOrigin: string;
|
|
20
50
|
}) => {
|
|
21
51
|
signEthereumMessageHeadless: (params: EthereumSignMessageParams) => Promise<EthereumSignMessageResult>;
|
|
22
52
|
signEthereumTransactionHeadless: (params: EthereumSignTransactionParams) => Promise<EthereumSignTransactionResult>;
|
|
@@ -34,10 +64,11 @@ declare const getHeadlessEthereumMethods: ({ transport, passkey, publishableKey,
|
|
|
34
64
|
}) => Promise<unknown>;
|
|
35
65
|
};
|
|
36
66
|
|
|
37
|
-
declare const getHeadlessSolanaMethods: ({ transport, passkey, publishableKey, }: {
|
|
67
|
+
declare const getHeadlessSolanaMethods: ({ transport, passkey, publishableKey, relyingPartyOrigin, }: {
|
|
38
68
|
transport: Transport;
|
|
39
69
|
passkey: PasskeyAssertor;
|
|
40
70
|
publishableKey: string;
|
|
71
|
+
relyingPartyOrigin: string;
|
|
41
72
|
}) => {
|
|
42
73
|
signSolanaMessageHeadless: (params: SolanaSignMessageParams) => Promise<SolanaSignMessageResult>;
|
|
43
74
|
signSolanaTransactionHeadless: (params: SolanaSignTransactionParams) => Promise<SolanaSignTransactionResult>;
|
|
@@ -59,17 +90,19 @@ interface VerifyOAuthParams {
|
|
|
59
90
|
token?: string;
|
|
60
91
|
state?: string;
|
|
61
92
|
}
|
|
62
|
-
declare const getHeadlessAuthenticationMethods: ({ transport, publishableKey,
|
|
93
|
+
declare const getHeadlessAuthenticationMethods: ({ transport, publishableKey, setIsAuthenticated, setUser, }: {
|
|
63
94
|
transport: Transport;
|
|
64
95
|
publishableKey: string;
|
|
65
|
-
emailConfig?: {
|
|
66
|
-
expiresIn?: number;
|
|
67
|
-
};
|
|
68
96
|
setIsAuthenticated?: (isAuth: boolean) => void;
|
|
69
97
|
setUser?: (user: unknown | null) => void;
|
|
70
98
|
}) => {
|
|
71
|
-
/**
|
|
72
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Send a one-time passcode to the user's email address. Returns the
|
|
101
|
+
* server's response — most importantly `expires_at` (unix seconds),
|
|
102
|
+
* which the UI uses to render a countdown that cannot drift from the
|
|
103
|
+
* authoritative server-side TTL.
|
|
104
|
+
*/
|
|
105
|
+
sendCode: (params: SendCodeParams) => Promise<SendEmailOtpResponse>;
|
|
73
106
|
/**
|
|
74
107
|
* Verify the OTP and complete the login. The iframe-app handles
|
|
75
108
|
* session persistence; on success the SDK flips isAuthenticated and
|
|
@@ -84,11 +117,12 @@ declare const getHeadlessAuthenticationMethods: ({ transport, publishableKey, em
|
|
|
84
117
|
verifyOAuth: (params: VerifyOAuthParams) => Promise<unknown>;
|
|
85
118
|
};
|
|
86
119
|
|
|
87
|
-
declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publishableKey, setIsAuthenticated, setUser, }: {
|
|
120
|
+
declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publishableKey, relyingPartyOrigin, setIsAuthenticated, setUser, }: {
|
|
88
121
|
transport: Transport;
|
|
89
122
|
passkey: PasskeyAssertor;
|
|
90
123
|
storage: KvStorage;
|
|
91
124
|
publishableKey: string;
|
|
125
|
+
relyingPartyOrigin: string;
|
|
92
126
|
setIsAuthenticated?: (isAuth: boolean) => void;
|
|
93
127
|
setUser?: (user: unknown | null) => void;
|
|
94
128
|
}) => {
|
|
@@ -97,13 +131,10 @@ declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publish
|
|
|
97
131
|
createWallet: (walletType: "solana" | "ethereum", options?: {
|
|
98
132
|
createAdditional?: boolean;
|
|
99
133
|
walletIndex?: number;
|
|
100
|
-
requireFreshAssertion?: boolean;
|
|
101
134
|
}) => Promise<{
|
|
102
135
|
wallet: PublicWallet;
|
|
103
136
|
}>;
|
|
104
|
-
importKey: (walletType: "solana" | "ethereum", key: string
|
|
105
|
-
requireFreshAssertion?: boolean;
|
|
106
|
-
}) => Promise<{
|
|
137
|
+
importKey: (walletType: "solana" | "ethereum", key: string) => Promise<{
|
|
107
138
|
wallet: PublicWallet;
|
|
108
139
|
}>;
|
|
109
140
|
getWallets: (walletType: "solana" | "ethereum") => Promise<{
|
|
@@ -123,4 +154,4 @@ declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publish
|
|
|
123
154
|
getUser: () => Promise<unknown>;
|
|
124
155
|
};
|
|
125
156
|
|
|
126
|
-
export { type AssertPasskeyInParentResult, KvStorage, type LoginWithCodeParams, PasskeyAssertor, type SendCodeParams, Transport, type VerifyOAuthParams, assertPasskeyInParent, getHeadlessAuthenticationMethods, getHeadlessEthereumMethods, getHeadlessGeneralMethods, getHeadlessSolanaMethods };
|
|
157
|
+
export { type AssertPasskeyInParentResult, type GetInternalPresenceTokensResult, type GetPresenceTokenResult, KvStorage, type LoginWithCodeParams, PasskeyAssertor, type ScopedPresenceToken, type SendCodeParams, Transport, type VerifyOAuthParams, assertPasskeyInParent, flattenPresenceTokens, getHeadlessAuthenticationMethods, getHeadlessEthereumMethods, getHeadlessGeneralMethods, getHeadlessSolanaMethods, getInternalPresenceTokens, getPresenceToken };
|