@ikonai/sdk 1.3.5 → 1.3.6
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/index.d.ts +1 -1
- package/index.js +1692 -1675
- package/package.json +1 -1
- package/utils/embedded-oauth.d.ts +25 -0
package/package.json
CHANGED
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
/** What the frame asks its embedder for, and what the embedder answers to claim the request. */
|
|
15
15
|
export declare const EMBEDDER_SIGN_IN_REQUEST = "ikon-oauth-embedder-request";
|
|
16
16
|
export declare const EMBEDDER_SIGN_IN_ACCEPTED = "ikon-oauth-embedder-accepted";
|
|
17
|
+
/** What a frame sends to collect a sign-in the embedder completed for it, and the answer it gets. */
|
|
18
|
+
export declare const EMBEDDER_RESULT_CLAIM = "ikon-oauth-embedder-claim";
|
|
19
|
+
export declare const EMBEDDER_RESULT = "ikon-oauth-embedder-result";
|
|
20
|
+
export interface EmbeddedOAuthResult {
|
|
21
|
+
code: string;
|
|
22
|
+
provider: string;
|
|
23
|
+
codeVerifier: string | null;
|
|
24
|
+
}
|
|
17
25
|
/**
|
|
18
26
|
* Carries the verifier back to the frame on its own URL, beside the code.
|
|
19
27
|
*
|
|
@@ -49,6 +57,23 @@ export declare function isEmbedded(): boolean;
|
|
|
49
57
|
* to the person. Throws nothing — a failed sign-in is an outcome, not an exception.
|
|
50
58
|
*/
|
|
51
59
|
export declare function startEmbeddedOAuthSignIn(provider: string, spaceId: string): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Collect a sign-in the embedder ran on this frame's behalf, and hand it to `deliver`.
|
|
62
|
+
*
|
|
63
|
+
* The result travels as a message rather than on this frame's address, because an address can be
|
|
64
|
+
* given to any number of documents. An embedder that reassigns the frame's src while the preview
|
|
65
|
+
* settles hands the same single-use code to each of them, and every redemption after the first
|
|
66
|
+
* fails against a code the first already spent — which reports a sign-in as broken to whichever
|
|
67
|
+
* document is left on screen, moments after it actually succeeded. A message has one recipient, and
|
|
68
|
+
* the embedder drops its copy as it answers, so the code cannot be presented twice.
|
|
69
|
+
*
|
|
70
|
+
* The claim is sent on mount rather than waited for: an embedder holding nothing simply never
|
|
71
|
+
* answers, and the app resolves its session exactly as it would unembedded instead of pausing every
|
|
72
|
+
* framed boot on a timeout.
|
|
73
|
+
*
|
|
74
|
+
* Returns a function that stops listening.
|
|
75
|
+
*/
|
|
76
|
+
export declare function onEmbeddedOAuthResult(spaceId: string, deliver: (result: EmbeddedOAuthResult) => void): () => void;
|
|
52
77
|
/**
|
|
53
78
|
* Take a verifier off this document's URL and put it back where the exchange looks for it.
|
|
54
79
|
*
|