@constal/sdk 6.5.0 → 6.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constal/sdk",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "Public TypeScript SDK for authoring Constal agents, integrations, policies, channels, and credential providers",
5
5
  "keywords": [
6
6
  "constal",
package/publish/api.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@constal/sdk",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "exports": [
5
5
  "AGENT_UI_DEFAULTS",
6
6
  "Action",
@@ -3591,7 +3591,10 @@ type AuthProviderResult = {
3591
3591
  };
3592
3592
  /** A request signature an AuthProvider returns for Constal to check with one of its own Credential bindings. */
3593
3593
  interface HmacVerification {
3594
- /** The name of one of this AuthProvider's Credential bindings. */
3594
+ /**
3595
+ * The name of one of this AuthProvider's Credential bindings. The key is that Credential's value in its key format: its
3596
+ * UTF-8 bytes, or for a `"base64"` Credential the bytes the value decodes to.
3597
+ */
3595
3598
  credential: string;
3596
3599
  algorithm: "HMAC-SHA256" | "HMAC-SHA384" | "HMAC-SHA512";
3597
3600
  /** Exactly what the provider signed, as this AuthProvider builds it; a string is signed as UTF-8. */
@@ -5125,6 +5128,12 @@ interface CredentialProviderPackageMetadata {
5125
5128
  credentialSlots: string[];
5126
5129
  /** Non-secret configuration collected separately for each Credential created from this provider. */
5127
5130
  credentialConfigSchema: object;
5131
+ /**
5132
+ * How each Credential's value becomes the key an AuthProvider's HMAC check verifies with: `"text"`, the default, is its
5133
+ * UTF-8 bytes; `"base64"` is the bytes it decodes to as standard base64. Only that check reads it: wherever the Credential
5134
+ * is injected as a secret, its value is as stored. It cannot change across the provider's versions.
5135
+ */
5136
+ key?: "text" | "base64";
5128
5137
  /**
5129
5138
  * Interactive acquisition metadata. Null for non-interactive providers. `origins` are fixed when the package is published;
5130
5139
  * `urlProperty` names the top-level config property whose HTTPS URL's origin each install may send a browser to.
package/publish/index.js CHANGED
@@ -4438,6 +4438,9 @@ function credentialProvider(definition) {
4438
4438
  credentialRotationDefaults(definition.rotation);
4439
4439
  credentialProviderConfigSchema(definition.configSchema);
4440
4440
  credentialProviderConfigSchema(definition.credentialConfigSchema);
4441
+ if (definition.key !== void 0 && definition.key !== "text" && definition.key !== "base64") {
4442
+ throw new TypeError("credential provider key format is invalid");
4443
+ }
4441
4444
  if (!Array.isArray(definition.credentialSlots) || new Set(definition.credentialSlots).size !== definition.credentialSlots.length || definition.credentialSlots.some((slot) => typeof slot !== "string" || !/^[a-z0-9][a-z0-9._-]{0,127}$/u.test(slot))) {
4442
4445
  throw new TypeError("credential provider bootstrap slots are invalid");
4443
4446
  }
@@ -4479,6 +4482,7 @@ function credentialProvider(definition) {
4479
4482
  ...setup ? { setup } : {},
4480
4483
  credentialSlots: [...definition.credentialSlots].sort(),
4481
4484
  credentialConfigSchema: definition.credentialConfigSchema,
4485
+ ...definition.key === void 0 ? {} : { key: definition.key },
4482
4486
  interaction: !interaction ? null : "urlProperty" in interaction ? { urlProperty: interaction.urlProperty } : { origins: [...interaction.origins].sort() },
4483
4487
  rotation: definition.rotation,
4484
4488
  egress: integrationEgressPolicy(definition.egress),