@bsv/wallet-toolbox 1.3.19 → 1.3.21

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": "@bsv/wallet-toolbox",
3
- "version": "1.3.19",
3
+ "version": "1.3.21",
4
4
  "description": "BRC100 conforming wallet, wallet storage and wallet signer components",
5
5
  "main": "./out/src/index.js",
6
6
  "types": "./out/src/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "dependencies": {
33
33
  "@bsv/auth-express-middleware": "^1.1.2",
34
34
  "@bsv/payment-express-middleware": "^1.0.6",
35
- "@bsv/sdk": "^1.4.22",
35
+ "@bsv/sdk": "^1.4.24",
36
36
  "express": "^4.21.2",
37
37
  "idb": "^8.0.2",
38
38
  "knex": "^3.1.0",
@@ -1,4 +1,4 @@
1
- import { WalletInterface, Utils, PushDrop, LockingScript, Transaction, WalletProtocol, Base64String } from '@bsv/sdk'
1
+ import { WalletInterface, Utils, PushDrop, LockingScript, Transaction, WalletProtocol, Base64String, PubKeyHex } from '@bsv/sdk'
2
2
  import { validateCreateActionArgs } from './sdk'
3
3
 
4
4
  ////// TODO: ADD SUPPORT FOR ADMIN COUNTERPARTIES BASED ON WALLET STORAGE
