pshenmic-dpp 1.0.5 → 1.0.6
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/.github/workflows/build.yml +1 -1
- package/.github/workflows/publish.yml +1 -1
- package/Cargo.lock +147 -49
- package/Cargo.toml +13 -7
- package/README.md +10 -1
- package/dist/wasm/index.d.ts +52 -0
- package/dist/wasm/pshenmic_dpp.d.ts +962 -0
- package/dist/wasm/pshenmic_dpp.js +3342 -875
- package/dist/wasm/pshenmic_dpp_bg.js +1 -1
- package/dist/wasm/pshenmic_dpp_bg.wasm.d.ts +440 -0
- package/docs/AssetLockProof.md +107 -0
- package/docs/Building.md +50 -0
- package/docs/ChainLockProof.md +63 -0
- package/docs/CoreScript.md +17 -0
- package/docs/DataContract.md +192 -0
- package/docs/DataContractCreateTransition.md +84 -0
- package/docs/DataContractUpdateTransition.md +84 -0
- package/docs/Document.md +396 -0
- package/docs/DocumentBaseTransition.md +111 -0
- package/docs/DocumentCreateTransition.md +132 -0
- package/docs/DocumentDeleteTransition.md +82 -0
- package/docs/DocumentPurchaseTransition.md +109 -0
- package/docs/DocumentReplaceTransition.md +112 -0
- package/docs/DocumentTransferTransition.md +96 -0
- package/docs/DocumentTransition.md +125 -0
- package/docs/DocumentUpdatePriceTransition.md +109 -0
- package/docs/DocumentsBatch.md +133 -0
- package/docs/Enums.md +103 -0
- package/docs/Home.md +28 -0
- package/docs/Identifier.md +37 -0
- package/docs/Identity.md +140 -0
- package/docs/IdentityCreateTransition.md +155 -0
- package/docs/IdentityCreditTransfer.md +187 -0
- package/docs/IdentityCreditWithdrawalTransition.md +244 -0
- package/docs/IdentityPublicKey.md +348 -0
- package/docs/IdentityPublicKeyInCreation.md +141 -0
- package/docs/IdentityTopUpTransition.md +166 -0
- package/docs/IdentityUpdateTransition.md +234 -0
- package/docs/InstantAssetLockProof.md +117 -0
- package/docs/InstantLock.md +100 -0
- package/docs/OutPoint.md +80 -0
- package/docs/PrefundedVotingBalance.md +48 -0
- package/docs/PrivateKey.md +112 -0
- package/docs/TxOut.md +93 -0
- package/package.json +3 -3
- package/packages/asset_lock_proof/Cargo.toml +19 -0
- package/packages/asset_lock_proof/src/chain/mod.rs +79 -0
- package/packages/asset_lock_proof/src/instant/instant_lock.rs +111 -0
- package/packages/asset_lock_proof/src/instant/mod.rs +115 -0
- package/packages/asset_lock_proof/src/lib.rs +133 -0
- package/packages/asset_lock_proof/src/outpoint/mod.rs +79 -0
- package/packages/asset_lock_proof/src/tx_out/mod.rs +80 -0
- package/packages/cbor_conversation/Cargo.toml +1 -1
- package/packages/core_script/Cargo.toml +13 -0
- package/packages/core_script/src/lib.rs +69 -0
- package/packages/data_contract/Cargo.toml +2 -1
- package/packages/data_contract/src/lib.rs +34 -30
- package/packages/data_contract_transitions/Cargo.toml +1 -1
- package/packages/data_contract_transitions/src/create/mod.rs +3 -3
- package/packages/data_contract_transitions/src/update/mod.rs +3 -3
- package/packages/document/Cargo.toml +2 -1
- package/packages/document/src/lib.rs +13 -12
- package/packages/document/src/methods/mod.rs +41 -38
- package/packages/documents_batch/Cargo.toml +2 -1
- package/packages/documents_batch/src/document_base_transition/mod.rs +16 -20
- package/packages/documents_batch/src/document_transition/mod.rs +9 -9
- package/packages/documents_batch/src/lib.rs +23 -16
- package/packages/documents_batch/src/transitions/create/mod.rs +5 -2
- package/packages/documents_batch/src/transitions/transfer/mod.rs +9 -11
- package/packages/enums/Cargo.toml +1 -1
- package/packages/enums/src/batch/batch_enum.rs +2 -2
- package/packages/enums/src/lib.rs +2 -0
- package/packages/enums/src/lock_types/mod.rs +65 -0
- package/packages/enums/src/platform/mod.rs +2 -0
- package/packages/enums/src/withdrawal/mod.rs +72 -0
- package/packages/identifier/Cargo.toml +9 -0
- package/packages/identifier/src/lib.rs +105 -0
- package/packages/identity/Cargo.toml +2 -1
- package/packages/identity/src/lib.rs +13 -18
- package/packages/identity_public_key/Cargo.toml +1 -1
- package/packages/identity_transitions/Cargo.toml +7 -3
- package/packages/identity_transitions/src/create_transition/mod.rs +99 -36
- package/packages/identity_transitions/src/credit_withdrawal_transition/mod.rs +212 -0
- package/packages/identity_transitions/src/identity_credit_transfer_transition/mod.rs +169 -0
- package/packages/identity_transitions/src/lib.rs +6 -1
- package/packages/identity_transitions/src/{create_transition/public_key_in_creation → public_key_in_creation}/mod.rs +67 -20
- package/packages/identity_transitions/src/top_up_transition/mod.rs +141 -0
- package/packages/identity_transitions/src/update_transition/mod.rs +213 -0
- package/packages/private_key/Cargo.toml +1 -1
- package/packages/state_transition/Cargo.toml +2 -1
- package/packages/state_transition/src/lib.rs +3 -2
- package/packages/utils/Cargo.toml +2 -2
- package/packages/utils/src/lib.rs +0 -3
- package/scripts/build-js.sh +16 -0
- package/scripts/build.sh +5 -1
- package/src/lib.rs +1 -0
- package/tests/AssetLockProof.spec.js +80 -0
- package/tests/ChainLockProof.spec.js +69 -0
- package/tests/CoreScript.spec.js +37 -0
- package/tests/DataContract.spec.js +17 -14
- package/tests/Document.spec.js +14 -8
- package/tests/DocumentBatchTransition.spec.js +11 -11
- package/tests/DocumentTransition.spec.js +4 -4
- package/tests/DocumentsTransitions.spec.js +22 -22
- package/tests/Identifier.spec.js +84 -0
- package/tests/Identity.spec.js +1 -1
- package/tests/IdentityCreateTransition.spec.js +93 -0
- package/tests/IdentityCreditTransferTransition.spec.js +146 -0
- package/tests/IdentityCreditWithdrawalTransition.spec.js +192 -0
- package/tests/IdentityTopUpTransition.spec.js +131 -0
- package/tests/IdentityUpdateTransition.spec.js +147 -0
- package/tests/InstantLockProof.spec.js +97 -0
- package/tests/OutPoint.spec.js +55 -0
- package/tests/PublicKeyInCreation.spec.js +258 -0
- package/tests/TxOut.spec.js +76 -0
- package/tests/mocks/Locks/index.js +5 -0
- package/tests/mocks/PublicKey/index.js +1 -1
- package/typings/index.d.ts +52 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# IdentityCreditWithdrawalTransitionWASM
|
|
2
|
+
|
|
3
|
+
This class allows to create instance of IdentityCreditWithdrawalTransition struct
|
|
4
|
+
|
|
5
|
+
`IdentityCreditWithdrawalTransitionWASM` can be created via constructor, bytes and state transition
|
|
6
|
+
|
|
7
|
+
Constructor params:
|
|
8
|
+
|
|
9
|
+
- `identityId -> IdentifierWASM | String | ArrayLike`
|
|
10
|
+
- `amount -> BigInt`
|
|
11
|
+
- `coreFeePerByte -> Number`
|
|
12
|
+
- `pooling -> PoolingENUM`
|
|
13
|
+
- `outputScript -> OutPutScript`
|
|
14
|
+
- `nonce -> BigInt`
|
|
15
|
+
- `userFeeIncrease -> Number`
|
|
16
|
+
|
|
17
|
+
___
|
|
18
|
+
|
|
19
|
+
## Navigation
|
|
20
|
+
|
|
21
|
+
- [Example](#Example)
|
|
22
|
+
- [Fields](#fields)
|
|
23
|
+
- [userFeeIncrease](#userfeeincrease)
|
|
24
|
+
- [identityId](#identityid)
|
|
25
|
+
- [amount](#amount)
|
|
26
|
+
- [nonce](#nonce)
|
|
27
|
+
- [signature](#signature)
|
|
28
|
+
- [signaturePublicKeyId](#signaturepublickeyid)
|
|
29
|
+
- [pooling](#pooling)
|
|
30
|
+
- [outputScript](#outputscript)
|
|
31
|
+
- [Getters](#getters)
|
|
32
|
+
- [getPurposeRequirement](#getpurposerequirement)
|
|
33
|
+
- [getModifiedDataIds](#getmodifieddataids)
|
|
34
|
+
- [getOptionalAssetLockProof](#getoptionalassetlockproof)
|
|
35
|
+
- [getSignableBytes](#getsignablebytes)
|
|
36
|
+
- [toBytes](#tobytes)
|
|
37
|
+
- [toStateTransition](#tostatetransition)
|
|
38
|
+
|
|
39
|
+
___
|
|
40
|
+
|
|
41
|
+
### Example
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
const identifier = new wasm.IdentifierWASM('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec')
|
|
45
|
+
const script = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
|
|
46
|
+
|
|
47
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
___
|
|
51
|
+
|
|
52
|
+
## Fields
|
|
53
|
+
|
|
54
|
+
All fields are readable and writable.
|
|
55
|
+
|
|
56
|
+
### `userFeeIncrease`
|
|
57
|
+
|
|
58
|
+
Contains userFeeIncrease in `Number`
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
62
|
+
|
|
63
|
+
transition.userFeeIncrease = 99
|
|
64
|
+
|
|
65
|
+
transition.userFeeIncrease // -> Number
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
___
|
|
69
|
+
|
|
70
|
+
### `identityId`
|
|
71
|
+
|
|
72
|
+
Contains identity identifier in `IdentifierWASM`
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
76
|
+
|
|
77
|
+
transition.identityId = '12FRq8L3VuBEQfCAZykmUaiXXrsd1Bwub2gcaMmtNbn3'
|
|
78
|
+
|
|
79
|
+
transition.identityId // -> IdentifierWASM
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
___
|
|
83
|
+
|
|
84
|
+
### `amount`
|
|
85
|
+
|
|
86
|
+
Contains credits amount for transfer in `BigInt`
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
90
|
+
|
|
91
|
+
transition.amount = BigInt(999999999)
|
|
92
|
+
|
|
93
|
+
transition.amount // -> BigInt
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
___
|
|
97
|
+
|
|
98
|
+
### `nonce`
|
|
99
|
+
|
|
100
|
+
Contains nonce in `BigInt`
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
104
|
+
|
|
105
|
+
transition.nonce = BigInt(999999999)
|
|
106
|
+
|
|
107
|
+
transition.nonce // -> BigInt
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
___
|
|
111
|
+
|
|
112
|
+
### `signature`
|
|
113
|
+
|
|
114
|
+
Contains signature in `Uint8Array`
|
|
115
|
+
|
|
116
|
+
```js
|
|
117
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
118
|
+
|
|
119
|
+
transition.signature = Uint8Array.from([1, 2, 3, 4, 5])
|
|
120
|
+
|
|
121
|
+
transition.signature // -> Uint8Array
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
___
|
|
125
|
+
|
|
126
|
+
### `signaturePublicKeyId`
|
|
127
|
+
|
|
128
|
+
Contains signature public key id in `Number`
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
132
|
+
|
|
133
|
+
transition.signaturePublicKeyId = 12
|
|
134
|
+
|
|
135
|
+
transition.signaturePublicKeyId // -> Number
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
___
|
|
139
|
+
|
|
140
|
+
### `pooling`
|
|
141
|
+
|
|
142
|
+
Contains pooling enum in `String`
|
|
143
|
+
|
|
144
|
+
```js
|
|
145
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
146
|
+
|
|
147
|
+
transition.pooling = "never"
|
|
148
|
+
|
|
149
|
+
transition.pooling // -> Number
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
___
|
|
153
|
+
|
|
154
|
+
### `outputScript`
|
|
155
|
+
|
|
156
|
+
Contains output script in `CoreScriptWASM | undefined`
|
|
157
|
+
|
|
158
|
+
```js
|
|
159
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
160
|
+
|
|
161
|
+
transition.outputScript = wasm.CoreScriptWASM.newP2PKH([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
|
|
162
|
+
|
|
163
|
+
transition.outputScript // -> CoreScriptWASM
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
___
|
|
167
|
+
|
|
168
|
+
## Getters
|
|
169
|
+
|
|
170
|
+
### `getPurposeRequirement`
|
|
171
|
+
|
|
172
|
+
Returns purpose requirement in PurposeENUM `String`
|
|
173
|
+
|
|
174
|
+
```js
|
|
175
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
176
|
+
|
|
177
|
+
transition.getPurposeRequirement() // -> String
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
___
|
|
182
|
+
|
|
183
|
+
### `getModifiedDataIds`
|
|
184
|
+
|
|
185
|
+
Returns modified ids in `[IdentifierWASM]`
|
|
186
|
+
|
|
187
|
+
```js
|
|
188
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
189
|
+
|
|
190
|
+
transition.getModifiedDataIds() // -> [IdentifierWASM]
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
___
|
|
195
|
+
|
|
196
|
+
### `getOptionalAssetLockProof`
|
|
197
|
+
|
|
198
|
+
Returns asset lock proof in `AssetLockProofWASM | undefined`
|
|
199
|
+
|
|
200
|
+
```js
|
|
201
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
202
|
+
|
|
203
|
+
transition.getOptionalAssetLockProof() // -> AssetLockProofWASM | undefined
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
___
|
|
208
|
+
|
|
209
|
+
### `getSignableBytes`
|
|
210
|
+
|
|
211
|
+
Returns bytes for sign in `Uint8Array`
|
|
212
|
+
|
|
213
|
+
```js
|
|
214
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
215
|
+
|
|
216
|
+
transition.getSignableBytes() // -> Uint8Array
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
___
|
|
221
|
+
|
|
222
|
+
### `toBytes`
|
|
223
|
+
|
|
224
|
+
Returns transition in `Uint8Array`
|
|
225
|
+
|
|
226
|
+
```js
|
|
227
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
228
|
+
|
|
229
|
+
transition.toBytes() // -> Uint8Array
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
___
|
|
234
|
+
|
|
235
|
+
### `toStateTransition`
|
|
236
|
+
|
|
237
|
+
Returns `StateTransitionWASM`
|
|
238
|
+
|
|
239
|
+
```js
|
|
240
|
+
const transition = new wasm.IdentityCreditWithdrawalTransitionWASM(identifier, BigInt(111), 1, 'never', script, BigInt(1), 1)
|
|
241
|
+
|
|
242
|
+
transition.toStateTransition() // -> StateTransitionWASM
|
|
243
|
+
|
|
244
|
+
```
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
# IdentityPublicKeyWASM
|
|
2
|
+
|
|
3
|
+
This class allows to create IdentityPublicKey instance and interact
|
|
4
|
+
|
|
5
|
+
Arguments in constructor:
|
|
6
|
+
|
|
7
|
+
- `id -> Number`
|
|
8
|
+
- `purpose -> PurposeEnum`
|
|
9
|
+
- `securityLevel -> SecurityLevelEnum`
|
|
10
|
+
- `keyType -> KeyTypeEnum`
|
|
11
|
+
- `readOnly -> Boolean`
|
|
12
|
+
- `binaryData -> Hex String`
|
|
13
|
+
- `disabledAt -> ?BigInt`
|
|
14
|
+
|
|
15
|
+
You can create `IdentityPublicKeyWASM` via constructor and `fromBytes`
|
|
16
|
+
|
|
17
|
+
If you want to create `IdentityPublicKey` from bytes,
|
|
18
|
+
you need to use serialized to bytes `IdentityPublicKey` from `rs-dpp` or `pshenmic-dpp`
|
|
19
|
+
___
|
|
20
|
+
|
|
21
|
+
## Navigation
|
|
22
|
+
|
|
23
|
+
- [Example](#example)
|
|
24
|
+
- [Getters methods](#getters-methods)
|
|
25
|
+
- [validatePrivateKey](#validateprivatekey)
|
|
26
|
+
- [getKeyId](#getkeyid)
|
|
27
|
+
- [getPurpose](#getpurpose)
|
|
28
|
+
- [getSecurityLevel](#getsecuritylevel)
|
|
29
|
+
- [getKeyType](#getkeytype)
|
|
30
|
+
- [getReadOnly](#getreadonly)
|
|
31
|
+
- [getData](#getdata)
|
|
32
|
+
- [getDisabledAt](#getdisabledat)
|
|
33
|
+
- [Setters methods](#setters-methods)
|
|
34
|
+
- [setKeyId](#setkeyid)
|
|
35
|
+
- [setPurpose](#setpurpose)
|
|
36
|
+
- [setSecurityLevel](#setsecuritylevel)
|
|
37
|
+
- [setKeyType](#setkeytype)
|
|
38
|
+
- [setReadOnly](#setreadonly)
|
|
39
|
+
- [setData](#setdata)
|
|
40
|
+
- [setDisabledAt](#setdisabledat)
|
|
41
|
+
|
|
42
|
+
___
|
|
43
|
+
|
|
44
|
+
## Example
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
48
|
+
2,
|
|
49
|
+
'AUTHENTICATION',
|
|
50
|
+
'CRITICAL',
|
|
51
|
+
'ECDSA_SECP256K1',
|
|
52
|
+
false,
|
|
53
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
54
|
+
)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
___
|
|
58
|
+
|
|
59
|
+
## Getters methods
|
|
60
|
+
|
|
61
|
+
### `validatePrivateKey`
|
|
62
|
+
|
|
63
|
+
Allows to validate private key for selected public key.
|
|
64
|
+
|
|
65
|
+
Returns `Boolean`
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
const privateKey = PrivateKeyWASM.fromWIF('cR4EZ2nAvCmn2cFepKn7UgSSQFgFTjkySAchvcoiEVdm48eWjQGn')
|
|
69
|
+
|
|
70
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
71
|
+
2,
|
|
72
|
+
'AUTHENTICATION',
|
|
73
|
+
'CRITICAL',
|
|
74
|
+
'ECDSA_SECP256K1',
|
|
75
|
+
false,
|
|
76
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
publicKey.validatePrivateKey(privateKey.getBytes(), 'mainnet')
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
___
|
|
83
|
+
|
|
84
|
+
### `getKeyId`
|
|
85
|
+
|
|
86
|
+
Returns key id in `Number`
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
90
|
+
2,
|
|
91
|
+
'AUTHENTICATION',
|
|
92
|
+
'CRITICAL',
|
|
93
|
+
'ECDSA_SECP256K1',
|
|
94
|
+
false,
|
|
95
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
publicKey.getKeyId() // -> Number
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
___
|
|
102
|
+
|
|
103
|
+
### `getPurpose`
|
|
104
|
+
|
|
105
|
+
Returns purpose value for identity public key in `String`
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
109
|
+
2,
|
|
110
|
+
'AUTHENTICATION',
|
|
111
|
+
'CRITICAL',
|
|
112
|
+
'ECDSA_SECP256K1',
|
|
113
|
+
false,
|
|
114
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
publicKey.getPurpose() // -> String
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
___
|
|
121
|
+
|
|
122
|
+
### `getSecurityLevel`
|
|
123
|
+
|
|
124
|
+
Returns security level for identity public key in `String`
|
|
125
|
+
|
|
126
|
+
```js
|
|
127
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
128
|
+
2,
|
|
129
|
+
'AUTHENTICATION',
|
|
130
|
+
'CRITICAL',
|
|
131
|
+
'ECDSA_SECP256K1',
|
|
132
|
+
false,
|
|
133
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
publicKey.getSecurityLevel() // -> String
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
___
|
|
140
|
+
|
|
141
|
+
### `getKeyType`
|
|
142
|
+
|
|
143
|
+
Returns key type for identity public key in `String`
|
|
144
|
+
|
|
145
|
+
```js
|
|
146
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
147
|
+
2,
|
|
148
|
+
'AUTHENTICATION',
|
|
149
|
+
'CRITICAL',
|
|
150
|
+
'ECDSA_SECP256K1',
|
|
151
|
+
false,
|
|
152
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
publicKey.getKeyType() // -> String
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
___
|
|
159
|
+
|
|
160
|
+
### `getReadOnly`
|
|
161
|
+
|
|
162
|
+
Returns read only flag for identity public key in `Boolean`
|
|
163
|
+
|
|
164
|
+
```js
|
|
165
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
166
|
+
2,
|
|
167
|
+
'AUTHENTICATION',
|
|
168
|
+
'CRITICAL',
|
|
169
|
+
'ECDSA_SECP256K1',
|
|
170
|
+
false,
|
|
171
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
publicKey.getReadOnly() // -> Boolean
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
___
|
|
178
|
+
|
|
179
|
+
### `getData`
|
|
180
|
+
|
|
181
|
+
Returns identity public key data in Hex `String`
|
|
182
|
+
|
|
183
|
+
```js
|
|
184
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
185
|
+
2,
|
|
186
|
+
'AUTHENTICATION',
|
|
187
|
+
'CRITICAL',
|
|
188
|
+
'ECDSA_SECP256K1',
|
|
189
|
+
false,
|
|
190
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
publicKey.getData() // -> String
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
___
|
|
197
|
+
|
|
198
|
+
### `getDisabledAt`
|
|
199
|
+
|
|
200
|
+
Returns optional disabled at timestamp identity public key `?Number`
|
|
201
|
+
|
|
202
|
+
```js
|
|
203
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
204
|
+
2,
|
|
205
|
+
'AUTHENTICATION',
|
|
206
|
+
'CRITICAL',
|
|
207
|
+
'ECDSA_SECP256K1',
|
|
208
|
+
false,
|
|
209
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
publicKey.getDisabledAt() // -> ?BigInt
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
___
|
|
216
|
+
|
|
217
|
+
## Setters methods
|
|
218
|
+
|
|
219
|
+
### `setKeyId`
|
|
220
|
+
|
|
221
|
+
Allows to set key id in `Number`
|
|
222
|
+
|
|
223
|
+
```js
|
|
224
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
225
|
+
2,
|
|
226
|
+
'AUTHENTICATION',
|
|
227
|
+
'CRITICAL',
|
|
228
|
+
'ECDSA_SECP256K1',
|
|
229
|
+
false,
|
|
230
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
publicKey.setKeyId(11)
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
___
|
|
237
|
+
|
|
238
|
+
### `setPurpose`
|
|
239
|
+
|
|
240
|
+
Allows to set purpose value for identity public key in `PurposeEnum`
|
|
241
|
+
|
|
242
|
+
```js
|
|
243
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
244
|
+
2,
|
|
245
|
+
'AUTHENTICATION',
|
|
246
|
+
'CRITICAL',
|
|
247
|
+
'ECDSA_SECP256K1',
|
|
248
|
+
false,
|
|
249
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
publicKey.setPurpose('ENCRYPTION')
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
___
|
|
256
|
+
|
|
257
|
+
### `setSecurityLevel`
|
|
258
|
+
|
|
259
|
+
Allows to set security level for identity public key in `SecurityLevelEnum`
|
|
260
|
+
|
|
261
|
+
```js
|
|
262
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
263
|
+
2,
|
|
264
|
+
'AUTHENTICATION',
|
|
265
|
+
'CRITICAL',
|
|
266
|
+
'ECDSA_SECP256K1',
|
|
267
|
+
false,
|
|
268
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
publicKey.setSecurityLevel('HIGH')
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
___
|
|
275
|
+
|
|
276
|
+
### `setKeyType`
|
|
277
|
+
|
|
278
|
+
Allows to set key type for identity public key in `KeyTypeEnum`
|
|
279
|
+
|
|
280
|
+
```js
|
|
281
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
282
|
+
2,
|
|
283
|
+
'AUTHENTICATION',
|
|
284
|
+
'CRITICAL',
|
|
285
|
+
'ECDSA_SECP256K1',
|
|
286
|
+
false,
|
|
287
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
288
|
+
)
|
|
289
|
+
|
|
290
|
+
publicKey.setKeyType('ECDSA_HASH160')
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
___
|
|
294
|
+
|
|
295
|
+
### `setReadOnly`
|
|
296
|
+
|
|
297
|
+
Allows to set read only flag for identity public key in `Boolean`
|
|
298
|
+
|
|
299
|
+
```js
|
|
300
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
301
|
+
2,
|
|
302
|
+
'AUTHENTICATION',
|
|
303
|
+
'CRITICAL',
|
|
304
|
+
'ECDSA_SECP256K1',
|
|
305
|
+
false,
|
|
306
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
publicKey.setReadOnly(true)
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
___
|
|
313
|
+
|
|
314
|
+
### `setData`
|
|
315
|
+
|
|
316
|
+
Allows to set identity public key data in Hex `String`
|
|
317
|
+
|
|
318
|
+
```js
|
|
319
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
320
|
+
2,
|
|
321
|
+
'AUTHENTICATION',
|
|
322
|
+
'CRITICAL',
|
|
323
|
+
'ECDSA_SECP256K1',
|
|
324
|
+
false,
|
|
325
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
publicKey.setData('0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48')
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
___
|
|
332
|
+
|
|
333
|
+
### `setDisabledAt`
|
|
334
|
+
|
|
335
|
+
Allows to set disabled at timestamp identity public key `BigInt`
|
|
336
|
+
|
|
337
|
+
```js
|
|
338
|
+
const publicKey = new IdentityPublicKeyWASM(
|
|
339
|
+
2,
|
|
340
|
+
'AUTHENTICATION',
|
|
341
|
+
'CRITICAL',
|
|
342
|
+
'ECDSA_SECP256K1',
|
|
343
|
+
false,
|
|
344
|
+
'0300000002e40e81d928fde2bde7880070e4fa9c1d1d9b168da707ea468afa2b48'
|
|
345
|
+
)
|
|
346
|
+
|
|
347
|
+
publicKey.setDisabledAt(BigInt(11))
|
|
348
|
+
```
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# IdentityPublicKeyInCreationWASM
|
|
2
|
+
|
|
3
|
+
This class allows to create and interact with instance of IdentityPublicKeyInCreation struct
|
|
4
|
+
|
|
5
|
+
`IdentityPublicKeyInCreationWASM` can be created only via constructor
|
|
6
|
+
|
|
7
|
+
Constructor params:
|
|
8
|
+
|
|
9
|
+
- `id -> Number`
|
|
10
|
+
- `purpose -> PurposeEnum`
|
|
11
|
+
- `securityLevel -> SecurityLevelEnum`
|
|
12
|
+
- `keyType -> KeyTypeEnum`
|
|
13
|
+
- `readOnly -> Boolean`
|
|
14
|
+
- `binaryData -> Uint8Array`
|
|
15
|
+
- `signature -> Uint8Array`
|
|
16
|
+
|
|
17
|
+
___
|
|
18
|
+
|
|
19
|
+
## Navigation
|
|
20
|
+
|
|
21
|
+
- [Example](#Example)
|
|
22
|
+
- [Fields](#fields)
|
|
23
|
+
- [keyId](#keyid)
|
|
24
|
+
- [purpose](#purpose)
|
|
25
|
+
- [securityLevel](#securitylevel)
|
|
26
|
+
- [keyType](#keytype)
|
|
27
|
+
- [readOnly](#readonly)
|
|
28
|
+
- [data](#data)
|
|
29
|
+
- [signature](#signature)
|
|
30
|
+
- [Getters](#getters)
|
|
31
|
+
- [toIdentityPublicKey](#toIdentityPublicKey)
|
|
32
|
+
|
|
33
|
+
___
|
|
34
|
+
|
|
35
|
+
### Example
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
const key = new wasm.IdentityPublicKeyInCreationWASM(
|
|
39
|
+
1, 'system', 'master', 'ECDSA_SECP256K1', false, [], []
|
|
40
|
+
)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
___
|
|
44
|
+
|
|
45
|
+
## Fields
|
|
46
|
+
|
|
47
|
+
All fields are readable and writable.
|
|
48
|
+
|
|
49
|
+
### `keyId`
|
|
50
|
+
|
|
51
|
+
Contains id of key in `Number`
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
key.keyId = 1
|
|
55
|
+
|
|
56
|
+
key.keyId // -> Number
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
___
|
|
60
|
+
|
|
61
|
+
### `purpose`
|
|
62
|
+
|
|
63
|
+
Contains purpose enum in `String`
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
key.purpose = 'system'
|
|
67
|
+
|
|
68
|
+
key.purpose // -> String
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
___
|
|
72
|
+
|
|
73
|
+
### `securityLevel`
|
|
74
|
+
|
|
75
|
+
Contains securityLevel enum in `String`
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
key.securityLevel = 'master'
|
|
79
|
+
|
|
80
|
+
key.securityLevel // -> String
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
___
|
|
84
|
+
|
|
85
|
+
### `keyType`
|
|
86
|
+
|
|
87
|
+
Contains keyType enum in `String`
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
key.keyType = 'ECDSA_SECP256K1'
|
|
91
|
+
|
|
92
|
+
key.keyType // -> String
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
___
|
|
96
|
+
|
|
97
|
+
### `readOnly`
|
|
98
|
+
|
|
99
|
+
Contains readOnly flag in `Boolean`
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
key.readOnly = true
|
|
103
|
+
|
|
104
|
+
key.readOnly // -> Boolean
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
___
|
|
108
|
+
|
|
109
|
+
### `data`
|
|
110
|
+
|
|
111
|
+
Contains data in `Uint8Array`
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
key.data = Uint8Array.from([1, 2, 3, 4, 5])
|
|
115
|
+
|
|
116
|
+
key.data // -> Uint8Array
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
___
|
|
120
|
+
|
|
121
|
+
### `signature`
|
|
122
|
+
|
|
123
|
+
Contains signature in `Uint8Array`
|
|
124
|
+
|
|
125
|
+
```js
|
|
126
|
+
key.signature = Uint8Array.from([1, 2, 3, 4, 5])
|
|
127
|
+
|
|
128
|
+
key.signature // -> Uint8Array
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
___
|
|
132
|
+
|
|
133
|
+
## Getters
|
|
134
|
+
|
|
135
|
+
### `toIdentityPublicKey`
|
|
136
|
+
|
|
137
|
+
Allows to get `IdentityPublicKeyWASM`
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
key.toIdentityPublicKey() // -> IdentityPublicKeyWASM
|
|
141
|
+
```
|