@reclaimprotocol/client 0.1.37 → 0.1.39
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/lib/launch/extension.js
CHANGED
|
@@ -2,6 +2,10 @@ export const RECLAIM_EXTENSION_CHECK = 'RECLAIM_EXTENSION_CHECK';
|
|
|
2
2
|
export const RECLAIM_EXTENSION_RESPONSE = 'RECLAIM_EXTENSION_RESPONSE';
|
|
3
3
|
export const RECLAIM_START_VERIFICATION = 'RECLAIM_START_VERIFICATION';
|
|
4
4
|
export const RECLAIM_CANCEL_VERIFICATION = 'RECLAIM_CANCEL_VERIFICATION';
|
|
5
|
+
/** `postMessage` target for the page's own window, where the extension's
|
|
6
|
+
* content script listens: only a receiver on this page's origin gets the
|
|
7
|
+
* session id, never a frame or opener on another origin. */
|
|
8
|
+
const SAME_ORIGIN = '/';
|
|
5
9
|
function isRecord(value) {
|
|
6
10
|
return typeof value === 'object' && value !== null;
|
|
7
11
|
}
|
|
@@ -39,7 +43,7 @@ export function probeExtension(env, options = {}) {
|
|
|
39
43
|
action: RECLAIM_EXTENSION_CHECK,
|
|
40
44
|
extensionID: options.extensionID,
|
|
41
45
|
messageId,
|
|
42
|
-
},
|
|
46
|
+
}, SAME_ORIGIN);
|
|
43
47
|
});
|
|
44
48
|
}
|
|
45
49
|
/** Hands the session off to the extension. No navigation, no return value —
|
|
@@ -57,7 +61,7 @@ export function sendExtensionStartVerification(env, handoff) {
|
|
|
57
61
|
...(handoff.diag ? { diagnosticMode: true } : {}),
|
|
58
62
|
},
|
|
59
63
|
},
|
|
60
|
-
},
|
|
64
|
+
}, SAME_ORIGIN);
|
|
61
65
|
}
|
|
62
66
|
/** Tears down the extension's in-progress verification UI. This is what
|
|
63
67
|
* `FlowHandle.close()` does for the extension-handoff mechanism — there's
|
|
@@ -68,5 +72,5 @@ export function sendExtensionCancelVerification(env, handoff) {
|
|
|
68
72
|
action: RECLAIM_CANCEL_VERIFICATION,
|
|
69
73
|
messageId: handoff.sessionId,
|
|
70
74
|
extensionID: handoff.extensionID,
|
|
71
|
-
},
|
|
75
|
+
}, SAME_ORIGIN);
|
|
72
76
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reclaimprotocol/client",
|
|
3
3
|
"title": "Reclaim Client",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.39",
|
|
5
5
|
"description": "Typed SDK/HTTP client SDK for the Reclaim Protocol — the programmatic way to use Reclaim Protocol to verify **data points** about your users (a follower count, an account balance, an order). Can be directly integrated by apps to request verification for their users using Reclaim Protocol and verify the results.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
package/src/launch/extension.ts
CHANGED
|
@@ -27,6 +27,11 @@ export interface ExtensionHandoff {
|
|
|
27
27
|
extensionID?: string
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/** `postMessage` target for the page's own window, where the extension's
|
|
31
|
+
* content script listens: only a receiver on this page's origin gets the
|
|
32
|
+
* session id, never a frame or opener on another origin. */
|
|
33
|
+
const SAME_ORIGIN = '/'
|
|
34
|
+
|
|
30
35
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
31
36
|
return typeof value === 'object' && value !== null
|
|
32
37
|
}
|
|
@@ -76,7 +81,7 @@ export function probeExtension(
|
|
|
76
81
|
extensionID: options.extensionID,
|
|
77
82
|
messageId,
|
|
78
83
|
},
|
|
79
|
-
|
|
84
|
+
SAME_ORIGIN,
|
|
80
85
|
)
|
|
81
86
|
})
|
|
82
87
|
}
|
|
@@ -101,7 +106,7 @@ export function sendExtensionStartVerification(
|
|
|
101
106
|
},
|
|
102
107
|
},
|
|
103
108
|
},
|
|
104
|
-
|
|
109
|
+
SAME_ORIGIN,
|
|
105
110
|
)
|
|
106
111
|
}
|
|
107
112
|
|
|
@@ -119,6 +124,6 @@ export function sendExtensionCancelVerification(
|
|
|
119
124
|
messageId: handoff.sessionId,
|
|
120
125
|
extensionID: handoff.extensionID,
|
|
121
126
|
},
|
|
122
|
-
|
|
127
|
+
SAME_ORIGIN,
|
|
123
128
|
)
|
|
124
129
|
}
|