@moon-x/core 0.5.0 → 0.7.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/dist/{interfaces-BdIeMGGD.d.mts → interfaces-BWxOajnD.d.mts} +16 -1
- package/dist/{interfaces-1vfik3Ef.d.ts → interfaces-BZ5GMWS9.d.ts} +16 -1
- package/dist/react/index.d.mts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/sdk/index.d.mts +10 -9
- package/dist/sdk/index.d.ts +10 -9
- package/dist/sdk/index.js +15 -6
- package/dist/sdk/index.mjs +14 -6
- package/dist/web/index.d.mts +1 -1
- package/dist/web/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -148,6 +148,21 @@ interface WebAuthnAssertionResponse {
|
|
|
148
148
|
clientExtensionResults?: Record<string, unknown>;
|
|
149
149
|
authenticatorAttachment?: string;
|
|
150
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* RelyingPartyOriginInput — the WebAuthn relying-party origin the
|
|
153
|
+
* presence/register orchestrators thread to `/presence/begin` so the
|
|
154
|
+
* server can rebuild the per-app RP config.
|
|
155
|
+
*
|
|
156
|
+
* Web passes a plain string (`window.location.origin`) — the browser
|
|
157
|
+
* always has an ambient origin. RN has none, so it passes a thunk that
|
|
158
|
+
* derives `https://<rp_id>` from the iframe's `GET_DEK_INFO` (and
|
|
159
|
+
* memoizes the round-trip). Resolved lazily at call time via
|
|
160
|
+
* `resolveRelyingPartyOrigin` — i.e. always after auth, when
|
|
161
|
+
* `GET_DEK_INFO` is answerable.
|
|
162
|
+
*/
|
|
163
|
+
type RelyingPartyOriginInput = string | (() => string | Promise<string>);
|
|
164
|
+
/** Resolve a {@link RelyingPartyOriginInput} to its string value. */
|
|
165
|
+
declare const resolveRelyingPartyOrigin: (input: RelyingPartyOriginInput) => Promise<string>;
|
|
151
166
|
/**
|
|
152
167
|
* KvStorage — async key/value storage for ID tokens + session metadata.
|
|
153
168
|
* Web wraps `localStorage` (sync, lifted to a resolved Promise); RN
|
|
@@ -189,4 +204,4 @@ interface PlatformImpls {
|
|
|
189
204
|
oauth: OAuthOpener;
|
|
190
205
|
}
|
|
191
206
|
|
|
192
|
-
export type
|
|
207
|
+
export { type KvStorage as K, type OAuthOpener as O, type PasskeyAssertor as P, type RelyingPartyOriginInput as R, type Transport as T, type WebAuthnAssertionResponse as W, type PlatformImpls as a, type WebAuthnRequestOptions as b, resolveRelyingPartyOrigin as r };
|
|
@@ -148,6 +148,21 @@ interface WebAuthnAssertionResponse {
|
|
|
148
148
|
clientExtensionResults?: Record<string, unknown>;
|
|
149
149
|
authenticatorAttachment?: string;
|
|
150
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* RelyingPartyOriginInput — the WebAuthn relying-party origin the
|
|
153
|
+
* presence/register orchestrators thread to `/presence/begin` so the
|
|
154
|
+
* server can rebuild the per-app RP config.
|
|
155
|
+
*
|
|
156
|
+
* Web passes a plain string (`window.location.origin`) — the browser
|
|
157
|
+
* always has an ambient origin. RN has none, so it passes a thunk that
|
|
158
|
+
* derives `https://<rp_id>` from the iframe's `GET_DEK_INFO` (and
|
|
159
|
+
* memoizes the round-trip). Resolved lazily at call time via
|
|
160
|
+
* `resolveRelyingPartyOrigin` — i.e. always after auth, when
|
|
161
|
+
* `GET_DEK_INFO` is answerable.
|
|
162
|
+
*/
|
|
163
|
+
type RelyingPartyOriginInput = string | (() => string | Promise<string>);
|
|
164
|
+
/** Resolve a {@link RelyingPartyOriginInput} to its string value. */
|
|
165
|
+
declare const resolveRelyingPartyOrigin: (input: RelyingPartyOriginInput) => Promise<string>;
|
|
151
166
|
/**
|
|
152
167
|
* KvStorage — async key/value storage for ID tokens + session metadata.
|
|
153
168
|
* Web wraps `localStorage` (sync, lifted to a resolved Promise); RN
|
|
@@ -189,4 +204,4 @@ interface PlatformImpls {
|
|
|
189
204
|
oauth: OAuthOpener;
|
|
190
205
|
}
|
|
191
206
|
|
|
192
|
-
export type
|
|
207
|
+
export { type KvStorage as K, type OAuthOpener as O, type PasskeyAssertor as P, type RelyingPartyOriginInput as R, type Transport as T, type WebAuthnAssertionResponse as W, type PlatformImpls as a, type WebAuthnRequestOptions as b, resolveRelyingPartyOrigin as r };
|
package/dist/react/index.d.mts
CHANGED
|
@@ -93,9 +93,9 @@ declare const useLoginWithEmail: (callbacks?: UseLoginWithEmailCallbacks) => {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
interface RegisterPasskeyResult {
|
|
96
|
-
/** RN headless
|
|
96
|
+
/** Credential id of the enrolled passkey (RN headless + web modal paths) */
|
|
97
97
|
credential_id?: string;
|
|
98
|
-
/**
|
|
98
|
+
/** true on successful enroll (both platforms); false only on web skip */
|
|
99
99
|
passkey_registered?: boolean;
|
|
100
100
|
}
|
|
101
101
|
interface UseRegisterPasskeyResult {
|
package/dist/react/index.d.ts
CHANGED
|
@@ -93,9 +93,9 @@ declare const useLoginWithEmail: (callbacks?: UseLoginWithEmailCallbacks) => {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
interface RegisterPasskeyResult {
|
|
96
|
-
/** RN headless
|
|
96
|
+
/** Credential id of the enrolled passkey (RN headless + web modal paths) */
|
|
97
97
|
credential_id?: string;
|
|
98
|
-
/**
|
|
98
|
+
/** true on successful enroll (both platforms); false only on web skip */
|
|
99
99
|
passkey_registered?: boolean;
|
|
100
100
|
}
|
|
101
101
|
interface UseRegisterPasskeyResult {
|
package/dist/sdk/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-
|
|
2
|
-
export { O as OAuthOpener, a as PlatformImpls, W as WebAuthnAssertionResponse, b as WebAuthnRequestOptions } from '../interfaces-
|
|
1
|
+
import { T as Transport, P as PasskeyAssertor, R as RelyingPartyOriginInput, K as KvStorage } from '../interfaces-BWxOajnD.mjs';
|
|
2
|
+
export { O as OAuthOpener, a as PlatformImpls, W as WebAuthnAssertionResponse, b as WebAuthnRequestOptions, r as resolveRelyingPartyOrigin } from '../interfaces-BWxOajnD.mjs';
|
|
3
3
|
import { C as CachedAssertion } from '../passkey-cache-WnDFQ-v4.mjs';
|
|
4
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, ProvisionEphemeralSignerParams, ProvisionEphemeralSignerResult, ListEphemeralSignersResult, RevokeEphemeralSignerParams } from '../types/index.mjs';
|
|
5
5
|
import '../post-message-Z6cLf0mS.mjs';
|
|
@@ -16,11 +16,12 @@ interface GetPresenceTokenResult {
|
|
|
16
16
|
presenceToken: string;
|
|
17
17
|
expiresAt: number;
|
|
18
18
|
}
|
|
19
|
-
declare const getPresenceToken: ({ transport, passkey, publishableKey, relyingPartyOrigin, }: {
|
|
19
|
+
declare const getPresenceToken: ({ transport, passkey, publishableKey, relyingPartyOrigin, expiresInSecs, }: {
|
|
20
20
|
transport: Transport;
|
|
21
21
|
passkey: PasskeyAssertor;
|
|
22
22
|
publishableKey: string;
|
|
23
|
-
relyingPartyOrigin:
|
|
23
|
+
relyingPartyOrigin: RelyingPartyOriginInput;
|
|
24
|
+
expiresInSecs?: number;
|
|
24
25
|
}) => Promise<GetPresenceTokenResult>;
|
|
25
26
|
|
|
26
27
|
interface ScopedPresenceToken {
|
|
@@ -37,7 +38,7 @@ declare const getInternalPresenceTokens: ({ transport, passkey, publishableKey,
|
|
|
37
38
|
transport: Transport;
|
|
38
39
|
passkey: PasskeyAssertor;
|
|
39
40
|
publishableKey: string;
|
|
40
|
-
relyingPartyOrigin:
|
|
41
|
+
relyingPartyOrigin: RelyingPartyOriginInput;
|
|
41
42
|
scopes?: string[];
|
|
42
43
|
scopeCounts?: Record<string, number>;
|
|
43
44
|
}) => Promise<GetInternalPresenceTokensResult>;
|
|
@@ -47,7 +48,7 @@ declare const getHeadlessEthereumMethods: ({ transport, passkey, publishableKey,
|
|
|
47
48
|
transport: Transport;
|
|
48
49
|
passkey: PasskeyAssertor;
|
|
49
50
|
publishableKey: string;
|
|
50
|
-
relyingPartyOrigin:
|
|
51
|
+
relyingPartyOrigin: RelyingPartyOriginInput;
|
|
51
52
|
}) => {
|
|
52
53
|
signEthereumMessageHeadless: (params: EthereumSignMessageParams) => Promise<EthereumSignMessageResult>;
|
|
53
54
|
signEthereumTransactionHeadless: (params: EthereumSignTransactionParams) => Promise<EthereumSignTransactionResult>;
|
|
@@ -69,7 +70,7 @@ declare const getHeadlessSolanaMethods: ({ transport, passkey, publishableKey, r
|
|
|
69
70
|
transport: Transport;
|
|
70
71
|
passkey: PasskeyAssertor;
|
|
71
72
|
publishableKey: string;
|
|
72
|
-
relyingPartyOrigin:
|
|
73
|
+
relyingPartyOrigin: RelyingPartyOriginInput;
|
|
73
74
|
}) => {
|
|
74
75
|
signSolanaMessageHeadless: (params: SolanaSignMessageParams) => Promise<SolanaSignMessageResult>;
|
|
75
76
|
signSolanaTransactionHeadless: (params: SolanaSignTransactionParams) => Promise<SolanaSignTransactionResult>;
|
|
@@ -123,7 +124,7 @@ declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publish
|
|
|
123
124
|
passkey: PasskeyAssertor;
|
|
124
125
|
storage: KvStorage;
|
|
125
126
|
publishableKey: string;
|
|
126
|
-
relyingPartyOrigin:
|
|
127
|
+
relyingPartyOrigin: RelyingPartyOriginInput;
|
|
127
128
|
setIsAuthenticated?: (isAuth: boolean) => void;
|
|
128
129
|
setUser?: (user: unknown | null) => void;
|
|
129
130
|
}) => {
|
|
@@ -208,4 +209,4 @@ declare class EphemeralSignerSignError extends Error {
|
|
|
208
209
|
}
|
|
209
210
|
declare function signWithEphemeralSigner(input: EphemeralSignerSignInput): Promise<EphemeralSignerSignResult>;
|
|
210
211
|
|
|
211
|
-
export { type AssertPasskeyInParentResult, EphemeralSignerSignError, type EphemeralSignerSignInput, type EphemeralSignerSignResult, type GetInternalPresenceTokensResult, type GetPresenceTokenResult, KvStorage, type LoginWithCodeParams, PasskeyAssertor, type ScopedPresenceToken, type SendCodeParams, Transport, type VerifyOAuthParams, assertPasskeyInParent, flattenPresenceTokens, getHeadlessAuthenticationMethods, getHeadlessEthereumMethods, getHeadlessGeneralMethods, getHeadlessSolanaMethods, getInternalPresenceTokens, getPresenceToken, signWithEphemeralSigner };
|
|
212
|
+
export { type AssertPasskeyInParentResult, EphemeralSignerSignError, type EphemeralSignerSignInput, type EphemeralSignerSignResult, type GetInternalPresenceTokensResult, type GetPresenceTokenResult, KvStorage, type LoginWithCodeParams, PasskeyAssertor, RelyingPartyOriginInput, type ScopedPresenceToken, type SendCodeParams, Transport, type VerifyOAuthParams, assertPasskeyInParent, flattenPresenceTokens, getHeadlessAuthenticationMethods, getHeadlessEthereumMethods, getHeadlessGeneralMethods, getHeadlessSolanaMethods, getInternalPresenceTokens, getPresenceToken, signWithEphemeralSigner };
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-
|
|
2
|
-
export { O as OAuthOpener, a as PlatformImpls, W as WebAuthnAssertionResponse, b as WebAuthnRequestOptions } from '../interfaces-
|
|
1
|
+
import { T as Transport, P as PasskeyAssertor, R as RelyingPartyOriginInput, K as KvStorage } from '../interfaces-BZ5GMWS9.js';
|
|
2
|
+
export { O as OAuthOpener, a as PlatformImpls, W as WebAuthnAssertionResponse, b as WebAuthnRequestOptions, r as resolveRelyingPartyOrigin } from '../interfaces-BZ5GMWS9.js';
|
|
3
3
|
import { C as CachedAssertion } from '../passkey-cache-WnDFQ-v4.js';
|
|
4
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, ProvisionEphemeralSignerParams, ProvisionEphemeralSignerResult, ListEphemeralSignersResult, RevokeEphemeralSignerParams } from '../types/index.js';
|
|
5
5
|
import '../post-message-Z6cLf0mS.js';
|
|
@@ -16,11 +16,12 @@ interface GetPresenceTokenResult {
|
|
|
16
16
|
presenceToken: string;
|
|
17
17
|
expiresAt: number;
|
|
18
18
|
}
|
|
19
|
-
declare const getPresenceToken: ({ transport, passkey, publishableKey, relyingPartyOrigin, }: {
|
|
19
|
+
declare const getPresenceToken: ({ transport, passkey, publishableKey, relyingPartyOrigin, expiresInSecs, }: {
|
|
20
20
|
transport: Transport;
|
|
21
21
|
passkey: PasskeyAssertor;
|
|
22
22
|
publishableKey: string;
|
|
23
|
-
relyingPartyOrigin:
|
|
23
|
+
relyingPartyOrigin: RelyingPartyOriginInput;
|
|
24
|
+
expiresInSecs?: number;
|
|
24
25
|
}) => Promise<GetPresenceTokenResult>;
|
|
25
26
|
|
|
26
27
|
interface ScopedPresenceToken {
|
|
@@ -37,7 +38,7 @@ declare const getInternalPresenceTokens: ({ transport, passkey, publishableKey,
|
|
|
37
38
|
transport: Transport;
|
|
38
39
|
passkey: PasskeyAssertor;
|
|
39
40
|
publishableKey: string;
|
|
40
|
-
relyingPartyOrigin:
|
|
41
|
+
relyingPartyOrigin: RelyingPartyOriginInput;
|
|
41
42
|
scopes?: string[];
|
|
42
43
|
scopeCounts?: Record<string, number>;
|
|
43
44
|
}) => Promise<GetInternalPresenceTokensResult>;
|
|
@@ -47,7 +48,7 @@ declare const getHeadlessEthereumMethods: ({ transport, passkey, publishableKey,
|
|
|
47
48
|
transport: Transport;
|
|
48
49
|
passkey: PasskeyAssertor;
|
|
49
50
|
publishableKey: string;
|
|
50
|
-
relyingPartyOrigin:
|
|
51
|
+
relyingPartyOrigin: RelyingPartyOriginInput;
|
|
51
52
|
}) => {
|
|
52
53
|
signEthereumMessageHeadless: (params: EthereumSignMessageParams) => Promise<EthereumSignMessageResult>;
|
|
53
54
|
signEthereumTransactionHeadless: (params: EthereumSignTransactionParams) => Promise<EthereumSignTransactionResult>;
|
|
@@ -69,7 +70,7 @@ declare const getHeadlessSolanaMethods: ({ transport, passkey, publishableKey, r
|
|
|
69
70
|
transport: Transport;
|
|
70
71
|
passkey: PasskeyAssertor;
|
|
71
72
|
publishableKey: string;
|
|
72
|
-
relyingPartyOrigin:
|
|
73
|
+
relyingPartyOrigin: RelyingPartyOriginInput;
|
|
73
74
|
}) => {
|
|
74
75
|
signSolanaMessageHeadless: (params: SolanaSignMessageParams) => Promise<SolanaSignMessageResult>;
|
|
75
76
|
signSolanaTransactionHeadless: (params: SolanaSignTransactionParams) => Promise<SolanaSignTransactionResult>;
|
|
@@ -123,7 +124,7 @@ declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publish
|
|
|
123
124
|
passkey: PasskeyAssertor;
|
|
124
125
|
storage: KvStorage;
|
|
125
126
|
publishableKey: string;
|
|
126
|
-
relyingPartyOrigin:
|
|
127
|
+
relyingPartyOrigin: RelyingPartyOriginInput;
|
|
127
128
|
setIsAuthenticated?: (isAuth: boolean) => void;
|
|
128
129
|
setUser?: (user: unknown | null) => void;
|
|
129
130
|
}) => {
|
|
@@ -208,4 +209,4 @@ declare class EphemeralSignerSignError extends Error {
|
|
|
208
209
|
}
|
|
209
210
|
declare function signWithEphemeralSigner(input: EphemeralSignerSignInput): Promise<EphemeralSignerSignResult>;
|
|
210
211
|
|
|
211
|
-
export { type AssertPasskeyInParentResult, EphemeralSignerSignError, type EphemeralSignerSignInput, type EphemeralSignerSignResult, type GetInternalPresenceTokensResult, type GetPresenceTokenResult, KvStorage, type LoginWithCodeParams, PasskeyAssertor, type ScopedPresenceToken, type SendCodeParams, Transport, type VerifyOAuthParams, assertPasskeyInParent, flattenPresenceTokens, getHeadlessAuthenticationMethods, getHeadlessEthereumMethods, getHeadlessGeneralMethods, getHeadlessSolanaMethods, getInternalPresenceTokens, getPresenceToken, signWithEphemeralSigner };
|
|
212
|
+
export { type AssertPasskeyInParentResult, EphemeralSignerSignError, type EphemeralSignerSignInput, type EphemeralSignerSignResult, type GetInternalPresenceTokensResult, type GetPresenceTokenResult, KvStorage, type LoginWithCodeParams, PasskeyAssertor, RelyingPartyOriginInput, type ScopedPresenceToken, type SendCodeParams, Transport, type VerifyOAuthParams, assertPasskeyInParent, flattenPresenceTokens, getHeadlessAuthenticationMethods, getHeadlessEthereumMethods, getHeadlessGeneralMethods, getHeadlessSolanaMethods, getInternalPresenceTokens, getPresenceToken, signWithEphemeralSigner };
|
package/dist/sdk/index.js
CHANGED
|
@@ -39,10 +39,14 @@ __export(sdk_exports, {
|
|
|
39
39
|
getHeadlessSolanaMethods: () => getHeadlessSolanaMethods,
|
|
40
40
|
getInternalPresenceTokens: () => getInternalPresenceTokens,
|
|
41
41
|
getPresenceToken: () => getPresenceToken,
|
|
42
|
+
resolveRelyingPartyOrigin: () => resolveRelyingPartyOrigin,
|
|
42
43
|
signWithEphemeralSigner: () => signWithEphemeralSigner
|
|
43
44
|
});
|
|
44
45
|
module.exports = __toCommonJS(sdk_exports);
|
|
45
46
|
|
|
47
|
+
// src/sdk/interfaces.ts
|
|
48
|
+
var resolveRelyingPartyOrigin = async (input) => typeof input === "function" ? input() : input;
|
|
49
|
+
|
|
46
50
|
// src/lib/auth/authentication-state.ts
|
|
47
51
|
var AuthenticationState = class {
|
|
48
52
|
constructor() {
|
|
@@ -343,12 +347,14 @@ var getPresenceToken = async ({
|
|
|
343
347
|
transport,
|
|
344
348
|
passkey,
|
|
345
349
|
publishableKey,
|
|
346
|
-
relyingPartyOrigin
|
|
350
|
+
relyingPartyOrigin,
|
|
351
|
+
expiresInSecs
|
|
347
352
|
}) => {
|
|
353
|
+
const rpOrigin = await resolveRelyingPartyOrigin(relyingPartyOrigin);
|
|
348
354
|
const { token, optionsJSON } = await transport.send(
|
|
349
355
|
PostMessageType.AUTH,
|
|
350
356
|
PostMessageMethod.PASSKEY_PRESENCE_BEGIN,
|
|
351
|
-
{ publishableKey, relyingPartyOrigin }
|
|
357
|
+
{ publishableKey, relyingPartyOrigin: rpOrigin }
|
|
352
358
|
);
|
|
353
359
|
const response = await passkey.assertForServer({ optionsJSON });
|
|
354
360
|
const verify = await transport.send(
|
|
@@ -356,9 +362,10 @@ var getPresenceToken = async ({
|
|
|
356
362
|
PostMessageMethod.PASSKEY_PRESENCE_VERIFY,
|
|
357
363
|
{
|
|
358
364
|
publishableKey,
|
|
359
|
-
relyingPartyOrigin,
|
|
365
|
+
relyingPartyOrigin: rpOrigin,
|
|
360
366
|
token,
|
|
361
|
-
response
|
|
367
|
+
response,
|
|
368
|
+
...typeof expiresInSecs === "number" && expiresInSecs > 0 ? { ttl_secs: expiresInSecs } : {}
|
|
362
369
|
}
|
|
363
370
|
);
|
|
364
371
|
return {
|
|
@@ -376,15 +383,16 @@ var getInternalPresenceTokens = async ({
|
|
|
376
383
|
scopes,
|
|
377
384
|
scopeCounts
|
|
378
385
|
}) => {
|
|
386
|
+
const rpOrigin = await resolveRelyingPartyOrigin(relyingPartyOrigin);
|
|
379
387
|
const { token, optionsJSON } = await transport.send(
|
|
380
388
|
PostMessageType.AUTH,
|
|
381
389
|
PostMessageMethod.PASSKEY_PRESENCE_BEGIN,
|
|
382
|
-
{ publishableKey, relyingPartyOrigin }
|
|
390
|
+
{ publishableKey, relyingPartyOrigin: rpOrigin }
|
|
383
391
|
);
|
|
384
392
|
const { response, userHandleB64url, credentialIdB64url } = await passkey.assertForInternalPresence({ optionsJSON });
|
|
385
393
|
const verifyPayload = {
|
|
386
394
|
publishableKey,
|
|
387
|
-
relyingPartyOrigin,
|
|
395
|
+
relyingPartyOrigin: rpOrigin,
|
|
388
396
|
token,
|
|
389
397
|
response,
|
|
390
398
|
purpose: "internal"
|
|
@@ -1263,5 +1271,6 @@ async function signWithEphemeralSigner(input) {
|
|
|
1263
1271
|
getHeadlessSolanaMethods,
|
|
1264
1272
|
getInternalPresenceTokens,
|
|
1265
1273
|
getPresenceToken,
|
|
1274
|
+
resolveRelyingPartyOrigin,
|
|
1266
1275
|
signWithEphemeralSigner
|
|
1267
1276
|
});
|
package/dist/sdk/index.mjs
CHANGED
|
@@ -13,6 +13,9 @@ import {
|
|
|
13
13
|
} from "../chunk-I56GRKAG.mjs";
|
|
14
14
|
import "../chunk-GQKIA37O.mjs";
|
|
15
15
|
|
|
16
|
+
// src/sdk/interfaces.ts
|
|
17
|
+
var resolveRelyingPartyOrigin = async (input) => typeof input === "function" ? input() : input;
|
|
18
|
+
|
|
16
19
|
// src/sdk/parent-passkey-assert.ts
|
|
17
20
|
var assertPasskeyInParent = async ({
|
|
18
21
|
transport,
|
|
@@ -54,12 +57,14 @@ var getPresenceToken = async ({
|
|
|
54
57
|
transport,
|
|
55
58
|
passkey,
|
|
56
59
|
publishableKey,
|
|
57
|
-
relyingPartyOrigin
|
|
60
|
+
relyingPartyOrigin,
|
|
61
|
+
expiresInSecs
|
|
58
62
|
}) => {
|
|
63
|
+
const rpOrigin = await resolveRelyingPartyOrigin(relyingPartyOrigin);
|
|
59
64
|
const { token, optionsJSON } = await transport.send(
|
|
60
65
|
PostMessageType.AUTH,
|
|
61
66
|
PostMessageMethod.PASSKEY_PRESENCE_BEGIN,
|
|
62
|
-
{ publishableKey, relyingPartyOrigin }
|
|
67
|
+
{ publishableKey, relyingPartyOrigin: rpOrigin }
|
|
63
68
|
);
|
|
64
69
|
const response = await passkey.assertForServer({ optionsJSON });
|
|
65
70
|
const verify = await transport.send(
|
|
@@ -67,9 +72,10 @@ var getPresenceToken = async ({
|
|
|
67
72
|
PostMessageMethod.PASSKEY_PRESENCE_VERIFY,
|
|
68
73
|
{
|
|
69
74
|
publishableKey,
|
|
70
|
-
relyingPartyOrigin,
|
|
75
|
+
relyingPartyOrigin: rpOrigin,
|
|
71
76
|
token,
|
|
72
|
-
response
|
|
77
|
+
response,
|
|
78
|
+
...typeof expiresInSecs === "number" && expiresInSecs > 0 ? { ttl_secs: expiresInSecs } : {}
|
|
73
79
|
}
|
|
74
80
|
);
|
|
75
81
|
return {
|
|
@@ -87,15 +93,16 @@ var getInternalPresenceTokens = async ({
|
|
|
87
93
|
scopes,
|
|
88
94
|
scopeCounts
|
|
89
95
|
}) => {
|
|
96
|
+
const rpOrigin = await resolveRelyingPartyOrigin(relyingPartyOrigin);
|
|
90
97
|
const { token, optionsJSON } = await transport.send(
|
|
91
98
|
PostMessageType.AUTH,
|
|
92
99
|
PostMessageMethod.PASSKEY_PRESENCE_BEGIN,
|
|
93
|
-
{ publishableKey, relyingPartyOrigin }
|
|
100
|
+
{ publishableKey, relyingPartyOrigin: rpOrigin }
|
|
94
101
|
);
|
|
95
102
|
const { response, userHandleB64url, credentialIdB64url } = await passkey.assertForInternalPresence({ optionsJSON });
|
|
96
103
|
const verifyPayload = {
|
|
97
104
|
publishableKey,
|
|
98
|
-
relyingPartyOrigin,
|
|
105
|
+
relyingPartyOrigin: rpOrigin,
|
|
99
106
|
token,
|
|
100
107
|
response,
|
|
101
108
|
purpose: "internal"
|
|
@@ -973,5 +980,6 @@ export {
|
|
|
973
980
|
getHeadlessSolanaMethods,
|
|
974
981
|
getInternalPresenceTokens,
|
|
975
982
|
getPresenceToken,
|
|
983
|
+
resolveRelyingPartyOrigin,
|
|
976
984
|
signWithEphemeralSigner
|
|
977
985
|
};
|
package/dist/web/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as PostMessageClient } from '../post-message-Z6cLf0mS.mjs';
|
|
2
|
-
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-
|
|
2
|
+
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-BWxOajnD.mjs';
|
|
3
3
|
|
|
4
4
|
declare const getCachedPostMessageClient: (contentWindow: Window) => PostMessageClient;
|
|
5
5
|
/**
|
package/dist/web/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { P as PostMessageClient } from '../post-message-Z6cLf0mS.js';
|
|
2
|
-
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-
|
|
2
|
+
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-BZ5GMWS9.js';
|
|
3
3
|
|
|
4
4
|
declare const getCachedPostMessageClient: (contentWindow: Window) => PostMessageClient;
|
|
5
5
|
/**
|