@i4ctime/q-ring 0.17.5 → 0.17.6

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/index.js CHANGED
@@ -4119,71 +4119,80 @@ function pick(charset, length) {
4119
4119
  for (let i = 0; i < length; i++) out += charset[randomInt2(charset.length)];
4120
4120
  return out;
4121
4121
  }
4122
+ function dodgingPlaceholders(generate) {
4123
+ return () => {
4124
+ for (let attempt = 0; attempt < 32; attempt++) {
4125
+ const value = generate();
4126
+ if (!isPlaceholderValue(value)) return value;
4127
+ }
4128
+ throw new Error("canary generator kept producing placeholder-like values");
4129
+ };
4130
+ }
4122
4131
  var CANARY_FORMATS = {
4123
4132
  aws: {
4124
4133
  name: "aws",
4125
4134
  description: "AWS access key id (AKIA\u2026)",
4126
- generate: () => `AKIA${pick(UPPER_NUM, 16)}`
4135
+ generate: dodgingPlaceholders(() => `AKIA${pick(UPPER_NUM, 16)}`)
4127
4136
  },
4128
4137
  "aws-secret": {
4129
4138
  name: "aws-secret",
4130
4139
  description: "AWS secret access key (40-char base64)",
4131
- generate: () => pick(BASE64, 40)
4140
+ generate: dodgingPlaceholders(() => pick(BASE64, 40))
4132
4141
  },
4133
4142
  github: {
4134
4143
  name: "github",
4135
4144
  description: "GitHub classic personal access token (ghp_\u2026)",
4136
- generate: () => `ghp_${pick(ALNUM, 36)}`
4145
+ generate: dodgingPlaceholders(() => `ghp_${pick(ALNUM, 36)}`)
4137
4146
  },
4138
4147
  "github-pat": {
4139
4148
  name: "github-pat",
4140
4149
  description: "GitHub fine-grained personal access token (github_pat_\u2026)",
4141
- generate: () => `github_pat_${pick(ALNUM, 22)}_${pick(ALNUM, 59)}`
4150
+ generate: dodgingPlaceholders(() => `github_pat_${pick(ALNUM, 22)}_${pick(ALNUM, 59)}`)
4142
4151
  },
4143
4152
  openai: {
4144
4153
  name: "openai",
4145
4154
  description: "OpenAI API key (sk-\u2026)",
4146
- generate: () => `sk-${pick(ALNUM, 48)}`
4155
+ generate: dodgingPlaceholders(() => `sk-${pick(ALNUM, 48)}`)
4147
4156
  },
4148
4157
  "openai-project": {
4149
4158
  name: "openai-project",
4150
4159
  description: "OpenAI project API key (sk-proj-\u2026)",
4151
- generate: () => `sk-proj-${pick(URLSAFE, 74)}T3BlbkFJ${pick(URLSAFE, 74)}`
4160
+ generate: dodgingPlaceholders(() => `sk-proj-${pick(URLSAFE, 74)}T3BlbkFJ${pick(URLSAFE, 74)}`)
4152
4161
  },
4153
4162
  anthropic: {
4154
4163
  name: "anthropic",
4155
4164
  description: "Anthropic API key (sk-ant-api03-\u2026)",
4156
- generate: () => `sk-ant-api03-${pick(URLSAFE, 91)}AA`
4165
+ generate: dodgingPlaceholders(() => `sk-ant-api03-${pick(URLSAFE, 91)}AA`)
4157
4166
  },
4158
4167
  stripe: {
4159
4168
  name: "stripe",
4160
4169
  description: "Stripe live secret key (sk_live_\u2026)",
4161
- generate: () => `sk_live_${pick(ALNUM, 24)}`
4170
+ generate: dodgingPlaceholders(() => `sk_live_${pick(ALNUM, 24)}`)
4162
4171
  },
4163
4172
  gitlab: {
4164
4173
  name: "gitlab",
4165
4174
  description: "GitLab personal access token (glpat-\u2026)",
4166
- generate: () => `glpat-${pick(URLSAFE, 20)}`
4175
+ generate: dodgingPlaceholders(() => `glpat-${pick(URLSAFE, 20)}`)
4167
4176
  },
4168
4177
  slack: {
4169
4178
  name: "slack",
4170
4179
  description: "Slack bot token (xoxb-\u2026)",
4171
- generate: () => `xoxb-${pick(DIGITS, 12)}-${pick(DIGITS, 13)}-${pick(ALNUM, 24)}`
4180
+ generate: dodgingPlaceholders(() => `xoxb-${pick(DIGITS, 12)}-${pick(DIGITS, 13)}-${pick(ALNUM, 24)}`)
4172
4181
  },
4173
4182
  google: {
4174
4183
  name: "google",
4175
4184
  description: "Google API key (AIza\u2026)",
4176
- generate: () => `AIza${pick(URLSAFE, 35)}`
4185
+ generate: dodgingPlaceholders(() => `AIza${pick(URLSAFE, 35)}`)
4177
4186
  },
4178
4187
  npm: {
4179
4188
  name: "npm",
4180
4189
  description: "npm access token (npm_\u2026)",
4181
- generate: () => `npm_${pick(ALNUM, 36)}`
4190
+ generate: dodgingPlaceholders(() => `npm_${pick(ALNUM, 36)}`)
4182
4191
  },
4183
4192
  generic: {
4184
4193
  name: "generic",
4185
4194
  description: "Generic high-entropy API key",
4186
- generate: () => generateSecret({ format: "api-key", prefix: "qk_", length: 40 })
4195
+ generate: dodgingPlaceholders(() => generateSecret({ format: "api-key", prefix: "qk_", length: 40 }))
4187
4196
  }
4188
4197
  };
4189
4198
  var DEFAULT_CANARY_FORMAT = "generic";