@taquito/remote-signer 22.0.0 → 23.0.0-beta.1
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/lib/taquito-remote-signer.js +23 -35
- package/dist/lib/version.js +2 -2
- package/dist/taquito-remote-signer.es6.js +27 -39
- package/dist/taquito-remote-signer.es6.js.map +1 -1
- package/dist/taquito-remote-signer.umd.js +29 -40
- package/dist/taquito-remote-signer.umd.js.map +1 -1
- package/package.json +6 -6
|
@@ -16,32 +16,11 @@ exports.RemoteSigner = exports.VERSION = void 0;
|
|
|
16
16
|
*/
|
|
17
17
|
const http_utils_1 = require("@taquito/http-utils");
|
|
18
18
|
const utils_1 = require("@taquito/utils");
|
|
19
|
-
const blake2b_1 = require("@stablelib/blake2b");
|
|
20
19
|
const typedarray_to_buffer_1 = require("typedarray-to-buffer");
|
|
21
20
|
const errors_1 = require("./errors");
|
|
22
21
|
const core_1 = require("@taquito/core");
|
|
23
22
|
var version_1 = require("./version");
|
|
24
23
|
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
25
|
-
const pref = {
|
|
26
|
-
ed: {
|
|
27
|
-
pk: utils_1.prefix['edpk'],
|
|
28
|
-
sk: utils_1.prefix['edsk'],
|
|
29
|
-
pkh: utils_1.prefix.tz1,
|
|
30
|
-
sig: utils_1.prefix.edsig,
|
|
31
|
-
},
|
|
32
|
-
p2: {
|
|
33
|
-
pk: utils_1.prefix['p2pk'],
|
|
34
|
-
sk: utils_1.prefix['p2sk'],
|
|
35
|
-
pkh: utils_1.prefix.tz3,
|
|
36
|
-
sig: utils_1.prefix.p2sig,
|
|
37
|
-
},
|
|
38
|
-
sp: {
|
|
39
|
-
pk: utils_1.prefix['sppk'],
|
|
40
|
-
sk: utils_1.prefix['spsk'],
|
|
41
|
-
pkh: utils_1.prefix.tz2,
|
|
42
|
-
sig: utils_1.prefix.spsig,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
24
|
class RemoteSigner {
|
|
46
25
|
constructor(pkh, rootUrl, options = {}, http = new http_utils_1.HttpBackend()) {
|
|
47
26
|
this.pkh = pkh;
|
|
@@ -50,7 +29,7 @@ class RemoteSigner {
|
|
|
50
29
|
this.http = http;
|
|
51
30
|
const pkhValidation = (0, utils_1.validateKeyHash)(this.pkh);
|
|
52
31
|
if (pkhValidation !== utils_1.ValidationResult.VALID) {
|
|
53
|
-
throw new core_1.InvalidKeyHashError(this.pkh,
|
|
32
|
+
throw new core_1.InvalidKeyHashError(this.pkh, pkhValidation);
|
|
54
33
|
}
|
|
55
34
|
}
|
|
56
35
|
publicKeyHash() {
|
|
@@ -106,13 +85,24 @@ class RemoteSigner {
|
|
|
106
85
|
method: 'POST',
|
|
107
86
|
headers: this.options.headers,
|
|
108
87
|
}, watermarkedBytes);
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
88
|
+
const [decoded] = (() => {
|
|
89
|
+
try {
|
|
90
|
+
return (0, utils_1.b58DecodeAndCheckPrefix)(signature, [
|
|
91
|
+
utils_1.PrefixV2.GenericSignature,
|
|
92
|
+
utils_1.PrefixV2.Secp256k1Signature,
|
|
93
|
+
utils_1.PrefixV2.Ed25519Signature,
|
|
94
|
+
utils_1.PrefixV2.P256Signature,
|
|
95
|
+
]);
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
if (err instanceof core_1.ParameterValidationError) {
|
|
99
|
+
throw new core_1.InvalidSignatureError(signature, err.result);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
throw err;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
})();
|
|
116
106
|
const pk = yield this.publicKey();
|
|
117
107
|
yield this.verifyPublicKey(pk);
|
|
118
108
|
const signatureVerified = (0, utils_1.verifySignature)(watermarkedBytes, pk, signature);
|
|
@@ -121,7 +111,7 @@ class RemoteSigner {
|
|
|
121
111
|
}
|
|
122
112
|
return {
|
|
123
113
|
bytes,
|
|
124
|
-
sig: (0, utils_1.
|
|
114
|
+
sig: (0, utils_1.b58Encode)(decoded, utils_1.PrefixV2.GenericSignature),
|
|
125
115
|
prefixSig: signature,
|
|
126
116
|
sbytes: bytes + (0, utils_1.buf2hex)((0, typedarray_to_buffer_1.default)(decoded)),
|
|
127
117
|
};
|
|
@@ -144,11 +134,9 @@ class RemoteSigner {
|
|
|
144
134
|
}
|
|
145
135
|
verifyPublicKey(publicKey) {
|
|
146
136
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (publicKeyHash !== this.pkh) {
|
|
151
|
-
throw new errors_1.PublicKeyVerificationError(publicKey, publicKeyHash, this.pkh);
|
|
137
|
+
const pkh = (0, utils_1.getPkhfromPk)(publicKey);
|
|
138
|
+
if (this.pkh !== pkh) {
|
|
139
|
+
throw new errors_1.PublicKeyVerificationError(publicKey, pkh, this.pkh);
|
|
152
140
|
}
|
|
153
141
|
});
|
|
154
142
|
}
|
package/dist/lib/version.js
CHANGED
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
4
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
5
5
|
exports.VERSION = {
|
|
6
|
-
"commitHash": "
|
|
7
|
-
"version": "
|
|
6
|
+
"commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
|
|
7
|
+
"version": "23.0.0-beta.1"
|
|
8
8
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { HttpBackend, HttpResponseError, STATUS_CODE } from '@taquito/http-utils';
|
|
2
|
-
import {
|
|
3
|
-
import { hash } from '@stablelib/blake2b';
|
|
2
|
+
import { validateKeyHash, ValidationResult, hex2buf, mergebuf, buf2hex, b58DecodeAndCheckPrefix, PrefixV2, verifySignature, b58Encode, getPkhfromPk } from '@taquito/utils';
|
|
4
3
|
import toBuffer from 'typedarray-to-buffer';
|
|
5
|
-
import { PermissionDeniedError, TaquitoError, InvalidKeyHashError, PublicKeyNotFoundError, ProhibitedActionError, InvalidSignatureError } from '@taquito/core';
|
|
4
|
+
import { PermissionDeniedError, TaquitoError, InvalidKeyHashError, PublicKeyNotFoundError, ProhibitedActionError, ParameterValidationError, InvalidSignatureError } from '@taquito/core';
|
|
6
5
|
|
|
7
6
|
/******************************************************************************
|
|
8
7
|
Copyright (c) Microsoft Corporation.
|
|
@@ -95,30 +94,10 @@ class SignatureVerificationError extends TaquitoError {
|
|
|
95
94
|
|
|
96
95
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
97
96
|
const VERSION = {
|
|
98
|
-
"commitHash": "
|
|
99
|
-
"version": "
|
|
97
|
+
"commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
|
|
98
|
+
"version": "23.0.0-beta.1"
|
|
100
99
|
};
|
|
101
100
|
|
|
102
|
-
const pref = {
|
|
103
|
-
ed: {
|
|
104
|
-
pk: prefix['edpk'],
|
|
105
|
-
sk: prefix['edsk'],
|
|
106
|
-
pkh: prefix.tz1,
|
|
107
|
-
sig: prefix.edsig,
|
|
108
|
-
},
|
|
109
|
-
p2: {
|
|
110
|
-
pk: prefix['p2pk'],
|
|
111
|
-
sk: prefix['p2sk'],
|
|
112
|
-
pkh: prefix.tz3,
|
|
113
|
-
sig: prefix.p2sig,
|
|
114
|
-
},
|
|
115
|
-
sp: {
|
|
116
|
-
pk: prefix['sppk'],
|
|
117
|
-
sk: prefix['spsk'],
|
|
118
|
-
pkh: prefix.tz2,
|
|
119
|
-
sig: prefix.spsig,
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
101
|
class RemoteSigner {
|
|
123
102
|
constructor(pkh, rootUrl, options = {}, http = new HttpBackend()) {
|
|
124
103
|
this.pkh = pkh;
|
|
@@ -127,7 +106,7 @@ class RemoteSigner {
|
|
|
127
106
|
this.http = http;
|
|
128
107
|
const pkhValidation = validateKeyHash(this.pkh);
|
|
129
108
|
if (pkhValidation !== ValidationResult.VALID) {
|
|
130
|
-
throw new InvalidKeyHashError(this.pkh,
|
|
109
|
+
throw new InvalidKeyHashError(this.pkh, pkhValidation);
|
|
131
110
|
}
|
|
132
111
|
}
|
|
133
112
|
publicKeyHash() {
|
|
@@ -183,13 +162,24 @@ class RemoteSigner {
|
|
|
183
162
|
method: 'POST',
|
|
184
163
|
headers: this.options.headers,
|
|
185
164
|
}, watermarkedBytes);
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
165
|
+
const [decoded] = (() => {
|
|
166
|
+
try {
|
|
167
|
+
return b58DecodeAndCheckPrefix(signature, [
|
|
168
|
+
PrefixV2.GenericSignature,
|
|
169
|
+
PrefixV2.Secp256k1Signature,
|
|
170
|
+
PrefixV2.Ed25519Signature,
|
|
171
|
+
PrefixV2.P256Signature,
|
|
172
|
+
]);
|
|
173
|
+
}
|
|
174
|
+
catch (err) {
|
|
175
|
+
if (err instanceof ParameterValidationError) {
|
|
176
|
+
throw new InvalidSignatureError(signature, err.result);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
throw err;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
})();
|
|
193
183
|
const pk = yield this.publicKey();
|
|
194
184
|
yield this.verifyPublicKey(pk);
|
|
195
185
|
const signatureVerified = verifySignature(watermarkedBytes, pk, signature);
|
|
@@ -198,7 +188,7 @@ class RemoteSigner {
|
|
|
198
188
|
}
|
|
199
189
|
return {
|
|
200
190
|
bytes,
|
|
201
|
-
sig:
|
|
191
|
+
sig: b58Encode(decoded, PrefixV2.GenericSignature),
|
|
202
192
|
prefixSig: signature,
|
|
203
193
|
sbytes: bytes + buf2hex(toBuffer(decoded)),
|
|
204
194
|
};
|
|
@@ -221,11 +211,9 @@ class RemoteSigner {
|
|
|
221
211
|
}
|
|
222
212
|
verifyPublicKey(publicKey) {
|
|
223
213
|
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (publicKeyHash !== this.pkh) {
|
|
228
|
-
throw new PublicKeyVerificationError(publicKey, publicKeyHash, this.pkh);
|
|
214
|
+
const pkh = getPkhfromPk(publicKey);
|
|
215
|
+
if (this.pkh !== pkh) {
|
|
216
|
+
throw new PublicKeyVerificationError(publicKey, pkh, this.pkh);
|
|
229
217
|
}
|
|
230
218
|
});
|
|
231
219
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taquito-remote-signer.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"taquito-remote-signer.es6.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@taquito/http-utils'), require('@taquito/utils'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@taquito/http-utils', '@taquito/utils', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoRemoteSigner = {}, global.httpUtils, global.utils, global.
|
|
5
|
-
})(this, (function (exports, httpUtils, utils,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@taquito/http-utils'), require('@taquito/utils'), require('typedarray-to-buffer'), require('@taquito/core')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@taquito/http-utils', '@taquito/utils', 'typedarray-to-buffer', '@taquito/core'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.taquitoRemoteSigner = {}, global.httpUtils, global.utils, global.toBuffer, global.core));
|
|
5
|
+
})(this, (function (exports, httpUtils, utils, toBuffer, core) { 'use strict';
|
|
6
6
|
|
|
7
7
|
/******************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -95,30 +95,10 @@
|
|
|
95
95
|
|
|
96
96
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
|
|
97
97
|
const VERSION = {
|
|
98
|
-
"commitHash": "
|
|
99
|
-
"version": "
|
|
98
|
+
"commitHash": "10b3de10de15ae68d47b1fca922d3129d2f79641",
|
|
99
|
+
"version": "23.0.0-beta.1"
|
|
100
100
|
};
|
|
101
101
|
|
|
102
|
-
const pref = {
|
|
103
|
-
ed: {
|
|
104
|
-
pk: utils.prefix['edpk'],
|
|
105
|
-
sk: utils.prefix['edsk'],
|
|
106
|
-
pkh: utils.prefix.tz1,
|
|
107
|
-
sig: utils.prefix.edsig,
|
|
108
|
-
},
|
|
109
|
-
p2: {
|
|
110
|
-
pk: utils.prefix['p2pk'],
|
|
111
|
-
sk: utils.prefix['p2sk'],
|
|
112
|
-
pkh: utils.prefix.tz3,
|
|
113
|
-
sig: utils.prefix.p2sig,
|
|
114
|
-
},
|
|
115
|
-
sp: {
|
|
116
|
-
pk: utils.prefix['sppk'],
|
|
117
|
-
sk: utils.prefix['spsk'],
|
|
118
|
-
pkh: utils.prefix.tz2,
|
|
119
|
-
sig: utils.prefix.spsig,
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
102
|
class RemoteSigner {
|
|
123
103
|
constructor(pkh, rootUrl, options = {}, http = new httpUtils.HttpBackend()) {
|
|
124
104
|
this.pkh = pkh;
|
|
@@ -127,7 +107,7 @@
|
|
|
127
107
|
this.http = http;
|
|
128
108
|
const pkhValidation = utils.validateKeyHash(this.pkh);
|
|
129
109
|
if (pkhValidation !== utils.ValidationResult.VALID) {
|
|
130
|
-
throw new core.InvalidKeyHashError(this.pkh,
|
|
110
|
+
throw new core.InvalidKeyHashError(this.pkh, pkhValidation);
|
|
131
111
|
}
|
|
132
112
|
}
|
|
133
113
|
publicKeyHash() {
|
|
@@ -183,13 +163,24 @@
|
|
|
183
163
|
method: 'POST',
|
|
184
164
|
headers: this.options.headers,
|
|
185
165
|
}, watermarkedBytes);
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
166
|
+
const [decoded] = (() => {
|
|
167
|
+
try {
|
|
168
|
+
return utils.b58DecodeAndCheckPrefix(signature, [
|
|
169
|
+
utils.PrefixV2.GenericSignature,
|
|
170
|
+
utils.PrefixV2.Secp256k1Signature,
|
|
171
|
+
utils.PrefixV2.Ed25519Signature,
|
|
172
|
+
utils.PrefixV2.P256Signature,
|
|
173
|
+
]);
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
if (err instanceof core.ParameterValidationError) {
|
|
177
|
+
throw new core.InvalidSignatureError(signature, err.result);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
throw err;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
})();
|
|
193
184
|
const pk = yield this.publicKey();
|
|
194
185
|
yield this.verifyPublicKey(pk);
|
|
195
186
|
const signatureVerified = utils.verifySignature(watermarkedBytes, pk, signature);
|
|
@@ -198,7 +189,7 @@
|
|
|
198
189
|
}
|
|
199
190
|
return {
|
|
200
191
|
bytes,
|
|
201
|
-
sig: utils.
|
|
192
|
+
sig: utils.b58Encode(decoded, utils.PrefixV2.GenericSignature),
|
|
202
193
|
prefixSig: signature,
|
|
203
194
|
sbytes: bytes + utils.buf2hex(toBuffer(decoded)),
|
|
204
195
|
};
|
|
@@ -221,11 +212,9 @@
|
|
|
221
212
|
}
|
|
222
213
|
verifyPublicKey(publicKey) {
|
|
223
214
|
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (publicKeyHash !== this.pkh) {
|
|
228
|
-
throw new PublicKeyVerificationError(publicKey, publicKeyHash, this.pkh);
|
|
215
|
+
const pkh = utils.getPkhfromPk(publicKey);
|
|
216
|
+
if (this.pkh !== pkh) {
|
|
217
|
+
throw new PublicKeyVerificationError(publicKey, pkh, this.pkh);
|
|
229
218
|
}
|
|
230
219
|
});
|
|
231
220
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taquito-remote-signer.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"taquito-remote-signer.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taquito/remote-signer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.0-beta.1",
|
|
4
4
|
"description": "Remote signer provider",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tezos",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@stablelib/blake2b": "^1.0.1",
|
|
64
64
|
"@stablelib/ed25519": "^1.0.3",
|
|
65
|
-
"@taquito/core": "^
|
|
66
|
-
"@taquito/http-utils": "^
|
|
67
|
-
"@taquito/taquito": "^
|
|
68
|
-
"@taquito/utils": "^
|
|
65
|
+
"@taquito/core": "^23.0.0-beta.1",
|
|
66
|
+
"@taquito/http-utils": "^23.0.0-beta.1",
|
|
67
|
+
"@taquito/taquito": "^23.0.0-beta.1",
|
|
68
|
+
"@taquito/utils": "^23.0.0-beta.1",
|
|
69
69
|
"typedarray-to-buffer": "^4.0.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"ts-toolbelt": "^9.6.0",
|
|
97
97
|
"typescript": "~5.5.4"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "1469d6f0d55134a4b853598a2eec48e6f71b3da3"
|
|
100
100
|
}
|