solana-age-verify-sdk 2.0.0-beta.11 → 2.0.0-beta.12

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 (2) hide show
  1. package/dist/verify.js +29 -13
  2. package/package.json +1 -1
package/dist/verify.js CHANGED
@@ -8,13 +8,6 @@ import { generateChallengeSequence } from './liveness/challenges';
8
8
  import { getPlatformPublicKey, getProtocolFee } from './security';
9
9
  import { createSpinnerHTML } from './ui/spinner';
10
10
  // Lazy getter to avoid top-level PublicKey construction before polyfills load
11
- let _memoProgramId = null;
12
- function getMemoProgramId() {
13
- if (!_memoProgramId) {
14
- _memoProgramId = new PublicKey('MemoSq4gqABAXib96qFbncnscymPme7yS4AtGf4Vb7');
15
- }
16
- return _memoProgramId;
17
- }
18
11
  export async function verifyHost18Plus(options) {
19
12
  const config = { ...DEFAULT_CONFIG, ...options.config };
20
13
  // Cooldown & Retry Check
@@ -703,20 +696,43 @@ export async function verifyHost18Plus(options) {
703
696
  const memoText = `Solana-Age-Registry | ${statusStr} | HASH: ${facehash} | ${verifiedAt}`;
704
697
  // Step 3: Memo Instruction
705
698
  try {
706
- // DEFENSIVE FIX: Reconstruct keys locally to ensure they are valid instances for this context
707
- // This fixes "Invalid public key input" errors caused by version mismatches or "alien" objects
708
- const cleanFromKey = new PublicKey(fromPubkey.toBase58());
709
- const cleanPlatformKey = new PublicKey(platformPubKey.toBase58());
699
+ // DEBUG: Log all keys to identify the culprit
700
+ console.log('--- KEY DEBUG START ---');
701
+ console.log('Wallet Key (base58):', fromPubkey?.toBase58 ? fromPubkey.toBase58() : 'INVALID_OBJ');
702
+ console.log('Platform Key (base58):', platformPubKey?.toBase58 ? platformPubKey.toBase58() : 'INVALID_OBJ');
703
+ let cleanFromKey;
704
+ try {
705
+ cleanFromKey = new PublicKey(fromPubkey.toBase58());
706
+ }
707
+ catch (e) {
708
+ throw new Error(`Invalid Wallet Key: ${e.message}`);
709
+ }
710
+ let cleanPlatformKey;
711
+ try {
712
+ cleanPlatformKey = new PublicKey(platformPubKey.toBase58());
713
+ }
714
+ catch (e) {
715
+ throw new Error(`Invalid Platform Key: ${e.message}`);
716
+ }
717
+ let cleanMemoId;
718
+ try {
719
+ cleanMemoId = new PublicKey('MemoSq4gqABAXib96qFbncnscymPme7yS4AtGf4Vb7');
720
+ }
721
+ catch (e) {
722
+ throw new Error(`Invalid Memo Program ID: ${e.message}`);
723
+ }
724
+ console.log('Keys reconstructed successfully.');
710
725
  transaction.add(new TransactionInstruction({
711
726
  keys: [
712
727
  { pubkey: cleanFromKey, isSigner: true, isWritable: false },
713
- { pubkey: cleanPlatformKey, isSigner: false, isWritable: false } // Platform doesn't sign the memo instruction itself, just receives fee
728
+ { pubkey: cleanPlatformKey, isSigner: false, isWritable: false }
714
729
  ],
715
- programId: getMemoProgramId(),
730
+ programId: cleanMemoId,
716
731
  data: new TextEncoder().encode(memoText),
717
732
  }));
718
733
  }
719
734
  catch (e) {
735
+ console.error('Memo Instruction Construction Failed:', e);
720
736
  throw new Error(`Memo Instruction Failed: ${e.message}`);
721
737
  }
722
738
  const { blockhash } = await options.connection.getLatestBlockhash();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solana-age-verify-sdk",
3
- "version": "2.0.0-beta.11",
3
+ "version": "2.0.0-beta.12",
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",