@bsv/sdk 2.0.7 → 2.0.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/primitives/index.js.map +1 -1
- package/dist/cjs/src/script/templates/P2PKH.js +9 -43
- package/dist/cjs/src/script/templates/P2PKH.js.map +1 -1
- package/dist/cjs/src/script/templates/PushDrop.js +10 -40
- package/dist/cjs/src/script/templates/PushDrop.js.map +1 -1
- package/dist/cjs/src/script/templates/SignatureUtils.js +77 -0
- package/dist/cjs/src/script/templates/SignatureUtils.js.map +1 -0
- package/dist/cjs/src/transaction/Transaction.js +45 -0
- package/dist/cjs/src/transaction/Transaction.js.map +1 -1
- package/dist/cjs/src/transaction/http/BinaryFetchClient.js +2 -28
- package/dist/cjs/src/transaction/http/BinaryFetchClient.js.map +1 -1
- package/dist/cjs/src/transaction/http/NodejsHttpClient.js +2 -28
- package/dist/cjs/src/transaction/http/NodejsHttpClient.js.map +1 -1
- package/dist/cjs/src/transaction/http/NodejsHttpRequestUtils.js +43 -0
- package/dist/cjs/src/transaction/http/NodejsHttpRequestUtils.js.map +1 -0
- package/dist/cjs/src/wallet/substrates/InvokableWalletBase.js +98 -0
- package/dist/cjs/src/wallet/substrates/InvokableWalletBase.js.map +1 -0
- package/dist/cjs/src/wallet/substrates/ReactNativeWebView.js +3 -85
- package/dist/cjs/src/wallet/substrates/ReactNativeWebView.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/XDM.js +3 -85
- package/dist/cjs/src/wallet/substrates/XDM.js.map +1 -1
- package/dist/cjs/src/wallet/substrates/index.js +3 -1
- package/dist/cjs/src/wallet/substrates/index.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/primitives/index.js.map +1 -1
- package/dist/esm/src/script/templates/P2PKH.js +10 -46
- package/dist/esm/src/script/templates/P2PKH.js.map +1 -1
- package/dist/esm/src/script/templates/PushDrop.js +10 -42
- package/dist/esm/src/script/templates/PushDrop.js.map +1 -1
- package/dist/esm/src/script/templates/SignatureUtils.js +69 -0
- package/dist/esm/src/script/templates/SignatureUtils.js.map +1 -0
- package/dist/esm/src/transaction/Transaction.js +45 -0
- package/dist/esm/src/transaction/Transaction.js.map +1 -1
- package/dist/esm/src/transaction/http/BinaryFetchClient.js +2 -28
- package/dist/esm/src/transaction/http/BinaryFetchClient.js.map +1 -1
- package/dist/esm/src/transaction/http/NodejsHttpClient.js +2 -28
- package/dist/esm/src/transaction/http/NodejsHttpClient.js.map +1 -1
- package/dist/esm/src/transaction/http/NodejsHttpRequestUtils.js +40 -0
- package/dist/esm/src/transaction/http/NodejsHttpRequestUtils.js.map +1 -0
- package/dist/esm/src/wallet/substrates/InvokableWalletBase.js +94 -0
- package/dist/esm/src/wallet/substrates/InvokableWalletBase.js.map +1 -0
- package/dist/esm/src/wallet/substrates/ReactNativeWebView.js +3 -85
- package/dist/esm/src/wallet/substrates/ReactNativeWebView.js.map +1 -1
- package/dist/esm/src/wallet/substrates/XDM.js +3 -85
- package/dist/esm/src/wallet/substrates/XDM.js.map +1 -1
- package/dist/esm/src/wallet/substrates/index.js +1 -0
- package/dist/esm/src/wallet/substrates/index.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/primitives/index.d.ts +1 -1
- package/dist/types/src/primitives/index.d.ts.map +1 -1
- package/dist/types/src/script/templates/P2PKH.d.ts.map +1 -1
- package/dist/types/src/script/templates/PushDrop.d.ts.map +1 -1
- package/dist/types/src/script/templates/SignatureUtils.d.ts +32 -0
- package/dist/types/src/script/templates/SignatureUtils.d.ts.map +1 -0
- package/dist/types/src/transaction/Transaction.d.ts +10 -0
- package/dist/types/src/transaction/Transaction.d.ts.map +1 -1
- package/dist/types/src/transaction/http/BinaryFetchClient.d.ts +1 -1
- package/dist/types/src/transaction/http/BinaryFetchClient.d.ts.map +1 -1
- package/dist/types/src/transaction/http/NodejsHttpClient.d.ts +1 -1
- package/dist/types/src/transaction/http/NodejsHttpClient.d.ts.map +1 -1
- package/dist/types/src/transaction/http/NodejsHttpRequestUtils.d.ts +22 -0
- package/dist/types/src/transaction/http/NodejsHttpRequestUtils.d.ts.map +1 -0
- package/dist/types/src/wallet/substrates/InvokableWalletBase.d.ts +41 -0
- package/dist/types/src/wallet/substrates/InvokableWalletBase.d.ts.map +1 -0
- package/dist/types/src/wallet/substrates/ReactNativeWebView.d.ts +2 -403
- package/dist/types/src/wallet/substrates/ReactNativeWebView.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/XDM.d.ts +2 -403
- package/dist/types/src/wallet/substrates/XDM.d.ts.map +1 -1
- package/dist/types/src/wallet/substrates/index.d.ts +1 -0
- package/dist/types/src/wallet/substrates/index.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +3 -3
- package/dist/umd/bundle.js.map +1 -1
- package/docs/reference/transaction.md +24 -1
- package/package.json +1 -1
- package/src/primitives/index.ts +1 -1
- package/src/script/templates/P2PKH.ts +10 -59
- package/src/script/templates/PushDrop.ts +11 -54
- package/src/script/templates/SignatureUtils.ts +111 -0
- package/src/transaction/Transaction.ts +47 -0
- package/src/transaction/__tests/Transaction.test.ts +179 -9
- package/src/transaction/http/BinaryFetchClient.ts +8 -32
- package/src/transaction/http/NodejsHttpClient.ts +8 -32
- package/src/transaction/http/NodejsHttpRequestUtils.ts +68 -0
- package/src/wallet/substrates/InvokableWalletBase.ts +176 -0
- package/src/wallet/substrates/ReactNativeWebView.ts +3 -491
- package/src/wallet/substrates/XDM.ts +3 -491
- package/src/wallet/substrates/index.ts +1 -0
|
@@ -1,44 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Base64String,
|
|
3
|
-
BasketStringUnder300Bytes,
|
|
4
|
-
BEEF,
|
|
5
|
-
BooleanDefaultFalse,
|
|
6
|
-
BooleanDefaultTrue,
|
|
7
|
-
Byte,
|
|
8
|
-
CertificateFieldNameUnder50Bytes,
|
|
9
|
-
DescriptionString5to50Bytes,
|
|
10
|
-
EntityIconURLStringMax500Bytes,
|
|
11
|
-
EntityNameStringMax100Bytes,
|
|
12
|
-
HexString,
|
|
13
|
-
ISOTimestampString,
|
|
14
|
-
KeyIDStringUnder800Bytes,
|
|
15
|
-
LabelStringUnder300Bytes,
|
|
16
|
-
OutpointString,
|
|
17
|
-
OutputTagStringUnder300Bytes,
|
|
18
|
-
PositiveInteger,
|
|
19
|
-
PositiveIntegerDefault10Max10000,
|
|
20
|
-
PositiveIntegerMax10,
|
|
21
|
-
PositiveIntegerOrZero,
|
|
22
|
-
ProtocolString5To400Bytes,
|
|
23
|
-
PubKeyHex,
|
|
24
|
-
SatoshiValue,
|
|
25
|
-
SecurityLevel,
|
|
26
|
-
TXIDHexString,
|
|
27
|
-
VersionString7To30Bytes,
|
|
28
|
-
WalletInterface
|
|
29
|
-
} from '../Wallet.interfaces.js'
|
|
30
1
|
import Random from '../../primitives/Random.js'
|
|
31
2
|
import * as Utils from '../../primitives/utils.js'
|
|
32
3
|
import { WalletError } from '../WalletError.js'
|
|
33
4
|
import { CallType } from './WalletWireCalls.js'
|
|
5
|
+
import { InvokableWalletBase } from './InvokableWalletBase.js'
|
|
34
6
|
|
|
35
7
|
/**
|
|
36
8
|
* Facilitates wallet operations over cross-document messaging.
|
|
37
9
|
*/
|
|
38
|
-
export default class XDMSubstrate
|
|
10
|
+
export default class XDMSubstrate extends InvokableWalletBase {
|
|
39
11
|
private readonly domain: string
|
|
40
12
|
|
|
41
13
|
constructor(domain: string = '*') {
|
|
14
|
+
super()
|
|
42
15
|
if (typeof window !== 'object') {
|
|
43
16
|
throw new Error('The XDM substrate requires a global window object.')
|
|
44
17
|
}
|
|
@@ -83,465 +56,4 @@ export default class XDMSubstrate implements WalletInterface {
|
|
|
83
56
|
)
|
|
84
57
|
})
|
|
85
58
|
}
|
|
86
|
-
|
|
87
|
-
async createAction(args: {
|
|
88
|
-
description: DescriptionString5to50Bytes
|
|
89
|
-
inputs?: Array<{
|
|
90
|
-
tx?: BEEF
|
|
91
|
-
outpoint: OutpointString
|
|
92
|
-
unlockingScript?: HexString
|
|
93
|
-
unlockingScriptLength?: PositiveInteger
|
|
94
|
-
inputDescription: DescriptionString5to50Bytes
|
|
95
|
-
sequenceNumber?: PositiveIntegerOrZero
|
|
96
|
-
}>
|
|
97
|
-
outputs?: Array<{
|
|
98
|
-
lockingScript: HexString
|
|
99
|
-
satoshis: SatoshiValue
|
|
100
|
-
outputDescription: DescriptionString5to50Bytes
|
|
101
|
-
basket?: BasketStringUnder300Bytes
|
|
102
|
-
customInstructions?: string
|
|
103
|
-
tags?: OutputTagStringUnder300Bytes[]
|
|
104
|
-
}>
|
|
105
|
-
lockTime?: PositiveIntegerOrZero
|
|
106
|
-
version?: PositiveIntegerOrZero
|
|
107
|
-
labels?: LabelStringUnder300Bytes[]
|
|
108
|
-
options?: {
|
|
109
|
-
signAndProcess?: BooleanDefaultTrue
|
|
110
|
-
acceptDelayedBroadcast?: BooleanDefaultTrue
|
|
111
|
-
trustSelf?: 'known'
|
|
112
|
-
knownTxids?: TXIDHexString[]
|
|
113
|
-
returnTXIDOnly?: BooleanDefaultFalse
|
|
114
|
-
noSend?: BooleanDefaultFalse
|
|
115
|
-
noSendChange?: OutpointString[]
|
|
116
|
-
sendWith?: TXIDHexString[]
|
|
117
|
-
}
|
|
118
|
-
}): Promise<{
|
|
119
|
-
txid?: TXIDHexString
|
|
120
|
-
tx?: BEEF
|
|
121
|
-
noSendChange?: OutpointString[]
|
|
122
|
-
sendWithResults?: Array<{
|
|
123
|
-
txid: TXIDHexString
|
|
124
|
-
status: 'unproven' | 'sending' | 'failed'
|
|
125
|
-
}>
|
|
126
|
-
signableTransaction?: { tx: BEEF, reference: Base64String }
|
|
127
|
-
}> {
|
|
128
|
-
return await this.invoke('createAction', args)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
async signAction(args: {
|
|
132
|
-
spends: Record<
|
|
133
|
-
PositiveIntegerOrZero,
|
|
134
|
-
{ unlockingScript: HexString, sequenceNumber?: PositiveIntegerOrZero }
|
|
135
|
-
>
|
|
136
|
-
reference: Base64String
|
|
137
|
-
options?: {
|
|
138
|
-
acceptDelayedBroadcast?: BooleanDefaultTrue
|
|
139
|
-
returnTXIDOnly?: BooleanDefaultFalse
|
|
140
|
-
noSend?: BooleanDefaultFalse
|
|
141
|
-
noSendChange?: OutpointString[]
|
|
142
|
-
sendWith: TXIDHexString[]
|
|
143
|
-
}
|
|
144
|
-
}): Promise<{
|
|
145
|
-
txid?: TXIDHexString
|
|
146
|
-
tx?: BEEF
|
|
147
|
-
noSendChange?: OutpointString[]
|
|
148
|
-
sendWithResults?: Array<{
|
|
149
|
-
txid: TXIDHexString
|
|
150
|
-
status: 'unproven' | 'sending' | 'failed'
|
|
151
|
-
}>
|
|
152
|
-
}> {
|
|
153
|
-
return await this.invoke('signAction', args)
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
async abortAction(args: {
|
|
157
|
-
reference: Base64String
|
|
158
|
-
}): Promise<{ aborted: true }> {
|
|
159
|
-
return await this.invoke('abortAction', args)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
async listActions(args: {
|
|
163
|
-
labels: LabelStringUnder300Bytes[]
|
|
164
|
-
labelQueryMode?: 'any' | 'all'
|
|
165
|
-
includeLabels?: BooleanDefaultFalse
|
|
166
|
-
includeInputs?: BooleanDefaultFalse
|
|
167
|
-
includeInputSourceLockingScripts?: BooleanDefaultFalse
|
|
168
|
-
includeInputUnlockingScripts?: BooleanDefaultFalse
|
|
169
|
-
includeOutputs?: BooleanDefaultFalse
|
|
170
|
-
includeOutputLockingScripts?: BooleanDefaultFalse
|
|
171
|
-
limit?: PositiveIntegerDefault10Max10000
|
|
172
|
-
offset?: PositiveIntegerOrZero
|
|
173
|
-
}): Promise<{
|
|
174
|
-
totalActions: PositiveIntegerOrZero
|
|
175
|
-
actions: Array<{
|
|
176
|
-
txid: TXIDHexString
|
|
177
|
-
satoshis: SatoshiValue
|
|
178
|
-
status:
|
|
179
|
-
| 'completed'
|
|
180
|
-
| 'unprocessed'
|
|
181
|
-
| 'sending'
|
|
182
|
-
| 'unproven'
|
|
183
|
-
| 'unsigned'
|
|
184
|
-
| 'nosend'
|
|
185
|
-
| 'nonfinal'
|
|
186
|
-
isOutgoing: boolean
|
|
187
|
-
description: DescriptionString5to50Bytes
|
|
188
|
-
labels?: LabelStringUnder300Bytes[]
|
|
189
|
-
version: PositiveIntegerOrZero
|
|
190
|
-
lockTime: PositiveIntegerOrZero
|
|
191
|
-
inputs?: Array<{
|
|
192
|
-
sourceOutpoint: OutpointString
|
|
193
|
-
sourceSatoshis: SatoshiValue
|
|
194
|
-
sourceLockingScript?: HexString
|
|
195
|
-
unlockingScript?: HexString
|
|
196
|
-
inputDescription: DescriptionString5to50Bytes
|
|
197
|
-
sequenceNumber: PositiveIntegerOrZero
|
|
198
|
-
}>
|
|
199
|
-
outputs?: Array<{
|
|
200
|
-
outputIndex: PositiveIntegerOrZero
|
|
201
|
-
satoshis: SatoshiValue
|
|
202
|
-
lockingScript?: HexString
|
|
203
|
-
spendable: boolean
|
|
204
|
-
outputDescription: DescriptionString5to50Bytes
|
|
205
|
-
basket: BasketStringUnder300Bytes
|
|
206
|
-
tags: OutputTagStringUnder300Bytes[]
|
|
207
|
-
customInstructions?: string
|
|
208
|
-
}>
|
|
209
|
-
}>
|
|
210
|
-
}> {
|
|
211
|
-
return await this.invoke('listActions', args)
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
async internalizeAction(args: {
|
|
215
|
-
tx: BEEF
|
|
216
|
-
outputs: Array<{
|
|
217
|
-
outputIndex: PositiveIntegerOrZero
|
|
218
|
-
protocol: 'wallet payment' | 'basket insertion'
|
|
219
|
-
paymentRemittance?: {
|
|
220
|
-
derivationPrefix: Base64String
|
|
221
|
-
derivationSuffix: Base64String
|
|
222
|
-
senderIdentityKey: PubKeyHex
|
|
223
|
-
}
|
|
224
|
-
insertionRemittance?: {
|
|
225
|
-
basket: BasketStringUnder300Bytes
|
|
226
|
-
customInstructions?: string
|
|
227
|
-
tags?: OutputTagStringUnder300Bytes[]
|
|
228
|
-
}
|
|
229
|
-
}>
|
|
230
|
-
description: DescriptionString5to50Bytes
|
|
231
|
-
labels?: LabelStringUnder300Bytes[]
|
|
232
|
-
}): Promise<{ accepted: true }> {
|
|
233
|
-
return await this.invoke('internalizeAction', args)
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
async listOutputs(args: {
|
|
237
|
-
basket: BasketStringUnder300Bytes
|
|
238
|
-
tags?: OutputTagStringUnder300Bytes[]
|
|
239
|
-
tagQueryMode?: 'all' | 'any'
|
|
240
|
-
include?: 'locking scripts' | 'entire transactions'
|
|
241
|
-
includeCustomInstructions?: BooleanDefaultFalse
|
|
242
|
-
includeTags?: BooleanDefaultFalse
|
|
243
|
-
includeLabels?: BooleanDefaultFalse
|
|
244
|
-
limit?: PositiveIntegerDefault10Max10000
|
|
245
|
-
offset?: PositiveIntegerOrZero
|
|
246
|
-
}): Promise<{
|
|
247
|
-
totalOutputs: PositiveIntegerOrZero
|
|
248
|
-
outputs: Array<{
|
|
249
|
-
outpoint: OutpointString
|
|
250
|
-
satoshis: SatoshiValue
|
|
251
|
-
lockingScript?: HexString
|
|
252
|
-
tx?: BEEF
|
|
253
|
-
spendable: boolean
|
|
254
|
-
customInstructions?: string
|
|
255
|
-
tags?: OutputTagStringUnder300Bytes[]
|
|
256
|
-
labels?: LabelStringUnder300Bytes[]
|
|
257
|
-
}>
|
|
258
|
-
}> {
|
|
259
|
-
return await this.invoke('listOutputs', args)
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
async relinquishOutput(args: {
|
|
263
|
-
basket: BasketStringUnder300Bytes
|
|
264
|
-
output: OutpointString
|
|
265
|
-
}): Promise<{ relinquished: true }> {
|
|
266
|
-
return await this.invoke('relinquishOutput', args)
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
async getPublicKey(args: {
|
|
270
|
-
identityKey?: true
|
|
271
|
-
protocolID?: [SecurityLevel, ProtocolString5To400Bytes]
|
|
272
|
-
keyID?: KeyIDStringUnder800Bytes
|
|
273
|
-
privileged?: BooleanDefaultFalse
|
|
274
|
-
privilegedReason?: DescriptionString5to50Bytes
|
|
275
|
-
counterparty?: PubKeyHex | 'self' | 'anyone'
|
|
276
|
-
forSelf?: BooleanDefaultFalse
|
|
277
|
-
}): Promise<{ publicKey: PubKeyHex }> {
|
|
278
|
-
return await this.invoke('getPublicKey', args)
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
async revealCounterpartyKeyLinkage(args: {
|
|
282
|
-
counterparty: PubKeyHex
|
|
283
|
-
verifier: PubKeyHex
|
|
284
|
-
privilegedReason?: DescriptionString5to50Bytes
|
|
285
|
-
privileged?: BooleanDefaultFalse
|
|
286
|
-
}): Promise<{
|
|
287
|
-
prover: PubKeyHex
|
|
288
|
-
verifier: PubKeyHex
|
|
289
|
-
counterparty: PubKeyHex
|
|
290
|
-
revelationTime: ISOTimestampString
|
|
291
|
-
encryptedLinkage: Byte[]
|
|
292
|
-
encryptedLinkageProof: Byte[]
|
|
293
|
-
}> {
|
|
294
|
-
return await this.invoke('revealCounterpartyKeyLinkage', args)
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
async revealSpecificKeyLinkage(args: {
|
|
298
|
-
counterparty: PubKeyHex
|
|
299
|
-
verifier: PubKeyHex
|
|
300
|
-
protocolID: [SecurityLevel, ProtocolString5To400Bytes]
|
|
301
|
-
keyID: KeyIDStringUnder800Bytes
|
|
302
|
-
privilegedReason?: DescriptionString5to50Bytes
|
|
303
|
-
privileged?: BooleanDefaultFalse
|
|
304
|
-
}): Promise<{
|
|
305
|
-
prover: PubKeyHex
|
|
306
|
-
verifier: PubKeyHex
|
|
307
|
-
counterparty: PubKeyHex
|
|
308
|
-
protocolID: [SecurityLevel, ProtocolString5To400Bytes]
|
|
309
|
-
keyID: KeyIDStringUnder800Bytes
|
|
310
|
-
encryptedLinkage: Byte[]
|
|
311
|
-
encryptedLinkageProof: Byte[]
|
|
312
|
-
proofType: Byte
|
|
313
|
-
}> {
|
|
314
|
-
return await this.invoke('revealSpecificKeyLinkage', args)
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
async encrypt(args: {
|
|
318
|
-
plaintext: Byte[]
|
|
319
|
-
protocolID: [SecurityLevel, ProtocolString5To400Bytes]
|
|
320
|
-
keyID: KeyIDStringUnder800Bytes
|
|
321
|
-
privilegedReason?: DescriptionString5to50Bytes
|
|
322
|
-
counterparty?: PubKeyHex | 'self' | 'anyone'
|
|
323
|
-
privileged?: BooleanDefaultFalse
|
|
324
|
-
}): Promise<{ ciphertext: Byte[] }> {
|
|
325
|
-
return await this.invoke('encrypt', args)
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
async decrypt(args: {
|
|
329
|
-
ciphertext: Byte[]
|
|
330
|
-
protocolID: [SecurityLevel, ProtocolString5To400Bytes]
|
|
331
|
-
keyID: KeyIDStringUnder800Bytes
|
|
332
|
-
privilegedReason?: DescriptionString5to50Bytes
|
|
333
|
-
counterparty?: PubKeyHex | 'self' | 'anyone'
|
|
334
|
-
privileged?: BooleanDefaultFalse
|
|
335
|
-
}): Promise<{ plaintext: Byte[] }> {
|
|
336
|
-
return await this.invoke('decrypt', args)
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
async createHmac(args: {
|
|
340
|
-
data: Byte[]
|
|
341
|
-
protocolID: [SecurityLevel, ProtocolString5To400Bytes]
|
|
342
|
-
keyID: KeyIDStringUnder800Bytes
|
|
343
|
-
privilegedReason?: DescriptionString5to50Bytes
|
|
344
|
-
counterparty?: PubKeyHex | 'self' | 'anyone'
|
|
345
|
-
privileged?: BooleanDefaultFalse
|
|
346
|
-
}): Promise<{ hmac: Byte[] }> {
|
|
347
|
-
return await this.invoke('createHmac', args)
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
async verifyHmac(args: {
|
|
351
|
-
data: Byte[]
|
|
352
|
-
hmac: Byte[]
|
|
353
|
-
protocolID: [SecurityLevel, ProtocolString5To400Bytes]
|
|
354
|
-
keyID: KeyIDStringUnder800Bytes
|
|
355
|
-
privilegedReason?: DescriptionString5to50Bytes
|
|
356
|
-
counterparty?: PubKeyHex | 'self' | 'anyone'
|
|
357
|
-
privileged?: BooleanDefaultFalse
|
|
358
|
-
}): Promise<{ valid: true }> {
|
|
359
|
-
return await this.invoke('verifyHmac', args)
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
async createSignature(args: {
|
|
363
|
-
data?: Byte[]
|
|
364
|
-
hashToDirectlySign?: Byte[]
|
|
365
|
-
protocolID: [SecurityLevel, ProtocolString5To400Bytes]
|
|
366
|
-
keyID: KeyIDStringUnder800Bytes
|
|
367
|
-
privilegedReason?: DescriptionString5to50Bytes
|
|
368
|
-
counterparty?: PubKeyHex | 'self' | 'anyone'
|
|
369
|
-
privileged?: BooleanDefaultFalse
|
|
370
|
-
}): Promise<{ signature: Byte[] }> {
|
|
371
|
-
return await this.invoke('createSignature', args)
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
async verifySignature(args: {
|
|
375
|
-
data?: Byte[]
|
|
376
|
-
hashToDirectlyVerify?: Byte[]
|
|
377
|
-
signature: Byte[]
|
|
378
|
-
protocolID: [SecurityLevel, ProtocolString5To400Bytes]
|
|
379
|
-
keyID: KeyIDStringUnder800Bytes
|
|
380
|
-
privilegedReason?: DescriptionString5to50Bytes
|
|
381
|
-
counterparty?: PubKeyHex | 'self' | 'anyone'
|
|
382
|
-
forSelf?: BooleanDefaultFalse
|
|
383
|
-
privileged?: BooleanDefaultFalse
|
|
384
|
-
}): Promise<{ valid: true }> {
|
|
385
|
-
return await this.invoke('verifySignature', args)
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
async acquireCertificate(args: {
|
|
389
|
-
type: Base64String
|
|
390
|
-
subject: PubKeyHex
|
|
391
|
-
serialNumber: Base64String
|
|
392
|
-
revocationOutpoint: OutpointString
|
|
393
|
-
signature: HexString
|
|
394
|
-
fields: Record<CertificateFieldNameUnder50Bytes, string>
|
|
395
|
-
certifier: PubKeyHex
|
|
396
|
-
keyringRevealer: PubKeyHex | 'certifier'
|
|
397
|
-
keyringForSubject: Record<CertificateFieldNameUnder50Bytes, Base64String>
|
|
398
|
-
acquisitionProtocol: 'direct' | 'issuance'
|
|
399
|
-
certifierUrl?: string
|
|
400
|
-
}): Promise<{
|
|
401
|
-
type: Base64String
|
|
402
|
-
subject: PubKeyHex
|
|
403
|
-
serialNumber: Base64String
|
|
404
|
-
certifier: PubKeyHex
|
|
405
|
-
revocationOutpoint: OutpointString
|
|
406
|
-
signature: HexString
|
|
407
|
-
fields: Record<CertificateFieldNameUnder50Bytes, string>
|
|
408
|
-
}> {
|
|
409
|
-
return await this.invoke('acquireCertificate', args)
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
async listCertificates(args: {
|
|
413
|
-
certifiers: PubKeyHex[]
|
|
414
|
-
types: Base64String[]
|
|
415
|
-
limit?: PositiveIntegerDefault10Max10000
|
|
416
|
-
offset?: PositiveIntegerOrZero
|
|
417
|
-
privileged?: BooleanDefaultFalse
|
|
418
|
-
privilegedReason?: DescriptionString5to50Bytes
|
|
419
|
-
}): Promise<{
|
|
420
|
-
totalCertificates: PositiveIntegerOrZero
|
|
421
|
-
certificates: Array<{
|
|
422
|
-
type: Base64String
|
|
423
|
-
subject: PubKeyHex
|
|
424
|
-
serialNumber: Base64String
|
|
425
|
-
certifier: PubKeyHex
|
|
426
|
-
revocationOutpoint: OutpointString
|
|
427
|
-
signature: HexString
|
|
428
|
-
fields: Record<CertificateFieldNameUnder50Bytes, string>
|
|
429
|
-
}>
|
|
430
|
-
}> {
|
|
431
|
-
return await this.invoke('listCertificates', args)
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
async proveCertificate(args: {
|
|
435
|
-
certificate: {
|
|
436
|
-
type: Base64String
|
|
437
|
-
subject: PubKeyHex
|
|
438
|
-
serialNumber: Base64String
|
|
439
|
-
certifier: PubKeyHex
|
|
440
|
-
revocationOutpoint: OutpointString
|
|
441
|
-
signature: HexString
|
|
442
|
-
fields: Record<CertificateFieldNameUnder50Bytes, string>
|
|
443
|
-
}
|
|
444
|
-
fieldsToReveal: CertificateFieldNameUnder50Bytes[]
|
|
445
|
-
verifier: PubKeyHex
|
|
446
|
-
privileged?: BooleanDefaultFalse
|
|
447
|
-
privilegedReason?: DescriptionString5to50Bytes
|
|
448
|
-
}): Promise<{
|
|
449
|
-
keyringForVerifier: Record<CertificateFieldNameUnder50Bytes, Base64String>
|
|
450
|
-
}> {
|
|
451
|
-
return await this.invoke('proveCertificate', args)
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
async relinquishCertificate(args: {
|
|
455
|
-
type: Base64String
|
|
456
|
-
serialNumber: Base64String
|
|
457
|
-
certifier: PubKeyHex
|
|
458
|
-
}): Promise<{ relinquished: true }> {
|
|
459
|
-
return await this.invoke('relinquishCertificate', args)
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
async discoverByIdentityKey(args: {
|
|
463
|
-
identityKey: PubKeyHex
|
|
464
|
-
limit?: PositiveIntegerDefault10Max10000
|
|
465
|
-
offset?: PositiveIntegerOrZero
|
|
466
|
-
}): Promise<{
|
|
467
|
-
totalCertificates: PositiveIntegerOrZero
|
|
468
|
-
certificates: Array<{
|
|
469
|
-
type: Base64String
|
|
470
|
-
subject: PubKeyHex
|
|
471
|
-
serialNumber: Base64String
|
|
472
|
-
certifier: PubKeyHex
|
|
473
|
-
revocationOutpoint: OutpointString
|
|
474
|
-
signature: HexString
|
|
475
|
-
fields: Record<CertificateFieldNameUnder50Bytes, Base64String>
|
|
476
|
-
certifierInfo: {
|
|
477
|
-
name: EntityNameStringMax100Bytes
|
|
478
|
-
iconUrl: EntityIconURLStringMax500Bytes
|
|
479
|
-
description: DescriptionString5to50Bytes
|
|
480
|
-
trust: PositiveIntegerMax10
|
|
481
|
-
}
|
|
482
|
-
publiclyRevealedKeyring: Record<
|
|
483
|
-
CertificateFieldNameUnder50Bytes,
|
|
484
|
-
Base64String
|
|
485
|
-
>
|
|
486
|
-
decryptedFields: Record<CertificateFieldNameUnder50Bytes, string>
|
|
487
|
-
}>
|
|
488
|
-
}> {
|
|
489
|
-
return await this.invoke('discoverByIdentityKey', args)
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
async discoverByAttributes(args: {
|
|
493
|
-
attributes: Record<CertificateFieldNameUnder50Bytes, string>
|
|
494
|
-
limit?: PositiveIntegerDefault10Max10000
|
|
495
|
-
offset?: PositiveIntegerOrZero
|
|
496
|
-
}): Promise<{
|
|
497
|
-
totalCertificates: PositiveIntegerOrZero
|
|
498
|
-
certificates: Array<{
|
|
499
|
-
type: Base64String
|
|
500
|
-
subject: PubKeyHex
|
|
501
|
-
serialNumber: Base64String
|
|
502
|
-
certifier: PubKeyHex
|
|
503
|
-
revocationOutpoint: OutpointString
|
|
504
|
-
signature: HexString
|
|
505
|
-
fields: Record<CertificateFieldNameUnder50Bytes, Base64String>
|
|
506
|
-
certifierInfo: {
|
|
507
|
-
name: EntityNameStringMax100Bytes
|
|
508
|
-
iconUrl: EntityIconURLStringMax500Bytes
|
|
509
|
-
description: DescriptionString5to50Bytes
|
|
510
|
-
trust: PositiveIntegerMax10
|
|
511
|
-
}
|
|
512
|
-
publiclyRevealedKeyring: Record<
|
|
513
|
-
CertificateFieldNameUnder50Bytes,
|
|
514
|
-
Base64String
|
|
515
|
-
>
|
|
516
|
-
decryptedFields: Record<CertificateFieldNameUnder50Bytes, string>
|
|
517
|
-
}>
|
|
518
|
-
}> {
|
|
519
|
-
return await this.invoke('discoverByAttributes', args)
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
async isAuthenticated(args: {}): Promise<{ authenticated: true }> {
|
|
523
|
-
return await this.invoke('isAuthenticated', args)
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
async waitForAuthentication(args: {}): Promise<{ authenticated: true }> {
|
|
527
|
-
return await this.invoke('waitForAuthentication', args)
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
async getHeight(args: {}): Promise<{ height: PositiveInteger }> {
|
|
531
|
-
return await this.invoke('getHeight', args)
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
async getHeaderForHeight(args: {
|
|
535
|
-
height: PositiveInteger
|
|
536
|
-
}): Promise<{ header: HexString }> {
|
|
537
|
-
return await this.invoke('getHeaderForHeight', args)
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
async getNetwork(args: {}): Promise<{ network: 'mainnet' | 'testnet' }> {
|
|
541
|
-
return await this.invoke('getNetwork', args)
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
async getVersion(args: {}): Promise<{ version: VersionString7To30Bytes }> {
|
|
545
|
-
return await this.invoke('getVersion', args)
|
|
546
|
-
}
|
|
547
59
|
}
|