@mdbase-dev/connect 0.1.0-beta.55 → 0.1.0-beta.56

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 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 v2 and grant encryption profile
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
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "file": "mdbase-connect.min.js",
3
- "integrity": "sha384-6M+exMhOm+JESB8xqgBNPFnykP6bx043yY1RbfIP4UidAlareN3dFvCVZDSd1/aj"
3
+ "integrity": "sha384-fZeP3Z5L7qaOmLPO0ST72DyQgwJCq0XaamP4LFUHOTWxA2MTeF4eerxdIfULZkEq"
4
4
  }