@bsv/sdk 1.2.3 → 1.2.4
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/Certificate.js +1 -1
- package/dist/cjs/src/auth/Certificate.js.map +1 -1
- package/dist/cjs/src/overlay-tools/LookupResolver.js.map +1 -1
- package/dist/cjs/src/overlay-tools/OverlayAdminTokenTemplate.js.map +1 -1
- package/dist/cjs/src/overlay-tools/SHIPBroadcaster.js +1 -1
- package/dist/cjs/src/overlay-tools/SHIPBroadcaster.js.map +1 -1
- package/dist/cjs/src/transaction/Beef.js +19 -10
- package/dist/cjs/src/transaction/Beef.js.map +1 -1
- package/dist/cjs/src/transaction/Transaction.js +38 -6
- package/dist/cjs/src/transaction/Transaction.js.map +1 -1
- package/dist/cjs/src/wallet/CachedKeyDeriver.js.map +1 -1
- package/dist/cjs/src/wallet/KeyDeriver.js.map +1 -1
- 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/WalletError.js.map +1 -1
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/auth/Certificate.js +1 -1
- package/dist/esm/src/auth/Certificate.js.map +1 -1
- package/dist/esm/src/overlay-tools/LookupResolver.js.map +1 -1
- package/dist/esm/src/overlay-tools/OverlayAdminTokenTemplate.js.map +1 -1
- package/dist/esm/src/overlay-tools/SHIPBroadcaster.js +1 -1
- package/dist/esm/src/overlay-tools/SHIPBroadcaster.js.map +1 -1
- package/dist/esm/src/transaction/Beef.js +19 -10
- package/dist/esm/src/transaction/Beef.js.map +1 -1
- package/dist/esm/src/transaction/Transaction.js +38 -6
- package/dist/esm/src/transaction/Transaction.js.map +1 -1
- package/dist/esm/src/wallet/CachedKeyDeriver.js.map +1 -1
- package/dist/esm/src/wallet/KeyDeriver.js.map +1 -1
- 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/WalletError.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/auth/Certificate.d.ts.map +1 -1
- package/dist/types/src/overlay-tools/LookupResolver.d.ts.map +1 -1
- package/dist/types/src/overlay-tools/OverlayAdminTokenTemplate.d.ts.map +1 -1
- package/dist/types/src/overlay-tools/SHIPBroadcaster.d.ts.map +1 -1
- package/dist/types/src/transaction/Beef.d.ts.map +1 -1
- package/dist/types/src/transaction/Transaction.d.ts.map +1 -1
- package/dist/types/src/wallet/CachedKeyDeriver.d.ts.map +1 -1
- package/dist/types/src/wallet/KeyDeriver.d.ts.map +1 -1
- package/dist/types/src/wallet/ProtoWallet.d.ts.map +1 -1
- package/dist/types/src/wallet/Wallet.interfaces.d.ts +11 -11
- package/dist/types/src/wallet/Wallet.interfaces.d.ts.map +1 -1
- package/dist/types/src/wallet/WalletClient.d.ts.map +1 -1
- package/dist/types/src/wallet/WalletError.d.ts.map +1 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +1 -1
- package/package.json +1 -1
- package/src/auth/Certificate.ts +9 -9
- package/src/auth/index.ts +1 -1
- package/src/overlay-tools/LookupResolver.ts +7 -7
- package/src/overlay-tools/OverlayAdminTokenTemplate.ts +4 -4
- package/src/overlay-tools/SHIPBroadcaster.ts +9 -9
- package/src/overlay-tools/index.ts +1 -1
- package/src/transaction/Beef.ts +33 -48
- package/src/transaction/BeefParty.ts +4 -4
- package/src/transaction/BeefTx.ts +1 -1
- package/src/transaction/Transaction.ts +38 -10
- package/src/transaction/__tests/Transaction.test.ts +133 -4
- package/src/wallet/CachedKeyDeriver.ts +10 -10
- package/src/wallet/KeyDeriver.ts +8 -8
- package/src/wallet/ProtoWallet.ts +176 -176
- package/src/wallet/Wallet.interfaces.ts +19 -19
- package/src/wallet/WalletClient.ts +30 -30
- package/src/wallet/WalletError.ts +2 -2
|
@@ -203,9 +203,9 @@ export type ActionStatus = | 'completed' | 'unprocessed' | 'sending' | 'unproven
|
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* Controls behavior of input BEEF validation.
|
|
206
|
-
*
|
|
206
|
+
*
|
|
207
207
|
* If `known`, input transactions may omit supporting validity proof data for all TXIDs known to this wallet.
|
|
208
|
-
*
|
|
208
|
+
*
|
|
209
209
|
* If undefined, input BEEFs must be complete and valid.
|
|
210
210
|
*/
|
|
211
211
|
export type TrustSelf = 'known'
|
|
@@ -279,7 +279,7 @@ export interface CreateActionResult {
|
|
|
279
279
|
txid?: TXIDHexString
|
|
280
280
|
tx?: AtomicBEEF
|
|
281
281
|
noSendChange?: OutpointString[]
|
|
282
|
-
sendWithResults?:
|
|
282
|
+
sendWithResults?: SendWithResult[]
|
|
283
283
|
signableTransaction?: SignableTransaction
|
|
284
284
|
}
|
|
285
285
|
|
|
@@ -296,8 +296,8 @@ export interface CreateActionResult {
|
|
|
296
296
|
export interface CreateActionArgs {
|
|
297
297
|
description: DescriptionString5to50Bytes
|
|
298
298
|
inputBEEF?: BEEF
|
|
299
|
-
inputs?:
|
|
300
|
-
outputs?:
|
|
299
|
+
inputs?: CreateActionInput[]
|
|
300
|
+
outputs?: CreateActionOutput[]
|
|
301
301
|
lockTime?: PositiveIntegerOrZero
|
|
302
302
|
version?: PositiveIntegerOrZero
|
|
303
303
|
labels?: LabelStringUnder300Bytes[]
|
|
@@ -340,12 +340,12 @@ export interface SignActionArgs {
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
/**
|
|
343
|
-
*
|
|
343
|
+
*
|
|
344
344
|
*/
|
|
345
345
|
export interface SignActionResult {
|
|
346
346
|
txid?: TXIDHexString
|
|
347
347
|
tx?: AtomicBEEF
|
|
348
|
-
sendWithResults?:
|
|
348
|
+
sendWithResults?: SendWithResult[]
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
/**
|
|
@@ -431,13 +431,13 @@ export interface WalletAction {
|
|
|
431
431
|
labels?: LabelStringUnder300Bytes[]
|
|
432
432
|
version: PositiveIntegerOrZero
|
|
433
433
|
lockTime: PositiveIntegerOrZero
|
|
434
|
-
inputs?:
|
|
435
|
-
outputs?:
|
|
434
|
+
inputs?: WalletActionInput[]
|
|
435
|
+
outputs?: WalletActionOutput[]
|
|
436
436
|
}
|
|
437
437
|
|
|
438
438
|
export interface ListActionsResult {
|
|
439
439
|
totalActions: PositiveIntegerOrZero
|
|
440
|
-
actions:
|
|
440
|
+
actions: WalletAction[]
|
|
441
441
|
}
|
|
442
442
|
|
|
443
443
|
/**
|
|
@@ -484,7 +484,7 @@ export interface InternalizeOutput {
|
|
|
484
484
|
*/
|
|
485
485
|
export interface InternalizeActionArgs {
|
|
486
486
|
tx: AtomicBEEF
|
|
487
|
-
outputs:
|
|
487
|
+
outputs: InternalizeOutput[]
|
|
488
488
|
description: DescriptionString5to50Bytes
|
|
489
489
|
labels?: LabelStringUnder300Bytes[]
|
|
490
490
|
seekPermission?: BooleanDefaultTrue
|
|
@@ -523,7 +523,7 @@ export interface ListOutputsArgs {
|
|
|
523
523
|
export interface ListOutputsResult {
|
|
524
524
|
totalOutputs: PositiveIntegerOrZero
|
|
525
525
|
BEEF?: BEEF
|
|
526
|
-
outputs:
|
|
526
|
+
outputs: WalletOutput[]
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
/**
|
|
@@ -550,9 +550,9 @@ export interface WalletEncryptionArgs extends KeyLinkageArgs {
|
|
|
550
550
|
|
|
551
551
|
/**
|
|
552
552
|
* When `identityKey` is true, `WalletEncryptionArgs` are not used.
|
|
553
|
-
*
|
|
553
|
+
*
|
|
554
554
|
* When `identityKey` is undefined, `WalletEncryptionArgs` are required.
|
|
555
|
-
*
|
|
555
|
+
*
|
|
556
556
|
* @param {BooleanDefaultFalse|true} [identityKey] - Use true to retrieve the current user's own identity key, overriding any protocol ID, key ID, or counterparty specified.
|
|
557
557
|
* @param {BooleanDefaultFalse} [forSelf] - Whether to return the public key derived from the current user's own identity (as opposed to the counterparty's identity).
|
|
558
558
|
*/
|
|
@@ -736,7 +736,7 @@ export interface ListCertificatesArgs {
|
|
|
736
736
|
|
|
737
737
|
export interface ListCertificatesResult {
|
|
738
738
|
totalCertificates: PositiveIntegerOrZero
|
|
739
|
-
certificates:
|
|
739
|
+
certificates: WalletCertificate[]
|
|
740
740
|
}
|
|
741
741
|
|
|
742
742
|
/**
|
|
@@ -786,7 +786,7 @@ export interface DiscoverByIdentityKeyArgs {
|
|
|
786
786
|
*/
|
|
787
787
|
export interface DiscoverCertificatesResult {
|
|
788
788
|
totalCertificates: PositiveIntegerOrZero
|
|
789
|
-
certificates:
|
|
789
|
+
certificates: IdentityCertificate[]
|
|
790
790
|
}
|
|
791
791
|
|
|
792
792
|
/**
|
|
@@ -817,9 +817,9 @@ export interface WalletErrorObject extends Error {
|
|
|
817
817
|
* encryption, decryption, identity certificate management, identity verification, and communication
|
|
818
818
|
* with applications as per the BRC standards. This interface allows applications to interact with
|
|
819
819
|
* the wallet for a range of functionalities aligned with the Babbage architectural principles.
|
|
820
|
-
*
|
|
820
|
+
*
|
|
821
821
|
* Error Handling
|
|
822
|
-
*
|
|
822
|
+
*
|
|
823
823
|
* Every method of the `Wallet` interface has a return value of the form `Promise<object>`.
|
|
824
824
|
* When an error occurs, an exception object may be thrown which must conform to the `WalletError` interface.
|
|
825
825
|
* Serialization layers can rely on the `isError` property being unique to error objects to
|
|
@@ -1167,4 +1167,4 @@ export interface Wallet {
|
|
|
1167
1167
|
args: {},
|
|
1168
1168
|
originator?: OriginatorDomainNameStringUnder250Bytes
|
|
1169
1169
|
) => Promise<{ version: VersionString7To30Bytes }>
|
|
1170
|
-
}
|
|
1170
|
+
}
|
|
@@ -12,7 +12,7 @@ const MAX_XDM_RESPONSE_WAIT = 200
|
|
|
12
12
|
export default class WalletClient implements Wallet {
|
|
13
13
|
public substrate: 'auto' | Wallet
|
|
14
14
|
originator?: OriginatorDomainNameStringUnder250Bytes
|
|
15
|
-
constructor(substrate: 'auto' | 'Cicada' | 'XDM' | 'window.CWI' | Wallet = 'auto', originator?: OriginatorDomainNameStringUnder250Bytes) {
|
|
15
|
+
constructor (substrate: 'auto' | 'Cicada' | 'XDM' | 'window.CWI' | Wallet = 'auto', originator?: OriginatorDomainNameStringUnder250Bytes) {
|
|
16
16
|
if (substrate === 'Cicada') substrate = new WalletWireTransceiver(new HTTPWalletWire(originator))
|
|
17
17
|
if (substrate === 'window.CWI') substrate = new WindowCWISubstrate()
|
|
18
18
|
if (substrate === 'XDM') substrate = new XDMSubstrate()
|
|
@@ -20,7 +20,7 @@ export default class WalletClient implements Wallet {
|
|
|
20
20
|
this.originator = originator
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
async connectToSubstrate() {
|
|
23
|
+
async connectToSubstrate () {
|
|
24
24
|
if (typeof this.substrate === 'object') {
|
|
25
25
|
return // substrate is already connected
|
|
26
26
|
}
|
|
@@ -60,141 +60,141 @@ export default class WalletClient implements Wallet {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
async createAction(args: CreateActionArgs): Promise<CreateActionResult> {
|
|
63
|
+
async createAction (args: CreateActionArgs): Promise<CreateActionResult> {
|
|
64
64
|
await this.connectToSubstrate()
|
|
65
65
|
return await (this.substrate as Wallet).createAction(args, this.originator)
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
async signAction(args: SignActionArgs): Promise<SignActionResult> {
|
|
68
|
+
async signAction (args: SignActionArgs): Promise<SignActionResult> {
|
|
69
69
|
await this.connectToSubstrate()
|
|
70
70
|
return await (this.substrate as Wallet).signAction(args, this.originator)
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
async abortAction(args: { reference: Base64String }): Promise<{ aborted: true }> {
|
|
73
|
+
async abortAction (args: { reference: Base64String }): Promise<{ aborted: true }> {
|
|
74
74
|
await this.connectToSubstrate()
|
|
75
75
|
return await (this.substrate as Wallet).abortAction(args, this.originator)
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
async listActions(args: ListActionsArgs): Promise<ListActionsResult> {
|
|
78
|
+
async listActions (args: ListActionsArgs): Promise<ListActionsResult> {
|
|
79
79
|
await this.connectToSubstrate()
|
|
80
80
|
return await (this.substrate as Wallet).listActions(args, this.originator)
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
async internalizeAction(args: InternalizeActionArgs): Promise<{ accepted: true }> {
|
|
83
|
+
async internalizeAction (args: InternalizeActionArgs): Promise<{ accepted: true }> {
|
|
84
84
|
await this.connectToSubstrate()
|
|
85
85
|
return await (this.substrate as Wallet).internalizeAction(args, this.originator)
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
async listOutputs(args: ListOutputsArgs): Promise<ListOutputsResult> {
|
|
88
|
+
async listOutputs (args: ListOutputsArgs): Promise<ListOutputsResult> {
|
|
89
89
|
await this.connectToSubstrate()
|
|
90
90
|
return await (this.substrate as Wallet).listOutputs(args, this.originator)
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
async relinquishOutput(args: { basket: BasketStringUnder300Bytes, output: OutpointString }): Promise<{ relinquished: true }> {
|
|
93
|
+
async relinquishOutput (args: { basket: BasketStringUnder300Bytes, output: OutpointString }): Promise<{ relinquished: true }> {
|
|
94
94
|
await this.connectToSubstrate()
|
|
95
95
|
return await (this.substrate as Wallet).relinquishOutput(args, this.originator)
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
async getPublicKey(args: { identityKey?: true, protocolID?: [0 | 1 | 2, ProtocolString5To400Bytes], keyID?: KeyIDStringUnder800Bytes, privileged?: BooleanDefaultFalse, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', forSelf?: BooleanDefaultFalse }): Promise<{ publicKey: PubKeyHex }> {
|
|
98
|
+
async getPublicKey (args: { identityKey?: true, protocolID?: [0 | 1 | 2, ProtocolString5To400Bytes], keyID?: KeyIDStringUnder800Bytes, privileged?: BooleanDefaultFalse, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', forSelf?: BooleanDefaultFalse }): Promise<{ publicKey: PubKeyHex }> {
|
|
99
99
|
await this.connectToSubstrate()
|
|
100
100
|
return await (this.substrate as Wallet).getPublicKey(args, this.originator)
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
async revealCounterpartyKeyLinkage(args: { counterparty: PubKeyHex, verifier: PubKeyHex, privilegedReason?: DescriptionString5to50Bytes, privileged?: BooleanDefaultFalse }): Promise<{ prover: PubKeyHex, verifier: PubKeyHex, counterparty: PubKeyHex, revelationTime: ISOTimestampString, encryptedLinkage: Byte[], encryptedLinkageProof: Byte[] }> {
|
|
103
|
+
async revealCounterpartyKeyLinkage (args: { counterparty: PubKeyHex, verifier: PubKeyHex, privilegedReason?: DescriptionString5to50Bytes, privileged?: BooleanDefaultFalse }): Promise<{ prover: PubKeyHex, verifier: PubKeyHex, counterparty: PubKeyHex, revelationTime: ISOTimestampString, encryptedLinkage: Byte[], encryptedLinkageProof: Byte[] }> {
|
|
104
104
|
await this.connectToSubstrate()
|
|
105
105
|
return await (this.substrate as Wallet).revealCounterpartyKeyLinkage(args, this.originator)
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
async revealSpecificKeyLinkage(args: { counterparty: PubKeyHex, verifier: PubKeyHex, protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, privileged?: BooleanDefaultFalse }): Promise<{ prover: PubKeyHex, verifier: PubKeyHex, counterparty: PubKeyHex, protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, encryptedLinkage: Byte[], encryptedLinkageProof: Byte[], proofType: Byte }> {
|
|
108
|
+
async revealSpecificKeyLinkage (args: { counterparty: PubKeyHex, verifier: PubKeyHex, protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, privileged?: BooleanDefaultFalse }): Promise<{ prover: PubKeyHex, verifier: PubKeyHex, counterparty: PubKeyHex, protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, encryptedLinkage: Byte[], encryptedLinkageProof: Byte[], proofType: Byte }> {
|
|
109
109
|
await this.connectToSubstrate()
|
|
110
110
|
return await (this.substrate as Wallet).revealSpecificKeyLinkage(args, this.originator)
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
async encrypt(args: { plaintext: Byte[], protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ ciphertext: Byte[] }> {
|
|
113
|
+
async encrypt (args: { plaintext: Byte[], protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ ciphertext: Byte[] }> {
|
|
114
114
|
await this.connectToSubstrate()
|
|
115
115
|
return await (this.substrate as Wallet).encrypt(args, this.originator)
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
async decrypt(args: { ciphertext: Byte[], protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ plaintext: Byte[] }> {
|
|
118
|
+
async decrypt (args: { ciphertext: Byte[], protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ plaintext: Byte[] }> {
|
|
119
119
|
return await (this.substrate as Wallet).decrypt(args, this.originator)
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
async createHmac(args: { data: Byte[], protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ hmac: Byte[] }> {
|
|
122
|
+
async createHmac (args: { data: Byte[], protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ hmac: Byte[] }> {
|
|
123
123
|
await this.connectToSubstrate()
|
|
124
124
|
return await (this.substrate as Wallet).createHmac(args, this.originator)
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
async verifyHmac(args: { data: Byte[], hmac: Byte[], protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ valid: true }> {
|
|
127
|
+
async verifyHmac (args: { data: Byte[], hmac: Byte[], protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ valid: true }> {
|
|
128
128
|
await this.connectToSubstrate()
|
|
129
129
|
return await (this.substrate as Wallet).verifyHmac(args, this.originator)
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
async createSignature(args: { data?: Byte[], hashToDirectlySign?: Byte[], protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ signature: Byte[] }> {
|
|
132
|
+
async createSignature (args: { data?: Byte[], hashToDirectlySign?: Byte[], protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', privileged?: BooleanDefaultFalse }): Promise<{ signature: Byte[] }> {
|
|
133
133
|
await this.connectToSubstrate()
|
|
134
134
|
return await (this.substrate as Wallet).createSignature(args, this.originator)
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
async verifySignature(args: { data?: Byte[], hashToDirectlyVerify?: Byte[], signature: Byte[], protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', forSelf?: BooleanDefaultFalse, privileged?: BooleanDefaultFalse }): Promise<{ valid: true }> {
|
|
137
|
+
async verifySignature (args: { data?: Byte[], hashToDirectlyVerify?: Byte[], signature: Byte[], protocolID: [0 | 1 | 2, ProtocolString5To400Bytes], keyID: KeyIDStringUnder800Bytes, privilegedReason?: DescriptionString5to50Bytes, counterparty?: PubKeyHex | 'self' | 'anyone', forSelf?: BooleanDefaultFalse, privileged?: BooleanDefaultFalse }): Promise<{ valid: true }> {
|
|
138
138
|
await this.connectToSubstrate()
|
|
139
139
|
return await (this.substrate as Wallet).verifySignature(args, this.originator)
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
async acquireCertificate(args: AcquireCertificateArgs): Promise<AcquireCertificateResult> {
|
|
142
|
+
async acquireCertificate (args: AcquireCertificateArgs): Promise<AcquireCertificateResult> {
|
|
143
143
|
await this.connectToSubstrate()
|
|
144
144
|
return await (this.substrate as Wallet).acquireCertificate(args, this.originator)
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
async listCertificates(args: { certifiers: PubKeyHex[], types: Base64String[], limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero, privileged?: BooleanDefaultFalse, privilegedReason?: DescriptionString5to50Bytes }): Promise<ListCertificatesResult> {
|
|
147
|
+
async listCertificates (args: { certifiers: PubKeyHex[], types: Base64String[], limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero, privileged?: BooleanDefaultFalse, privilegedReason?: DescriptionString5to50Bytes }): Promise<ListCertificatesResult> {
|
|
148
148
|
await this.connectToSubstrate()
|
|
149
149
|
return await (this.substrate as Wallet).listCertificates(args, this.originator)
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
async proveCertificate(args: ProveCertificateArgs): Promise<ProveCertificateResult> {
|
|
152
|
+
async proveCertificate (args: ProveCertificateArgs): Promise<ProveCertificateResult> {
|
|
153
153
|
await this.connectToSubstrate()
|
|
154
154
|
return await (this.substrate as Wallet).proveCertificate(args, this.originator)
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
async relinquishCertificate(args: { type: Base64String, serialNumber: Base64String, certifier: PubKeyHex }): Promise<{ relinquished: true }> {
|
|
157
|
+
async relinquishCertificate (args: { type: Base64String, serialNumber: Base64String, certifier: PubKeyHex }): Promise<{ relinquished: true }> {
|
|
158
158
|
await this.connectToSubstrate()
|
|
159
159
|
return await (this.substrate as Wallet).relinquishCertificate(args, this.originator)
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
async discoverByIdentityKey(args: { identityKey: PubKeyHex, limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero }): Promise<DiscoverCertificatesResult> {
|
|
162
|
+
async discoverByIdentityKey (args: { identityKey: PubKeyHex, limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero }): Promise<DiscoverCertificatesResult> {
|
|
163
163
|
await this.connectToSubstrate()
|
|
164
164
|
return await (this.substrate as Wallet).discoverByIdentityKey(args, this.originator)
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
async discoverByAttributes(args: { attributes: Record<CertificateFieldNameUnder50Bytes, string>, limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero }): Promise<DiscoverCertificatesResult> {
|
|
167
|
+
async discoverByAttributes (args: { attributes: Record<CertificateFieldNameUnder50Bytes, string>, limit?: PositiveIntegerDefault10Max10000, offset?: PositiveIntegerOrZero }): Promise<DiscoverCertificatesResult> {
|
|
168
168
|
await this.connectToSubstrate()
|
|
169
169
|
return await (this.substrate as Wallet).discoverByAttributes(args, this.originator)
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
async isAuthenticated(args: {} = {}): Promise<{ authenticated: boolean }> {
|
|
172
|
+
async isAuthenticated (args: {} = {}): Promise<{ authenticated: boolean }> {
|
|
173
173
|
await this.connectToSubstrate()
|
|
174
174
|
return await (this.substrate as Wallet).isAuthenticated(args, this.originator)
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
async waitForAuthentication(args: {} = {}): Promise<{ authenticated: true }> {
|
|
177
|
+
async waitForAuthentication (args: {} = {}): Promise<{ authenticated: true }> {
|
|
178
178
|
await this.connectToSubstrate()
|
|
179
179
|
return await (this.substrate as Wallet).waitForAuthentication(args, this.originator)
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
async getHeight(args: {} = {}): Promise<{ height: PositiveInteger }> {
|
|
182
|
+
async getHeight (args: {} = {}): Promise<{ height: PositiveInteger }> {
|
|
183
183
|
await this.connectToSubstrate()
|
|
184
184
|
return await (this.substrate as Wallet).getHeight(args, this.originator)
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
async getHeaderForHeight(args: { height: PositiveInteger }): Promise<{ header: HexString }> {
|
|
187
|
+
async getHeaderForHeight (args: { height: PositiveInteger }): Promise<{ header: HexString }> {
|
|
188
188
|
await this.connectToSubstrate()
|
|
189
189
|
return await (this.substrate as Wallet).getHeaderForHeight(args, this.originator)
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
async getNetwork(args: {} = {}): Promise<{ network: 'mainnet' | 'testnet' }> {
|
|
192
|
+
async getNetwork (args: {} = {}): Promise<{ network: 'mainnet' | 'testnet' }> {
|
|
193
193
|
await this.connectToSubstrate()
|
|
194
194
|
return await (this.substrate as Wallet).getNetwork(args, this.originator)
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
async getVersion(args: {} = {}): Promise<{ version: VersionString7To30Bytes }> {
|
|
197
|
+
async getVersion (args: {} = {}): Promise<{ version: VersionString7To30Bytes }> {
|
|
198
198
|
await this.connectToSubstrate()
|
|
199
199
|
return await (this.substrate as Wallet).getVersion(args, this.originator)
|
|
200
200
|
}
|
|
@@ -2,7 +2,7 @@ export class WalletError extends Error {
|
|
|
2
2
|
code: number
|
|
3
3
|
isError: boolean = true
|
|
4
4
|
|
|
5
|
-
constructor(message: string, code = 1, stack?: string) {
|
|
5
|
+
constructor (message: string, code = 1, stack?: string) {
|
|
6
6
|
super(message)
|
|
7
7
|
this.code = code
|
|
8
8
|
this.name = this.constructor.name
|
|
@@ -24,4 +24,4 @@ enum walletErrors {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export default walletErrors
|
|
27
|
-
export type WalletErrorCode = keyof typeof walletErrors
|
|
27
|
+
export type WalletErrorCode = keyof typeof walletErrors
|