@partite-ai/particle-signing 0.1.0

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.
Files changed (4) hide show
  1. package/README.md +25 -0
  2. package/index.d.ts +22 -0
  3. package/index.js +10 -0
  4. package/package.json +24 -0
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @partite-ai/particle-signing
2
+
3
+ TypeScript types for the `@partite-ai/particle-signing` host capability
4
+ consumed by [Particle](https://github.com/partite-ai/particles) particles.
5
+
6
+ Types only — the runtime implementation lives in the Particle wasm
7
+ runtime. Key material never enters the particle's address space; sign
8
+ and verify are host calls.
9
+
10
+ ```ts
11
+ import { signing } from "@partite-ai/particle-signing";
12
+
13
+ const data = new TextEncoder().encode(payload);
14
+ const sig = await signing.sign("webhook-key", data);
15
+ // post `sig` as a header / body field per the upstream's protocol
16
+ ```
17
+
18
+ ## API
19
+
20
+ - `signing.sign(name, data)` — host-side signature. v1 supports
21
+ HMAC-SHA-256 and HMAC-SHA-512.
22
+ - `signing.verify(name, data, signature)` — host-side verify.
23
+
24
+ See the [Particle README](https://github.com/partite-ai/particles) for
25
+ the manifest schema.
package/index.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ // TypeScript types for the host-provided `@partite-ai/particle-signing`
2
+ // module. The runtime resolves this import to a JS shim that wraps
3
+ // the WIT-imported `particle:host/signing@0.1.0` interface — see
4
+ // the Particle repository for the implementation. Types only.
5
+
6
+ /**
7
+ * Cryptographic operations against a host-stored key. The key
8
+ * material never enters JS; sign / verify happen entirely on the
9
+ * host side. Importing this requires at least one
10
+ * `type: "signing-key"` credential in the manifest.
11
+ */
12
+ export const signing: {
13
+ /** Returns the signature of `data` under the named key. */
14
+ sign(name: string, data: Uint8Array): Promise<Uint8Array>;
15
+ /** Returns whether `signature` matches `data` under the named key. */
16
+ verify(name: string, data: Uint8Array, signature: Uint8Array): Promise<boolean>;
17
+ };
18
+
19
+ export type SigningError =
20
+ | { tag: "not-configured" }
21
+ | { tag: "not-signing-key" }
22
+ | { tag: "invalid-input"; val: string };
package/index.js ADDED
@@ -0,0 +1,10 @@
1
+ // This package ships TypeScript types only. The runtime
2
+ // implementation is provided by the Particle wasm runtime — see
3
+ // components/runtime/src/host-shim.ts in the Particle repo.
4
+ // Loading this file outside that runtime throws so the misuse
5
+ // is loud rather than silent.
6
+ throw new Error(
7
+ "@partite-ai/particle-signing is only callable inside the Particle runtime. " +
8
+ "Run your particle with `particle run` / `particle serve-mcp`, or build it into " +
9
+ "a .particle artifact.",
10
+ );
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@partite-ai/particle-signing",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript types for `@partite-ai/particle-signing` — host-side cryptographic sign/verify for Particle particles.",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/partite-ai/particles",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/partite-ai/particles.git",
10
+ "directory": "js-types/particle-signing"
11
+ },
12
+ "main": "index.js",
13
+ "types": "index.d.ts",
14
+ "files": [
15
+ "index.js",
16
+ "index.d.ts",
17
+ "README.md"
18
+ ],
19
+ "keywords": ["particle", "wasm", "signing", "hmac", "credentials", "mcp"],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "sideEffects": false
24
+ }