@@ -1461,12 +1461,49 @@ export class WalletPermissionsManager implements WalletInterface {
1461
1461
  * --------------------------------------------------------------------- */
1462
1462
 
1463
1463
  /**
1464
- * Lists all protocol permission tokens (DPACP) for a given originator or for all if originator is undefined.
1465
- * This is a convenience method for UI or debug.
1464
+ * Lists all protocol permission tokens (DPACP) with optional filters.
1465
+ * @param originator Optional originator domain to filter by
1466
+ * @param privileged Optional boolean to filter by privileged status
1467
+ * @param protocolName Optional protocol name to filter by
1468
+ * @param protocolSecurityLevel Optional protocol security level to filter by
1469
+ * @param counterparty Optional counterparty to filter by
1470
+ * @returns Array of permission tokens that match the filter criteria
1466
1471
  */
1467
- public async listProtocolPermissions({ originator }: { originator?: string }): Promise<PermissionToken[]> {
1472
+ public async listProtocolPermissions({
1473
+ originator,
1474
+ privileged,
1475
+ protocolName,
1476
+ protocolSecurityLevel,
1477
+ counterparty
1478
+ }: {
1479
+ originator?: string
1480
+ privileged?: boolean
1481
+ protocolName?: string
1482
+ protocolSecurityLevel?: number
1483
+ counterparty?: string
1484
+ } = {}): Promise<PermissionToken[]> {
1468
1485
  const basketName = BASKET_MAP.protocol
1469
- const tags: string[] = originator ? [`originator ${originator}`] : []
1486
+ const tags: string[] = []
1487
+
1488
+ if (originator) {
1489
+ tags.push(`originator ${originator}`)
1490
+ }
1491
+
1492
+ if (privileged !== undefined) {
1493
+ tags.push(`privileged ${!!privileged}`)
1494
+ }
1495
+
1496
+ if (protocolName) {
1497
+ tags.push(`protocolName ${protocolName}`)
1498
+ }
1499
+
1500
+ if (protocolSecurityLevel !== undefined) {
1501
+ tags.push(`protocolSecurityLevel ${protocolSecurityLevel}`)
1502
+ }
1503
+
1504
+ if (counterparty) {
1505
+ tags.push(`counterparty ${counterparty}`)
1506
+ }
1470
1507
  const result = await this.underlying.listOutputs(
1471
1508
  {
1472
1509
  basket: basketName,
@@ -1534,14 +1571,22 @@ export class WalletPermissionsManager implements WalletInterface {
1534
1571
  }
1535
1572
 
1536
1573
  /**
1537
- * Lists basket permission tokens (DBAP) for a given originator (or for all if not specified).
1574
+ * Lists basket permission tokens (DBAP) for a given originator or basket (or for all if not specified).
1575
+ * @param params.originator Optional originator to filter by
1576
+ * @param params.basket Optional basket name to filter by
1577
+ * @returns Array of permission tokens that match the filter criteria
1538
1578
  */
1539
- public async listBasketAccess(params: { originator?: string }): Promise<PermissionToken[]> {
1579
+ public async listBasketAccess(params: { originator?: string, basket?: string } = {}): Promise<PermissionToken[]> {
1540
1580
  const basketName = BASKET_MAP.basket
1541
1581
  const tags: string[] = []
1582
+
1542
1583
  if (params.originator) {
1543
1584
  tags.push(`originator ${params.originator}`)
1544
1585
  }
1586
+
1587
+ if (params.basket) {
1588
+ tags.push(`basket ${params.basket}`)
1589
+ }
1545
1590
  const result = await this.underlying.listOutputs(
1546
1591
  {
1547
1592
  basket: basketName,
@@ -1656,14 +1701,37 @@ export class WalletPermissionsManager implements WalletInterface {
1656
1701
  }
1657
1702
 
1658
1703
  /**
1659
- * Lists certificate permission tokens (DCAP) for a given originator (or all).
1704
+ * Lists certificate permission tokens (DCAP) with optional filters.
1705
+ * @param originator Optional originator domain to filter by
1706
+ * @param privileged Optional boolean to filter by privileged status
1707
+ * @param certType Optional certificate type to filter by
1708
+ * @param verifier Optional verifier to filter by
1709
+ * @returns Array of permission tokens that match the filter criteria
1660
1710
  */
1661
- public async listCertificateAccess(params: { originator?: string }): Promise<PermissionToken[]> {
1711
+ public async listCertificateAccess(params: {
1712
+ originator?: string,
1713
+ privileged?: boolean,
1714
+ certType?: Base64String,
1715
+ verifier?: PubKeyHex
1716
+ } = {}): Promise<PermissionToken[]> {
1662
1717
  const basketName = BASKET_MAP.certificate
1663
1718
  const tags: string[] = []
1719
+
1664
1720
  if (params.originator) {
1665
1721
  tags.push(`originator ${params.originator}`)
1666
1722
  }
1723
+
1724
+ if (params.privileged !== undefined) {
1725
+ tags.push(`privileged ${!!params.privileged}`)
1726
+ }
1727
+
1728
+ if (params.certType) {
1729
+ tags.push(`type ${params.certType}`)
1730
+ }
1731
+
1732
+ if (params.verifier) {
1733
+ tags.push(`verifier ${params.verifier}`)
1734
+ }
1667
1735
  const result = await this.underlying.listOutputs(
1668
1736
  {
1669
1737
  basket: basketName,
@@ -0,0 +1,18 @@
1
+ export * as sdk from './sdk/index'
2
+ export * from './utility/index.client'
3
+ export * from './SetupClient'
4
+ export * from './SetupWallet'
5
+ export * from './signer/WalletSigner'
6
+ export * from './WalletPermissionsManager'
7
+ export * from './CWIStyleWalletManager'
8
+ export * from './WalletAuthenticationManager'
9
+ export * from './wab-client/WABClient'
10
+ export * from './wab-client/auth-method-interactors/TwilioPhoneInteractor'
11
+ export * from './wab-client/auth-method-interactors/PersonaIDInteractor'
12
+ export * from './wab-client/auth-method-interactors/AuthMethodInteractor'
13
+ export * from './services/Services'
14
+ export * from './sdk/PrivilegedKeyManager'
15
+ export * from './SimpleWalletManager'
16
+ export * from './storage/index.mobile'
17
+ export * from './Wallet'
18
+ export * from './monitor/Monitor'
@@ -0,0 +1,6 @@
1
+ export * from './WalletStorageManager'
2
+ export * from './StorageProvider'
3
+ export * from './StorageSyncReader'
4
+ export * from './schema/tables/index'
5
+ export * from './schema/entities/index'
6
+ export * from './remoting/StorageClient'
@@ -10,7 +10,7 @@
10
10
  * - Delete user
11
11
  */
12
12
  import { AuthMethodInteractor } from './auth-method-interactors/AuthMethodInteractor'
13
- import crypto from 'crypto'
13
+ import { PrivateKey } from '@bsv/sdk'
14
14
 
15
15
  export class WABClient {
16
16
  constructor(private serverUrl: string) {}
@@ -27,7 +27,7 @@ export class WABClient {
27
27
  * Generate a random 256-bit presentation key as a hex string (client side).
28
28
  */
29
29
  public generateRandomPresentationKey(): string {
30
- return crypto.randomBytes(32).toString('hex')
30
+ return PrivateKey.fromRandom().toHex()
31
31
  }
32
32
 
33
33
  /**