@bsv/sdk 1.3.8 → 1.3.9

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 (120) hide show
  1. package/dist/cjs/package.json +1 -1
  2. package/dist/cjs/src/auth/Peer.js +1 -1
  3. package/dist/cjs/src/auth/Peer.js.map +1 -1
  4. package/dist/cjs/src/auth/certificates/Certificate.js.map +1 -1
  5. package/dist/cjs/src/auth/certificates/MasterCertificate.js +3 -3
  6. package/dist/cjs/src/auth/certificates/MasterCertificate.js.map +1 -1
  7. package/dist/cjs/src/auth/certificates/VerifiableCertificate.js +1 -1
  8. package/dist/cjs/src/auth/certificates/VerifiableCertificate.js.map +1 -1
  9. package/dist/cjs/src/auth/certificates/__tests/CompletedProtoWallet.js +12 -0
  10. package/dist/cjs/src/auth/certificates/__tests/CompletedProtoWallet.js.map +1 -1
  11. package/dist/cjs/src/auth/clients/AuthFetch.js.map +1 -1
  12. package/dist/cjs/src/auth/utils/createNonce.js.map +1 -1
  13. package/dist/cjs/src/auth/utils/getVerifiableCertificates.js.map +1 -1
  14. package/dist/cjs/src/auth/utils/validateCertificates.js.map +1 -1
  15. package/dist/cjs/src/auth/utils/verifyNonce.js.map +1 -1
  16. package/dist/cjs/src/overlay-tools/OverlayAdminTokenTemplate.js.map +1 -1
  17. package/dist/cjs/src/script/templates/PushDrop.js +1 -1
  18. package/dist/cjs/src/script/templates/PushDrop.js.map +1 -1
  19. package/dist/cjs/src/wallet/ProtoWallet.js +10 -58
  20. package/dist/cjs/src/wallet/ProtoWallet.js.map +1 -1
  21. package/dist/cjs/src/wallet/WalletClient.js.map +1 -1
  22. package/dist/cjs/src/wallet/substrates/HTTPWalletJSON.js.map +1 -1
  23. package/dist/cjs/src/wallet/substrates/WalletWireProcessor.js.map +1 -1
  24. package/dist/cjs/src/wallet/substrates/window.CWI.js.map +1 -1
  25. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  26. package/dist/esm/src/auth/Peer.js +1 -1
  27. package/dist/esm/src/auth/Peer.js.map +1 -1
  28. package/dist/esm/src/auth/certificates/Certificate.js +1 -1
  29. package/dist/esm/src/auth/certificates/Certificate.js.map +1 -1
  30. package/dist/esm/src/auth/certificates/MasterCertificate.js +3 -3
  31. package/dist/esm/src/auth/certificates/MasterCertificate.js.map +1 -1
  32. package/dist/esm/src/auth/certificates/VerifiableCertificate.js +1 -1
  33. package/dist/esm/src/auth/certificates/VerifiableCertificate.js.map +1 -1
  34. package/dist/esm/src/auth/certificates/__tests/CompletedProtoWallet.js +12 -0
  35. package/dist/esm/src/auth/certificates/__tests/CompletedProtoWallet.js.map +1 -1
  36. package/dist/esm/src/auth/clients/AuthFetch.js.map +1 -1
  37. package/dist/esm/src/auth/utils/createNonce.js.map +1 -1
  38. package/dist/esm/src/auth/utils/getVerifiableCertificates.js.map +1 -1
  39. package/dist/esm/src/auth/utils/validateCertificates.js.map +1 -1
  40. package/dist/esm/src/auth/utils/verifyNonce.js.map +1 -1
  41. package/dist/esm/src/overlay-tools/OverlayAdminTokenTemplate.js.map +1 -1
  42. package/dist/esm/src/script/templates/PushDrop.js +1 -1
  43. package/dist/esm/src/script/templates/PushDrop.js.map +1 -1
  44. package/dist/esm/src/wallet/ProtoWallet.js +10 -58
  45. package/dist/esm/src/wallet/ProtoWallet.js.map +1 -1
  46. package/dist/esm/src/wallet/WalletClient.js.map +1 -1
  47. package/dist/esm/src/wallet/substrates/HTTPWalletJSON.js.map +1 -1
  48. package/dist/esm/src/wallet/substrates/WalletWireProcessor.js.map +1 -1
  49. package/dist/esm/src/wallet/substrates/window.CWI.js.map +1 -1
  50. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  51. package/dist/types/src/auth/Peer.d.ts +3 -3
  52. package/dist/types/src/auth/Peer.d.ts.map +1 -1
  53. package/dist/types/src/auth/certificates/Certificate.d.ts +2 -2
  54. package/dist/types/src/auth/certificates/Certificate.d.ts.map +1 -1
  55. package/dist/types/src/auth/certificates/MasterCertificate.d.ts +7 -7
  56. package/dist/types/src/auth/certificates/MasterCertificate.d.ts.map +1 -1
  57. package/dist/types/src/auth/certificates/VerifiableCertificate.d.ts +3 -3
  58. package/dist/types/src/auth/certificates/VerifiableCertificate.d.ts.map +1 -1
  59. package/dist/types/src/auth/certificates/__tests/CompletedProtoWallet.d.ts +6 -2
  60. package/dist/types/src/auth/certificates/__tests/CompletedProtoWallet.d.ts.map +1 -1
  61. package/dist/types/src/auth/clients/AuthFetch.d.ts +2 -2
  62. package/dist/types/src/auth/clients/AuthFetch.d.ts.map +1 -1
  63. package/dist/types/src/auth/utils/createNonce.d.ts +2 -2
  64. package/dist/types/src/auth/utils/createNonce.d.ts.map +1 -1
  65. package/dist/types/src/auth/utils/getVerifiableCertificates.d.ts +2 -2
  66. package/dist/types/src/auth/utils/getVerifiableCertificates.d.ts.map +1 -1
  67. package/dist/types/src/auth/utils/validateCertificates.d.ts +2 -2
  68. package/dist/types/src/auth/utils/validateCertificates.d.ts.map +1 -1
  69. package/dist/types/src/auth/utils/verifyNonce.d.ts +2 -2
  70. package/dist/types/src/auth/utils/verifyNonce.d.ts.map +1 -1
  71. package/dist/types/src/overlay-tools/OverlayAdminTokenTemplate.d.ts +2 -2
  72. package/dist/types/src/overlay-tools/OverlayAdminTokenTemplate.d.ts.map +1 -1
  73. package/dist/types/src/script/templates/PushDrop.d.ts +4 -4
  74. package/dist/types/src/script/templates/PushDrop.d.ts.map +1 -1
  75. package/dist/types/src/wallet/ProtoWallet.d.ts +12 -24
  76. package/dist/types/src/wallet/ProtoWallet.d.ts.map +1 -1
  77. package/dist/types/src/wallet/Wallet.interfaces.d.ts +5 -18
  78. package/dist/types/src/wallet/Wallet.interfaces.d.ts.map +1 -1
  79. package/dist/types/src/wallet/WalletClient.d.ts +4 -4
  80. package/dist/types/src/wallet/WalletClient.d.ts.map +1 -1
  81. package/dist/types/src/wallet/substrates/HTTPWalletJSON.d.ts +2 -2
  82. package/dist/types/src/wallet/substrates/HTTPWalletJSON.d.ts.map +1 -1
  83. package/dist/types/src/wallet/substrates/WalletWireProcessor.d.ts +3 -3
  84. package/dist/types/src/wallet/substrates/WalletWireProcessor.d.ts.map +1 -1
  85. package/dist/types/src/wallet/substrates/WalletWireTransceiver.d.ts +2 -2
  86. package/dist/types/src/wallet/substrates/WalletWireTransceiver.d.ts.map +1 -1
  87. package/dist/types/src/wallet/substrates/XDM.d.ts +2 -2
  88. package/dist/types/src/wallet/substrates/XDM.d.ts.map +1 -1
  89. package/dist/types/src/wallet/substrates/window.CWI.d.ts +2 -2
  90. package/dist/types/src/wallet/substrates/window.CWI.d.ts.map +1 -1
  91. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  92. package/dist/umd/bundle.js +1 -1
  93. package/docs/auth.md +72 -39
  94. package/docs/overlay-tools.md +4 -4
  95. package/docs/script.md +5 -5
  96. package/docs/wallet-substrates.md +11 -11
  97. package/docs/wallet.md +300 -360
  98. package/package.json +1 -1
  99. package/src/auth/Peer.ts +25 -25
  100. package/src/auth/certificates/Certificate.ts +4 -3
  101. package/src/auth/certificates/MasterCertificate.ts +8 -8
  102. package/src/auth/certificates/VerifiableCertificate.ts +3 -3
  103. package/src/auth/certificates/__tests/CompletedProtoWallet.ts +14 -3
  104. package/src/auth/clients/AuthFetch.ts +3 -3
  105. package/src/auth/utils/createNonce.ts +2 -2
  106. package/src/auth/utils/getVerifiableCertificates.ts +2 -2
  107. package/src/auth/utils/validateCertificates.ts +2 -2
  108. package/src/auth/utils/verifyNonce.ts +2 -2
  109. package/src/overlay-tools/OverlayAdminTokenTemplate.ts +5 -5
  110. package/src/script/templates/PushDrop.ts +4 -4
  111. package/src/wallet/ProtoWallet.ts +11 -77
  112. package/src/wallet/Wallet.interfaces.ts +5 -19
  113. package/src/wallet/WalletClient.ts +62 -62
  114. package/src/wallet/__tests/ProtoWallet.test.ts +0 -31
  115. package/src/wallet/substrates/HTTPWalletJSON.ts +3 -3
  116. package/src/wallet/substrates/WalletWireProcessor.ts +3 -3
  117. package/src/wallet/substrates/WalletWireTransceiver.ts +2 -2
  118. package/src/wallet/substrates/XDM.ts +3 -3
  119. package/src/wallet/substrates/__tests/WalletWire.integration.test.ts +0 -104
  120. package/src/wallet/substrates/window.CWI.ts +5 -5
