@fungi.computer/oyster 0.57.0 → 0.57.2
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/agent-computer-source.js +1 -1
- package/dist/boot-host-script.js +1 -1
- package/dist/credential-migration-002.js +6 -1
- package/dist/embed-metafiles.js +2 -2
- package/dist/embed-scripts.js +2 -2
- package/dist/git.d.ts +8 -2
- package/dist/git.js +12 -3
- package/dist/hello-app-script.js +1 -1
- package/dist/host-page-assets.js +1 -1
- package/dist/host-page.d.ts +4 -1
- package/dist/host-page.js +40 -11
- package/dist/host.d.ts +6 -0
- package/dist/host.js +57 -7
- package/dist/page/port-preview.d.ts +1 -0
- package/dist/page/port-preview.js +33 -0
- package/dist/page-script.js +3 -3
- package/dist/platform-skills.generated.d.ts +1 -1
- package/dist/platform-skills.generated.js +1 -1
- package/dist/port-preview-entry.d.ts +84 -0
- package/dist/port-preview-entry.js +86 -0
- package/dist/standalone/computer.d.ts +2 -3
- package/dist/standalone/computer.js +13 -9
- package/dist/standalone/preview.d.ts +9 -4
- package/dist/standalone/preview.js +35 -44
- package/dist/standalone/worker.js +3 -0
- package/dist/storage-frame.d.ts +3 -3
- package/dist/webhook-delivery.d.ts +1 -0
- package/dist/webhook-delivery.js +1 -1
- package/dist/workers-git.d.ts +19 -0
- package/dist/workers-git.js +98 -5
- package/docs/api/README.md +9 -0
- package/docs/api/git.md +13 -7
- package/docs/api/host.md +1 -0
- package/docs/api/workers-git.md +50 -0
- package/docs/api/workers.md +17 -16
- package/package.json +13 -13
package/dist/git.d.ts
CHANGED
|
@@ -20,8 +20,14 @@ export declare function lsRefsRequest(): Uint8Array;
|
|
|
20
20
|
export declare function parseLsRefs(response: Uint8Array): Awaited<ReturnType<GitBinding["refs"]>>;
|
|
21
21
|
/** The Standard Webhooks `webhook-signature` value for one delivery. */
|
|
22
22
|
export declare function signStandardWebhook(secret: string, id: string, timestamp: number, body: string): Promise<string>;
|
|
23
|
-
/**
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Headers for one signed delivery: Standard Webhooks plus `X-Hub-Signature-256`.
|
|
25
|
+
* While a rotated-out secret is still honoured, `previousSecret` adds its
|
|
26
|
+
* signature after the current one, space-separated as Standard Webhooks
|
|
27
|
+
* allows, so a receiver holding either secret verifies the delivery.
|
|
28
|
+
* `X-Hub-Signature-256` uses only the current secret and switches at rotation.
|
|
29
|
+
*/
|
|
30
|
+
export declare function webhookHeaders(secret: string, id: string, type: string, timestamp: number, body: string, previousSecret?: string): Promise<Record<string, string>>;
|
|
25
31
|
export { createGitDoor, gitDoorRoute, smartHttpExchange } from "./git-door.js";
|
|
26
32
|
export type { GitDoor, GitDoorHost, GitDoorTarget } from "./git-door.js";
|
|
27
33
|
export { createAdmittedGit, createInstallationGitAdmission, } from "./git-admission.js";
|
package/dist/git.js
CHANGED
|
@@ -43,14 +43,23 @@ export async function signStandardWebhook(secret, id, timestamp, body) {
|
|
|
43
43
|
const signature = await hmac(secretBytes(secret), `${id}.${String(timestamp)}.${body}`);
|
|
44
44
|
return `v1,${btoa(String.fromCharCode(...signature))}`;
|
|
45
45
|
}
|
|
46
|
-
/**
|
|
47
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Headers for one signed delivery: Standard Webhooks plus `X-Hub-Signature-256`.
|
|
48
|
+
* While a rotated-out secret is still honoured, `previousSecret` adds its
|
|
49
|
+
* signature after the current one, space-separated as Standard Webhooks
|
|
50
|
+
* allows, so a receiver holding either secret verifies the delivery.
|
|
51
|
+
* `X-Hub-Signature-256` uses only the current secret and switches at rotation.
|
|
52
|
+
*/
|
|
53
|
+
export async function webhookHeaders(secret, id, type, timestamp, body, previousSecret) {
|
|
54
|
+
const signatures = [await signStandardWebhook(secret, id, timestamp, body)];
|
|
55
|
+
if (previousSecret !== undefined)
|
|
56
|
+
signatures.push(await signStandardWebhook(previousSecret, id, timestamp, body));
|
|
48
57
|
return {
|
|
49
58
|
"content-type": "application/json",
|
|
50
59
|
"user-agent": "Oyster-Webhooks/1",
|
|
51
60
|
"webhook-id": id,
|
|
52
61
|
"webhook-timestamp": String(timestamp),
|
|
53
|
-
"webhook-signature":
|
|
62
|
+
"webhook-signature": signatures.join(" "),
|
|
54
63
|
// The headers receivers built for git hosts check.
|
|
55
64
|
"x-hub-signature-256": `sha256=${hex(await hmac(encoder.encode(secret), body))}`,
|
|
56
65
|
"x-github-delivery": id,
|