solana-age-verify-sdk 2.0.0-beta.13 → 2.0.0-beta.15

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
@@ -1,4 +1,4 @@
1
- # Solana Age Verify SDK (Beta 2.0)
1
+ # Solana Age Verify SDK (Beta)
2
2
 
3
3
  **Verify users as 18+ on-chain. Privacy-safe, no ID needed, run entirely in the browser.**
4
4
 
package/dist/types.d.ts CHANGED
@@ -17,7 +17,11 @@ export interface VerifyConfig {
17
17
  challenges: string[];
18
18
  minLivenessScore: number;
19
19
  minAgeConfidence: number;
20
- minAgeEstimate: number;
20
+ /**
21
+ * Minimum age required to pass verification.
22
+ * Default: 18
23
+ */
24
+ minAgeThreshold?: number;
21
25
  timeoutMs: number;
22
26
  maxRetries: number;
23
27
  cooldownMinutes: number;
package/dist/verify.js CHANGED
@@ -11,12 +11,13 @@ import { createSpinnerHTML } from './ui/spinner';
11
11
  export async function verifyHost18Plus(options) {
12
12
  const config = { ...DEFAULT_CONFIG, ...options.config };
13
13
  // Cooldown & Retry Check
14
- const storageKey = `talkchain_verify_retries_${options.walletPubkeyBase58}`;
15
- const cooldownKey = `talkchain_verify_cooldown_${options.walletPubkeyBase58}`;
14
+ // v2 key prefix resets history for everyone (clearing failed attempts as requested)
15
+ const storageKey = `solana_av_v2_retries_${options.walletPubkeyBase58}`;
16
+ const cooldownKey = `solana_av_v2_cooldown_${options.walletPubkeyBase58}`;
16
17
  const now = Date.now();
17
18
  const cooldownUntil = parseInt(localStorage.getItem(cooldownKey) || '0');
18
19
  const currentRetries = parseInt(localStorage.getItem(storageKey) || '0');
19
- const cooldownCountKey = `talkchain_verify_cooldown_count_${options.walletPubkeyBase58}`;
20
+ const cooldownCountKey = `solana_av_v2_cooldown_count_${options.walletPubkeyBase58}`;
20
21
  const currentCooldownCount = parseInt(localStorage.getItem(cooldownCountKey) || '0');
21
22
  if (cooldownUntil > now) {
22
23
  const remainingSec = Math.ceil((cooldownUntil - now) / 1000);
@@ -600,14 +601,14 @@ export async function verifyHost18Plus(options) {
600
601
  const avgTextureScore = textureAnalysisCount > 0
601
602
  ? textureScoreAccumulator / textureAnalysisCount
602
603
  : undefined;
603
- const isAgeValid = ageEstimate >= config.minAgeEstimate;
604
+ const isAgeValid = ageEstimate >= (config.minAgeThreshold || 18);
604
605
  const isLivenessValid = livenessScore >= config.minLivenessScore;
605
606
  const isConfidenceValid = ageConfidence >= config.minAgeConfidence;
606
607
  // DEBUG LOGGING
607
608
  console.log('═══════════════════════════════════════════');
608
609
  console.log('VERIFICATION VALIDATION SUMMARY');
609
610
  console.log('═══════════════════════════════════════════');
610
- console.log(`Age Estimate: ${ageEstimate.toFixed(1)} (threshold: ${config.minAgeEstimate}) → ${isAgeValid ? '✓ PASS' : '✗ FAIL'}`);
611
+ console.log(`Age Estimate: ${ageEstimate.toFixed(1)} (threshold: ${config.minAgeThreshold}) → ${isAgeValid ? '✓ PASS' : '✗ FAIL'}`);
611
612
  console.log(`Age Confidence: ${(ageConfidence * 100).toFixed(1)}% (threshold: ${config.minAgeConfidence * 100}%) → ${isConfidenceValid ? '✓ PASS' : '✗ FAIL'}`);
612
613
  console.log(`Liveness Score: ${(livenessScore * 100).toFixed(1)}% (threshold: ${config.minLivenessScore * 100}%) → ${isLivenessValid ? '✓ PASS' : '✗ FAIL'}`);
613
614
  console.log(`Age Method: ${ageMethod}`);
@@ -617,7 +618,7 @@ export async function verifyHost18Plus(options) {
617
618
  let failureReason = '';
618
619
  if (!isOver18) {
619
620
  if (!isAgeValid)
620
- failureReason = `Estimated age (${Math.round(ageEstimate)}) is below the required ${config.minAgeEstimate}.`;
621
+ failureReason = `Estimated age (${Math.round(ageEstimate)}) is below the required ${config.minAgeThreshold}.`;
621
622
  else if (!isLivenessValid)
622
623
  failureReason = 'Liveness detection failed.';
623
624
  else if (!isConfidenceValid)
@@ -936,7 +937,7 @@ export async function verifyHost18Plus(options) {
936
937
  // Detailed Log for Developer
937
938
  console.log('--- VERIFICATION FAILED ---');
938
939
  console.log('Reason: Liveness or Age below threshold');
939
- console.log(`Detected Age: ${ageEstimate.toFixed(1)} (Threshold: ${config.minAgeEstimate})`);
940
+ console.log(`Detected Age: ${ageEstimate.toFixed(1)} (Threshold: ${config.minAgeThreshold})`);
940
941
  console.log(`Age Confidence: ${(ageConfidence * 100).toFixed(1)}%`);
941
942
  console.log(`Liveness Score: ${(livenessScore * 100).toFixed(1)}%`);
942
943
  console.log(`Attempt: ${updatedRetries} / ${config.maxRetries} (Session: ${currentCooldownCount + 1} / 3)`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solana-age-verify-sdk",
3
- "version": "2.0.0-beta.13",
3
+ "version": "2.0.0-beta.15",
4
4
  "type": "module",
5
5
  "description": "Solana Age Verify is a premium, client-side SDK for privacy-preserving age verification and liveness detection. It generates a deterministic Face Hash linked to a wallet without storing facial data.",
6
6
  "license": "MIT",