@@ -10,7 +10,6 @@ import {
10
10
  GetPublicKeyArgs,
11
11
  GetVersionResult,
12
12
  OriginatorDomainNameStringUnder250Bytes,
13
- ProtoWalletApi,
14
13
  PubKeyHex,
15
14
  RevealCounterpartyKeyLinkageArgs,
16
15
  RevealCounterpartyKeyLinkageResult,
@@ -26,16 +25,14 @@ import {
26
25
  WalletEncryptResult
27
26
  } from './Wallet.interfaces.js'
28
27
 
29
- const privilegedError = new Error('ProtoWallet is a single-keyring wallet, operating without context about whether its configured keyring is privileged.')
30
-
31
28
  /**
32
29
  * A ProtoWallet is precursor to a full wallet, capable of performing all foundational cryptographic operations.
33
30
  * It can derive keys, create signatures, facilitate encryption and HMAC operations, and reveal key linkages.
34
31
  *
35
32
  * However, ProtoWallet does not create transactions, manage outputs, interact with the blockchain,
36
- * enable the management of identity certificates, or store any data.
33
+ * enable the management of identity certificates, or store any data. It is also not concerned with privileged keys.
37
34
  */
38
- export class ProtoWallet implements ProtoWalletApi {
35
+ export class ProtoWallet {
39
36
  keyDeriver: KeyDeriverApi
40
37
 
41
38
  constructor(rootKeyOrKeyDeriver: PrivateKey | 'anyone' | KeyDeriverApi) {
@@ -45,40 +42,9 @@ export class ProtoWallet implements ProtoWalletApi {
45
42
  this.keyDeriver = rootKeyOrKeyDeriver as KeyDeriver
46
43
  }
47
44
 
48
- async isAuthenticated(args: {}, Originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AuthenticatedResult> {
49
- return { authenticated: true }
50
- }
51
-
52
- async waitForAuthentication(args: {}, Originator?: OriginatorDomainNameStringUnder250Bytes): Promise<AuthenticatedResult> {
53
- return { authenticated: true }
54
- }
55
-
56
- async getNetwork(args: {}, Originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetNetworkResult> {
57
- return { network: 'mainnet' }
58
- }
59
-
60
- async getVersion(args: {}, Originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetVersionResult> {
61
- return { version: 'proto-1.0.0' }
62
- }
63
-
64
- /**
65
- * Convenience method to obtain the identityKey.
66
- * @param originator
67
- * @returns `await this.getPublicKey({ identityKey: true }, originator)`
68
- */
69
- async getIdentityKey(
70
- originator?: OriginatorDomainNameStringUnder250Bytes
71
- ): Promise<{ publicKey: PubKeyHex }> {
72
- return await this.getPublicKey({ identityKey: true }, originator)
73
- }
74
-
75
45
  async getPublicKey(
76
- args: GetPublicKeyArgs,
77
- originator?: OriginatorDomainNameStringUnder250Bytes
46
+ args: GetPublicKeyArgs
78
47
  ): Promise<{ publicKey: PubKeyHex }> {
79
- if (args.privileged) {
80
- throw privilegedError
81
- }
82
48
  if (args.identityKey) {
83
49
  return { publicKey: this.keyDeriver.rootKey.toPublicKey().toString() }
84
50
  } else {
@@ -99,12 +65,8 @@ export class ProtoWallet implements ProtoWalletApi {
99
65
  }
100
66
 
101
67
  async revealCounterpartyKeyLinkage(
102
- args: RevealCounterpartyKeyLinkageArgs,
103
- originator?: OriginatorDomainNameStringUnder250Bytes
68
+ args: RevealCounterpartyKeyLinkageArgs
104
69
  ): Promise<RevealCounterpartyKeyLinkageResult> {
105
- if (args.privileged) {
106
- throw privilegedError
107
- }
108
70
  const { publicKey: identityKey } = await this.getPublicKey({ identityKey: true })
109
71
  const linkage = this.keyDeriver.revealCounterpartySecret(args.counterparty)
110
72
  const linkageProof = new Schnorr().generateProof(this.keyDeriver.rootKey, this.keyDeriver.rootKey.toPublicKey(), PublicKey.fromString(args.counterparty), Point.fromDER(linkage))
@@ -137,12 +99,8 @@ export class ProtoWallet implements ProtoWalletApi {
137
99
  }
138
100
 
139
101
  async revealSpecificKeyLinkage(
140
- args: RevealSpecificKeyLinkageArgs,
141
- originator?: OriginatorDomainNameStringUnder250Bytes
102
+ args: RevealSpecificKeyLinkageArgs
142
103
  ): Promise<RevealSpecificKeyLinkageResult> {
143
- if (args.privileged) {
144
- throw privilegedError
145
- }
146
104
  const { publicKey: identityKey } = await this.getPublicKey({ identityKey: true })
147
105
  const linkage = this.keyDeriver.revealSpecificSecret(
148
106
  args.counterparty,
@@ -174,12 +132,8 @@ export class ProtoWallet implements ProtoWalletApi {
174
132
  }
175
133
 
176
134
  async encrypt(
177
- args: WalletEncryptArgs,
178
- originator?: OriginatorDomainNameStringUnder250Bytes
135
+ args: WalletEncryptArgs
179
136
  ): Promise<WalletEncryptResult> {
180
- if (args.privileged) {
181
- throw privilegedError
182
- }
183
137
  const key = this.keyDeriver.deriveSymmetricKey(
184
138
  args.protocolID,
185
139
  args.keyID,
@@ -189,12 +143,8 @@ export class ProtoWallet implements ProtoWalletApi {
189
143
  }
190
144
 
191
145
  async decrypt(
192
- args: WalletDecryptArgs,
193
- originator?: OriginatorDomainNameStringUnder250Bytes
146
+ args: WalletDecryptArgs
194
147
  ): Promise<WalletDecryptResult> {
195
- if (args.privileged) {
196
- throw privilegedError
197
- }
198
148
  const key = this.keyDeriver.deriveSymmetricKey(
199
149
  args.protocolID,
200
150
  args.keyID,
@@ -204,12 +154,8 @@ export class ProtoWallet implements ProtoWalletApi {
204
154
  }
205
155
 
206
156
  async createHmac(
207
- args: CreateHmacArgs,
208
- originator?: OriginatorDomainNameStringUnder250Bytes
157
+ args: CreateHmacArgs
209
158
  ): Promise<CreateHmacResult> {
210
- if (args.privileged) {
211
- throw privilegedError
212
- }
213
159
  const key = this.keyDeriver.deriveSymmetricKey(
214
160
  args.protocolID,
215
161
  args.keyID,
@@ -219,12 +165,8 @@ export class ProtoWallet implements ProtoWalletApi {
219
165
  }
220
166
 
221
167
  async verifyHmac(
222
- args: VerifyHmacArgs,
223
- originator?: OriginatorDomainNameStringUnder250Bytes
168
+ args: VerifyHmacArgs
224
169
  ): Promise<VerifyHmacResult> {
225
- if (args.privileged) {
226
- throw privilegedError
227
- }
228
170
  const key = this.keyDeriver.deriveSymmetricKey(
229
171
  args.protocolID,
230
172
  args.keyID,
@@ -240,12 +182,8 @@ export class ProtoWallet implements ProtoWalletApi {
240
182
  }
241
183
 
242
184
  async createSignature(
243
- args: CreateSignatureArgs,
244
- originator?: OriginatorDomainNameStringUnder250Bytes
185
+ args: CreateSignatureArgs
245
186
  ): Promise<CreateSignatureResult> {
246
- if (args.privileged) {
247
- throw privilegedError
248
- }
249
187
  if (!args.hashToDirectlySign && !args.data) {
250
188
  throw new Error('args.data or args.hashToDirectlySign must be valid')
251
189
  }
@@ -259,12 +197,8 @@ export class ProtoWallet implements ProtoWalletApi {
259
197
  }
260
198
 
261
199
  async verifySignature(
262
- args: VerifySignatureArgs,
263
- originator?: OriginatorDomainNameStringUnder250Bytes
200
+ args: VerifySignatureArgs
264
201
  ): Promise<VerifySignatureResult> {
265
- if (args.privileged) {
266
- throw privilegedError
267
- }
268
202
  if (!args.hashToDirectlyVerify && !args.data) {
269
203
  throw new Error('args.data or args.hashToDirectlyVerify must be valid')
270
204
  }
@@ -916,8 +916,10 @@ export interface GetPublicKeyResult {
916
916
  }
917
917
 
918
918
  /**
919
- * The ProtoWalletApi interface defines a wallet cryptographic capabilities including:
920
- * key derivation, encryption, decryption, hmac creation and verification, signature generation and verification
919
+ * The Wallet interface defines a wallet capable of various tasks including transaction creation and signing,
920
+ * encryption, decryption, identity certificate management, identity verification, and communication
921
+ * with applications as per the BRC standards. This interface allows applications to interact with
922
+ * the wallet for a range of functionalities aligned with the Babbage architectural principles.
921
923
  *
922
924
  * Error Handling
923
925
  *
@@ -926,7 +928,7 @@ export interface GetPublicKeyResult {
926
928
  * Serialization layers can rely on the `isError` property being unique to error objects to
927
929
  * deserialize and rethrow `WalletErrorObject` conforming objects.
928
930
  */
929
- export interface ProtoWalletApi {
931
+ export interface WalletInterface {
930
932
  /**
931
933
  * Retrieves a derived or identity public key based on the requested protocol, key ID, counterparty, and other factors.
932
934
  *
@@ -1035,22 +1037,6 @@ export interface ProtoWalletApi {
1035
1037
  originator?: OriginatorDomainNameStringUnder250Bytes
1036
1038
  ) => Promise<VerifySignatureResult>
1037
1039
 
1038
- }
1039
-
1040
- /**
1041
- * The Wallet interface defines a wallet capable of various tasks including transaction creation and signing,
1042
- * encryption, decryption, identity certificate management, identity verification, and communication
1043
- * with applications as per the BRC standards. This interface allows applications to interact with
1044
- * the wallet for a range of functionalities aligned with the Babbage architectural principles.
1045
- *
1046
- * Error Handling
1047
- *
1048
- * Every method of the `Wallet` interface has a return value of the form `Promise<object>`.
1049
- * When an error occurs, an exception object may be thrown which must conform to the `WalletErrorObject` interface.
1050
- * Serialization layers can rely on the `isError` property being unique to error objects to
1051
- * deserialize and rethrow `WalletErrorObject` conforming objects.
1052
- */
1053
- export interface Wallet extends ProtoWalletApi {
1054
1040
  /**
1055
1041
  * Creates a new Bitcoin transaction based on the provided inputs, outputs, labels, locks, and other options.
1056
1042
  *
@@ -1,4 +1,4 @@
1
- import { AcquireCertificateArgs, AcquireCertificateResult, Base64String, BasketStringUnder300Bytes, BEEF, BooleanDefaultFalse, BooleanDefaultTrue, Byte, CertificateFieldNameUnder50Bytes, CreateActionArgs, CreateActionResult, DescriptionString5to50Bytes, DiscoverCertificatesResult, EntityIconURLStringMax500Bytes, EntityNameStringMax100Bytes, HexString, InternalizeActionArgs, ISOTimestampString, KeyIDStringUnder800Bytes, LabelStringUnder300Bytes, ListActionsArgs, ListActionsResult, ListCertificatesResult, ListOutputsArgs, ListOutputsResult, OriginatorDomainNameStringUnder250Bytes, OutpointString, OutputTagStringUnder300Bytes, PositiveInteger, PositiveIntegerDefault10Max10000, PositiveIntegerMax10, PositiveIntegerOrZero, ProtocolString5To400Bytes, ProveCertificateArgs, ProveCertificateResult, PubKeyHex, SatoshiValue, SecurityLevel, SignActionArgs, SignActionResult, TXIDHexString, VersionString7To30Bytes, Wallet, AuthenticatedResult } from './Wallet.interfaces.js'
1
+ import { AcquireCertificateArgs, AcquireCertificateResult, Base64String, BasketStringUnder300Bytes, BEEF, BooleanDefaultFalse, BooleanDefaultTrue, Byte, CertificateFieldNameUnder50Bytes, CreateActionArgs, CreateActionResult, DescriptionString5to50Bytes, DiscoverCertificatesResult, EntityIconURLStringMax500Bytes, EntityNameStringMax100Bytes, HexString, InternalizeActionArgs, ISOTimestampString, KeyIDStringUnder800Bytes, LabelStringUnder300Bytes, ListActionsArgs, ListActionsResult, ListCertificatesResult, ListOutputsArgs, ListOutputsResult, OriginatorDomainNameStringUnder250Bytes, OutpointString, OutputTagStringUnder300Bytes, PositiveInteger, PositiveIntegerDefault10Max10000, PositiveIntegerMax10, PositiveIntegerOrZero, ProtocolString5To400Bytes, ProveCertificateArgs, ProveCertificateResult, PubKeyHex, SatoshiValue, SecurityLevel, SignActionArgs, SignActionResult, TXIDHexString, VersionString7To30Bytes, WalletInterface, AuthenticatedResult } from './Wallet.interfaces.js'
2
2
  import WindowCWISubstrate from './substrates/window.CWI.js'
3
3
  import XDMSubstrate from './substrates/XDM.js'
4
4
  import WalletWireTransceiver from './substrates/WalletWireTransceiver.js'
@@ -10,10 +10,10 @@ const MAX_XDM_RESPONSE_WAIT = 200
10
10
  /**
11
11
  * The SDK is how applications communicate with wallets over a communications substrate.
12
12
  */
13
- export default class WalletClient implements Wallet {
14
- public substrate: 'auto' | Wallet
13
+ export default class WalletClient implements WalletInterface {
14
+ public substrate: 'auto' | WalletInterface
15
15
  originator?: OriginatorDomainNameStringUnder250Bytes
16
- constructor (substrate: 'auto' | 'Cicada' | 'XDM' | 'window.CWI' | 'json-api' | Wallet = 'auto', originator?: OriginatorDomainNameStringUnder250Bytes) {
16
+ constructor(substrate: 'auto' | 'Cicada' | 'XDM' | 'window.CWI' | 'json-api' | WalletInterface = 'auto', originator?: OriginatorDomainNameStringUnder250Bytes) {
17
17
  if (substrate === 'Cicada') substrate = new WalletWireTransceiver(new HTTPWalletWire(originator))
18
18
  if (substrate === 'window.CWI') substrate = new WindowCWISubstrate()
19
19
  if (substrate === 'XDM') substrate = new XDMSubstrate()
@@ -22,11 +22,11 @@ export default class WalletClient implements Wallet {
22
22
  this.originator = originator
23
23
  }
24
24
 
25
- async connectToSubstrate () {
25
+ async connectToSubstrate() {
26
26
  if (typeof this.substrate === 'object') {
27
27
  return // substrate is already connected
28
28
  }
29
- let sub: Wallet
29
+ let sub: WalletInterface
30
30
  const checkSub = async (timeout?: number) => {
31
31
  let result
32
32
  if (typeof timeout === 'number') {
@@ -68,142 +68,142 @@ export default class WalletClient implements Wallet {
68
68
  }
69
69
  }
70
70
 
71
- async createAction (args: CreateActionArgs): Promise<CreateActionResult> {
71
+ async createAction(args: CreateActionArgs): Promise<CreateActionResult> {
72
72
  await this.connectToSubstrate()
73
- return await (this.substrate as Wallet).createAction(args, this.originator)
73
+ return await (this.substrate as WalletInterface).createAction(args, this.originator)
74
74
  }
75
75
 
76
- async signAction (args: SignActionArgs): Promise<SignActionResult> {
76
+ async signAction(args: SignActionArgs): Promise<SignActionResult> {
77
77
  await this.connectToSubstrate()
78
- return await (this.substrate as Wallet).signAction(args, this.originator)
78
+ return await (this.substrate as WalletInterface).signAction(args, this.originator)
79
79
  }
80
80
 
81
- async abortAction (args: { reference: Base64String }): Promise<{ aborted: true }> {
81
+ async abortAction(args: { reference: Base64String }): Promise<{ aborted: true }> {
82
82
  await this.connectToSubstrate()
83
- return await (this.substrate as Wallet).abortAction(args, this.originator)
83
+ return await (this.substrate as WalletInterface).abortAction(args, this.originator)
84
84
  }
85
85
 
86
- async listActions (args: ListActionsArgs): Promise<ListActionsResult> {
86
+ async listActions(args: ListActionsArgs): Promise<ListActionsResult> {
87
87
  await this.connectToSubstrate()
88
- return await (this.substrate as Wallet).listActions(args, this.originator)
88
+ return await (this.substrate as WalletInterface).listActions(args, this.originator)
89
89
  }
90
90
 
91
- async internalizeAction (args: InternalizeActionArgs): Promise<{ accepted: true }> {
91
+ async internalizeAction(args: InternalizeActionArgs): Promise<{ accepted: true }> {
92
92
  await this.connectToSubstrate()
93
- return await (this.substrate as Wallet).internalizeAction(args, this.originator)
93
+ return await (this.substrate as WalletInterface).internalizeAction(args, this.originator)
94
94
  }
95
95
 
96
- async listOutputs (args: ListOutputsArgs): Promise<ListOutputsResult> {
96
+ async listOutputs(args: ListOutputsArgs): Promise<ListOutputsResult> {
97
97
  await this.connectToSubstrate()
98
- return await (this.substrate as Wallet).listOutputs(args, this.originator)
98
+ return await (this.substrate as WalletInterface).listOutputs(args, this.originator)
99
99
  }
100
100
 
101
- async relinquishOutput (args: { basket: BasketStringUnder300Bytes, output: OutpointString }): Promise<{ relinquished: true }> {
101
+ async relinquishOutput(args: { basket: BasketStringUnder300Bytes, output: OutpointString }): Promise<{ relinquished: true }> {
102
102
  await this.connectToSubstrate()
103
- return await (this.substrate as Wallet).relinquishOutput(args, this.originator)
103
+ return await (this.substrate as WalletInterface).relinquishOutput(args, this.originator)
104
104
  }
105
105
 
106
- async getPublicKey (args: { identityKey?: true, protocolID?: [SecurityLevel, ProtocolString5To400Bytes], keyID?: KeyIDStringUnder800Bytes, privileged?: BooleanDefaultFalse, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', forSelf?: BooleanDefaultFalse }): Promise<{ publicKey: PubKeyHex }> {
106
+ async getPublicKey(args: { identityKey?: true, protocolID?: [SecurityLevel, ProtocolString5To400Bytes], keyID?: KeyIDStringUnder800Bytes, privileged?: BooleanDefaultFalse, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', forSelf?: BooleanDefaultFalse }): Promise<{ publicKey: PubKeyHex }> {
107
107
  await this.connectToSubstrate()
108
- return await (this.substrate as Wallet).getPublicKey(args, this.originator)
108
+ return await (this.substrate as WalletInterface).getPublicKey(args, this.originator)
109
109
  }
110
110
 
111
- async revealCounterpartyKeyLinkage (args: { counterparty: PubKeyHex, verifier: PubKeyHex, privilegedReason?: DescriptionString5to50Bytes, privileged?: BooleanDefaultFalse }): Promise<{ prover: PubKeyHex, verifier: PubKeyHex, counterparty: PubKeyHex, revelationTime: ISOTimestampString, encryptedLinkage: Byte[], encryptedLinkageProof: Byte[] }> {
111
+ async revealCounterpartyKeyLinkage(args: { counterparty: PubKeyHex, verifier: PubKeyHex, privilegedReason?: DescriptionString5to50Bytes, privileged?: BooleanDefaultFalse }): Promise<{ prover: PubKeyHex, verifier: PubKeyHex, counterparty: PubKeyHex, revelationTime: ISOTimestampString, encryptedLinkage: Byte[], encryptedLinkageProof: Byte[] }> {
112
112
  await this.connectToSubstrate()
113
- return await (this.substrate as Wallet).revealCounterpartyKeyLinkage(args, this.originator)
113
+ return await (this.substrate as WalletInterface).revealCounterpartyKeyLinkage(args, this.originator)
114
114
  }
115
115
 
116
- async revealSpecificKeyLinkage (args: { counterparty: PubKeyHex, verifier: PubKeyHex, protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, privileged?: BooleanDefaultFalse }): Promise<{ prover: PubKeyHex, verifier: PubKeyHex, counterparty: PubKeyHex, protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, encryptedLinkage: Byte[], encryptedLinkageProof: Byte[], proofType: Byte }> {
116
+ async revealSpecificKeyLinkage(args: { counterparty: PubKeyHex, verifier: PubKeyHex, protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, privileged?: BooleanDefaultFalse }): Promise<{ prover: PubKeyHex, verifier: PubKeyHex, counterparty: PubKeyHex, protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, encryptedLinkage: Byte[], encryptedLinkageProof: Byte[], proofType: Byte }> {
117
117
  await this.connectToSubstrate()
118
- return await (this.substrate as Wallet).revealSpecificKeyLinkage(args, this.originator)
118
+ return await (this.substrate as WalletInterface).revealSpecificKeyLinkage(args, this.originator)
119
119
  }
120
120
 
121
- async encrypt (args: { plaintext: Byte[], protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ ciphertext: Byte[] }> {
121
+ async encrypt(args: { plaintext: Byte[], protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ ciphertext: Byte[] }> {
122
122
  await this.connectToSubstrate()
123
- return await (this.substrate as Wallet).encrypt(args, this.originator)
123
+ return await (this.substrate as WalletInterface).encrypt(args, this.originator)
124
124
  }
125
125
 
126
- async decrypt (args: { ciphertext: Byte[], protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ plaintext: Byte[] }> {
127
- return await (this.substrate as Wallet).decrypt(args, this.originator)
126
+ async decrypt(args: { ciphertext: Byte[], protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ plaintext: Byte[] }> {
127
+ return await (this.substrate as WalletInterface).decrypt(args, this.originator)
128
128
  }
129
129
 
130
- async createHmac (args: { data: Byte[], protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ hmac: Byte[] }> {
130
+ async createHmac(args: { data: Byte[], protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ hmac: Byte[] }> {
131
131
  await this.connectToSubstrate()
132
- return await (this.substrate as Wallet).createHmac(args, this.originator)
132
+ return await (this.substrate as WalletInterface).createHmac(args, this.originator)
133
133
  }
134
134
 
135
- async verifyHmac (args: { data: Byte[], hmac: Byte[], protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ valid: true }> {
135
+ async verifyHmac(args: { data: Byte[], hmac: Byte[], protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ valid: true }> {
136
136
  await this.connectToSubstrate()
137
- return await (this.substrate as Wallet).verifyHmac(args, this.originator)
137
+ return await (this.substrate as WalletInterface).verifyHmac(args, this.originator)
138
138
  }
139
139
 
140
- async createSignature (args: { data?: Byte[], hashToDirectlySign?: Byte[], protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ signature: Byte[] }> {
140
+ async createSignature(args: { data?: Byte[], hashToDirectlySign?: Byte[], protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ signature: Byte[] }> {
141
141
  await this.connectToSubstrate()
142
- return await (this.substrate as Wallet).createSignature(args, this.originator)
142
+ return await (this.substrate as WalletInterface).createSignature(args, this.originator)
143
143
  }
144
144
 
145
- async verifySignature (args: { data?: Byte[], hashToDirectlyVerify?: Byte[], signature: Byte[], protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', forSelf?: BooleanDefaultFalse, privileged?: BooleanDefaultFalse }): Promise<{ valid: true }> {
145
+ async verifySignature(args: { data?: Byte[], hashToDirectlyVerify?: Byte[], signature: Byte[], protocolID: [SecurityLevel, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', forSelf?: BooleanDefaultFalse, privileged?: BooleanDefaultFalse }): Promise<{ valid: true }> {
146
146
  await this.connectToSubstrate()
147
- return await (this.substrate as Wallet).verifySignature(args, this.originator)
147
+ return await (this.substrate as WalletInterface).verifySignature(args, this.originator)
148
148
  }
149
149
 
150
- async acquireCertificate (args: AcquireCertificateArgs): Promise<AcquireCertificateResult> {
150
+ async acquireCertificate(args: AcquireCertificateArgs): Promise<AcquireCertificateResult> {
151
151
  await this.connectToSubstrate()
152
- return await (this.substrate as Wallet).acquireCertificate(args, this.originator)
152
+ return await (this.substrate as WalletInterface).acquireCertificate(args, this.originator)
153
153
  }
154
154
 
155
- async listCertificates (args: { certifiers: PubKeyHex[], types: Base64String[], limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero, privileged?: BooleanDefaultFalse, privilegedReason?: DescriptionString5to50Bytes }): Promise<ListCertificatesResult> {
155
+ async listCertificates(args: { certifiers: PubKeyHex[], types: Base64String[], limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero, privileged?: BooleanDefaultFalse, privilegedReason?: DescriptionString5to50Bytes }): Promise<ListCertificatesResult> {
156
156
  await this.connectToSubstrate()
157
- return await (this.substrate as Wallet).listCertificates(args, this.originator)
157
+ return await (this.substrate as WalletInterface).listCertificates(args, this.originator)
158
158
  }
159
159
 
160
- async proveCertificate (args: ProveCertificateArgs): Promise<ProveCertificateResult> {
160
+ async proveCertificate(args: ProveCertificateArgs): Promise<ProveCertificateResult> {
161
161
  await this.connectToSubstrate()
162
- return await (this.substrate as Wallet).proveCertificate(args, this.originator)
162
+ return await (this.substrate as WalletInterface).proveCertificate(args, this.originator)
163
163
  }
164
164
 
165
- async relinquishCertificate (args: { type: Base64String, serialNumber: Base64String, certifier: PubKeyHex }): Promise<{ relinquished: true }> {
165
+ async relinquishCertificate(args: { type: Base64String, serialNumber: Base64String, certifier: PubKeyHex }): Promise<{ relinquished: true }> {
166
166
  await this.connectToSubstrate()
167
- return await (this.substrate as Wallet).relinquishCertificate(args, this.originator)
167
+ return await (this.substrate as WalletInterface).relinquishCertificate(args, this.originator)
168
168
  }
169
169
 
170
- async discoverByIdentityKey (args: { identityKey: PubKeyHex, limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero }): Promise<DiscoverCertificatesResult> {
170
+ async discoverByIdentityKey(args: { identityKey: PubKeyHex, limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero }): Promise<DiscoverCertificatesResult> {
171
171
  await this.connectToSubstrate()
172
- return await (this.substrate as Wallet).discoverByIdentityKey(args, this.originator)
172
+ return await (this.substrate as WalletInterface).discoverByIdentityKey(args, this.originator)
173
173
  }
174
174
 
175
- async discoverByAttributes (args: { attributes: Record<CertificateFieldNameUnder50Bytes, string>, limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero }): Promise<DiscoverCertificatesResult> {
175
+ async discoverByAttributes(args: { attributes: Record<CertificateFieldNameUnder50Bytes, string>, limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero }): Promise<DiscoverCertificatesResult> {
176
176
  await this.connectToSubstrate()
177
- return await (this.substrate as Wallet).discoverByAttributes(args, this.originator)
177
+ return await (this.substrate as WalletInterface).discoverByAttributes(args, this.originator)
178
178
  }
179
179
 
180
- async isAuthenticated (args: {} = {}): Promise<AuthenticatedResult> {
180
+ async isAuthenticated(args: {} = {}): Promise<AuthenticatedResult> {
181
181
  await this.connectToSubstrate()
182
- return await (this.substrate as Wallet).isAuthenticated(args, this.originator)
182
+ return await (this.substrate as WalletInterface).isAuthenticated(args, this.originator)
183
183
  }
184
184
 
185
- async waitForAuthentication (args: {} = {}): Promise<{ authenticated: true }> {
185
+ async waitForAuthentication(args: {} = {}): Promise<{ authenticated: true }> {
186
186
  await this.connectToSubstrate()
187
- return await (this.substrate as Wallet).waitForAuthentication(args, this.originator)
187
+ return await (this.substrate as WalletInterface).waitForAuthentication(args, this.originator)
188
188
  }
189
189
 
190
- async getHeight (args: {} = {}): Promise<{ height: PositiveInteger }> {
190
+ async getHeight(args: {} = {}): Promise<{ height: PositiveInteger }> {
191
191
  await this.connectToSubstrate()
192
- return await (this.substrate as Wallet).getHeight(args, this.originator)
192
+ return await (this.substrate as WalletInterface).getHeight(args, this.originator)
193
193
  }
194
194
 
195
- async getHeaderForHeight (args: { height: PositiveInteger }): Promise<{ header: HexString }> {
195
+ async getHeaderForHeight(args: { height: PositiveInteger }): Promise<{ header: HexString }> {
196
196
  await this.connectToSubstrate()
197
- return await (this.substrate as Wallet).getHeaderForHeight(args, this.originator)
197
+ return await (this.substrate as WalletInterface).getHeaderForHeight(args, this.originator)
198
198
  }
199
199
 
200
- async getNetwork (args: {} = {}): Promise<{ network: 'mainnet' | 'testnet' }> {
200
+ async getNetwork(args: {} = {}): Promise<{ network: 'mainnet' | 'testnet' }> {
201
201
  await this.connectToSubstrate()
202
- return await (this.substrate as Wallet).getNetwork(args, this.originator)
202
+ return await (this.substrate as WalletInterface).getNetwork(args, this.originator)
203
203
  }
204
204
 
205
- async getVersion (args: {} = {}): Promise<{ version: VersionString7To30Bytes }> {
205
+ async getVersion(args: {} = {}): Promise<{ version: VersionString7To30Bytes }> {
206
206
  await this.connectToSubstrate()
207
- return await (this.substrate as Wallet).getVersion(args, this.originator)
207
+ return await (this.substrate as WalletInterface).getVersion(args, this.originator)
208
208
  }
209
209
  }
@@ -7,37 +7,6 @@ describe('ProtoWallet', () => {
7
7
  it('Throws when functions are not supported', async () => {
8
8
  const wallet = new ProtoWallet('anyone')
9
9
  })
10
- it('Throws the privileged error when the privileged flag is set', async () => {
11
- const wallet = new ProtoWallet('anyone')
12
- const privilegedError = 'ProtoWallet is a single-keyring wallet, operating without context about whether its configured keyring is privileged.'
13
- await expect(() => {
14
- return (wallet as any).encrypt({ privileged: true })
15
- }).rejects.toThrow(new Error(privilegedError))
16
- await expect(() => {
17
- return (wallet as any).decrypt({ privileged: true })
18
- }).rejects.toThrow(new Error(privilegedError))
19
- await expect(() => {
20
- return (wallet as any).createSignature({ privileged: true })
21
- }).rejects.toThrow(new Error(privilegedError))
22
- await expect(() => {
23
- return (wallet as any).verifySignature({ privileged: true })
24
- }).rejects.toThrow(new Error(privilegedError))
25
- await expect(() => {
26
- return (wallet as any).createHmac({ privileged: true })
27
- }).rejects.toThrow(new Error(privilegedError))
28
- await expect(() => {
29
- return (wallet as any).verifyHmac({ privileged: true })
30
- }).rejects.toThrow(new Error(privilegedError))
31
- await expect(() => {
32
- return (wallet as any).getPublicKey({ privileged: true })
33
- }).rejects.toThrow(new Error(privilegedError))
34
- await expect(() => {
35
- return (wallet as any).revealCounterpartyKeyLinkage({ privileged: true })
36
- }).rejects.toThrow(new Error(privilegedError))
37
- await expect(() => {
38
- return (wallet as any).revealSpecificKeyLinkage({ privileged: true })
39
- }).rejects.toThrow(new Error(privilegedError))
40
- })
41
10
  it('Validates the BRC-3 compliance vector', async () => {
42
11
  const wallet = new ProtoWallet('anyone')
43
12
  const { valid } = await wallet.verifySignature({
@@ -1,6 +1,6 @@
1
- import { Wallet, CreateActionArgs, OriginatorDomainNameStringUnder250Bytes, CreateActionResult, BooleanDefaultTrue, AcquireCertificateArgs, AcquireCertificateResult, Base64String, BasketStringUnder300Bytes, BooleanDefaultFalse, Byte, CertificateFieldNameUnder50Bytes, DescriptionString5to50Bytes, DiscoverCertificatesResult, EntityIconURLStringMax500Bytes, EntityNameStringMax100Bytes, HexString, InternalizeActionArgs, ISOTimestampString, KeyIDStringUnder800Bytes, ListActionsArgs, ListActionsResult, ListCertificatesResult, ListOutputsArgs, ListOutputsResult, OutpointString, PositiveInteger, PositiveIntegerDefault10Max10000, PositiveIntegerMax10, PositiveIntegerOrZero, ProtocolString5To400Bytes, ProveCertificateArgs, ProveCertificateResult, PubKeyHex, SecurityLevel, SignActionArgs, SignActionResult, VersionString7To30Bytes } from '../Wallet.interfaces.js'
1
+ import { WalletInterface, CreateActionArgs, OriginatorDomainNameStringUnder250Bytes, CreateActionResult, BooleanDefaultTrue, AcquireCertificateArgs, AcquireCertificateResult, Base64String, BasketStringUnder300Bytes, BooleanDefaultFalse, Byte, CertificateFieldNameUnder50Bytes, DescriptionString5to50Bytes, DiscoverCertificatesResult, EntityIconURLStringMax500Bytes, EntityNameStringMax100Bytes, HexString, InternalizeActionArgs, ISOTimestampString, KeyIDStringUnder800Bytes, ListActionsArgs, ListActionsResult, ListCertificatesResult, ListOutputsArgs, ListOutputsResult, OutpointString, PositiveInteger, PositiveIntegerDefault10Max10000, PositiveIntegerMax10, PositiveIntegerOrZero, ProtocolString5To400Bytes, ProveCertificateArgs, ProveCertificateResult, PubKeyHex, SecurityLevel, SignActionArgs, SignActionResult, VersionString7To30Bytes } from '../Wallet.interfaces.js'
2
2
 
3
- export default class HTTPWalletJSON implements Wallet {
3
+ export default class HTTPWalletJSON implements WalletInterface {
4
4
  baseUrl: string
5
5
  httpClient: typeof fetch
6
6
  originator: OriginatorDomainNameStringUnder250Bytes | undefined
@@ -23,7 +23,7 @@ export default class HTTPWalletJSON implements Wallet {
23
23
  })).json()
24
24
  return response
25
25
  } catch (error) {
26
- console.log({ 'HTTPWalletJSON': { call, args, error }})
26
+ console.log({ 'HTTPWalletJSON': { call, args, error } })
27
27
  throw error
28
28
  }
29
29
  }
@@ -1,4 +1,4 @@
1
- import { Wallet } from '../Wallet.interfaces.js'
1
+ import { WalletInterface } from '../Wallet.interfaces.js'
2
2
  import WalletWire from './WalletWire.js'
3
3
  import { Utils } from '../../primitives/index.js'
4
4
  import calls from './WalletWireCalls.js'
@@ -9,9 +9,9 @@ import { SecurityLevel } from '../Wallet.interfaces.js'
9
9
  * Processes incoming wallet calls received over a wallet wire, with a given wallet.
10
10
  */
11
11
  export default class WalletWireProcessor implements WalletWire {
12
- wallet: Wallet
12
+ wallet: WalletInterface
13
13
 
14
- constructor(wallet: Wallet) {
14
+ constructor(wallet: WalletInterface) {
15
15
  this.wallet = wallet
16
16
  }
17
17
 
@@ -1,4 +1,4 @@
1
- import { AcquireCertificateArgs, AcquireCertificateResult, SecurityLevel, Base64String, BasketStringUnder300Bytes, BEEF, BooleanDefaultFalse, BooleanDefaultTrue, Byte, CertificateFieldNameUnder50Bytes, CreateActionArgs, CreateActionResult, DescriptionString5to50Bytes, DiscoverCertificatesResult, EntityIconURLStringMax500Bytes, EntityNameStringMax100Bytes, HexString, InternalizeActionArgs, ISOTimestampString, KeyIDStringUnder800Bytes, LabelStringUnder300Bytes, ListActionsArgs, ListActionsResult, ListCertificatesResult, ListOutputsArgs, ListOutputsResult, OriginatorDomainNameStringUnder250Bytes, OutpointString, OutputTagStringUnder300Bytes, PositiveInteger, PositiveIntegerDefault10Max10000, PositiveIntegerMax10, PositiveIntegerOrZero, ProtocolString5To400Bytes, ProveCertificateArgs, ProveCertificateResult, PubKeyHex, SatoshiValue, SignActionArgs, SignActionResult, TXIDHexString, VersionString7To30Bytes, Wallet } from '../Wallet.interfaces.js'
1
+ import { AcquireCertificateArgs, AcquireCertificateResult, SecurityLevel, Base64String, BasketStringUnder300Bytes, BEEF, BooleanDefaultFalse, BooleanDefaultTrue, Byte, CertificateFieldNameUnder50Bytes, CreateActionArgs, CreateActionResult, DescriptionString5to50Bytes, DiscoverCertificatesResult, EntityIconURLStringMax500Bytes, EntityNameStringMax100Bytes, HexString, InternalizeActionArgs, ISOTimestampString, KeyIDStringUnder800Bytes, LabelStringUnder300Bytes, ListActionsArgs, ListActionsResult, ListCertificatesResult, ListOutputsArgs, ListOutputsResult, OriginatorDomainNameStringUnder250Bytes, OutpointString, OutputTagStringUnder300Bytes, PositiveInteger, PositiveIntegerDefault10Max10000, PositiveIntegerMax10, PositiveIntegerOrZero, ProtocolString5To400Bytes, ProveCertificateArgs, ProveCertificateResult, PubKeyHex, SatoshiValue, SignActionArgs, SignActionResult, TXIDHexString, VersionString7To30Bytes, WalletInterface } from '../Wallet.interfaces.js'
2
2
  import WalletWire from './WalletWire.js'
3
3
  import { Certificate } from '../../auth/index.js'
4
4
  import { Utils } from '../../primitives/index.js'
@@ -8,7 +8,7 @@ import { WalletError } from '../WalletError.js'
8
8
  /**
9
9
  * A way to make remote calls to a wallet over a wallet wire.
10
10
  */
11
- export default class WalletWireTransceiver implements Wallet {
11
+ export default class WalletWireTransceiver implements WalletInterface {
12
12
  wire: WalletWire
13
13
 
14
14
  constructor(wire: WalletWire) {
@@ -1,4 +1,4 @@
1
- import { Base64String, BasketStringUnder300Bytes, BEEF, BooleanDefaultFalse, BooleanDefaultTrue, Byte, CertificateFieldNameUnder50Bytes, DescriptionString5to50Bytes, EntityIconURLStringMax500Bytes, EntityNameStringMax100Bytes, HexString, ISOTimestampString, KeyIDStringUnder800Bytes, LabelStringUnder300Bytes, OriginatorDomainNameStringUnder250Bytes, OutpointString, OutputTagStringUnder300Bytes, PositiveInteger, PositiveIntegerDefault10Max10000, PositiveIntegerMax10, PositiveIntegerOrZero, ProtocolString5To400Bytes, PubKeyHex, SatoshiValue, SecurityLevel, TXIDHexString, VersionString7To30Bytes, Wallet } from '../Wallet.interfaces.js'
1
+ import { Base64String, BasketStringUnder300Bytes, BEEF, BooleanDefaultFalse, BooleanDefaultTrue, Byte, CertificateFieldNameUnder50Bytes, DescriptionString5to50Bytes, EntityIconURLStringMax500Bytes, EntityNameStringMax100Bytes, HexString, ISOTimestampString, KeyIDStringUnder800Bytes, LabelStringUnder300Bytes, OriginatorDomainNameStringUnder250Bytes, OutpointString, OutputTagStringUnder300Bytes, PositiveInteger, PositiveIntegerDefault10Max10000, PositiveIntegerMax10, PositiveIntegerOrZero, ProtocolString5To400Bytes, PubKeyHex, SatoshiValue, SecurityLevel, TXIDHexString, VersionString7To30Bytes, WalletInterface } from '../Wallet.interfaces.js'
2
2
  import { Utils, Random } from '../../primitives/index.js'
3
3
  import { WalletError } from '../WalletError.js'
4
4
  import { CallType } from 'mod.js'
@@ -6,9 +6,9 @@ import { CallType } from 'mod.js'
6
6
  /**
7
7
  * Facilitates wallet operations over cross-document messaging.
8
8
  */
9
- export default class XDMSubstrate implements Wallet {
9
+ export default class XDMSubstrate implements WalletInterface {
10
10
  private readonly domain: string
11
-
11
+
12
12
  constructor(domain: string = '*') {
13
13
  if (typeof window !== 'object') {
14
14
  throw new Error('The XDM substrate requires a global window object.')