@entros/pulse-sdk 1.4.2 → 1.5.1
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 +2 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +2308 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2308 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -599,6 +599,26 @@ function extractFormantRatios(samples, sampleRate, frameSize, hopSize) {
|
|
|
599
599
|
return { f1f2, f2f3 };
|
|
600
600
|
}
|
|
601
601
|
|
|
602
|
+
// src/yield.ts
|
|
603
|
+
function yieldToMainThread() {
|
|
604
|
+
return new Promise((resolve) => {
|
|
605
|
+
if (typeof MessageChannel !== "undefined") {
|
|
606
|
+
const channel = new MessageChannel();
|
|
607
|
+
channel.port1.onmessage = () => {
|
|
608
|
+
channel.port1.close();
|
|
609
|
+
resolve();
|
|
610
|
+
};
|
|
611
|
+
channel.port2.postMessage(null);
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
if (typeof setTimeout !== "undefined") {
|
|
615
|
+
setTimeout(resolve, 0);
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
resolve();
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
|
|
602
622
|
// src/extraction/speaker.ts
|
|
603
623
|
function getFrameSize(sampleRate) {
|
|
604
624
|
const MIN_F0 = 50;
|
|
@@ -831,6 +851,7 @@ async function extractSpeakerFeaturesDetailed(audio) {
|
|
|
831
851
|
normalizedSamples = samples;
|
|
832
852
|
}
|
|
833
853
|
const { f0, amplitudes: normalizedAmplitudes, periods } = await detectF0Contour(normalizedSamples, sampleRate);
|
|
854
|
+
await yieldToMainThread();
|
|
834
855
|
const amplitudes = [];
|
|
835
856
|
for (let i = 0; i < numFrames; i++) {
|
|
836
857
|
const start = i * hopSize;
|
|
@@ -855,6 +876,7 @@ async function extractSpeakerFeaturesDetailed(audio) {
|
|
|
855
876
|
const hnrStats = condense(hnrValues);
|
|
856
877
|
const hnrEntropy = entropy(hnrValues);
|
|
857
878
|
const hnrFeatures = [hnrStats.mean, hnrStats.variance, hnrStats.skewness, hnrStats.kurtosis, hnrEntropy];
|
|
879
|
+
await yieldToMainThread();
|
|
858
880
|
const { f1f2, f2f3 } = extractFormantRatios(normalizedSamples, sampleRate, frameSize, hopSize);
|
|
859
881
|
const f1f2Stats = condense(f1f2);
|
|
860
882
|
const f2f3Stats = condense(f2f3);
|
|
@@ -868,6 +890,7 @@ async function extractSpeakerFeaturesDetailed(audio) {
|
|
|
868
890
|
f2f3Stats.skewness,
|
|
869
891
|
f2f3Stats.kurtosis
|
|
870
892
|
];
|
|
893
|
+
await yieldToMainThread();
|
|
871
894
|
const ltasFeatures = await computeLTAS(samples, sampleRate);
|
|
872
895
|
const voicingFeatures = [voicedRatio];
|
|
873
896
|
const ampStats = condense(amplitudes);
|
|
@@ -1364,6 +1387,2255 @@ async function generateSolanaProof(current, previous, wasmPath, zkeyPath, thresh
|
|
|
1364
1387
|
return serializeProof(proof, publicSignals);
|
|
1365
1388
|
}
|
|
1366
1389
|
|
|
1390
|
+
// src/protocol/idl/entros_anchor.json
|
|
1391
|
+
var entros_anchor_default = {
|
|
1392
|
+
address: "GZYwTp2ozeuRA5Gof9vs4ya961aANcJBdUzB7LN6q4b2",
|
|
1393
|
+
metadata: {
|
|
1394
|
+
name: "entros_anchor",
|
|
1395
|
+
version: "0.1.0",
|
|
1396
|
+
spec: "0.1.0",
|
|
1397
|
+
description: "Non-transferable identity token for Entros Protocol"
|
|
1398
|
+
},
|
|
1399
|
+
docs: [
|
|
1400
|
+
"Mint account space for Token-2022 with NonTransferable extension.",
|
|
1401
|
+
"Base mint = 82 bytes, account type = 1 byte, extension type (2) + length (2) = 4 bytes,",
|
|
1402
|
+
"NonTransferable data = 0 bytes. Plus multisig padding from Token-2022.",
|
|
1403
|
+
"We use a constant derived from the Token-2022 spec."
|
|
1404
|
+
],
|
|
1405
|
+
instructions: [
|
|
1406
|
+
{
|
|
1407
|
+
name: "authorize_new_wallet",
|
|
1408
|
+
docs: [
|
|
1409
|
+
"Authorize a new wallet by 2 signers. This can be done many times before invoking migrate_identity()"
|
|
1410
|
+
],
|
|
1411
|
+
discriminator: [
|
|
1412
|
+
178,
|
|
1413
|
+
186,
|
|
1414
|
+
185,
|
|
1415
|
+
108,
|
|
1416
|
+
51,
|
|
1417
|
+
219,
|
|
1418
|
+
107,
|
|
1419
|
+
197
|
|
1420
|
+
],
|
|
1421
|
+
accounts: [
|
|
1422
|
+
{
|
|
1423
|
+
name: "signer",
|
|
1424
|
+
writable: true,
|
|
1425
|
+
signer: true
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
name: "identity_state",
|
|
1429
|
+
writable: true,
|
|
1430
|
+
pda: {
|
|
1431
|
+
seeds: [
|
|
1432
|
+
{
|
|
1433
|
+
kind: "const",
|
|
1434
|
+
value: [
|
|
1435
|
+
105,
|
|
1436
|
+
100,
|
|
1437
|
+
101,
|
|
1438
|
+
110,
|
|
1439
|
+
116,
|
|
1440
|
+
105,
|
|
1441
|
+
116,
|
|
1442
|
+
121
|
|
1443
|
+
]
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
kind: "account",
|
|
1447
|
+
path: "signer"
|
|
1448
|
+
}
|
|
1449
|
+
]
|
|
1450
|
+
}
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
name: "signer_new",
|
|
1454
|
+
writable: true,
|
|
1455
|
+
signer: true
|
|
1456
|
+
},
|
|
1457
|
+
{
|
|
1458
|
+
name: "token_program"
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
name: "mint",
|
|
1462
|
+
writable: true,
|
|
1463
|
+
pda: {
|
|
1464
|
+
seeds: [
|
|
1465
|
+
{
|
|
1466
|
+
kind: "const",
|
|
1467
|
+
value: [
|
|
1468
|
+
109,
|
|
1469
|
+
105,
|
|
1470
|
+
110,
|
|
1471
|
+
116
|
|
1472
|
+
]
|
|
1473
|
+
},
|
|
1474
|
+
{
|
|
1475
|
+
kind: "account",
|
|
1476
|
+
path: "signer"
|
|
1477
|
+
}
|
|
1478
|
+
]
|
|
1479
|
+
}
|
|
1480
|
+
},
|
|
1481
|
+
{
|
|
1482
|
+
name: "token_account",
|
|
1483
|
+
writable: true,
|
|
1484
|
+
pda: {
|
|
1485
|
+
seeds: [
|
|
1486
|
+
{
|
|
1487
|
+
kind: "account",
|
|
1488
|
+
path: "signer"
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
kind: "account",
|
|
1492
|
+
path: "token_program"
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
kind: "account",
|
|
1496
|
+
path: "mint"
|
|
1497
|
+
}
|
|
1498
|
+
],
|
|
1499
|
+
program: {
|
|
1500
|
+
kind: "const",
|
|
1501
|
+
value: [
|
|
1502
|
+
140,
|
|
1503
|
+
151,
|
|
1504
|
+
37,
|
|
1505
|
+
143,
|
|
1506
|
+
78,
|
|
1507
|
+
36,
|
|
1508
|
+
137,
|
|
1509
|
+
241,
|
|
1510
|
+
187,
|
|
1511
|
+
61,
|
|
1512
|
+
16,
|
|
1513
|
+
41,
|
|
1514
|
+
20,
|
|
1515
|
+
142,
|
|
1516
|
+
13,
|
|
1517
|
+
131,
|
|
1518
|
+
11,
|
|
1519
|
+
90,
|
|
1520
|
+
19,
|
|
1521
|
+
153,
|
|
1522
|
+
218,
|
|
1523
|
+
255,
|
|
1524
|
+
16,
|
|
1525
|
+
132,
|
|
1526
|
+
4,
|
|
1527
|
+
142,
|
|
1528
|
+
123,
|
|
1529
|
+
216,
|
|
1530
|
+
219,
|
|
1531
|
+
233,
|
|
1532
|
+
248,
|
|
1533
|
+
89
|
|
1534
|
+
]
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
],
|
|
1539
|
+
args: []
|
|
1540
|
+
},
|
|
1541
|
+
{
|
|
1542
|
+
name: "migrate_identity",
|
|
1543
|
+
docs: [
|
|
1544
|
+
"Migrate from an user's old Anchor IdentityState PDA to a new one",
|
|
1545
|
+
"After this function call, the orphaned 0-balance ATA, pointing at a closed mint, locks ~0.002 SOL of rent. This ATA can be recovered by the old wallet calling closeAccount()"
|
|
1546
|
+
],
|
|
1547
|
+
discriminator: [
|
|
1548
|
+
161,
|
|
1549
|
+
192,
|
|
1550
|
+
70,
|
|
1551
|
+
80,
|
|
1552
|
+
47,
|
|
1553
|
+
37,
|
|
1554
|
+
26,
|
|
1555
|
+
10
|
|
1556
|
+
],
|
|
1557
|
+
accounts: [
|
|
1558
|
+
{
|
|
1559
|
+
name: "user",
|
|
1560
|
+
writable: true,
|
|
1561
|
+
signer: true
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
name: "identity_state",
|
|
1565
|
+
writable: true,
|
|
1566
|
+
pda: {
|
|
1567
|
+
seeds: [
|
|
1568
|
+
{
|
|
1569
|
+
kind: "const",
|
|
1570
|
+
value: [
|
|
1571
|
+
105,
|
|
1572
|
+
100,
|
|
1573
|
+
101,
|
|
1574
|
+
110,
|
|
1575
|
+
116,
|
|
1576
|
+
105,
|
|
1577
|
+
116,
|
|
1578
|
+
121
|
|
1579
|
+
]
|
|
1580
|
+
},
|
|
1581
|
+
{
|
|
1582
|
+
kind: "account",
|
|
1583
|
+
path: "user"
|
|
1584
|
+
}
|
|
1585
|
+
]
|
|
1586
|
+
}
|
|
1587
|
+
},
|
|
1588
|
+
{
|
|
1589
|
+
name: "mint",
|
|
1590
|
+
docs: [
|
|
1591
|
+
"initialization ordering. PDA seeds ensure uniqueness per user."
|
|
1592
|
+
],
|
|
1593
|
+
writable: true,
|
|
1594
|
+
pda: {
|
|
1595
|
+
seeds: [
|
|
1596
|
+
{
|
|
1597
|
+
kind: "const",
|
|
1598
|
+
value: [
|
|
1599
|
+
109,
|
|
1600
|
+
105,
|
|
1601
|
+
110,
|
|
1602
|
+
116
|
|
1603
|
+
]
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
kind: "account",
|
|
1607
|
+
path: "user"
|
|
1608
|
+
}
|
|
1609
|
+
]
|
|
1610
|
+
}
|
|
1611
|
+
},
|
|
1612
|
+
{
|
|
1613
|
+
name: "mint_authority",
|
|
1614
|
+
pda: {
|
|
1615
|
+
seeds: [
|
|
1616
|
+
{
|
|
1617
|
+
kind: "const",
|
|
1618
|
+
value: [
|
|
1619
|
+
109,
|
|
1620
|
+
105,
|
|
1621
|
+
110,
|
|
1622
|
+
116,
|
|
1623
|
+
95,
|
|
1624
|
+
97,
|
|
1625
|
+
117,
|
|
1626
|
+
116,
|
|
1627
|
+
104,
|
|
1628
|
+
111,
|
|
1629
|
+
114,
|
|
1630
|
+
105,
|
|
1631
|
+
116,
|
|
1632
|
+
121
|
|
1633
|
+
]
|
|
1634
|
+
}
|
|
1635
|
+
]
|
|
1636
|
+
}
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
name: "token_account",
|
|
1640
|
+
writable: true
|
|
1641
|
+
},
|
|
1642
|
+
{
|
|
1643
|
+
name: "associated_token_program",
|
|
1644
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
1645
|
+
},
|
|
1646
|
+
{
|
|
1647
|
+
name: "token_program"
|
|
1648
|
+
},
|
|
1649
|
+
{
|
|
1650
|
+
name: "system_program",
|
|
1651
|
+
address: "11111111111111111111111111111111"
|
|
1652
|
+
},
|
|
1653
|
+
{
|
|
1654
|
+
name: "protocol_config",
|
|
1655
|
+
pda: {
|
|
1656
|
+
seeds: [
|
|
1657
|
+
{
|
|
1658
|
+
kind: "const",
|
|
1659
|
+
value: [
|
|
1660
|
+
112,
|
|
1661
|
+
114,
|
|
1662
|
+
111,
|
|
1663
|
+
116,
|
|
1664
|
+
111,
|
|
1665
|
+
99,
|
|
1666
|
+
111,
|
|
1667
|
+
108,
|
|
1668
|
+
95,
|
|
1669
|
+
99,
|
|
1670
|
+
111,
|
|
1671
|
+
110,
|
|
1672
|
+
102,
|
|
1673
|
+
105,
|
|
1674
|
+
103
|
|
1675
|
+
]
|
|
1676
|
+
}
|
|
1677
|
+
],
|
|
1678
|
+
program: {
|
|
1679
|
+
kind: "const",
|
|
1680
|
+
value: [
|
|
1681
|
+
81,
|
|
1682
|
+
130,
|
|
1683
|
+
250,
|
|
1684
|
+
230,
|
|
1685
|
+
30,
|
|
1686
|
+
253,
|
|
1687
|
+
246,
|
|
1688
|
+
69,
|
|
1689
|
+
82,
|
|
1690
|
+
96,
|
|
1691
|
+
7,
|
|
1692
|
+
173,
|
|
1693
|
+
78,
|
|
1694
|
+
160,
|
|
1695
|
+
131,
|
|
1696
|
+
188,
|
|
1697
|
+
70,
|
|
1698
|
+
106,
|
|
1699
|
+
173,
|
|
1700
|
+
59,
|
|
1701
|
+
102,
|
|
1702
|
+
163,
|
|
1703
|
+
198,
|
|
1704
|
+
189,
|
|
1705
|
+
82,
|
|
1706
|
+
37,
|
|
1707
|
+
225,
|
|
1708
|
+
38,
|
|
1709
|
+
52,
|
|
1710
|
+
233,
|
|
1711
|
+
157,
|
|
1712
|
+
117
|
|
1713
|
+
]
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
},
|
|
1717
|
+
{
|
|
1718
|
+
name: "treasury",
|
|
1719
|
+
writable: true,
|
|
1720
|
+
pda: {
|
|
1721
|
+
seeds: [
|
|
1722
|
+
{
|
|
1723
|
+
kind: "const",
|
|
1724
|
+
value: [
|
|
1725
|
+
112,
|
|
1726
|
+
114,
|
|
1727
|
+
111,
|
|
1728
|
+
116,
|
|
1729
|
+
111,
|
|
1730
|
+
99,
|
|
1731
|
+
111,
|
|
1732
|
+
108,
|
|
1733
|
+
95,
|
|
1734
|
+
116,
|
|
1735
|
+
114,
|
|
1736
|
+
101,
|
|
1737
|
+
97,
|
|
1738
|
+
115,
|
|
1739
|
+
117,
|
|
1740
|
+
114,
|
|
1741
|
+
121
|
|
1742
|
+
]
|
|
1743
|
+
}
|
|
1744
|
+
],
|
|
1745
|
+
program: {
|
|
1746
|
+
kind: "const",
|
|
1747
|
+
value: [
|
|
1748
|
+
81,
|
|
1749
|
+
130,
|
|
1750
|
+
250,
|
|
1751
|
+
230,
|
|
1752
|
+
30,
|
|
1753
|
+
253,
|
|
1754
|
+
246,
|
|
1755
|
+
69,
|
|
1756
|
+
82,
|
|
1757
|
+
96,
|
|
1758
|
+
7,
|
|
1759
|
+
173,
|
|
1760
|
+
78,
|
|
1761
|
+
160,
|
|
1762
|
+
131,
|
|
1763
|
+
188,
|
|
1764
|
+
70,
|
|
1765
|
+
106,
|
|
1766
|
+
173,
|
|
1767
|
+
59,
|
|
1768
|
+
102,
|
|
1769
|
+
163,
|
|
1770
|
+
198,
|
|
1771
|
+
189,
|
|
1772
|
+
82,
|
|
1773
|
+
37,
|
|
1774
|
+
225,
|
|
1775
|
+
38,
|
|
1776
|
+
52,
|
|
1777
|
+
233,
|
|
1778
|
+
157,
|
|
1779
|
+
117
|
|
1780
|
+
]
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
},
|
|
1784
|
+
{
|
|
1785
|
+
name: "wallet_old",
|
|
1786
|
+
writable: true
|
|
1787
|
+
},
|
|
1788
|
+
{
|
|
1789
|
+
name: "identity_state_old",
|
|
1790
|
+
writable: true,
|
|
1791
|
+
pda: {
|
|
1792
|
+
seeds: [
|
|
1793
|
+
{
|
|
1794
|
+
kind: "const",
|
|
1795
|
+
value: [
|
|
1796
|
+
105,
|
|
1797
|
+
100,
|
|
1798
|
+
101,
|
|
1799
|
+
110,
|
|
1800
|
+
116,
|
|
1801
|
+
105,
|
|
1802
|
+
116,
|
|
1803
|
+
121
|
|
1804
|
+
]
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
kind: "account",
|
|
1808
|
+
path: "wallet_old"
|
|
1809
|
+
}
|
|
1810
|
+
]
|
|
1811
|
+
}
|
|
1812
|
+
},
|
|
1813
|
+
{
|
|
1814
|
+
name: "mint_old",
|
|
1815
|
+
writable: true,
|
|
1816
|
+
pda: {
|
|
1817
|
+
seeds: [
|
|
1818
|
+
{
|
|
1819
|
+
kind: "const",
|
|
1820
|
+
value: [
|
|
1821
|
+
109,
|
|
1822
|
+
105,
|
|
1823
|
+
110,
|
|
1824
|
+
116
|
|
1825
|
+
]
|
|
1826
|
+
},
|
|
1827
|
+
{
|
|
1828
|
+
kind: "account",
|
|
1829
|
+
path: "wallet_old"
|
|
1830
|
+
}
|
|
1831
|
+
]
|
|
1832
|
+
}
|
|
1833
|
+
},
|
|
1834
|
+
{
|
|
1835
|
+
name: "token_account_old",
|
|
1836
|
+
writable: true,
|
|
1837
|
+
pda: {
|
|
1838
|
+
seeds: [
|
|
1839
|
+
{
|
|
1840
|
+
kind: "account",
|
|
1841
|
+
path: "wallet_old"
|
|
1842
|
+
},
|
|
1843
|
+
{
|
|
1844
|
+
kind: "account",
|
|
1845
|
+
path: "token_program"
|
|
1846
|
+
},
|
|
1847
|
+
{
|
|
1848
|
+
kind: "account",
|
|
1849
|
+
path: "mint_old"
|
|
1850
|
+
}
|
|
1851
|
+
],
|
|
1852
|
+
program: {
|
|
1853
|
+
kind: "const",
|
|
1854
|
+
value: [
|
|
1855
|
+
140,
|
|
1856
|
+
151,
|
|
1857
|
+
37,
|
|
1858
|
+
143,
|
|
1859
|
+
78,
|
|
1860
|
+
36,
|
|
1861
|
+
137,
|
|
1862
|
+
241,
|
|
1863
|
+
187,
|
|
1864
|
+
61,
|
|
1865
|
+
16,
|
|
1866
|
+
41,
|
|
1867
|
+
20,
|
|
1868
|
+
142,
|
|
1869
|
+
13,
|
|
1870
|
+
131,
|
|
1871
|
+
11,
|
|
1872
|
+
90,
|
|
1873
|
+
19,
|
|
1874
|
+
153,
|
|
1875
|
+
218,
|
|
1876
|
+
255,
|
|
1877
|
+
16,
|
|
1878
|
+
132,
|
|
1879
|
+
4,
|
|
1880
|
+
142,
|
|
1881
|
+
123,
|
|
1882
|
+
216,
|
|
1883
|
+
219,
|
|
1884
|
+
233,
|
|
1885
|
+
248,
|
|
1886
|
+
89
|
|
1887
|
+
]
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
],
|
|
1892
|
+
args: []
|
|
1893
|
+
},
|
|
1894
|
+
{
|
|
1895
|
+
name: "mint_anchor",
|
|
1896
|
+
docs: [
|
|
1897
|
+
"Mint a new Entros Anchor identity for the caller.",
|
|
1898
|
+
"Creates a NonTransferable Token-2022 mint, mints 1 token to the user's ATA,",
|
|
1899
|
+
"and initializes the IdentityState PDA."
|
|
1900
|
+
],
|
|
1901
|
+
discriminator: [
|
|
1902
|
+
68,
|
|
1903
|
+
56,
|
|
1904
|
+
113,
|
|
1905
|
+
102,
|
|
1906
|
+
236,
|
|
1907
|
+
152,
|
|
1908
|
+
146,
|
|
1909
|
+
60
|
|
1910
|
+
],
|
|
1911
|
+
accounts: [
|
|
1912
|
+
{
|
|
1913
|
+
name: "user",
|
|
1914
|
+
writable: true,
|
|
1915
|
+
signer: true
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
name: "identity_state",
|
|
1919
|
+
writable: true,
|
|
1920
|
+
pda: {
|
|
1921
|
+
seeds: [
|
|
1922
|
+
{
|
|
1923
|
+
kind: "const",
|
|
1924
|
+
value: [
|
|
1925
|
+
105,
|
|
1926
|
+
100,
|
|
1927
|
+
101,
|
|
1928
|
+
110,
|
|
1929
|
+
116,
|
|
1930
|
+
105,
|
|
1931
|
+
116,
|
|
1932
|
+
121
|
|
1933
|
+
]
|
|
1934
|
+
},
|
|
1935
|
+
{
|
|
1936
|
+
kind: "account",
|
|
1937
|
+
path: "user"
|
|
1938
|
+
}
|
|
1939
|
+
]
|
|
1940
|
+
}
|
|
1941
|
+
},
|
|
1942
|
+
{
|
|
1943
|
+
name: "mint",
|
|
1944
|
+
docs: [
|
|
1945
|
+
"initialization ordering. PDA seeds ensure uniqueness per user."
|
|
1946
|
+
],
|
|
1947
|
+
writable: true,
|
|
1948
|
+
pda: {
|
|
1949
|
+
seeds: [
|
|
1950
|
+
{
|
|
1951
|
+
kind: "const",
|
|
1952
|
+
value: [
|
|
1953
|
+
109,
|
|
1954
|
+
105,
|
|
1955
|
+
110,
|
|
1956
|
+
116
|
|
1957
|
+
]
|
|
1958
|
+
},
|
|
1959
|
+
{
|
|
1960
|
+
kind: "account",
|
|
1961
|
+
path: "user"
|
|
1962
|
+
}
|
|
1963
|
+
]
|
|
1964
|
+
}
|
|
1965
|
+
},
|
|
1966
|
+
{
|
|
1967
|
+
name: "mint_authority",
|
|
1968
|
+
pda: {
|
|
1969
|
+
seeds: [
|
|
1970
|
+
{
|
|
1971
|
+
kind: "const",
|
|
1972
|
+
value: [
|
|
1973
|
+
109,
|
|
1974
|
+
105,
|
|
1975
|
+
110,
|
|
1976
|
+
116,
|
|
1977
|
+
95,
|
|
1978
|
+
97,
|
|
1979
|
+
117,
|
|
1980
|
+
116,
|
|
1981
|
+
104,
|
|
1982
|
+
111,
|
|
1983
|
+
114,
|
|
1984
|
+
105,
|
|
1985
|
+
116,
|
|
1986
|
+
121
|
|
1987
|
+
]
|
|
1988
|
+
}
|
|
1989
|
+
]
|
|
1990
|
+
}
|
|
1991
|
+
},
|
|
1992
|
+
{
|
|
1993
|
+
name: "token_account",
|
|
1994
|
+
writable: true
|
|
1995
|
+
},
|
|
1996
|
+
{
|
|
1997
|
+
name: "associated_token_program",
|
|
1998
|
+
address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
|
|
1999
|
+
},
|
|
2000
|
+
{
|
|
2001
|
+
name: "token_program"
|
|
2002
|
+
},
|
|
2003
|
+
{
|
|
2004
|
+
name: "system_program",
|
|
2005
|
+
address: "11111111111111111111111111111111"
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
name: "protocol_config",
|
|
2009
|
+
pda: {
|
|
2010
|
+
seeds: [
|
|
2011
|
+
{
|
|
2012
|
+
kind: "const",
|
|
2013
|
+
value: [
|
|
2014
|
+
112,
|
|
2015
|
+
114,
|
|
2016
|
+
111,
|
|
2017
|
+
116,
|
|
2018
|
+
111,
|
|
2019
|
+
99,
|
|
2020
|
+
111,
|
|
2021
|
+
108,
|
|
2022
|
+
95,
|
|
2023
|
+
99,
|
|
2024
|
+
111,
|
|
2025
|
+
110,
|
|
2026
|
+
102,
|
|
2027
|
+
105,
|
|
2028
|
+
103
|
|
2029
|
+
]
|
|
2030
|
+
}
|
|
2031
|
+
],
|
|
2032
|
+
program: {
|
|
2033
|
+
kind: "const",
|
|
2034
|
+
value: [
|
|
2035
|
+
81,
|
|
2036
|
+
130,
|
|
2037
|
+
250,
|
|
2038
|
+
230,
|
|
2039
|
+
30,
|
|
2040
|
+
253,
|
|
2041
|
+
246,
|
|
2042
|
+
69,
|
|
2043
|
+
82,
|
|
2044
|
+
96,
|
|
2045
|
+
7,
|
|
2046
|
+
173,
|
|
2047
|
+
78,
|
|
2048
|
+
160,
|
|
2049
|
+
131,
|
|
2050
|
+
188,
|
|
2051
|
+
70,
|
|
2052
|
+
106,
|
|
2053
|
+
173,
|
|
2054
|
+
59,
|
|
2055
|
+
102,
|
|
2056
|
+
163,
|
|
2057
|
+
198,
|
|
2058
|
+
189,
|
|
2059
|
+
82,
|
|
2060
|
+
37,
|
|
2061
|
+
225,
|
|
2062
|
+
38,
|
|
2063
|
+
52,
|
|
2064
|
+
233,
|
|
2065
|
+
157,
|
|
2066
|
+
117
|
|
2067
|
+
]
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
name: "treasury",
|
|
2073
|
+
writable: true,
|
|
2074
|
+
pda: {
|
|
2075
|
+
seeds: [
|
|
2076
|
+
{
|
|
2077
|
+
kind: "const",
|
|
2078
|
+
value: [
|
|
2079
|
+
112,
|
|
2080
|
+
114,
|
|
2081
|
+
111,
|
|
2082
|
+
116,
|
|
2083
|
+
111,
|
|
2084
|
+
99,
|
|
2085
|
+
111,
|
|
2086
|
+
108,
|
|
2087
|
+
95,
|
|
2088
|
+
116,
|
|
2089
|
+
114,
|
|
2090
|
+
101,
|
|
2091
|
+
97,
|
|
2092
|
+
115,
|
|
2093
|
+
117,
|
|
2094
|
+
114,
|
|
2095
|
+
121
|
|
2096
|
+
]
|
|
2097
|
+
}
|
|
2098
|
+
],
|
|
2099
|
+
program: {
|
|
2100
|
+
kind: "const",
|
|
2101
|
+
value: [
|
|
2102
|
+
81,
|
|
2103
|
+
130,
|
|
2104
|
+
250,
|
|
2105
|
+
230,
|
|
2106
|
+
30,
|
|
2107
|
+
253,
|
|
2108
|
+
246,
|
|
2109
|
+
69,
|
|
2110
|
+
82,
|
|
2111
|
+
96,
|
|
2112
|
+
7,
|
|
2113
|
+
173,
|
|
2114
|
+
78,
|
|
2115
|
+
160,
|
|
2116
|
+
131,
|
|
2117
|
+
188,
|
|
2118
|
+
70,
|
|
2119
|
+
106,
|
|
2120
|
+
173,
|
|
2121
|
+
59,
|
|
2122
|
+
102,
|
|
2123
|
+
163,
|
|
2124
|
+
198,
|
|
2125
|
+
189,
|
|
2126
|
+
82,
|
|
2127
|
+
37,
|
|
2128
|
+
225,
|
|
2129
|
+
38,
|
|
2130
|
+
52,
|
|
2131
|
+
233,
|
|
2132
|
+
157,
|
|
2133
|
+
117
|
|
2134
|
+
]
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
},
|
|
2138
|
+
{
|
|
2139
|
+
name: "instructions_sysvar",
|
|
2140
|
+
docs: [
|
|
2141
|
+
"receipt verification (master-list #146 Phase 3) to inspect the",
|
|
2142
|
+
"preceding Ed25519Program::verify instruction in the same tx.",
|
|
2143
|
+
"Address is constrained to the canonical sysvar pubkey, so the",
|
|
2144
|
+
"program is guaranteed to be reading the real sysvar regardless of",
|
|
2145
|
+
"what the client passes."
|
|
2146
|
+
],
|
|
2147
|
+
address: "Sysvar1nstructions1111111111111111111111111"
|
|
2148
|
+
}
|
|
2149
|
+
],
|
|
2150
|
+
args: [
|
|
2151
|
+
{
|
|
2152
|
+
name: "initial_commitment",
|
|
2153
|
+
type: {
|
|
2154
|
+
array: [
|
|
2155
|
+
"u8",
|
|
2156
|
+
32
|
|
2157
|
+
]
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
]
|
|
2161
|
+
},
|
|
2162
|
+
{
|
|
2163
|
+
name: "reset_identity_state",
|
|
2164
|
+
docs: [
|
|
2165
|
+
"Reset the caller's identity state to a fresh baseline.",
|
|
2166
|
+
"",
|
|
2167
|
+
"Recovery path for users whose client-side fingerprint envelope is",
|
|
2168
|
+
"unrecoverable (cleared site data, new device, corrupted keystore).",
|
|
2169
|
+
'Without this instruction the only answer is "mint a new wallet,"',
|
|
2170
|
+
"which discards on-chain history and the SAS attestation. Reset",
|
|
2171
|
+
"rotates `current_commitment` in place and zeroes verification",
|
|
2172
|
+
"history so a compromised wallet cannot inherit reputation.",
|
|
2173
|
+
"",
|
|
2174
|
+
"Defenses:",
|
|
2175
|
+
"- Signer constraint on `authority` proves wallet ownership.",
|
|
2176
|
+
"- 7-day cooldown (`RESET_COOLDOWN_SECS`) bounds abuse frequency.",
|
|
2177
|
+
"- Full zero of `verification_count`, `trust_score`, and",
|
|
2178
|
+
"`recent_timestamps` means an attacker who compromises the",
|
|
2179
|
+
"wallet key and passes Tier 1 validation starts from zero.",
|
|
2180
|
+
"- Verification fee charged, matching mint/update economics.",
|
|
2181
|
+
"",
|
|
2182
|
+
"No ZK proof is consumed: there is no prior fingerprint to",
|
|
2183
|
+
"Hamming-compare against, and the Hamming circuit's",
|
|
2184
|
+
"`min_distance \u2265 3` constraint would reject a same-fingerprint",
|
|
2185
|
+
"proof anyway. Live-humanness evidence comes from the Tier 1",
|
|
2186
|
+
"validation pipeline at the SAS attestation step (handled by",
|
|
2187
|
+
"the off-chain executor, not this instruction)."
|
|
2188
|
+
],
|
|
2189
|
+
discriminator: [
|
|
2190
|
+
26,
|
|
2191
|
+
78,
|
|
2192
|
+
86,
|
|
2193
|
+
143,
|
|
2194
|
+
247,
|
|
2195
|
+
132,
|
|
2196
|
+
85,
|
|
2197
|
+
203
|
|
2198
|
+
],
|
|
2199
|
+
accounts: [
|
|
2200
|
+
{
|
|
2201
|
+
name: "authority",
|
|
2202
|
+
writable: true,
|
|
2203
|
+
signer: true
|
|
2204
|
+
},
|
|
2205
|
+
{
|
|
2206
|
+
name: "identity_state",
|
|
2207
|
+
docs: [
|
|
2208
|
+
"may realloc legacy-layout accounts (207 or 543 bytes) to the current",
|
|
2209
|
+
"551-byte layout before deserialization. PDA validated by seeds;",
|
|
2210
|
+
"ownership verified in instruction body after deserialization."
|
|
2211
|
+
],
|
|
2212
|
+
writable: true,
|
|
2213
|
+
pda: {
|
|
2214
|
+
seeds: [
|
|
2215
|
+
{
|
|
2216
|
+
kind: "const",
|
|
2217
|
+
value: [
|
|
2218
|
+
105,
|
|
2219
|
+
100,
|
|
2220
|
+
101,
|
|
2221
|
+
110,
|
|
2222
|
+
116,
|
|
2223
|
+
105,
|
|
2224
|
+
116,
|
|
2225
|
+
121
|
|
2226
|
+
]
|
|
2227
|
+
},
|
|
2228
|
+
{
|
|
2229
|
+
kind: "account",
|
|
2230
|
+
path: "authority"
|
|
2231
|
+
}
|
|
2232
|
+
]
|
|
2233
|
+
}
|
|
2234
|
+
},
|
|
2235
|
+
{
|
|
2236
|
+
name: "protocol_config",
|
|
2237
|
+
docs: [
|
|
2238
|
+
"Supplies the verification fee amount charged on reset."
|
|
2239
|
+
],
|
|
2240
|
+
pda: {
|
|
2241
|
+
seeds: [
|
|
2242
|
+
{
|
|
2243
|
+
kind: "const",
|
|
2244
|
+
value: [
|
|
2245
|
+
112,
|
|
2246
|
+
114,
|
|
2247
|
+
111,
|
|
2248
|
+
116,
|
|
2249
|
+
111,
|
|
2250
|
+
99,
|
|
2251
|
+
111,
|
|
2252
|
+
108,
|
|
2253
|
+
95,
|
|
2254
|
+
99,
|
|
2255
|
+
111,
|
|
2256
|
+
110,
|
|
2257
|
+
102,
|
|
2258
|
+
105,
|
|
2259
|
+
103
|
|
2260
|
+
]
|
|
2261
|
+
}
|
|
2262
|
+
],
|
|
2263
|
+
program: {
|
|
2264
|
+
kind: "const",
|
|
2265
|
+
value: [
|
|
2266
|
+
81,
|
|
2267
|
+
130,
|
|
2268
|
+
250,
|
|
2269
|
+
230,
|
|
2270
|
+
30,
|
|
2271
|
+
253,
|
|
2272
|
+
246,
|
|
2273
|
+
69,
|
|
2274
|
+
82,
|
|
2275
|
+
96,
|
|
2276
|
+
7,
|
|
2277
|
+
173,
|
|
2278
|
+
78,
|
|
2279
|
+
160,
|
|
2280
|
+
131,
|
|
2281
|
+
188,
|
|
2282
|
+
70,
|
|
2283
|
+
106,
|
|
2284
|
+
173,
|
|
2285
|
+
59,
|
|
2286
|
+
102,
|
|
2287
|
+
163,
|
|
2288
|
+
198,
|
|
2289
|
+
189,
|
|
2290
|
+
82,
|
|
2291
|
+
37,
|
|
2292
|
+
225,
|
|
2293
|
+
38,
|
|
2294
|
+
52,
|
|
2295
|
+
233,
|
|
2296
|
+
157,
|
|
2297
|
+
117
|
|
2298
|
+
]
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
},
|
|
2302
|
+
{
|
|
2303
|
+
name: "treasury",
|
|
2304
|
+
writable: true,
|
|
2305
|
+
pda: {
|
|
2306
|
+
seeds: [
|
|
2307
|
+
{
|
|
2308
|
+
kind: "const",
|
|
2309
|
+
value: [
|
|
2310
|
+
112,
|
|
2311
|
+
114,
|
|
2312
|
+
111,
|
|
2313
|
+
116,
|
|
2314
|
+
111,
|
|
2315
|
+
99,
|
|
2316
|
+
111,
|
|
2317
|
+
108,
|
|
2318
|
+
95,
|
|
2319
|
+
116,
|
|
2320
|
+
114,
|
|
2321
|
+
101,
|
|
2322
|
+
97,
|
|
2323
|
+
115,
|
|
2324
|
+
117,
|
|
2325
|
+
114,
|
|
2326
|
+
121
|
|
2327
|
+
]
|
|
2328
|
+
}
|
|
2329
|
+
],
|
|
2330
|
+
program: {
|
|
2331
|
+
kind: "const",
|
|
2332
|
+
value: [
|
|
2333
|
+
81,
|
|
2334
|
+
130,
|
|
2335
|
+
250,
|
|
2336
|
+
230,
|
|
2337
|
+
30,
|
|
2338
|
+
253,
|
|
2339
|
+
246,
|
|
2340
|
+
69,
|
|
2341
|
+
82,
|
|
2342
|
+
96,
|
|
2343
|
+
7,
|
|
2344
|
+
173,
|
|
2345
|
+
78,
|
|
2346
|
+
160,
|
|
2347
|
+
131,
|
|
2348
|
+
188,
|
|
2349
|
+
70,
|
|
2350
|
+
106,
|
|
2351
|
+
173,
|
|
2352
|
+
59,
|
|
2353
|
+
102,
|
|
2354
|
+
163,
|
|
2355
|
+
198,
|
|
2356
|
+
189,
|
|
2357
|
+
82,
|
|
2358
|
+
37,
|
|
2359
|
+
225,
|
|
2360
|
+
38,
|
|
2361
|
+
52,
|
|
2362
|
+
233,
|
|
2363
|
+
157,
|
|
2364
|
+
117
|
|
2365
|
+
]
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
},
|
|
2369
|
+
{
|
|
2370
|
+
name: "system_program",
|
|
2371
|
+
address: "11111111111111111111111111111111"
|
|
2372
|
+
}
|
|
2373
|
+
],
|
|
2374
|
+
args: [
|
|
2375
|
+
{
|
|
2376
|
+
name: "new_commitment",
|
|
2377
|
+
type: {
|
|
2378
|
+
array: [
|
|
2379
|
+
"u8",
|
|
2380
|
+
32
|
|
2381
|
+
]
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
]
|
|
2385
|
+
},
|
|
2386
|
+
{
|
|
2387
|
+
name: "update_anchor",
|
|
2388
|
+
docs: [
|
|
2389
|
+
"Update the identity state after a successful proof verification.",
|
|
2390
|
+
"",
|
|
2391
|
+
"Trust score is computed automatically from verification history and protocol config.",
|
|
2392
|
+
"Handles transparent migration from old (10-slot) to new (52-slot) account layouts.",
|
|
2393
|
+
"",
|
|
2394
|
+
"Requires a matching, fresh `VerificationResult` PDA (owned by entros-verifier)",
|
|
2395
|
+
"whose `commitment_new` equals `new_commitment` and whose `commitment_prev`",
|
|
2396
|
+
"equals the identity's current stored commitment. Without this binding the",
|
|
2397
|
+
"instruction would accept any commitment with no biometric proof \u2014 allowing",
|
|
2398
|
+
"trust-score farming via per-call fee payment, which contradicts the",
|
|
2399
|
+
"protocol's economic deterrence model. See AUDIT.md for details.",
|
|
2400
|
+
"",
|
|
2401
|
+
"The `verification_nonce` argument supplies the challenge nonce used to",
|
|
2402
|
+
'derive the VerificationResult PDA (`seeds = [b"verification", authority, nonce]`).',
|
|
2403
|
+
"Single-use is enforced implicitly: after this call, `current_commitment`",
|
|
2404
|
+
"rotates to `new_commitment`, so the consumed VerificationResult's",
|
|
2405
|
+
"`commitment_prev` no longer matches on any future call."
|
|
2406
|
+
],
|
|
2407
|
+
discriminator: [
|
|
2408
|
+
120,
|
|
2409
|
+
192,
|
|
2410
|
+
72,
|
|
2411
|
+
245,
|
|
2412
|
+
112,
|
|
2413
|
+
246,
|
|
2414
|
+
119,
|
|
2415
|
+
135
|
|
2416
|
+
],
|
|
2417
|
+
accounts: [
|
|
2418
|
+
{
|
|
2419
|
+
name: "authority",
|
|
2420
|
+
writable: true,
|
|
2421
|
+
signer: true
|
|
2422
|
+
},
|
|
2423
|
+
{
|
|
2424
|
+
name: "identity_state",
|
|
2425
|
+
docs: [
|
|
2426
|
+
"from old (10-slot) to new (52-slot) account layouts. PDA validated by seeds.",
|
|
2427
|
+
"Ownership verified in instruction body after deserialization."
|
|
2428
|
+
],
|
|
2429
|
+
writable: true,
|
|
2430
|
+
pda: {
|
|
2431
|
+
seeds: [
|
|
2432
|
+
{
|
|
2433
|
+
kind: "const",
|
|
2434
|
+
value: [
|
|
2435
|
+
105,
|
|
2436
|
+
100,
|
|
2437
|
+
101,
|
|
2438
|
+
110,
|
|
2439
|
+
116,
|
|
2440
|
+
105,
|
|
2441
|
+
116,
|
|
2442
|
+
121
|
|
2443
|
+
]
|
|
2444
|
+
},
|
|
2445
|
+
{
|
|
2446
|
+
kind: "account",
|
|
2447
|
+
path: "authority"
|
|
2448
|
+
}
|
|
2449
|
+
]
|
|
2450
|
+
}
|
|
2451
|
+
},
|
|
2452
|
+
{
|
|
2453
|
+
name: "verification_result",
|
|
2454
|
+
docs: [
|
|
2455
|
+
"PDA seeds validated by Anchor; layout + owner + cross-field constraints",
|
|
2456
|
+
"validated in instruction body. Binds the ZK proof to this specific",
|
|
2457
|
+
"update \u2014 without this account, update_anchor would accept any commitment",
|
|
2458
|
+
"with no proof."
|
|
2459
|
+
],
|
|
2460
|
+
pda: {
|
|
2461
|
+
seeds: [
|
|
2462
|
+
{
|
|
2463
|
+
kind: "const",
|
|
2464
|
+
value: [
|
|
2465
|
+
118,
|
|
2466
|
+
101,
|
|
2467
|
+
114,
|
|
2468
|
+
105,
|
|
2469
|
+
102,
|
|
2470
|
+
105,
|
|
2471
|
+
99,
|
|
2472
|
+
97,
|
|
2473
|
+
116,
|
|
2474
|
+
105,
|
|
2475
|
+
111,
|
|
2476
|
+
110
|
|
2477
|
+
]
|
|
2478
|
+
},
|
|
2479
|
+
{
|
|
2480
|
+
kind: "account",
|
|
2481
|
+
path: "authority"
|
|
2482
|
+
},
|
|
2483
|
+
{
|
|
2484
|
+
kind: "arg",
|
|
2485
|
+
path: "verification_nonce"
|
|
2486
|
+
}
|
|
2487
|
+
],
|
|
2488
|
+
program: {
|
|
2489
|
+
kind: "const",
|
|
2490
|
+
value: [
|
|
2491
|
+
48,
|
|
2492
|
+
50,
|
|
2493
|
+
94,
|
|
2494
|
+
115,
|
|
2495
|
+
90,
|
|
2496
|
+
162,
|
|
2497
|
+
108,
|
|
2498
|
+
8,
|
|
2499
|
+
240,
|
|
2500
|
+
151,
|
|
2501
|
+
76,
|
|
2502
|
+
223,
|
|
2503
|
+
101,
|
|
2504
|
+
176,
|
|
2505
|
+
170,
|
|
2506
|
+
86,
|
|
2507
|
+
254,
|
|
2508
|
+
247,
|
|
2509
|
+
252,
|
|
2510
|
+
28,
|
|
2511
|
+
240,
|
|
2512
|
+
145,
|
|
2513
|
+
60,
|
|
2514
|
+
108,
|
|
2515
|
+
42,
|
|
2516
|
+
129,
|
|
2517
|
+
105,
|
|
2518
|
+
32,
|
|
2519
|
+
232,
|
|
2520
|
+
212,
|
|
2521
|
+
226,
|
|
2522
|
+
52
|
|
2523
|
+
]
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
},
|
|
2527
|
+
{
|
|
2528
|
+
name: "protocol_config",
|
|
2529
|
+
docs: [
|
|
2530
|
+
"Validated by seeds + owner via seeds::program."
|
|
2531
|
+
],
|
|
2532
|
+
pda: {
|
|
2533
|
+
seeds: [
|
|
2534
|
+
{
|
|
2535
|
+
kind: "const",
|
|
2536
|
+
value: [
|
|
2537
|
+
112,
|
|
2538
|
+
114,
|
|
2539
|
+
111,
|
|
2540
|
+
116,
|
|
2541
|
+
111,
|
|
2542
|
+
99,
|
|
2543
|
+
111,
|
|
2544
|
+
108,
|
|
2545
|
+
95,
|
|
2546
|
+
99,
|
|
2547
|
+
111,
|
|
2548
|
+
110,
|
|
2549
|
+
102,
|
|
2550
|
+
105,
|
|
2551
|
+
103
|
|
2552
|
+
]
|
|
2553
|
+
}
|
|
2554
|
+
],
|
|
2555
|
+
program: {
|
|
2556
|
+
kind: "const",
|
|
2557
|
+
value: [
|
|
2558
|
+
81,
|
|
2559
|
+
130,
|
|
2560
|
+
250,
|
|
2561
|
+
230,
|
|
2562
|
+
30,
|
|
2563
|
+
253,
|
|
2564
|
+
246,
|
|
2565
|
+
69,
|
|
2566
|
+
82,
|
|
2567
|
+
96,
|
|
2568
|
+
7,
|
|
2569
|
+
173,
|
|
2570
|
+
78,
|
|
2571
|
+
160,
|
|
2572
|
+
131,
|
|
2573
|
+
188,
|
|
2574
|
+
70,
|
|
2575
|
+
106,
|
|
2576
|
+
173,
|
|
2577
|
+
59,
|
|
2578
|
+
102,
|
|
2579
|
+
163,
|
|
2580
|
+
198,
|
|
2581
|
+
189,
|
|
2582
|
+
82,
|
|
2583
|
+
37,
|
|
2584
|
+
225,
|
|
2585
|
+
38,
|
|
2586
|
+
52,
|
|
2587
|
+
233,
|
|
2588
|
+
157,
|
|
2589
|
+
117
|
|
2590
|
+
]
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
},
|
|
2594
|
+
{
|
|
2595
|
+
name: "treasury",
|
|
2596
|
+
writable: true,
|
|
2597
|
+
pda: {
|
|
2598
|
+
seeds: [
|
|
2599
|
+
{
|
|
2600
|
+
kind: "const",
|
|
2601
|
+
value: [
|
|
2602
|
+
112,
|
|
2603
|
+
114,
|
|
2604
|
+
111,
|
|
2605
|
+
116,
|
|
2606
|
+
111,
|
|
2607
|
+
99,
|
|
2608
|
+
111,
|
|
2609
|
+
108,
|
|
2610
|
+
95,
|
|
2611
|
+
116,
|
|
2612
|
+
114,
|
|
2613
|
+
101,
|
|
2614
|
+
97,
|
|
2615
|
+
115,
|
|
2616
|
+
117,
|
|
2617
|
+
114,
|
|
2618
|
+
121
|
|
2619
|
+
]
|
|
2620
|
+
}
|
|
2621
|
+
],
|
|
2622
|
+
program: {
|
|
2623
|
+
kind: "const",
|
|
2624
|
+
value: [
|
|
2625
|
+
81,
|
|
2626
|
+
130,
|
|
2627
|
+
250,
|
|
2628
|
+
230,
|
|
2629
|
+
30,
|
|
2630
|
+
253,
|
|
2631
|
+
246,
|
|
2632
|
+
69,
|
|
2633
|
+
82,
|
|
2634
|
+
96,
|
|
2635
|
+
7,
|
|
2636
|
+
173,
|
|
2637
|
+
78,
|
|
2638
|
+
160,
|
|
2639
|
+
131,
|
|
2640
|
+
188,
|
|
2641
|
+
70,
|
|
2642
|
+
106,
|
|
2643
|
+
173,
|
|
2644
|
+
59,
|
|
2645
|
+
102,
|
|
2646
|
+
163,
|
|
2647
|
+
198,
|
|
2648
|
+
189,
|
|
2649
|
+
82,
|
|
2650
|
+
37,
|
|
2651
|
+
225,
|
|
2652
|
+
38,
|
|
2653
|
+
52,
|
|
2654
|
+
233,
|
|
2655
|
+
157,
|
|
2656
|
+
117
|
|
2657
|
+
]
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
},
|
|
2661
|
+
{
|
|
2662
|
+
name: "system_program",
|
|
2663
|
+
address: "11111111111111111111111111111111"
|
|
2664
|
+
}
|
|
2665
|
+
],
|
|
2666
|
+
args: [
|
|
2667
|
+
{
|
|
2668
|
+
name: "new_commitment",
|
|
2669
|
+
type: {
|
|
2670
|
+
array: [
|
|
2671
|
+
"u8",
|
|
2672
|
+
32
|
|
2673
|
+
]
|
|
2674
|
+
}
|
|
2675
|
+
},
|
|
2676
|
+
{
|
|
2677
|
+
name: "verification_nonce",
|
|
2678
|
+
type: {
|
|
2679
|
+
array: [
|
|
2680
|
+
"u8",
|
|
2681
|
+
32
|
|
2682
|
+
]
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
]
|
|
2686
|
+
}
|
|
2687
|
+
],
|
|
2688
|
+
accounts: [
|
|
2689
|
+
{
|
|
2690
|
+
name: "IdentityState",
|
|
2691
|
+
discriminator: [
|
|
2692
|
+
156,
|
|
2693
|
+
32,
|
|
2694
|
+
87,
|
|
2695
|
+
93,
|
|
2696
|
+
52,
|
|
2697
|
+
155,
|
|
2698
|
+
248,
|
|
2699
|
+
207
|
|
2700
|
+
]
|
|
2701
|
+
}
|
|
2702
|
+
],
|
|
2703
|
+
events: [
|
|
2704
|
+
{
|
|
2705
|
+
name: "AnchorMinted",
|
|
2706
|
+
discriminator: [
|
|
2707
|
+
11,
|
|
2708
|
+
188,
|
|
2709
|
+
6,
|
|
2710
|
+
169,
|
|
2711
|
+
20,
|
|
2712
|
+
50,
|
|
2713
|
+
128,
|
|
2714
|
+
172
|
|
2715
|
+
]
|
|
2716
|
+
},
|
|
2717
|
+
{
|
|
2718
|
+
name: "AnchorReset",
|
|
2719
|
+
discriminator: [
|
|
2720
|
+
183,
|
|
2721
|
+
48,
|
|
2722
|
+
146,
|
|
2723
|
+
155,
|
|
2724
|
+
112,
|
|
2725
|
+
20,
|
|
2726
|
+
140,
|
|
2727
|
+
31
|
|
2728
|
+
]
|
|
2729
|
+
},
|
|
2730
|
+
{
|
|
2731
|
+
name: "AnchorUpdated",
|
|
2732
|
+
discriminator: [
|
|
2733
|
+
112,
|
|
2734
|
+
73,
|
|
2735
|
+
210,
|
|
2736
|
+
183,
|
|
2737
|
+
57,
|
|
2738
|
+
84,
|
|
2739
|
+
103,
|
|
2740
|
+
59
|
|
2741
|
+
]
|
|
2742
|
+
},
|
|
2743
|
+
{
|
|
2744
|
+
name: "MigrateIdentityEvent",
|
|
2745
|
+
discriminator: [
|
|
2746
|
+
33,
|
|
2747
|
+
239,
|
|
2748
|
+
166,
|
|
2749
|
+
187,
|
|
2750
|
+
108,
|
|
2751
|
+
47,
|
|
2752
|
+
49,
|
|
2753
|
+
139
|
|
2754
|
+
]
|
|
2755
|
+
}
|
|
2756
|
+
],
|
|
2757
|
+
errors: [
|
|
2758
|
+
{
|
|
2759
|
+
code: 6e3,
|
|
2760
|
+
name: "InvalidCommitment",
|
|
2761
|
+
msg: "Invalid commitment: must be 32 non-zero bytes"
|
|
2762
|
+
},
|
|
2763
|
+
{
|
|
2764
|
+
code: 6001,
|
|
2765
|
+
name: "Unauthorized",
|
|
2766
|
+
msg: "Unauthorized: caller is not the identity owner"
|
|
2767
|
+
},
|
|
2768
|
+
{
|
|
2769
|
+
code: 6002,
|
|
2770
|
+
name: "ArithmeticOverflow",
|
|
2771
|
+
msg: "Arithmetic overflow"
|
|
2772
|
+
},
|
|
2773
|
+
{
|
|
2774
|
+
code: 6003,
|
|
2775
|
+
name: "InvalidProtocolConfig",
|
|
2776
|
+
msg: "Invalid protocol config account"
|
|
2777
|
+
},
|
|
2778
|
+
{
|
|
2779
|
+
code: 6004,
|
|
2780
|
+
name: "InvalidIdentityState",
|
|
2781
|
+
msg: "Identity state account failed to deserialize"
|
|
2782
|
+
},
|
|
2783
|
+
{
|
|
2784
|
+
code: 6005,
|
|
2785
|
+
name: "IdentitySerializationFailed",
|
|
2786
|
+
msg: "Identity state account failed to serialize"
|
|
2787
|
+
},
|
|
2788
|
+
{
|
|
2789
|
+
code: 6006,
|
|
2790
|
+
name: "VerificationResultWrongOwner",
|
|
2791
|
+
msg: "VerificationResult account is owned by the wrong program"
|
|
2792
|
+
},
|
|
2793
|
+
{
|
|
2794
|
+
code: 6007,
|
|
2795
|
+
name: "StaleVerificationResult",
|
|
2796
|
+
msg: "VerificationResult account has stale layout (pre-binding-patch)"
|
|
2797
|
+
},
|
|
2798
|
+
{
|
|
2799
|
+
code: 6008,
|
|
2800
|
+
name: "VerifierMismatch",
|
|
2801
|
+
msg: "VerificationResult verifier does not match the signing authority"
|
|
2802
|
+
},
|
|
2803
|
+
{
|
|
2804
|
+
code: 6009,
|
|
2805
|
+
name: "ProofExpired",
|
|
2806
|
+
msg: "Proof is too old to consume (MAX_PROOF_AGE_SECS exceeded)"
|
|
2807
|
+
},
|
|
2808
|
+
{
|
|
2809
|
+
code: 6010,
|
|
2810
|
+
name: "CommitmentMismatch",
|
|
2811
|
+
msg: "Proof commitment_new does not match the submitted new_commitment"
|
|
2812
|
+
},
|
|
2813
|
+
{
|
|
2814
|
+
code: 6011,
|
|
2815
|
+
name: "PrevCommitmentMismatch",
|
|
2816
|
+
msg: "Proof commitment_prev does not match the identity's current_commitment"
|
|
2817
|
+
},
|
|
2818
|
+
{
|
|
2819
|
+
code: 6012,
|
|
2820
|
+
name: "ResetCooldownActive",
|
|
2821
|
+
msg: "Reset cooldown has not elapsed since the last reset"
|
|
2822
|
+
},
|
|
2823
|
+
{
|
|
2824
|
+
code: 6013,
|
|
2825
|
+
name: "UnauthorizedNewWallet",
|
|
2826
|
+
msg: "caller is not authorized by the old identity"
|
|
2827
|
+
},
|
|
2828
|
+
{
|
|
2829
|
+
code: 6014,
|
|
2830
|
+
name: "ProofFromFuture",
|
|
2831
|
+
msg: "VerificationResult.verified_at is in the future relative to the cluster clock"
|
|
2832
|
+
},
|
|
2833
|
+
{
|
|
2834
|
+
code: 6015,
|
|
2835
|
+
name: "MissingValidatorReceipt",
|
|
2836
|
+
msg: "mint_anchor expected a preceding Ed25519Program::verify instruction with a validator-signed receipt; none found"
|
|
2837
|
+
},
|
|
2838
|
+
{
|
|
2839
|
+
code: 6016,
|
|
2840
|
+
name: "ReceiptValidatorMismatch",
|
|
2841
|
+
msg: "Receipt was signed by a key that does not match ProtocolConfig.validator_pubkey"
|
|
2842
|
+
},
|
|
2843
|
+
{
|
|
2844
|
+
code: 6017,
|
|
2845
|
+
name: "ReceiptCommitmentMismatch",
|
|
2846
|
+
msg: "Receipt commitment does not match the mint_anchor commitment argument"
|
|
2847
|
+
},
|
|
2848
|
+
{
|
|
2849
|
+
code: 6018,
|
|
2850
|
+
name: "ReceiptWalletMismatch",
|
|
2851
|
+
msg: "Receipt wallet does not match the mint signer"
|
|
2852
|
+
},
|
|
2853
|
+
{
|
|
2854
|
+
code: 6019,
|
|
2855
|
+
name: "ReceiptExpired",
|
|
2856
|
+
msg: "Receipt has aged past MAX_RECEIPT_AGE_SECS"
|
|
2857
|
+
},
|
|
2858
|
+
{
|
|
2859
|
+
code: 6020,
|
|
2860
|
+
name: "ReceiptFromFuture",
|
|
2861
|
+
msg: "Receipt validated_at is in the future relative to the cluster clock"
|
|
2862
|
+
},
|
|
2863
|
+
{
|
|
2864
|
+
code: 6021,
|
|
2865
|
+
name: "MalformedReceiptMessage",
|
|
2866
|
+
msg: "Receipt message has malformed length or layout"
|
|
2867
|
+
}
|
|
2868
|
+
],
|
|
2869
|
+
types: [
|
|
2870
|
+
{
|
|
2871
|
+
name: "AnchorMinted",
|
|
2872
|
+
type: {
|
|
2873
|
+
kind: "struct",
|
|
2874
|
+
fields: [
|
|
2875
|
+
{
|
|
2876
|
+
name: "owner",
|
|
2877
|
+
type: "pubkey"
|
|
2878
|
+
},
|
|
2879
|
+
{
|
|
2880
|
+
name: "mint",
|
|
2881
|
+
type: "pubkey"
|
|
2882
|
+
},
|
|
2883
|
+
{
|
|
2884
|
+
name: "commitment",
|
|
2885
|
+
type: {
|
|
2886
|
+
array: [
|
|
2887
|
+
"u8",
|
|
2888
|
+
32
|
|
2889
|
+
]
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
]
|
|
2893
|
+
}
|
|
2894
|
+
},
|
|
2895
|
+
{
|
|
2896
|
+
name: "AnchorReset",
|
|
2897
|
+
type: {
|
|
2898
|
+
kind: "struct",
|
|
2899
|
+
fields: [
|
|
2900
|
+
{
|
|
2901
|
+
name: "owner",
|
|
2902
|
+
type: "pubkey"
|
|
2903
|
+
},
|
|
2904
|
+
{
|
|
2905
|
+
name: "mint",
|
|
2906
|
+
type: "pubkey"
|
|
2907
|
+
},
|
|
2908
|
+
{
|
|
2909
|
+
name: "commitment",
|
|
2910
|
+
type: {
|
|
2911
|
+
array: [
|
|
2912
|
+
"u8",
|
|
2913
|
+
32
|
|
2914
|
+
]
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
]
|
|
2918
|
+
}
|
|
2919
|
+
},
|
|
2920
|
+
{
|
|
2921
|
+
name: "AnchorUpdated",
|
|
2922
|
+
type: {
|
|
2923
|
+
kind: "struct",
|
|
2924
|
+
fields: [
|
|
2925
|
+
{
|
|
2926
|
+
name: "owner",
|
|
2927
|
+
type: "pubkey"
|
|
2928
|
+
},
|
|
2929
|
+
{
|
|
2930
|
+
name: "verification_count",
|
|
2931
|
+
type: "u32"
|
|
2932
|
+
},
|
|
2933
|
+
{
|
|
2934
|
+
name: "trust_score",
|
|
2935
|
+
type: "u16"
|
|
2936
|
+
},
|
|
2937
|
+
{
|
|
2938
|
+
name: "commitment",
|
|
2939
|
+
type: {
|
|
2940
|
+
array: [
|
|
2941
|
+
"u8",
|
|
2942
|
+
32
|
|
2943
|
+
]
|
|
2944
|
+
}
|
|
2945
|
+
}
|
|
2946
|
+
]
|
|
2947
|
+
}
|
|
2948
|
+
},
|
|
2949
|
+
{
|
|
2950
|
+
name: "IdentityState",
|
|
2951
|
+
type: {
|
|
2952
|
+
kind: "struct",
|
|
2953
|
+
fields: [
|
|
2954
|
+
{
|
|
2955
|
+
name: "owner",
|
|
2956
|
+
docs: [
|
|
2957
|
+
"The user's wallet pubkey"
|
|
2958
|
+
],
|
|
2959
|
+
type: "pubkey"
|
|
2960
|
+
},
|
|
2961
|
+
{
|
|
2962
|
+
name: "creation_timestamp",
|
|
2963
|
+
docs: [
|
|
2964
|
+
"When the identity was first minted"
|
|
2965
|
+
],
|
|
2966
|
+
type: "i64"
|
|
2967
|
+
},
|
|
2968
|
+
{
|
|
2969
|
+
name: "last_verification_timestamp",
|
|
2970
|
+
docs: [
|
|
2971
|
+
"Most recent successful verification"
|
|
2972
|
+
],
|
|
2973
|
+
type: "i64"
|
|
2974
|
+
},
|
|
2975
|
+
{
|
|
2976
|
+
name: "verification_count",
|
|
2977
|
+
docs: [
|
|
2978
|
+
"Total successful verifications"
|
|
2979
|
+
],
|
|
2980
|
+
type: "u32"
|
|
2981
|
+
},
|
|
2982
|
+
{
|
|
2983
|
+
name: "trust_score",
|
|
2984
|
+
docs: [
|
|
2985
|
+
"Computed reputation metric"
|
|
2986
|
+
],
|
|
2987
|
+
type: "u16"
|
|
2988
|
+
},
|
|
2989
|
+
{
|
|
2990
|
+
name: "current_commitment",
|
|
2991
|
+
docs: [
|
|
2992
|
+
"Latest Poseidon commitment H_TBH"
|
|
2993
|
+
],
|
|
2994
|
+
type: {
|
|
2995
|
+
array: [
|
|
2996
|
+
"u8",
|
|
2997
|
+
32
|
|
2998
|
+
]
|
|
2999
|
+
}
|
|
3000
|
+
},
|
|
3001
|
+
{
|
|
3002
|
+
name: "mint",
|
|
3003
|
+
docs: [
|
|
3004
|
+
"The NonTransferable mint associated with this identity"
|
|
3005
|
+
],
|
|
3006
|
+
type: "pubkey"
|
|
3007
|
+
},
|
|
3008
|
+
{
|
|
3009
|
+
name: "bump",
|
|
3010
|
+
docs: [
|
|
3011
|
+
"PDA bump seed"
|
|
3012
|
+
],
|
|
3013
|
+
type: "u8"
|
|
3014
|
+
},
|
|
3015
|
+
{
|
|
3016
|
+
name: "recent_timestamps",
|
|
3017
|
+
docs: [
|
|
3018
|
+
"Timestamps of last 52 verifications (newest at index 0).",
|
|
3019
|
+
"52 slots covers 1 year of weekly or 4+ years of monthly verifications.",
|
|
3020
|
+
"Older entries contribute negligible score due to exponential recency decay."
|
|
3021
|
+
],
|
|
3022
|
+
type: {
|
|
3023
|
+
array: [
|
|
3024
|
+
"i64",
|
|
3025
|
+
52
|
|
3026
|
+
]
|
|
3027
|
+
}
|
|
3028
|
+
},
|
|
3029
|
+
{
|
|
3030
|
+
name: "last_reset_timestamp",
|
|
3031
|
+
docs: [
|
|
3032
|
+
"Most recent `reset_identity_state` invocation. Zero when the identity",
|
|
3033
|
+
"has never been reset (including freshly minted accounts and accounts",
|
|
3034
|
+
"created before this field existed and then realloc'd in-place)."
|
|
3035
|
+
],
|
|
3036
|
+
type: "i64"
|
|
3037
|
+
},
|
|
3038
|
+
{
|
|
3039
|
+
name: "new_wallet",
|
|
3040
|
+
docs: [
|
|
3041
|
+
"new wallet for migrate_identity()"
|
|
3042
|
+
],
|
|
3043
|
+
type: "pubkey"
|
|
3044
|
+
}
|
|
3045
|
+
]
|
|
3046
|
+
}
|
|
3047
|
+
},
|
|
3048
|
+
{
|
|
3049
|
+
name: "MigrateIdentityEvent",
|
|
3050
|
+
type: {
|
|
3051
|
+
kind: "struct",
|
|
3052
|
+
fields: [
|
|
3053
|
+
{
|
|
3054
|
+
name: "wallet_old",
|
|
3055
|
+
type: "pubkey"
|
|
3056
|
+
},
|
|
3057
|
+
{
|
|
3058
|
+
name: "wallet_new",
|
|
3059
|
+
type: "pubkey"
|
|
3060
|
+
},
|
|
3061
|
+
{
|
|
3062
|
+
name: "identity_old",
|
|
3063
|
+
type: "pubkey"
|
|
3064
|
+
},
|
|
3065
|
+
{
|
|
3066
|
+
name: "identity_new",
|
|
3067
|
+
type: "pubkey"
|
|
3068
|
+
}
|
|
3069
|
+
]
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
]
|
|
3073
|
+
};
|
|
3074
|
+
|
|
3075
|
+
// src/protocol/idl/entros_verifier.json
|
|
3076
|
+
var entros_verifier_default = {
|
|
3077
|
+
address: "4F97jNoxQzT2qRbkWpW3ztC3Nz2TtKj3rnKG8ExgnrfV",
|
|
3078
|
+
metadata: {
|
|
3079
|
+
name: "entros_verifier",
|
|
3080
|
+
version: "0.1.0",
|
|
3081
|
+
spec: "0.1.0",
|
|
3082
|
+
description: "ZK proof verification program for Entros Protocol"
|
|
3083
|
+
},
|
|
3084
|
+
instructions: [
|
|
3085
|
+
{
|
|
3086
|
+
name: "close_challenge",
|
|
3087
|
+
docs: [
|
|
3088
|
+
"Close a used or expired challenge account to reclaim rent."
|
|
3089
|
+
],
|
|
3090
|
+
discriminator: [
|
|
3091
|
+
29,
|
|
3092
|
+
156,
|
|
3093
|
+
109,
|
|
3094
|
+
17,
|
|
3095
|
+
41,
|
|
3096
|
+
99,
|
|
3097
|
+
71,
|
|
3098
|
+
236
|
|
3099
|
+
],
|
|
3100
|
+
accounts: [
|
|
3101
|
+
{
|
|
3102
|
+
name: "challenger",
|
|
3103
|
+
writable: true,
|
|
3104
|
+
signer: true
|
|
3105
|
+
},
|
|
3106
|
+
{
|
|
3107
|
+
name: "challenge",
|
|
3108
|
+
writable: true
|
|
3109
|
+
}
|
|
3110
|
+
],
|
|
3111
|
+
args: []
|
|
3112
|
+
},
|
|
3113
|
+
{
|
|
3114
|
+
name: "close_verification_result",
|
|
3115
|
+
docs: [
|
|
3116
|
+
"Close a verification result account to reclaim rent."
|
|
3117
|
+
],
|
|
3118
|
+
discriminator: [
|
|
3119
|
+
202,
|
|
3120
|
+
203,
|
|
3121
|
+
62,
|
|
3122
|
+
127,
|
|
3123
|
+
7,
|
|
3124
|
+
157,
|
|
3125
|
+
143,
|
|
3126
|
+
12
|
|
3127
|
+
],
|
|
3128
|
+
accounts: [
|
|
3129
|
+
{
|
|
3130
|
+
name: "verifier",
|
|
3131
|
+
writable: true,
|
|
3132
|
+
signer: true
|
|
3133
|
+
},
|
|
3134
|
+
{
|
|
3135
|
+
name: "verification_result",
|
|
3136
|
+
writable: true
|
|
3137
|
+
}
|
|
3138
|
+
],
|
|
3139
|
+
args: []
|
|
3140
|
+
},
|
|
3141
|
+
{
|
|
3142
|
+
name: "create_challenge",
|
|
3143
|
+
docs: [
|
|
3144
|
+
"Create a verification challenge with a client-generated nonce."
|
|
3145
|
+
],
|
|
3146
|
+
discriminator: [
|
|
3147
|
+
170,
|
|
3148
|
+
244,
|
|
3149
|
+
47,
|
|
3150
|
+
1,
|
|
3151
|
+
1,
|
|
3152
|
+
15,
|
|
3153
|
+
173,
|
|
3154
|
+
239
|
|
3155
|
+
],
|
|
3156
|
+
accounts: [
|
|
3157
|
+
{
|
|
3158
|
+
name: "challenger",
|
|
3159
|
+
writable: true,
|
|
3160
|
+
signer: true
|
|
3161
|
+
},
|
|
3162
|
+
{
|
|
3163
|
+
name: "challenge",
|
|
3164
|
+
writable: true,
|
|
3165
|
+
pda: {
|
|
3166
|
+
seeds: [
|
|
3167
|
+
{
|
|
3168
|
+
kind: "const",
|
|
3169
|
+
value: [
|
|
3170
|
+
99,
|
|
3171
|
+
104,
|
|
3172
|
+
97,
|
|
3173
|
+
108,
|
|
3174
|
+
108,
|
|
3175
|
+
101,
|
|
3176
|
+
110,
|
|
3177
|
+
103,
|
|
3178
|
+
101
|
|
3179
|
+
]
|
|
3180
|
+
},
|
|
3181
|
+
{
|
|
3182
|
+
kind: "account",
|
|
3183
|
+
path: "challenger"
|
|
3184
|
+
},
|
|
3185
|
+
{
|
|
3186
|
+
kind: "arg",
|
|
3187
|
+
path: "nonce"
|
|
3188
|
+
}
|
|
3189
|
+
]
|
|
3190
|
+
}
|
|
3191
|
+
},
|
|
3192
|
+
{
|
|
3193
|
+
name: "system_program",
|
|
3194
|
+
address: "11111111111111111111111111111111"
|
|
3195
|
+
}
|
|
3196
|
+
],
|
|
3197
|
+
args: [
|
|
3198
|
+
{
|
|
3199
|
+
name: "nonce",
|
|
3200
|
+
type: {
|
|
3201
|
+
array: [
|
|
3202
|
+
"u8",
|
|
3203
|
+
32
|
|
3204
|
+
]
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
]
|
|
3208
|
+
},
|
|
3209
|
+
{
|
|
3210
|
+
name: "verify_proof",
|
|
3211
|
+
docs: [
|
|
3212
|
+
"Verify a proof against a challenge.",
|
|
3213
|
+
"Validates the challenge is unused and not expired, runs mock verification,",
|
|
3214
|
+
"and stores the result."
|
|
3215
|
+
],
|
|
3216
|
+
discriminator: [
|
|
3217
|
+
217,
|
|
3218
|
+
211,
|
|
3219
|
+
191,
|
|
3220
|
+
110,
|
|
3221
|
+
144,
|
|
3222
|
+
13,
|
|
3223
|
+
186,
|
|
3224
|
+
98
|
|
3225
|
+
],
|
|
3226
|
+
accounts: [
|
|
3227
|
+
{
|
|
3228
|
+
name: "verifier",
|
|
3229
|
+
writable: true,
|
|
3230
|
+
signer: true
|
|
3231
|
+
},
|
|
3232
|
+
{
|
|
3233
|
+
name: "challenge",
|
|
3234
|
+
writable: true,
|
|
3235
|
+
pda: {
|
|
3236
|
+
seeds: [
|
|
3237
|
+
{
|
|
3238
|
+
kind: "const",
|
|
3239
|
+
value: [
|
|
3240
|
+
99,
|
|
3241
|
+
104,
|
|
3242
|
+
97,
|
|
3243
|
+
108,
|
|
3244
|
+
108,
|
|
3245
|
+
101,
|
|
3246
|
+
110,
|
|
3247
|
+
103,
|
|
3248
|
+
101
|
|
3249
|
+
]
|
|
3250
|
+
},
|
|
3251
|
+
{
|
|
3252
|
+
kind: "account",
|
|
3253
|
+
path: "verifier"
|
|
3254
|
+
},
|
|
3255
|
+
{
|
|
3256
|
+
kind: "arg",
|
|
3257
|
+
path: "nonce"
|
|
3258
|
+
}
|
|
3259
|
+
]
|
|
3260
|
+
}
|
|
3261
|
+
},
|
|
3262
|
+
{
|
|
3263
|
+
name: "verification_result",
|
|
3264
|
+
writable: true,
|
|
3265
|
+
pda: {
|
|
3266
|
+
seeds: [
|
|
3267
|
+
{
|
|
3268
|
+
kind: "const",
|
|
3269
|
+
value: [
|
|
3270
|
+
118,
|
|
3271
|
+
101,
|
|
3272
|
+
114,
|
|
3273
|
+
105,
|
|
3274
|
+
102,
|
|
3275
|
+
105,
|
|
3276
|
+
99,
|
|
3277
|
+
97,
|
|
3278
|
+
116,
|
|
3279
|
+
105,
|
|
3280
|
+
111,
|
|
3281
|
+
110
|
|
3282
|
+
]
|
|
3283
|
+
},
|
|
3284
|
+
{
|
|
3285
|
+
kind: "account",
|
|
3286
|
+
path: "verifier"
|
|
3287
|
+
},
|
|
3288
|
+
{
|
|
3289
|
+
kind: "arg",
|
|
3290
|
+
path: "nonce"
|
|
3291
|
+
}
|
|
3292
|
+
]
|
|
3293
|
+
}
|
|
3294
|
+
},
|
|
3295
|
+
{
|
|
3296
|
+
name: "system_program",
|
|
3297
|
+
address: "11111111111111111111111111111111"
|
|
3298
|
+
}
|
|
3299
|
+
],
|
|
3300
|
+
args: [
|
|
3301
|
+
{
|
|
3302
|
+
name: "proof_bytes",
|
|
3303
|
+
type: "bytes"
|
|
3304
|
+
},
|
|
3305
|
+
{
|
|
3306
|
+
name: "public_inputs",
|
|
3307
|
+
type: {
|
|
3308
|
+
vec: {
|
|
3309
|
+
array: [
|
|
3310
|
+
"u8",
|
|
3311
|
+
32
|
|
3312
|
+
]
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
},
|
|
3316
|
+
{
|
|
3317
|
+
name: "nonce",
|
|
3318
|
+
type: {
|
|
3319
|
+
array: [
|
|
3320
|
+
"u8",
|
|
3321
|
+
32
|
|
3322
|
+
]
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
]
|
|
3326
|
+
}
|
|
3327
|
+
],
|
|
3328
|
+
accounts: [
|
|
3329
|
+
{
|
|
3330
|
+
name: "Challenge",
|
|
3331
|
+
discriminator: [
|
|
3332
|
+
119,
|
|
3333
|
+
250,
|
|
3334
|
+
161,
|
|
3335
|
+
121,
|
|
3336
|
+
119,
|
|
3337
|
+
81,
|
|
3338
|
+
22,
|
|
3339
|
+
208
|
|
3340
|
+
]
|
|
3341
|
+
},
|
|
3342
|
+
{
|
|
3343
|
+
name: "VerificationResult",
|
|
3344
|
+
discriminator: [
|
|
3345
|
+
104,
|
|
3346
|
+
111,
|
|
3347
|
+
80,
|
|
3348
|
+
172,
|
|
3349
|
+
219,
|
|
3350
|
+
191,
|
|
3351
|
+
162,
|
|
3352
|
+
38
|
|
3353
|
+
]
|
|
3354
|
+
}
|
|
3355
|
+
],
|
|
3356
|
+
events: [
|
|
3357
|
+
{
|
|
3358
|
+
name: "ChallengeCreated",
|
|
3359
|
+
discriminator: [
|
|
3360
|
+
166,
|
|
3361
|
+
178,
|
|
3362
|
+
174,
|
|
3363
|
+
178,
|
|
3364
|
+
11,
|
|
3365
|
+
172,
|
|
3366
|
+
98,
|
|
3367
|
+
243
|
|
3368
|
+
]
|
|
3369
|
+
},
|
|
3370
|
+
{
|
|
3371
|
+
name: "VerificationComplete",
|
|
3372
|
+
discriminator: [
|
|
3373
|
+
22,
|
|
3374
|
+
74,
|
|
3375
|
+
77,
|
|
3376
|
+
232,
|
|
3377
|
+
220,
|
|
3378
|
+
46,
|
|
3379
|
+
59,
|
|
3380
|
+
120
|
|
3381
|
+
]
|
|
3382
|
+
}
|
|
3383
|
+
],
|
|
3384
|
+
errors: [
|
|
3385
|
+
{
|
|
3386
|
+
code: 6e3,
|
|
3387
|
+
name: "InvalidProofFormat",
|
|
3388
|
+
msg: "Invalid proof format"
|
|
3389
|
+
},
|
|
3390
|
+
{
|
|
3391
|
+
code: 6001,
|
|
3392
|
+
name: "ProofVerificationFailed",
|
|
3393
|
+
msg: "Proof verification failed"
|
|
3394
|
+
},
|
|
3395
|
+
{
|
|
3396
|
+
code: 6002,
|
|
3397
|
+
name: "ChallengeExpired",
|
|
3398
|
+
msg: "Challenge has expired"
|
|
3399
|
+
},
|
|
3400
|
+
{
|
|
3401
|
+
code: 6003,
|
|
3402
|
+
name: "ChallengeAlreadyUsed",
|
|
3403
|
+
msg: "Challenge already used"
|
|
3404
|
+
},
|
|
3405
|
+
{
|
|
3406
|
+
code: 6004,
|
|
3407
|
+
name: "InvalidPublicInputs",
|
|
3408
|
+
msg: "Invalid public inputs"
|
|
3409
|
+
},
|
|
3410
|
+
{
|
|
3411
|
+
code: 6005,
|
|
3412
|
+
name: "ChallengeNotUsed",
|
|
3413
|
+
msg: "Challenge must be used before closing"
|
|
3414
|
+
},
|
|
3415
|
+
{
|
|
3416
|
+
code: 6006,
|
|
3417
|
+
name: "InvalidNonce",
|
|
3418
|
+
msg: "Invalid nonce: must not be all zeros"
|
|
3419
|
+
},
|
|
3420
|
+
{
|
|
3421
|
+
code: 6007,
|
|
3422
|
+
name: "ArithmeticOverflow",
|
|
3423
|
+
msg: "Arithmetic overflow"
|
|
3424
|
+
}
|
|
3425
|
+
],
|
|
3426
|
+
types: [
|
|
3427
|
+
{
|
|
3428
|
+
name: "Challenge",
|
|
3429
|
+
type: {
|
|
3430
|
+
kind: "struct",
|
|
3431
|
+
fields: [
|
|
3432
|
+
{
|
|
3433
|
+
name: "challenger",
|
|
3434
|
+
docs: [
|
|
3435
|
+
"The user who requested the challenge"
|
|
3436
|
+
],
|
|
3437
|
+
type: "pubkey"
|
|
3438
|
+
},
|
|
3439
|
+
{
|
|
3440
|
+
name: "nonce",
|
|
3441
|
+
docs: [
|
|
3442
|
+
"Random nonce for anti-replay"
|
|
3443
|
+
],
|
|
3444
|
+
type: {
|
|
3445
|
+
array: [
|
|
3446
|
+
"u8",
|
|
3447
|
+
32
|
|
3448
|
+
]
|
|
3449
|
+
}
|
|
3450
|
+
},
|
|
3451
|
+
{
|
|
3452
|
+
name: "created_at",
|
|
3453
|
+
docs: [
|
|
3454
|
+
"Unix timestamp when challenge was created"
|
|
3455
|
+
],
|
|
3456
|
+
type: "i64"
|
|
3457
|
+
},
|
|
3458
|
+
{
|
|
3459
|
+
name: "expires_at",
|
|
3460
|
+
docs: [
|
|
3461
|
+
"Unix timestamp when challenge expires"
|
|
3462
|
+
],
|
|
3463
|
+
type: "i64"
|
|
3464
|
+
},
|
|
3465
|
+
{
|
|
3466
|
+
name: "used",
|
|
3467
|
+
docs: [
|
|
3468
|
+
"Whether this challenge has been consumed"
|
|
3469
|
+
],
|
|
3470
|
+
type: "bool"
|
|
3471
|
+
},
|
|
3472
|
+
{
|
|
3473
|
+
name: "bump",
|
|
3474
|
+
docs: [
|
|
3475
|
+
"PDA bump seed"
|
|
3476
|
+
],
|
|
3477
|
+
type: "u8"
|
|
3478
|
+
}
|
|
3479
|
+
]
|
|
3480
|
+
}
|
|
3481
|
+
},
|
|
3482
|
+
{
|
|
3483
|
+
name: "ChallengeCreated",
|
|
3484
|
+
type: {
|
|
3485
|
+
kind: "struct",
|
|
3486
|
+
fields: [
|
|
3487
|
+
{
|
|
3488
|
+
name: "challenger",
|
|
3489
|
+
type: "pubkey"
|
|
3490
|
+
},
|
|
3491
|
+
{
|
|
3492
|
+
name: "nonce",
|
|
3493
|
+
type: {
|
|
3494
|
+
array: [
|
|
3495
|
+
"u8",
|
|
3496
|
+
32
|
|
3497
|
+
]
|
|
3498
|
+
}
|
|
3499
|
+
},
|
|
3500
|
+
{
|
|
3501
|
+
name: "expires_at",
|
|
3502
|
+
type: "i64"
|
|
3503
|
+
}
|
|
3504
|
+
]
|
|
3505
|
+
}
|
|
3506
|
+
},
|
|
3507
|
+
{
|
|
3508
|
+
name: "VerificationComplete",
|
|
3509
|
+
type: {
|
|
3510
|
+
kind: "struct",
|
|
3511
|
+
fields: [
|
|
3512
|
+
{
|
|
3513
|
+
name: "verifier",
|
|
3514
|
+
type: "pubkey"
|
|
3515
|
+
},
|
|
3516
|
+
{
|
|
3517
|
+
name: "is_valid",
|
|
3518
|
+
type: "bool"
|
|
3519
|
+
},
|
|
3520
|
+
{
|
|
3521
|
+
name: "nonce",
|
|
3522
|
+
type: {
|
|
3523
|
+
array: [
|
|
3524
|
+
"u8",
|
|
3525
|
+
32
|
|
3526
|
+
]
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
]
|
|
3530
|
+
}
|
|
3531
|
+
},
|
|
3532
|
+
{
|
|
3533
|
+
name: "VerificationResult",
|
|
3534
|
+
type: {
|
|
3535
|
+
kind: "struct",
|
|
3536
|
+
fields: [
|
|
3537
|
+
{
|
|
3538
|
+
name: "verifier",
|
|
3539
|
+
docs: [
|
|
3540
|
+
"Who submitted the proof"
|
|
3541
|
+
],
|
|
3542
|
+
type: "pubkey"
|
|
3543
|
+
},
|
|
3544
|
+
{
|
|
3545
|
+
name: "proof_hash",
|
|
3546
|
+
docs: [
|
|
3547
|
+
"Hash of the proof bytes for audit trail"
|
|
3548
|
+
],
|
|
3549
|
+
type: {
|
|
3550
|
+
array: [
|
|
3551
|
+
"u8",
|
|
3552
|
+
32
|
|
3553
|
+
]
|
|
3554
|
+
}
|
|
3555
|
+
},
|
|
3556
|
+
{
|
|
3557
|
+
name: "verified_at",
|
|
3558
|
+
docs: [
|
|
3559
|
+
"Unix timestamp of verification"
|
|
3560
|
+
],
|
|
3561
|
+
type: "i64"
|
|
3562
|
+
},
|
|
3563
|
+
{
|
|
3564
|
+
name: "is_valid",
|
|
3565
|
+
docs: [
|
|
3566
|
+
"Whether the proof was valid.",
|
|
3567
|
+
"Always true for persisted records \u2014 invalid proofs revert the transaction",
|
|
3568
|
+
"and never create a VerificationResult. Retained for account layout stability."
|
|
3569
|
+
],
|
|
3570
|
+
type: "bool"
|
|
3571
|
+
},
|
|
3572
|
+
{
|
|
3573
|
+
name: "challenge_nonce",
|
|
3574
|
+
docs: [
|
|
3575
|
+
"The challenge nonce that was consumed"
|
|
3576
|
+
],
|
|
3577
|
+
type: {
|
|
3578
|
+
array: [
|
|
3579
|
+
"u8",
|
|
3580
|
+
32
|
|
3581
|
+
]
|
|
3582
|
+
}
|
|
3583
|
+
},
|
|
3584
|
+
{
|
|
3585
|
+
name: "bump",
|
|
3586
|
+
docs: [
|
|
3587
|
+
"PDA bump seed"
|
|
3588
|
+
],
|
|
3589
|
+
type: "u8"
|
|
3590
|
+
},
|
|
3591
|
+
{
|
|
3592
|
+
name: "commitment_new",
|
|
3593
|
+
docs: [
|
|
3594
|
+
"New fingerprint commitment from public_inputs[0]. Read cross-program",
|
|
3595
|
+
"by entros-anchor::update_anchor to bind the proof to the identity update."
|
|
3596
|
+
],
|
|
3597
|
+
type: {
|
|
3598
|
+
array: [
|
|
3599
|
+
"u8",
|
|
3600
|
+
32
|
|
3601
|
+
]
|
|
3602
|
+
}
|
|
3603
|
+
},
|
|
3604
|
+
{
|
|
3605
|
+
name: "commitment_prev",
|
|
3606
|
+
docs: [
|
|
3607
|
+
"Previous fingerprint commitment from public_inputs[1]. Read cross-program",
|
|
3608
|
+
"by entros-anchor::update_anchor to bind to the identity's stored commitment."
|
|
3609
|
+
],
|
|
3610
|
+
type: {
|
|
3611
|
+
array: [
|
|
3612
|
+
"u8",
|
|
3613
|
+
32
|
|
3614
|
+
]
|
|
3615
|
+
}
|
|
3616
|
+
},
|
|
3617
|
+
{
|
|
3618
|
+
name: "threshold",
|
|
3619
|
+
docs: [
|
|
3620
|
+
"Hamming threshold from public_inputs[2]. Bounded at proof time to prevent",
|
|
3621
|
+
"attacker-chosen circuit parameters."
|
|
3622
|
+
],
|
|
3623
|
+
type: "u16"
|
|
3624
|
+
},
|
|
3625
|
+
{
|
|
3626
|
+
name: "min_distance",
|
|
3627
|
+
docs: [
|
|
3628
|
+
"Hamming min_distance from public_inputs[3]. Bounded at proof time to",
|
|
3629
|
+
"prevent replay (Hamming=0) attacks via attacker-chosen min_distance=0."
|
|
3630
|
+
],
|
|
3631
|
+
type: "u16"
|
|
3632
|
+
}
|
|
3633
|
+
]
|
|
3634
|
+
}
|
|
3635
|
+
}
|
|
3636
|
+
]
|
|
3637
|
+
};
|
|
3638
|
+
|
|
1367
3639
|
// src/submit/receipt.ts
|
|
1368
3640
|
var PUBKEY_BYTES = 32;
|
|
1369
3641
|
var SIGNATURE_BYTES = 64;
|
|
@@ -1404,6 +3676,17 @@ async function buildEd25519ReceiptIx(receipt) {
|
|
|
1404
3676
|
}
|
|
1405
3677
|
|
|
1406
3678
|
// src/submit/wallet.ts
|
|
3679
|
+
async function confirmAndCheck(connection, signature) {
|
|
3680
|
+
if (!signature) {
|
|
3681
|
+
throw new Error("confirmAndCheck called without a transaction signature");
|
|
3682
|
+
}
|
|
3683
|
+
const confirmation = await connection.confirmTransaction(signature, "confirmed");
|
|
3684
|
+
if (confirmation?.value?.err != null) {
|
|
3685
|
+
throw new Error(
|
|
3686
|
+
`Transaction failed on chain: ${JSON.stringify(confirmation.value.err)} (sig=${signature})`
|
|
3687
|
+
);
|
|
3688
|
+
}
|
|
3689
|
+
}
|
|
1407
3690
|
async function requestSasAttestation(wallet, walletAddress, relayerUrl, relayerApiKey, serverNonce) {
|
|
1408
3691
|
if (!serverNonce) {
|
|
1409
3692
|
sdkLog("[Entros SDK] Skipping SAS attestation: no server-issued nonce");
|
|
@@ -1546,24 +3829,14 @@ async function submitViaWallet(proof, commitment, options) {
|
|
|
1546
3829
|
[new TextEncoder().encode("protocol_treasury")],
|
|
1547
3830
|
registryProgramId
|
|
1548
3831
|
);
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
};
|
|
1558
|
-
}
|
|
1559
|
-
if (!anchorIdl) {
|
|
1560
|
-
return {
|
|
1561
|
-
success: false,
|
|
1562
|
-
error: `Failed to fetch entros-anchor IDL from Solana (program ${PROGRAM_IDS.entrosAnchor}). Check your RPC endpoint is reachable and on the correct cluster.`
|
|
1563
|
-
};
|
|
1564
|
-
}
|
|
1565
|
-
const verifierProgram = new anchor.Program(verifierIdl, provider);
|
|
1566
|
-
const anchorProgram = new anchor.Program(anchorIdl, provider);
|
|
3832
|
+
const verifierProgram = new anchor.Program(
|
|
3833
|
+
entros_verifier_default,
|
|
3834
|
+
provider
|
|
3835
|
+
);
|
|
3836
|
+
const anchorProgram = new anchor.Program(
|
|
3837
|
+
entros_anchor_default,
|
|
3838
|
+
provider
|
|
3839
|
+
);
|
|
1567
3840
|
const { Buffer: SolBuffer } = await import("buffer");
|
|
1568
3841
|
const createChallengeIx = await verifierProgram.methods.createChallenge(nonce).accounts({
|
|
1569
3842
|
challenger: provider.wallet.publicKey,
|
|
@@ -1598,16 +3871,12 @@ async function submitViaWallet(proof, commitment, options) {
|
|
|
1598
3871
|
txSig = await options.wallet.sendTransaction(tx, options.connection, {
|
|
1599
3872
|
skipPreflight: true
|
|
1600
3873
|
});
|
|
1601
|
-
await options.connection
|
|
3874
|
+
await confirmAndCheck(options.connection, txSig);
|
|
1602
3875
|
} else {
|
|
1603
|
-
const
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
error: `Failed to fetch entros-anchor IDL from Solana (program ${PROGRAM_IDS.entrosAnchor}). Check your RPC endpoint is reachable and on the correct cluster.`
|
|
1608
|
-
};
|
|
1609
|
-
}
|
|
1610
|
-
const anchorProgram = new anchor.Program(anchorIdl, provider);
|
|
3876
|
+
const anchorProgram = new anchor.Program(
|
|
3877
|
+
entros_anchor_default,
|
|
3878
|
+
provider
|
|
3879
|
+
);
|
|
1611
3880
|
const [identityPda] = PublicKey.findProgramAddressSync(
|
|
1612
3881
|
[new TextEncoder().encode("identity"), provider.wallet.publicKey.toBuffer()],
|
|
1613
3882
|
anchorProgramId
|
|
@@ -1680,7 +3949,7 @@ async function submitViaWallet(proof, commitment, options) {
|
|
|
1680
3949
|
txSig = await options.wallet.sendTransaction(tx, options.connection, {
|
|
1681
3950
|
skipPreflight: true
|
|
1682
3951
|
});
|
|
1683
|
-
await options.connection
|
|
3952
|
+
await confirmAndCheck(options.connection, txSig);
|
|
1684
3953
|
}
|
|
1685
3954
|
const attestationTx = options.relayerUrl ? await requestSasAttestation(
|
|
1686
3955
|
options.wallet,
|
|
@@ -1717,14 +3986,10 @@ async function submitResetViaWallet(commitment, options) {
|
|
|
1717
3986
|
[new TextEncoder().encode("protocol_treasury")],
|
|
1718
3987
|
registryProgramId
|
|
1719
3988
|
);
|
|
1720
|
-
const
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
error: `Failed to fetch entros-anchor IDL from Solana (program ${PROGRAM_IDS.entrosAnchor}). Check your RPC endpoint is reachable and on the correct cluster.`
|
|
1725
|
-
};
|
|
1726
|
-
}
|
|
1727
|
-
const anchorProgram = new anchor.Program(anchorIdl, provider);
|
|
3989
|
+
const anchorProgram = new anchor.Program(
|
|
3990
|
+
entros_anchor_default,
|
|
3991
|
+
provider
|
|
3992
|
+
);
|
|
1728
3993
|
const resetIx = await anchorProgram.methods.resetIdentityState(Array.from(commitment)).accounts({
|
|
1729
3994
|
authority: provider.wallet.publicKey,
|
|
1730
3995
|
identityState: identityPda,
|
|
@@ -1742,7 +4007,7 @@ async function submitResetViaWallet(commitment, options) {
|
|
|
1742
4007
|
options.connection,
|
|
1743
4008
|
{ skipPreflight: true }
|
|
1744
4009
|
);
|
|
1745
|
-
await options.connection
|
|
4010
|
+
await confirmAndCheck(options.connection, txSig);
|
|
1746
4011
|
const attestationTx = options.relayerUrl ? await requestSasAttestation(
|
|
1747
4012
|
options.wallet,
|
|
1748
4013
|
provider.wallet.publicKey.toBase58(),
|
|
@@ -1952,11 +4217,7 @@ async function fetchIdentityState(walletPubkey, connection) {
|
|
|
1952
4217
|
);
|
|
1953
4218
|
const accountInfo = await connection.getAccountInfo(identityPda);
|
|
1954
4219
|
if (!accountInfo) return null;
|
|
1955
|
-
const
|
|
1956
|
-
connection
|
|
1957
|
-
});
|
|
1958
|
-
if (!idl) return null;
|
|
1959
|
-
const coder = new anchor.BorshAccountsCoder(idl);
|
|
4220
|
+
const coder = new anchor.BorshAccountsCoder(entros_anchor_default);
|
|
1960
4221
|
const decoded = coder.decode("identityState", accountInfo.data);
|
|
1961
4222
|
return {
|
|
1962
4223
|
owner: decoded.owner.toBase58(),
|
|
@@ -2064,10 +4325,13 @@ async function extractFeatures(data) {
|
|
|
2064
4325
|
const { features: audioFeatures, f0Contour } = await extractSpeakerFeaturesDetailed(
|
|
2065
4326
|
data.audio
|
|
2066
4327
|
);
|
|
4328
|
+
await yieldToMainThread();
|
|
2067
4329
|
const hasMotion = data.motion.length >= MIN_MOTION_SAMPLES;
|
|
2068
4330
|
const hasTouch = data.touch.length >= MIN_TOUCH_SAMPLES;
|
|
2069
4331
|
const motionFeatures = hasMotion && hasTouch ? extractMouseDynamics(data.touch) : hasMotion ? extractMotionFeatures(data.motion) : extractMouseDynamics(data.touch);
|
|
4332
|
+
await yieldToMainThread();
|
|
2070
4333
|
const touchFeatures = extractTouchFeatures(data.touch);
|
|
4334
|
+
await yieldToMainThread();
|
|
2071
4335
|
const accelMagnitude = hasMotion && f0Contour.length > 0 ? extractAccelerationMagnitude(data.motion, f0Contour.length) : [];
|
|
2072
4336
|
return {
|
|
2073
4337
|
raw: fuseRawFeatures(audioFeatures, motionFeatures, touchFeatures),
|
|
@@ -2081,6 +4345,7 @@ var MIN_MOTION_SAMPLES = 10;
|
|
|
2081
4345
|
var MIN_TOUCH_SAMPLES = 10;
|
|
2082
4346
|
async function extractFingerprintAndValidate(sensorData, config, walletAddress, onProgress) {
|
|
2083
4347
|
onProgress?.("Extracting features...");
|
|
4348
|
+
await yieldToMainThread();
|
|
2084
4349
|
const {
|
|
2085
4350
|
raw: features,
|
|
2086
4351
|
normalized: normalizedFeatures,
|
|
@@ -2095,6 +4360,7 @@ async function extractFingerprintAndValidate(sensorData, config, walletAddress,
|
|
|
2095
4360
|
const tbh = await generateTBH(fingerprint);
|
|
2096
4361
|
let signedReceipt;
|
|
2097
4362
|
onProgress?.("Validating...");
|
|
4363
|
+
await yieldToMainThread();
|
|
2098
4364
|
if (config.relayerUrl && walletAddress) {
|
|
2099
4365
|
try {
|
|
2100
4366
|
const baseUrl = new URL(config.relayerUrl);
|