@mdbase-dev/connect 0.1.0-beta.55 → 0.1.0-beta.57
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 +1 -1
- package/dist/authority-sync-request.d.ts +3 -0
- package/dist/authority-sync-request.js +20 -0
- package/dist/browser/integrity.json +1 -1
- package/dist/browser/mdbase-connect.min.js +3 -3
- package/dist/browser/mdbase-connect.min.js.sha384 +1 -1
- package/dist/connect.d.ts +0 -2
- package/dist/connect.js +7 -31
- package/dist/connection-transport-internals.d.ts +22 -0
- package/dist/connection-transport-internals.js +1 -0
- package/dist/connection-transport.d.ts +2 -22
- package/dist/connection-transport.js +24 -22
- package/dist/crypto.js +22 -9
- package/dist/fresh-encrypted-request.d.ts +4 -0
- package/dist/fresh-encrypted-request.js +28 -0
- package/dist/local-file-transport.d.ts +1 -0
- package/dist/local-file-transport.js +28 -5
- package/dist/pending-recovery-transports.d.ts +4 -0
- package/dist/pending-recovery-transports.js +48 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -518,7 +518,7 @@ and the shell passes that URL to `completeAuthorization()`. PKCE prevents the
|
|
|
518
518
|
callback code from being exchanged without the pending application state and
|
|
519
519
|
verifier.
|
|
520
520
|
|
|
521
|
-
New authorizations require operation transport
|
|
521
|
+
New authorizations require operation transport v3 and grant encryption profile
|
|
522
522
|
v1 by default. The SDK keeps independent non-extractable P-256 ECDH agreement
|
|
523
523
|
and ECDSA signing keys plus an atomic message counter in IndexedDB. It encrypts
|
|
524
524
|
operation inputs for the connector, decrypts connector results locally, and
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { GrantKeyStore } from "./crypto.js";
|
|
2
|
+
import type { StoredToken } from "./internal-types.js";
|
|
3
|
+
export declare function sendAuthoritySyncRequest(keyStore: GrantKeyStore, token: StoredToken, method: "GET" | "POST", path: string, input: unknown, signal: AbortSignal): Promise<Response>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { authorityProofHeaders } from "./authority-proof.js";
|
|
2
|
+
import { connectError } from "./errors.js";
|
|
3
|
+
export async function sendAuthoritySyncRequest(keyStore, token, method, path, input, signal) {
|
|
4
|
+
if (!token.authority) {
|
|
5
|
+
throw connectError("not_remote_authority", "This authorization has no remote authority endpoint.");
|
|
6
|
+
}
|
|
7
|
+
const url = `${token.authority.syncUrl}/${path}`;
|
|
8
|
+
const body = input === undefined ? undefined : JSON.stringify(input);
|
|
9
|
+
const proof = await authorityProofHeaders(keyStore, token, method, url, body, token.authority.accessToken);
|
|
10
|
+
return fetch(url, {
|
|
11
|
+
method,
|
|
12
|
+
headers: {
|
|
13
|
+
authorization: `Bearer ${token.authority.accessToken}`,
|
|
14
|
+
...(input === undefined ? {} : { "content-type": "application/json" }),
|
|
15
|
+
...proof
|
|
16
|
+
},
|
|
17
|
+
...(body === undefined ? {} : { body }),
|
|
18
|
+
signal
|
|
19
|
+
});
|
|
20
|
+
}
|