@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.
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/auth/Peer.js +1 -1
- package/dist/cjs/src/auth/Peer.js.map +1 -1
- package/dist/cjs/src/auth/certificates/Certificate.js.map +1 -1
- package/dist/cjs/src/auth/certificates/MasterCertificate.js +3 -3
- package/dist/cjs/src/auth/certificates/MasterCertificate.js.map +1 -1
- package/dist/cjs/src/auth/certificates/VerifiableCertificate.js +1 -1
- package/dist/cjs/src/auth/certificates/VerifiableCertificate.js.map +1 -1
- package/dist/cjs/src/auth/certificates/__tests/CompletedProtoWallet.js +12 -0
- package/dist/cjs/src/auth/certificates/__tests/CompletedProtoWallet.js.map +1 -1
- package/dist/cjs/src/auth/clients/AuthFetch.js.map +1 -1
- package/dist/cjs/src/auth/utils/createNonce.js.map +1 -1
- package/dist/cjs/src/auth/utils/getVerifiableCertificates.js.map +1 -1
- package/dist/cjs/src/auth/utils/validateCertificates.js.map +1 -1
- package/dist/cjs/src/auth/utils/verifyNonce.js.map +1 -1
- package/dist/cjs/src/overlay-tools/OverlayAdminTokenTemplate.js.map +1 -1
- package/dist/cjs/src/script/templates/PushDrop.js +1 -1
- package/dist/cjs/src/script/templates/PushDrop.js.map +1 -1
- package/dist/cjs/src/wallet/ProtoWallet.js +10 -58
- package/dist/cjs/src/wallet/ProtoWallet.js.map +1 -1
- package/dist/cjs/src/wallet/WalletClient.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/HTTPWalletJSON.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/WalletWireProcessor.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/window.CWI.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/auth/Peer.js +1 -1
- package/dist/esm/src/auth/Peer.js.map +1 -1
- package/dist/esm/src/auth/certificates/Certificate.js +1 -1
- package/dist/esm/src/auth/certificates/Certificate.js.map +1 -1
- package/dist/esm/src/auth/certificates/MasterCertificate.js +3 -3
- package/dist/esm/src/auth/certificates/MasterCertificate.js.map +1 -1
- package/dist/esm/src/auth/certificates/VerifiableCertificate.js +1 -1
- package/dist/esm/src/auth/certificates/VerifiableCertificate.js.map +1 -1
- package/dist/esm/src/auth/certificates/__tests/CompletedProtoWallet.js +12 -0
- package/dist/esm/src/auth/certificates/__tests/CompletedProtoWallet.js.map +1 -1
- package/dist/esm/src/auth/clients/AuthFetch.js.map +1 -1
- package/dist/esm/src/auth/utils/createNonce.js.map +1 -1
- package/dist/esm/src/auth/utils/getVerifiableCertificates.js.map +1 -1
- package/dist/esm/src/auth/utils/validateCertificates.js.map +1 -1
- package/dist/esm/src/auth/utils/verifyNonce.js.map +1 -1
- package/dist/esm/src/overlay-tools/OverlayAdminTokenTemplate.js.map +1 -1
- package/dist/esm/src/script/templates/PushDrop.js +1 -1
- package/dist/esm/src/script/templates/PushDrop.js.map +1 -1
- package/dist/esm/src/wallet/ProtoWallet.js +10 -58
- package/dist/esm/src/wallet/ProtoWallet.js.map +1 -1
- package/dist/esm/src/wallet/WalletClient.js.map +1 -1
- package/dist/esm/src/wallet/substrates/HTTPWalletJSON.js.map +1 -1
- package/dist/esm/src/wallet/substrates/WalletWireProcessor.js.map +1 -1
- package/dist/esm/src/wallet/substrates/window.CWI.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/auth/Peer.d.ts +3 -3
- package/dist/types/src/auth/Peer.d.ts.map +1 -1
- package/dist/types/src/auth/certificates/Certificate.d.ts +2 -2
- package/dist/types/src/auth/certificates/Certificate.d.ts.map +1 -1
- package/dist/types/src/auth/certificates/MasterCertificate.d.ts +7 -7
- package/dist/types/src/auth/certificates/MasterCertificate.d.ts.map +1 -1
- package/dist/types/src/auth/certificates/VerifiableCertificate.d.ts +3 -3
- package/dist/types/src/auth/certificates/VerifiableCertificate.d.ts.map +1 -1
- package/dist/types/src/auth/certificates/__tests/CompletedProtoWallet.d.ts +6 -2
- package/dist/types/src/auth/certificates/__tests/CompletedProtoWallet.d.ts.map +1 -1
- package/dist/types/src/auth/clients/AuthFetch.d.ts +2 -2
- package/dist/types/src/auth/clients/AuthFetch.d.ts.map +1 -1
- package/dist/types/src/auth/utils/createNonce.d.ts +2 -2
- package/dist/types/src/auth/utils/createNonce.d.ts.map +1 -1
- package/dist/types/src/auth/utils/getVerifiableCertificates.d.ts +2 -2
- package/dist/types/src/auth/utils/getVerifiableCertificates.d.ts.map +1 -1
- package/dist/types/src/auth/utils/validateCertificates.d.ts +2 -2
- package/dist/types/src/auth/utils/validateCertificates.d.ts.map +1 -1
- package/dist/types/src/auth/utils/verifyNonce.d.ts +2 -2
- package/dist/types/src/auth/utils/verifyNonce.d.ts.map +1 -1
- package/dist/types/src/overlay-tools/OverlayAdminTokenTemplate.d.ts +2 -2
- package/dist/types/src/overlay-tools/OverlayAdminTokenTemplate.d.ts.map +1 -1
- package/dist/types/src/script/templates/PushDrop.d.ts +4 -4
- package/dist/types/src/script/templates/PushDrop.d.ts.map +1 -1
- package/dist/types/src/wallet/ProtoWallet.d.ts +12 -24
- package/dist/types/src/wallet/ProtoWallet.d.ts.map +1 -1
- package/dist/types/src/wallet/Wallet.interfaces.d.ts +5 -18
- package/dist/types/src/wallet/Wallet.interfaces.d.ts.map +1 -1
- package/dist/types/src/wallet/WalletClient.d.ts +4 -4
- package/dist/types/src/wallet/WalletClient.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/HTTPWalletJSON.d.ts +2 -2
- package/dist/types/src/wallet/substrates/HTTPWalletJSON.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/WalletWireProcessor.d.ts +3 -3
- package/dist/types/src/wallet/substrates/WalletWireProcessor.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/WalletWireTransceiver.d.ts +2 -2
- package/dist/types/src/wallet/substrates/WalletWireTransceiver.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/XDM.d.ts +2 -2
- package/dist/types/src/wallet/substrates/XDM.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/window.CWI.d.ts +2 -2
- package/dist/types/src/wallet/substrates/window.CWI.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/docs/auth.md +72 -39
- package/docs/overlay-tools.md +4 -4
- package/docs/script.md +5 -5
- package/docs/wallet-substrates.md +11 -11
- package/docs/wallet.md +300 -360
- package/package.json +1 -1
- package/src/auth/Peer.ts +25 -25
- package/src/auth/certificates/Certificate.ts +4 -3
- package/src/auth/certificates/MasterCertificate.ts +8 -8
- package/src/auth/certificates/VerifiableCertificate.ts +3 -3
- package/src/auth/certificates/__tests/CompletedProtoWallet.ts +14 -3
- package/src/auth/clients/AuthFetch.ts +3 -3
- package/src/auth/utils/createNonce.ts +2 -2
- package/src/auth/utils/getVerifiableCertificates.ts +2 -2
- package/src/auth/utils/validateCertificates.ts +2 -2
- package/src/auth/utils/verifyNonce.ts +2 -2
- package/src/overlay-tools/OverlayAdminTokenTemplate.ts +5 -5
- package/src/script/templates/PushDrop.ts +4 -4
- package/src/wallet/ProtoWallet.ts +11 -77
- package/src/wallet/Wallet.interfaces.ts +5 -19
- package/src/wallet/WalletClient.ts +62 -62
- package/src/wallet/__tests/ProtoWallet.test.ts +0 -31
- package/src/wallet/substrates/HTTPWalletJSON.ts +3 -3
- package/src/wallet/substrates/WalletWireProcessor.ts +3 -3
- package/src/wallet/substrates/WalletWireTransceiver.ts +2 -2
- package/src/wallet/substrates/XDM.ts +3 -3
- package/src/wallet/substrates/__tests/WalletWire.integration.test.ts +0 -104
- 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
|
|
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
|
|
920
|
-
*
|
|
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
|
|
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,
|
|
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
|
|
14
|
-
public substrate: 'auto' |
|
|
13
|
+
export default class WalletClient implements WalletInterface {
|
|
14
|
+
public substrate: 'auto' | WalletInterface
|
|
15
15
|
originator?: OriginatorDomainNameStringUnder250Bytes
|
|
16
|
-
constructor
|
|
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:
|
|
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
|
|
71
|
+
async createAction(args: CreateActionArgs): Promise<CreateActionResult> {
|
|
72
72
|
await this.connectToSubstrate()
|
|
73
|
-
return await (this.substrate as
|
|
73
|
+
return await (this.substrate as WalletInterface).createAction(args, this.originator)
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
async signAction
|
|
76
|
+
async signAction(args: SignActionArgs): Promise<SignActionResult> {
|
|
77
77
|
await this.connectToSubstrate()
|
|
78
|
-
return await (this.substrate as
|
|
78
|
+
return await (this.substrate as WalletInterface).signAction(args, this.originator)
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
async abortAction
|
|
81
|
+
async abortAction(args: { reference: Base64String }): Promise<{ aborted: true }> {
|
|
82
82
|
await this.connectToSubstrate()
|
|
83
|
-
return await (this.substrate as
|
|
83
|
+
return await (this.substrate as WalletInterface).abortAction(args, this.originator)
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
async listActions
|
|
86
|
+
async listActions(args: ListActionsArgs): Promise<ListActionsResult> {
|
|
87
87
|
await this.connectToSubstrate()
|
|
88
|
-
return await (this.substrate as
|
|
88
|
+
return await (this.substrate as WalletInterface).listActions(args, this.originator)
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
async internalizeAction
|
|
91
|
+
async internalizeAction(args: InternalizeActionArgs): Promise<{ accepted: true }> {
|
|
92
92
|
await this.connectToSubstrate()
|
|
93
|
-
return await (this.substrate as
|
|
93
|
+
return await (this.substrate as WalletInterface).internalizeAction(args, this.originator)
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
async listOutputs
|
|
96
|
+
async listOutputs(args: ListOutputsArgs): Promise<ListOutputsResult> {
|
|
97
97
|
await this.connectToSubstrate()
|
|
98
|
-
return await (this.substrate as
|
|
98
|
+
return await (this.substrate as WalletInterface).listOutputs(args, this.originator)
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
async relinquishOutput
|
|
101
|
+
async relinquishOutput(args: { basket: BasketStringUnder300Bytes, output: OutpointString }): Promise<{ relinquished: true }> {
|
|
102
102
|
await this.connectToSubstrate()
|
|
103
|
-
return await (this.substrate as
|
|
103
|
+
return await (this.substrate as WalletInterface).relinquishOutput(args, this.originator)
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
async getPublicKey
|
|
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
|
|
108
|
+
return await (this.substrate as WalletInterface).getPublicKey(args, this.originator)
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
async revealCounterpartyKeyLinkage
|
|
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
|
|
113
|
+
return await (this.substrate as WalletInterface).revealCounterpartyKeyLinkage(args, this.originator)
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
async revealSpecificKeyLinkage
|
|
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
|
|
118
|
+
return await (this.substrate as WalletInterface).revealSpecificKeyLinkage(args, this.originator)
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
async encrypt
|
|
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
|
|
123
|
+
return await (this.substrate as WalletInterface).encrypt(args, this.originator)
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
async decrypt
|
|
127
|
-
return await (this.substrate as
|
|
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
|
|
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
|
|
132
|
+
return await (this.substrate as WalletInterface).createHmac(args, this.originator)
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
async verifyHmac
|
|
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
|
|
137
|
+
return await (this.substrate as WalletInterface).verifyHmac(args, this.originator)
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
async createSignature
|
|
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
|
|
142
|
+
return await (this.substrate as WalletInterface).createSignature(args, this.originator)
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
async verifySignature
|
|
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
|
|
147
|
+
return await (this.substrate as WalletInterface).verifySignature(args, this.originator)
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
async acquireCertificate
|
|
150
|
+
async acquireCertificate(args: AcquireCertificateArgs): Promise<AcquireCertificateResult> {
|
|
151
151
|
await this.connectToSubstrate()
|
|
152
|
-
return await (this.substrate as
|
|
152
|
+
return await (this.substrate as WalletInterface).acquireCertificate(args, this.originator)
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
async listCertificates
|
|
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
|
|
157
|
+
return await (this.substrate as WalletInterface).listCertificates(args, this.originator)
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
async proveCertificate
|
|
160
|
+
async proveCertificate(args: ProveCertificateArgs): Promise<ProveCertificateResult> {
|
|
161
161
|
await this.connectToSubstrate()
|
|
162
|
-
return await (this.substrate as
|
|
162
|
+
return await (this.substrate as WalletInterface).proveCertificate(args, this.originator)
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
async relinquishCertificate
|
|
165
|
+
async relinquishCertificate(args: { type: Base64String, serialNumber: Base64String, certifier: PubKeyHex }): Promise<{ relinquished: true }> {
|
|
166
166
|
await this.connectToSubstrate()
|
|
167
|
-
return await (this.substrate as
|
|
167
|
+
return await (this.substrate as WalletInterface).relinquishCertificate(args, this.originator)
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
async discoverByIdentityKey
|
|
170
|
+
async discoverByIdentityKey(args: { identityKey: PubKeyHex, limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero }): Promise<DiscoverCertificatesResult> {
|
|
171
171
|
await this.connectToSubstrate()
|
|
172
|
-
return await (this.substrate as
|
|
172
|
+
return await (this.substrate as WalletInterface).discoverByIdentityKey(args, this.originator)
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
async discoverByAttributes
|
|
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
|
|
177
|
+
return await (this.substrate as WalletInterface).discoverByAttributes(args, this.originator)
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
async isAuthenticated
|
|
180
|
+
async isAuthenticated(args: {} = {}): Promise<AuthenticatedResult> {
|
|
181
181
|
await this.connectToSubstrate()
|
|
182
|
-
return await (this.substrate as
|
|
182
|
+
return await (this.substrate as WalletInterface).isAuthenticated(args, this.originator)
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
async waitForAuthentication
|
|
185
|
+
async waitForAuthentication(args: {} = {}): Promise<{ authenticated: true }> {
|
|
186
186
|
await this.connectToSubstrate()
|
|
187
|
-
return await (this.substrate as
|
|
187
|
+
return await (this.substrate as WalletInterface).waitForAuthentication(args, this.originator)
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
async getHeight
|
|
190
|
+
async getHeight(args: {} = {}): Promise<{ height: PositiveInteger }> {
|
|
191
191
|
await this.connectToSubstrate()
|
|
192
|
-
return await (this.substrate as
|
|
192
|
+
return await (this.substrate as WalletInterface).getHeight(args, this.originator)
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
async getHeaderForHeight
|
|
195
|
+
async getHeaderForHeight(args: { height: PositiveInteger }): Promise<{ header: HexString }> {
|
|
196
196
|
await this.connectToSubstrate()
|
|
197
|
-
return await (this.substrate as
|
|
197
|
+
return await (this.substrate as WalletInterface).getHeaderForHeight(args, this.originator)
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
async getNetwork
|
|
200
|
+
async getNetwork(args: {} = {}): Promise<{ network: 'mainnet' | 'testnet' }> {
|
|
201
201
|
await this.connectToSubstrate()
|
|
202
|
-
return await (this.substrate as
|
|
202
|
+
return await (this.substrate as WalletInterface).getNetwork(args, this.originator)
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
async getVersion
|
|
205
|
+
async getVersion(args: {} = {}): Promise<{ version: VersionString7To30Bytes }> {
|
|
206
206
|
await this.connectToSubstrate()
|
|
207
|
-
return await (this.substrate as
|
|
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 {
|
|
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
|
|
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 {
|
|
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:
|
|
12
|
+
wallet: WalletInterface
|
|
13
13
|
|
|
14
|
-
constructor(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,
|
|
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
|
|
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,
|
|
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
|
|
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.')
|