@taquito/remote-signer 24.2.0 → 24.3.0-beta.0
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/errors.js +4 -4
- package/dist/lib/taquito-remote-signer.js +74 -93
- package/dist/lib/version.js +2 -2
- package/dist/taquito-remote-signer.es6.js +84 -122
- package/dist/taquito-remote-signer.es6.js.map +1 -1
- package/dist/taquito-remote-signer.umd.js +180 -218
- package/dist/taquito-remote-signer.umd.js.map +1 -1
- package/dist/types/errors.d.ts +4 -4
- package/package.json +26 -12
- package/LICENSE +0 -202
package/dist/lib/errors.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.SignatureVerificationError = exports.PublicKeyVerificationError = export
|
|
|
4
4
|
const core_1 = require("@taquito/core");
|
|
5
5
|
/**
|
|
6
6
|
* @category Error
|
|
7
|
-
*
|
|
7
|
+
* Error that indicates an unauthorized operation being attempted
|
|
8
8
|
*/
|
|
9
9
|
class OperationNotAuthorizedError extends core_1.PermissionDeniedError {
|
|
10
10
|
constructor(message, cause) {
|
|
@@ -17,7 +17,7 @@ class OperationNotAuthorizedError extends core_1.PermissionDeniedError {
|
|
|
17
17
|
exports.OperationNotAuthorizedError = OperationNotAuthorizedError;
|
|
18
18
|
/**
|
|
19
19
|
* @category Error
|
|
20
|
-
*
|
|
20
|
+
* Error that indicates bad signing data
|
|
21
21
|
*/
|
|
22
22
|
class BadSigningDataError extends core_1.TaquitoError {
|
|
23
23
|
constructor(cause, bytes, watermark) {
|
|
@@ -34,7 +34,7 @@ class BadSigningDataError extends core_1.TaquitoError {
|
|
|
34
34
|
exports.BadSigningDataError = BadSigningDataError;
|
|
35
35
|
/**
|
|
36
36
|
* @category Error
|
|
37
|
-
*
|
|
37
|
+
* Error that indicates a mismatch between the initialized and the requested public key
|
|
38
38
|
*/
|
|
39
39
|
class PublicKeyVerificationError extends core_1.TaquitoError {
|
|
40
40
|
constructor(requestedPk, requestedPkh, initializedPkh) {
|
|
@@ -49,7 +49,7 @@ class PublicKeyVerificationError extends core_1.TaquitoError {
|
|
|
49
49
|
exports.PublicKeyVerificationError = PublicKeyVerificationError;
|
|
50
50
|
/**
|
|
51
51
|
* @category Error
|
|
52
|
-
*
|
|
52
|
+
* Error
|
|
53
53
|
*/
|
|
54
54
|
class SignatureVerificationError extends core_1.TaquitoError {
|
|
55
55
|
constructor(bytes, signature) {
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.RemoteSigner = exports.VERSION = void 0;
|
|
13
4
|
/**
|
|
@@ -32,10 +23,8 @@ class RemoteSigner {
|
|
|
32
23
|
throw new core_1.InvalidKeyHashError(this.pkh, pkhValidation);
|
|
33
24
|
}
|
|
34
25
|
}
|
|
35
|
-
publicKeyHash() {
|
|
36
|
-
return
|
|
37
|
-
return this.pkh;
|
|
38
|
-
});
|
|
26
|
+
async publicKeyHash() {
|
|
27
|
+
return this.pkh;
|
|
39
28
|
}
|
|
40
29
|
createURL(path) {
|
|
41
30
|
// Trim trailing slashes because it is assumed to be included in path
|
|
@@ -47,98 +36,90 @@ class RemoteSigner {
|
|
|
47
36
|
}
|
|
48
37
|
return `${rootUrl}${path}`;
|
|
49
38
|
}
|
|
50
|
-
publicKey() {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (ex
|
|
62
|
-
|
|
63
|
-
throw new core_1.PublicKeyNotFoundError(this.pkh, ex);
|
|
64
|
-
}
|
|
39
|
+
async publicKey() {
|
|
40
|
+
try {
|
|
41
|
+
const { public_key } = await this.http.createRequest({
|
|
42
|
+
url: this.createURL(`/keys/${this.pkh}`),
|
|
43
|
+
method: 'GET',
|
|
44
|
+
headers: this.options.headers,
|
|
45
|
+
});
|
|
46
|
+
return public_key;
|
|
47
|
+
}
|
|
48
|
+
catch (ex) {
|
|
49
|
+
if (ex instanceof http_utils_1.HttpResponseError) {
|
|
50
|
+
if (ex.status === http_utils_1.STATUS_CODE.NOT_FOUND) {
|
|
51
|
+
throw new core_1.PublicKeyNotFoundError(this.pkh, ex);
|
|
65
52
|
}
|
|
66
|
-
throw ex;
|
|
67
53
|
}
|
|
68
|
-
|
|
54
|
+
throw ex;
|
|
55
|
+
}
|
|
69
56
|
}
|
|
70
|
-
secretKey() {
|
|
71
|
-
|
|
72
|
-
throw new core_1.ProhibitedActionError('Secret key cannot be exposed');
|
|
73
|
-
});
|
|
57
|
+
async secretKey() {
|
|
58
|
+
throw new core_1.ProhibitedActionError('Secret key cannot be exposed');
|
|
74
59
|
}
|
|
75
|
-
sign(bytes, watermark) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
60
|
+
async sign(bytes, watermark) {
|
|
61
|
+
try {
|
|
62
|
+
let bb = (0, utils_1.hex2buf)(bytes);
|
|
63
|
+
if (typeof watermark !== 'undefined') {
|
|
64
|
+
bb = (0, utils_1.mergebuf)(watermark, bb);
|
|
65
|
+
}
|
|
66
|
+
const watermarkedBytes = (0, utils_1.buf2hex)((0, typedarray_to_buffer_1.default)(bb));
|
|
67
|
+
const { signature } = await this.http.createRequest({
|
|
68
|
+
url: this.createURL(`/keys/${this.pkh}`),
|
|
69
|
+
method: 'POST',
|
|
70
|
+
headers: this.options.headers,
|
|
71
|
+
}, watermarkedBytes);
|
|
72
|
+
const [decoded] = (() => {
|
|
73
|
+
try {
|
|
74
|
+
return (0, utils_1.b58DecodeAndCheckPrefix)(signature, [
|
|
75
|
+
utils_1.PrefixV2.GenericSignature,
|
|
76
|
+
utils_1.PrefixV2.Secp256k1Signature,
|
|
77
|
+
utils_1.PrefixV2.Ed25519Signature,
|
|
78
|
+
utils_1.PrefixV2.P256Signature,
|
|
79
|
+
]);
|
|
81
80
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
method: 'POST',
|
|
86
|
-
headers: this.options.headers,
|
|
87
|
-
}, watermarkedBytes);
|
|
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
|
-
]);
|
|
81
|
+
catch (err) {
|
|
82
|
+
if (err instanceof core_1.ParameterValidationError) {
|
|
83
|
+
throw new core_1.InvalidSignatureError(signature, err.result);
|
|
96
84
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
throw new core_1.InvalidSignatureError(signature, err.result);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
throw err;
|
|
103
|
-
}
|
|
85
|
+
else {
|
|
86
|
+
throw err;
|
|
104
87
|
}
|
|
105
|
-
})();
|
|
106
|
-
const pk = yield this.publicKey();
|
|
107
|
-
yield this.verifyPublicKey(pk);
|
|
108
|
-
const signatureVerified = (0, utils_1.verifySignature)(watermarkedBytes, pk, signature);
|
|
109
|
-
if (!signatureVerified) {
|
|
110
|
-
throw new errors_1.SignatureVerificationError(watermarkedBytes, signature);
|
|
111
88
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
89
|
+
})();
|
|
90
|
+
const pk = await this.publicKey();
|
|
91
|
+
await this.verifyPublicKey(pk);
|
|
92
|
+
const signatureVerified = (0, utils_1.verifySignature)(watermarkedBytes, pk, signature);
|
|
93
|
+
if (!signatureVerified) {
|
|
94
|
+
throw new errors_1.SignatureVerificationError(watermarkedBytes, signature);
|
|
118
95
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
96
|
+
return {
|
|
97
|
+
bytes,
|
|
98
|
+
sig: (0, utils_1.b58Encode)(decoded, utils_1.PrefixV2.GenericSignature),
|
|
99
|
+
prefixSig: signature,
|
|
100
|
+
sbytes: bytes + (0, utils_1.buf2hex)((0, typedarray_to_buffer_1.default)(decoded)),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
catch (ex) {
|
|
104
|
+
if (ex instanceof http_utils_1.HttpResponseError) {
|
|
105
|
+
if (ex.status === http_utils_1.STATUS_CODE.NOT_FOUND) {
|
|
106
|
+
throw new core_1.PublicKeyNotFoundError(this.pkh, ex);
|
|
107
|
+
}
|
|
108
|
+
else if (ex.status === http_utils_1.STATUS_CODE.FORBIDDEN) {
|
|
109
|
+
throw new errors_1.OperationNotAuthorizedError('Signing Operation not authorized', ex);
|
|
110
|
+
}
|
|
111
|
+
else if (ex.status === http_utils_1.STATUS_CODE.BAD_REQUEST) {
|
|
112
|
+
throw new errors_1.BadSigningDataError(ex, bytes, watermark);
|
|
130
113
|
}
|
|
131
|
-
throw ex;
|
|
132
114
|
}
|
|
133
|
-
|
|
115
|
+
throw ex;
|
|
116
|
+
}
|
|
134
117
|
}
|
|
135
|
-
verifyPublicKey(publicKey) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
});
|
|
118
|
+
async verifyPublicKey(publicKey) {
|
|
119
|
+
const pkh = (0, utils_1.getPkhfromPk)(publicKey);
|
|
120
|
+
if (this.pkh !== pkh) {
|
|
121
|
+
throw new errors_1.PublicKeyVerificationError(publicKey, pkh, this.pkh);
|
|
122
|
+
}
|
|
142
123
|
}
|
|
143
124
|
}
|
|
144
125
|
exports.RemoteSigner = RemoteSigner;
|
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!
|
|
5
5
|
exports.VERSION = {
|
|
6
|
-
"commitHash": "
|
|
7
|
-
"version": "24.
|
|
6
|
+
"commitHash": "27675679db6515e8b092195ef5c58c2c0ea5f5c8",
|
|
7
|
+
"version": "24.3.0-beta.0"
|
|
8
8
|
};
|
|
@@ -3,41 +3,9 @@ import { validateKeyHash, ValidationResult, hex2buf, mergebuf, buf2hex, b58Decod
|
|
|
3
3
|
import toBuffer from 'typedarray-to-buffer';
|
|
4
4
|
import { TaquitoError, PermissionDeniedError, InvalidKeyHashError, PublicKeyNotFoundError, ProhibitedActionError, ParameterValidationError, InvalidSignatureError } from '@taquito/core';
|
|
5
5
|
|
|
6
|
-
/******************************************************************************
|
|
7
|
-
Copyright (c) Microsoft Corporation.
|
|
8
|
-
|
|
9
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
10
|
-
purpose with or without fee is hereby granted.
|
|
11
|
-
|
|
12
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
13
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
14
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
15
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
16
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
17
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
19
|
-
***************************************************************************** */
|
|
20
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
24
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
26
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
27
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
28
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
29
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
34
|
-
var e = new Error(message);
|
|
35
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
6
|
/**
|
|
39
7
|
* @category Error
|
|
40
|
-
*
|
|
8
|
+
* Error that indicates an unauthorized operation being attempted
|
|
41
9
|
*/
|
|
42
10
|
class OperationNotAuthorizedError extends PermissionDeniedError {
|
|
43
11
|
constructor(message, cause) {
|
|
@@ -49,7 +17,7 @@ class OperationNotAuthorizedError extends PermissionDeniedError {
|
|
|
49
17
|
}
|
|
50
18
|
/**
|
|
51
19
|
* @category Error
|
|
52
|
-
*
|
|
20
|
+
* Error that indicates bad signing data
|
|
53
21
|
*/
|
|
54
22
|
class BadSigningDataError extends TaquitoError {
|
|
55
23
|
constructor(cause, bytes, watermark) {
|
|
@@ -65,7 +33,7 @@ class BadSigningDataError extends TaquitoError {
|
|
|
65
33
|
}
|
|
66
34
|
/**
|
|
67
35
|
* @category Error
|
|
68
|
-
*
|
|
36
|
+
* Error that indicates a mismatch between the initialized and the requested public key
|
|
69
37
|
*/
|
|
70
38
|
class PublicKeyVerificationError extends TaquitoError {
|
|
71
39
|
constructor(requestedPk, requestedPkh, initializedPkh) {
|
|
@@ -79,7 +47,7 @@ class PublicKeyVerificationError extends TaquitoError {
|
|
|
79
47
|
}
|
|
80
48
|
/**
|
|
81
49
|
* @category Error
|
|
82
|
-
*
|
|
50
|
+
* Error
|
|
83
51
|
*/
|
|
84
52
|
class SignatureVerificationError extends TaquitoError {
|
|
85
53
|
constructor(bytes, signature) {
|
|
@@ -94,10 +62,14 @@ class SignatureVerificationError extends TaquitoError {
|
|
|
94
62
|
|
|
95
63
|
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT!
|
|
96
64
|
const VERSION = {
|
|
97
|
-
"commitHash": "
|
|
98
|
-
"version": "24.
|
|
65
|
+
"commitHash": "27675679db6515e8b092195ef5c58c2c0ea5f5c8",
|
|
66
|
+
"version": "24.3.0-beta.0"
|
|
99
67
|
};
|
|
100
68
|
|
|
69
|
+
/**
|
|
70
|
+
* @packageDocumentation
|
|
71
|
+
* @module @taquito/remote-signer
|
|
72
|
+
*/
|
|
101
73
|
class RemoteSigner {
|
|
102
74
|
constructor(pkh, rootUrl, options = {}, http = new HttpBackend()) {
|
|
103
75
|
this.pkh = pkh;
|
|
@@ -109,10 +81,8 @@ class RemoteSigner {
|
|
|
109
81
|
throw new InvalidKeyHashError(this.pkh, pkhValidation);
|
|
110
82
|
}
|
|
111
83
|
}
|
|
112
|
-
publicKeyHash() {
|
|
113
|
-
return
|
|
114
|
-
return this.pkh;
|
|
115
|
-
});
|
|
84
|
+
async publicKeyHash() {
|
|
85
|
+
return this.pkh;
|
|
116
86
|
}
|
|
117
87
|
createURL(path) {
|
|
118
88
|
// Trim trailing slashes because it is assumed to be included in path
|
|
@@ -124,98 +94,90 @@ class RemoteSigner {
|
|
|
124
94
|
}
|
|
125
95
|
return `${rootUrl}${path}`;
|
|
126
96
|
}
|
|
127
|
-
publicKey() {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (ex
|
|
139
|
-
|
|
140
|
-
throw new PublicKeyNotFoundError(this.pkh, ex);
|
|
141
|
-
}
|
|
97
|
+
async publicKey() {
|
|
98
|
+
try {
|
|
99
|
+
const { public_key } = await this.http.createRequest({
|
|
100
|
+
url: this.createURL(`/keys/${this.pkh}`),
|
|
101
|
+
method: 'GET',
|
|
102
|
+
headers: this.options.headers,
|
|
103
|
+
});
|
|
104
|
+
return public_key;
|
|
105
|
+
}
|
|
106
|
+
catch (ex) {
|
|
107
|
+
if (ex instanceof HttpResponseError) {
|
|
108
|
+
if (ex.status === STATUS_CODE.NOT_FOUND) {
|
|
109
|
+
throw new PublicKeyNotFoundError(this.pkh, ex);
|
|
142
110
|
}
|
|
143
|
-
throw ex;
|
|
144
111
|
}
|
|
145
|
-
|
|
112
|
+
throw ex;
|
|
113
|
+
}
|
|
146
114
|
}
|
|
147
|
-
secretKey() {
|
|
148
|
-
|
|
149
|
-
throw new ProhibitedActionError('Secret key cannot be exposed');
|
|
150
|
-
});
|
|
115
|
+
async secretKey() {
|
|
116
|
+
throw new ProhibitedActionError('Secret key cannot be exposed');
|
|
151
117
|
}
|
|
152
|
-
sign(bytes, watermark) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
118
|
+
async sign(bytes, watermark) {
|
|
119
|
+
try {
|
|
120
|
+
let bb = hex2buf(bytes);
|
|
121
|
+
if (typeof watermark !== 'undefined') {
|
|
122
|
+
bb = mergebuf(watermark, bb);
|
|
123
|
+
}
|
|
124
|
+
const watermarkedBytes = buf2hex(toBuffer(bb));
|
|
125
|
+
const { signature } = await this.http.createRequest({
|
|
126
|
+
url: this.createURL(`/keys/${this.pkh}`),
|
|
127
|
+
method: 'POST',
|
|
128
|
+
headers: this.options.headers,
|
|
129
|
+
}, watermarkedBytes);
|
|
130
|
+
const [decoded] = (() => {
|
|
131
|
+
try {
|
|
132
|
+
return b58DecodeAndCheckPrefix(signature, [
|
|
133
|
+
PrefixV2.GenericSignature,
|
|
134
|
+
PrefixV2.Secp256k1Signature,
|
|
135
|
+
PrefixV2.Ed25519Signature,
|
|
136
|
+
PrefixV2.P256Signature,
|
|
137
|
+
]);
|
|
158
138
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
method: 'POST',
|
|
163
|
-
headers: this.options.headers,
|
|
164
|
-
}, watermarkedBytes);
|
|
165
|
-
const [decoded] = (() => {
|
|
166
|
-
try {
|
|
167
|
-
return b58DecodeAndCheckPrefix(signature, [
|
|
168
|
-
PrefixV2.GenericSignature,
|
|
169
|
-
PrefixV2.Secp256k1Signature,
|
|
170
|
-
PrefixV2.Ed25519Signature,
|
|
171
|
-
PrefixV2.P256Signature,
|
|
172
|
-
]);
|
|
139
|
+
catch (err) {
|
|
140
|
+
if (err instanceof ParameterValidationError) {
|
|
141
|
+
throw new InvalidSignatureError(signature, err.result);
|
|
173
142
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
throw new InvalidSignatureError(signature, err.result);
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
throw err;
|
|
180
|
-
}
|
|
143
|
+
else {
|
|
144
|
+
throw err;
|
|
181
145
|
}
|
|
182
|
-
})();
|
|
183
|
-
const pk = yield this.publicKey();
|
|
184
|
-
yield this.verifyPublicKey(pk);
|
|
185
|
-
const signatureVerified = verifySignature(watermarkedBytes, pk, signature);
|
|
186
|
-
if (!signatureVerified) {
|
|
187
|
-
throw new SignatureVerificationError(watermarkedBytes, signature);
|
|
188
146
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
147
|
+
})();
|
|
148
|
+
const pk = await this.publicKey();
|
|
149
|
+
await this.verifyPublicKey(pk);
|
|
150
|
+
const signatureVerified = verifySignature(watermarkedBytes, pk, signature);
|
|
151
|
+
if (!signatureVerified) {
|
|
152
|
+
throw new SignatureVerificationError(watermarkedBytes, signature);
|
|
195
153
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
154
|
+
return {
|
|
155
|
+
bytes,
|
|
156
|
+
sig: b58Encode(decoded, PrefixV2.GenericSignature),
|
|
157
|
+
prefixSig: signature,
|
|
158
|
+
sbytes: bytes + buf2hex(toBuffer(decoded)),
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
catch (ex) {
|
|
162
|
+
if (ex instanceof HttpResponseError) {
|
|
163
|
+
if (ex.status === STATUS_CODE.NOT_FOUND) {
|
|
164
|
+
throw new PublicKeyNotFoundError(this.pkh, ex);
|
|
165
|
+
}
|
|
166
|
+
else if (ex.status === STATUS_CODE.FORBIDDEN) {
|
|
167
|
+
throw new OperationNotAuthorizedError('Signing Operation not authorized', ex);
|
|
168
|
+
}
|
|
169
|
+
else if (ex.status === STATUS_CODE.BAD_REQUEST) {
|
|
170
|
+
throw new BadSigningDataError(ex, bytes, watermark);
|
|
207
171
|
}
|
|
208
|
-
throw ex;
|
|
209
172
|
}
|
|
210
|
-
|
|
173
|
+
throw ex;
|
|
174
|
+
}
|
|
211
175
|
}
|
|
212
|
-
verifyPublicKey(publicKey) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
});
|
|
176
|
+
async verifyPublicKey(publicKey) {
|
|
177
|
+
const pkh = getPkhfromPk(publicKey);
|
|
178
|
+
if (this.pkh !== pkh) {
|
|
179
|
+
throw new PublicKeyVerificationError(publicKey, pkh, this.pkh);
|
|
180
|
+
}
|
|
219
181
|
}
|
|
220
182
|
}
|
|
221
183
|
|
|
@@ -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,227 +1,189 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
5
|
})(this, (function (exports, httpUtils, utils, toBuffer, core) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @category Error
|
|
9
|
+
* Error that indicates an unauthorized operation being attempted
|
|
10
|
+
*/
|
|
11
|
+
class OperationNotAuthorizedError extends core.PermissionDeniedError {
|
|
12
|
+
constructor(message, cause) {
|
|
13
|
+
super();
|
|
14
|
+
this.message = message;
|
|
15
|
+
this.cause = cause;
|
|
16
|
+
this.name = 'OperationNotAuthorized';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @category Error
|
|
21
|
+
* Error that indicates bad signing data
|
|
22
|
+
*/
|
|
23
|
+
class BadSigningDataError extends core.TaquitoError {
|
|
24
|
+
constructor(cause, bytes, watermark) {
|
|
25
|
+
super();
|
|
26
|
+
this.cause = cause;
|
|
27
|
+
this.bytes = bytes;
|
|
28
|
+
this.watermark = watermark;
|
|
29
|
+
this.name = 'BadSigningData';
|
|
30
|
+
this.message = watermark
|
|
31
|
+
? `Invalid signing data with watermark`
|
|
32
|
+
: `Invalid signing data: "${bytes}"`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @category Error
|
|
37
|
+
* Error that indicates a mismatch between the initialized and the requested public key
|
|
38
|
+
*/
|
|
39
|
+
class PublicKeyVerificationError extends core.TaquitoError {
|
|
40
|
+
constructor(requestedPk, requestedPkh, initializedPkh) {
|
|
41
|
+
super();
|
|
42
|
+
this.requestedPk = requestedPk;
|
|
43
|
+
this.requestedPkh = requestedPkh;
|
|
44
|
+
this.initializedPkh = initializedPkh;
|
|
45
|
+
this.name = 'PublicKeyVerificationFailedError';
|
|
46
|
+
this.message = `Requested pk "${requestedPk}" has pkh "${requestedPkh}" deesn't match initialized pkh "${initializedPkh}."`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @category Error
|
|
51
|
+
* Error
|
|
52
|
+
*/
|
|
53
|
+
class SignatureVerificationError extends core.TaquitoError {
|
|
54
|
+
constructor(bytes, signature) {
|
|
55
|
+
super();
|
|
56
|
+
this.bytes = bytes;
|
|
57
|
+
this.signature = signature;
|
|
58
|
+
this.name = 'SignatureVerificationFailedError';
|
|
59
|
+
this.name = 'SignatureVerificationFailedError';
|
|
60
|
+
this.message = `Invalid signature of bytes failed verification agaisnt public key.`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
38
63
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
constructor(message, cause) {
|
|
45
|
-
super();
|
|
46
|
-
this.message = message;
|
|
47
|
-
this.cause = cause;
|
|
48
|
-
this.name = 'OperationNotAuthorized';
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* @category Error
|
|
53
|
-
* @description Error that indicates bad signing data
|
|
54
|
-
*/
|
|
55
|
-
class BadSigningDataError extends core.TaquitoError {
|
|
56
|
-
constructor(cause, bytes, watermark) {
|
|
57
|
-
super();
|
|
58
|
-
this.cause = cause;
|
|
59
|
-
this.bytes = bytes;
|
|
60
|
-
this.watermark = watermark;
|
|
61
|
-
this.name = 'BadSigningData';
|
|
62
|
-
this.message = watermark
|
|
63
|
-
? `Invalid signing data with watermark`
|
|
64
|
-
: `Invalid signing data: "${bytes}"`;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* @category Error
|
|
69
|
-
* @description Error that indicates a mismatch between the initialized and the requested public key
|
|
70
|
-
*/
|
|
71
|
-
class PublicKeyVerificationError extends core.TaquitoError {
|
|
72
|
-
constructor(requestedPk, requestedPkh, initializedPkh) {
|
|
73
|
-
super();
|
|
74
|
-
this.requestedPk = requestedPk;
|
|
75
|
-
this.requestedPkh = requestedPkh;
|
|
76
|
-
this.initializedPkh = initializedPkh;
|
|
77
|
-
this.name = 'PublicKeyVerificationFailedError';
|
|
78
|
-
this.message = `Requested pk "${requestedPk}" has pkh "${requestedPkh}" deesn't match initialized pkh "${initializedPkh}."`;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* @category Error
|
|
83
|
-
* @description Error
|
|
84
|
-
*/
|
|
85
|
-
class SignatureVerificationError extends core.TaquitoError {
|
|
86
|
-
constructor(bytes, signature) {
|
|
87
|
-
super();
|
|
88
|
-
this.bytes = bytes;
|
|
89
|
-
this.signature = signature;
|
|
90
|
-
this.name = 'SignatureVerificationFailedError';
|
|
91
|
-
this.name = 'SignatureVerificationFailedError';
|
|
92
|
-
this.message = `Invalid signature of bytes failed verification agaisnt public key.`;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
64
|
+
// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT!
|
|
65
|
+
const VERSION = {
|
|
66
|
+
"commitHash": "27675679db6515e8b092195ef5c58c2c0ea5f5c8",
|
|
67
|
+
"version": "24.3.0-beta.0"
|
|
68
|
+
};
|
|
95
69
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
70
|
+
/**
|
|
71
|
+
* @packageDocumentation
|
|
72
|
+
* @module @taquito/remote-signer
|
|
73
|
+
*/
|
|
74
|
+
class RemoteSigner {
|
|
75
|
+
constructor(pkh, rootUrl, options = {}, http = new httpUtils.HttpBackend()) {
|
|
76
|
+
this.pkh = pkh;
|
|
77
|
+
this.rootUrl = rootUrl;
|
|
78
|
+
this.options = options;
|
|
79
|
+
this.http = http;
|
|
80
|
+
const pkhValidation = utils.validateKeyHash(this.pkh);
|
|
81
|
+
if (pkhValidation !== utils.ValidationResult.VALID) {
|
|
82
|
+
throw new core.InvalidKeyHashError(this.pkh, pkhValidation);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async publicKeyHash() {
|
|
86
|
+
return this.pkh;
|
|
87
|
+
}
|
|
88
|
+
createURL(path) {
|
|
89
|
+
// Trim trailing slashes because it is assumed to be included in path
|
|
90
|
+
// the regex solution is prone to ReDoS. Please see: https://stackoverflow.com/questions/6680825/return-string-without-trailing-slash#comment124306698_6680877
|
|
91
|
+
// We also got a CodeQL error for the regex based solution
|
|
92
|
+
let rootUrl = this.rootUrl;
|
|
93
|
+
while (rootUrl.endsWith('/')) {
|
|
94
|
+
rootUrl = rootUrl.slice(0, -1);
|
|
95
|
+
}
|
|
96
|
+
return `${rootUrl}${path}`;
|
|
97
|
+
}
|
|
98
|
+
async publicKey() {
|
|
99
|
+
try {
|
|
100
|
+
const { public_key } = await this.http.createRequest({
|
|
101
|
+
url: this.createURL(`/keys/${this.pkh}`),
|
|
102
|
+
method: 'GET',
|
|
103
|
+
headers: this.options.headers,
|
|
104
|
+
});
|
|
105
|
+
return public_key;
|
|
106
|
+
}
|
|
107
|
+
catch (ex) {
|
|
108
|
+
if (ex instanceof httpUtils.HttpResponseError) {
|
|
109
|
+
if (ex.status === httpUtils.STATUS_CODE.NOT_FOUND) {
|
|
110
|
+
throw new core.PublicKeyNotFoundError(this.pkh, ex);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
throw ex;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async secretKey() {
|
|
117
|
+
throw new core.ProhibitedActionError('Secret key cannot be exposed');
|
|
118
|
+
}
|
|
119
|
+
async sign(bytes, watermark) {
|
|
120
|
+
try {
|
|
121
|
+
let bb = utils.hex2buf(bytes);
|
|
122
|
+
if (typeof watermark !== 'undefined') {
|
|
123
|
+
bb = utils.mergebuf(watermark, bb);
|
|
124
|
+
}
|
|
125
|
+
const watermarkedBytes = utils.buf2hex(toBuffer(bb));
|
|
126
|
+
const { signature } = await this.http.createRequest({
|
|
127
|
+
url: this.createURL(`/keys/${this.pkh}`),
|
|
128
|
+
method: 'POST',
|
|
129
|
+
headers: this.options.headers,
|
|
130
|
+
}, watermarkedBytes);
|
|
131
|
+
const [decoded] = (() => {
|
|
132
|
+
try {
|
|
133
|
+
return utils.b58DecodeAndCheckPrefix(signature, [
|
|
134
|
+
utils.PrefixV2.GenericSignature,
|
|
135
|
+
utils.PrefixV2.Secp256k1Signature,
|
|
136
|
+
utils.PrefixV2.Ed25519Signature,
|
|
137
|
+
utils.PrefixV2.P256Signature,
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
if (err instanceof core.ParameterValidationError) {
|
|
142
|
+
throw new core.InvalidSignatureError(signature, err.result);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
throw err;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
})();
|
|
149
|
+
const pk = await this.publicKey();
|
|
150
|
+
await this.verifyPublicKey(pk);
|
|
151
|
+
const signatureVerified = utils.verifySignature(watermarkedBytes, pk, signature);
|
|
152
|
+
if (!signatureVerified) {
|
|
153
|
+
throw new SignatureVerificationError(watermarkedBytes, signature);
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
bytes,
|
|
157
|
+
sig: utils.b58Encode(decoded, utils.PrefixV2.GenericSignature),
|
|
158
|
+
prefixSig: signature,
|
|
159
|
+
sbytes: bytes + utils.buf2hex(toBuffer(decoded)),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
catch (ex) {
|
|
163
|
+
if (ex instanceof httpUtils.HttpResponseError) {
|
|
164
|
+
if (ex.status === httpUtils.STATUS_CODE.NOT_FOUND) {
|
|
165
|
+
throw new core.PublicKeyNotFoundError(this.pkh, ex);
|
|
166
|
+
}
|
|
167
|
+
else if (ex.status === httpUtils.STATUS_CODE.FORBIDDEN) {
|
|
168
|
+
throw new OperationNotAuthorizedError('Signing Operation not authorized', ex);
|
|
169
|
+
}
|
|
170
|
+
else if (ex.status === httpUtils.STATUS_CODE.BAD_REQUEST) {
|
|
171
|
+
throw new BadSigningDataError(ex, bytes, watermark);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
throw ex;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
async verifyPublicKey(publicKey) {
|
|
178
|
+
const pkh = utils.getPkhfromPk(publicKey);
|
|
179
|
+
if (this.pkh !== pkh) {
|
|
180
|
+
throw new PublicKeyVerificationError(publicKey, pkh, this.pkh);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
101
184
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.pkh = pkh;
|
|
105
|
-
this.rootUrl = rootUrl;
|
|
106
|
-
this.options = options;
|
|
107
|
-
this.http = http;
|
|
108
|
-
const pkhValidation = utils.validateKeyHash(this.pkh);
|
|
109
|
-
if (pkhValidation !== utils.ValidationResult.VALID) {
|
|
110
|
-
throw new core.InvalidKeyHashError(this.pkh, pkhValidation);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
publicKeyHash() {
|
|
114
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
return this.pkh;
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
createURL(path) {
|
|
119
|
-
// Trim trailing slashes because it is assumed to be included in path
|
|
120
|
-
// the regex solution is prone to ReDoS. Please see: https://stackoverflow.com/questions/6680825/return-string-without-trailing-slash#comment124306698_6680877
|
|
121
|
-
// We also got a CodeQL error for the regex based solution
|
|
122
|
-
let rootUrl = this.rootUrl;
|
|
123
|
-
while (rootUrl.endsWith('/')) {
|
|
124
|
-
rootUrl = rootUrl.slice(0, -1);
|
|
125
|
-
}
|
|
126
|
-
return `${rootUrl}${path}`;
|
|
127
|
-
}
|
|
128
|
-
publicKey() {
|
|
129
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
try {
|
|
131
|
-
const { public_key } = yield this.http.createRequest({
|
|
132
|
-
url: this.createURL(`/keys/${this.pkh}`),
|
|
133
|
-
method: 'GET',
|
|
134
|
-
headers: this.options.headers,
|
|
135
|
-
});
|
|
136
|
-
return public_key;
|
|
137
|
-
}
|
|
138
|
-
catch (ex) {
|
|
139
|
-
if (ex instanceof httpUtils.HttpResponseError) {
|
|
140
|
-
if (ex.status === httpUtils.STATUS_CODE.NOT_FOUND) {
|
|
141
|
-
throw new core.PublicKeyNotFoundError(this.pkh, ex);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
throw ex;
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
secretKey() {
|
|
149
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
throw new core.ProhibitedActionError('Secret key cannot be exposed');
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
sign(bytes, watermark) {
|
|
154
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
-
try {
|
|
156
|
-
let bb = utils.hex2buf(bytes);
|
|
157
|
-
if (typeof watermark !== 'undefined') {
|
|
158
|
-
bb = utils.mergebuf(watermark, bb);
|
|
159
|
-
}
|
|
160
|
-
const watermarkedBytes = utils.buf2hex(toBuffer(bb));
|
|
161
|
-
const { signature } = yield this.http.createRequest({
|
|
162
|
-
url: this.createURL(`/keys/${this.pkh}`),
|
|
163
|
-
method: 'POST',
|
|
164
|
-
headers: this.options.headers,
|
|
165
|
-
}, watermarkedBytes);
|
|
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
|
-
})();
|
|
184
|
-
const pk = yield this.publicKey();
|
|
185
|
-
yield this.verifyPublicKey(pk);
|
|
186
|
-
const signatureVerified = utils.verifySignature(watermarkedBytes, pk, signature);
|
|
187
|
-
if (!signatureVerified) {
|
|
188
|
-
throw new SignatureVerificationError(watermarkedBytes, signature);
|
|
189
|
-
}
|
|
190
|
-
return {
|
|
191
|
-
bytes,
|
|
192
|
-
sig: utils.b58Encode(decoded, utils.PrefixV2.GenericSignature),
|
|
193
|
-
prefixSig: signature,
|
|
194
|
-
sbytes: bytes + utils.buf2hex(toBuffer(decoded)),
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
catch (ex) {
|
|
198
|
-
if (ex instanceof httpUtils.HttpResponseError) {
|
|
199
|
-
if (ex.status === httpUtils.STATUS_CODE.NOT_FOUND) {
|
|
200
|
-
throw new core.PublicKeyNotFoundError(this.pkh, ex);
|
|
201
|
-
}
|
|
202
|
-
else if (ex.status === httpUtils.STATUS_CODE.FORBIDDEN) {
|
|
203
|
-
throw new OperationNotAuthorizedError('Signing Operation not authorized', ex);
|
|
204
|
-
}
|
|
205
|
-
else if (ex.status === httpUtils.STATUS_CODE.BAD_REQUEST) {
|
|
206
|
-
throw new BadSigningDataError(ex, bytes, watermark);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
throw ex;
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
verifyPublicKey(publicKey) {
|
|
214
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
-
const pkh = utils.getPkhfromPk(publicKey);
|
|
216
|
-
if (this.pkh !== pkh) {
|
|
217
|
-
throw new PublicKeyVerificationError(publicKey, pkh, this.pkh);
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
exports.RemoteSigner = RemoteSigner;
|
|
224
|
-
exports.VERSION = VERSION;
|
|
185
|
+
exports.RemoteSigner = RemoteSigner;
|
|
186
|
+
exports.VERSION = VERSION;
|
|
225
187
|
|
|
226
188
|
}));
|
|
227
189
|
//# sourceMappingURL=taquito-remote-signer.umd.js.map
|
|
@@ -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/dist/types/errors.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PermissionDeniedError, TaquitoError } from '@taquito/core';
|
|
2
2
|
/**
|
|
3
3
|
* @category Error
|
|
4
|
-
*
|
|
4
|
+
* Error that indicates an unauthorized operation being attempted
|
|
5
5
|
*/
|
|
6
6
|
export declare class OperationNotAuthorizedError extends PermissionDeniedError {
|
|
7
7
|
readonly message: string;
|
|
@@ -10,7 +10,7 @@ export declare class OperationNotAuthorizedError extends PermissionDeniedError {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* @category Error
|
|
13
|
-
*
|
|
13
|
+
* Error that indicates bad signing data
|
|
14
14
|
*/
|
|
15
15
|
export declare class BadSigningDataError extends TaquitoError {
|
|
16
16
|
readonly cause: any;
|
|
@@ -20,7 +20,7 @@ export declare class BadSigningDataError extends TaquitoError {
|
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* @category Error
|
|
23
|
-
*
|
|
23
|
+
* Error that indicates a mismatch between the initialized and the requested public key
|
|
24
24
|
*/
|
|
25
25
|
export declare class PublicKeyVerificationError extends TaquitoError {
|
|
26
26
|
readonly requestedPk: string;
|
|
@@ -30,7 +30,7 @@ export declare class PublicKeyVerificationError extends TaquitoError {
|
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* @category Error
|
|
33
|
-
*
|
|
33
|
+
* Error
|
|
34
34
|
*/
|
|
35
35
|
export declare class SignatureVerificationError extends TaquitoError {
|
|
36
36
|
readonly bytes: string;
|
package/package.json
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taquito/remote-signer",
|
|
3
|
-
"version": "24.
|
|
4
|
-
"description": "Remote signer
|
|
3
|
+
"version": "24.3.0-beta.0",
|
|
4
|
+
"description": "Remote signer client for Taquito, designed to work with services such as Signatory.",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"taquito",
|
|
6
7
|
"tezos",
|
|
7
|
-
"
|
|
8
|
+
"typescript",
|
|
9
|
+
"blockchain",
|
|
10
|
+
"signer",
|
|
11
|
+
"remote-signer"
|
|
8
12
|
],
|
|
9
13
|
"main": "dist/taquito-remote-signer.umd.js",
|
|
10
14
|
"module": "dist/taquito-remote-signer.es6.js",
|
|
@@ -16,14 +20,24 @@
|
|
|
16
20
|
"publishConfig": {
|
|
17
21
|
"access": "public"
|
|
18
22
|
},
|
|
19
|
-
"author": "
|
|
23
|
+
"author": "ECAD Labs Inc <info@ecadlabs.com>",
|
|
24
|
+
"contributors": [
|
|
25
|
+
"Jev Björsell (jevonearth)",
|
|
26
|
+
"Davis Sawali <davis.sawali@ecadlabs.com>",
|
|
27
|
+
"Roxane Letourneau <roxane@ecadlabs.com>",
|
|
28
|
+
"Simon Boissonneault-Robert <simon@ecadlabs.com>"
|
|
29
|
+
],
|
|
30
|
+
"homepage": "https://taquito.io/",
|
|
20
31
|
"repository": {
|
|
21
32
|
"type": "git",
|
|
22
|
-
"url": ""
|
|
33
|
+
"url": "git+https://github.com/ecadlabs/taquito.git"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/ecadlabs/taquito/issues"
|
|
23
37
|
},
|
|
24
38
|
"license": "Apache-2.0",
|
|
25
39
|
"engines": {
|
|
26
|
-
"node": ">=
|
|
40
|
+
"node": ">=22"
|
|
27
41
|
},
|
|
28
42
|
"scripts": {
|
|
29
43
|
"test": "jest --coverage",
|
|
@@ -62,10 +76,10 @@
|
|
|
62
76
|
"dependencies": {
|
|
63
77
|
"@stablelib/blake2b": "^1.0.1",
|
|
64
78
|
"@stablelib/ed25519": "^1.0.3",
|
|
65
|
-
"@taquito/core": "^24.
|
|
66
|
-
"@taquito/http-utils": "^24.
|
|
67
|
-
"@taquito/taquito": "^24.
|
|
68
|
-
"@taquito/utils": "^24.
|
|
79
|
+
"@taquito/core": "^24.3.0-beta.0",
|
|
80
|
+
"@taquito/http-utils": "^24.3.0-beta.0",
|
|
81
|
+
"@taquito/taquito": "^24.3.0-beta.0",
|
|
82
|
+
"@taquito/utils": "^24.3.0-beta.0",
|
|
69
83
|
"typedarray-to-buffer": "^4.0.0"
|
|
70
84
|
},
|
|
71
85
|
"devDependencies": {
|
|
@@ -94,7 +108,7 @@
|
|
|
94
108
|
"ts-jest": "^29.2.3",
|
|
95
109
|
"ts-node": "^10.9.2",
|
|
96
110
|
"ts-toolbelt": "^9.6.0",
|
|
97
|
-
"typescript": "
|
|
111
|
+
"typescript": "^5.9.3"
|
|
98
112
|
},
|
|
99
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "551e35aeff7d6dcde1c72284238c0ed3c3aae77e"
|
|
100
114
|
}
|
package/LICENSE
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Apache License
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
http://www.apache.org/licenses/
|
|
5
|
-
|
|
6
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
-
|
|
8
|
-
1. Definitions.
|
|
9
|
-
|
|
10
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
-
|
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
-
the copyright owner that is granting the License.
|
|
15
|
-
|
|
16
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
-
other entities that control, are controlled by, or are under common
|
|
18
|
-
control with that entity. For the purposes of this definition,
|
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
-
direction or management of such entity, whether by contract or
|
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
-
|
|
24
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
-
exercising permissions granted by this License.
|
|
26
|
-
|
|
27
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
-
including but not limited to software source code, documentation
|
|
29
|
-
source, and configuration files.
|
|
30
|
-
|
|
31
|
-
"Object" form shall mean any form resulting from mechanical
|
|
32
|
-
transformation or translation of a Source form, including but
|
|
33
|
-
not limited to compiled object code, generated documentation,
|
|
34
|
-
and conversions to other media types.
|
|
35
|
-
|
|
36
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
-
Object form, made available under the License, as indicated by a
|
|
38
|
-
copyright notice that is included in or attached to the work
|
|
39
|
-
(an example is provided in the Appendix below).
|
|
40
|
-
|
|
41
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
-
form, that is based on (or derived from) the Work and for which the
|
|
43
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
-
the Work and Derivative Works thereof.
|
|
48
|
-
|
|
49
|
-
"Contribution" shall mean any work of authorship, including
|
|
50
|
-
the original version of the Work and any modifications or additions
|
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
-
|
|
63
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
-
subsequently incorporated within the Work.
|
|
66
|
-
|
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
73
|
-
|
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
-
where such license applies only to those patent claims licensable
|
|
80
|
-
by such Contributor that are necessarily infringed by their
|
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a
|
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
-
or contributory patent infringement, then any patent licenses
|
|
87
|
-
granted to You under this License for that Work shall terminate
|
|
88
|
-
as of the date such litigation is filed.
|
|
89
|
-
|
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
-
modifications, and in Source or Object form, provided that You
|
|
93
|
-
meet the following conditions:
|
|
94
|
-
|
|
95
|
-
(a) You must give any other recipients of the Work or
|
|
96
|
-
Derivative Works a copy of this License; and
|
|
97
|
-
|
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
|
99
|
-
stating that You changed the files; and
|
|
100
|
-
|
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
|
103
|
-
attribution notices from the Source form of the Work,
|
|
104
|
-
excluding those notices that do not pertain to any part of
|
|
105
|
-
the Derivative Works; and
|
|
106
|
-
|
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
|
109
|
-
include a readable copy of the attribution notices contained
|
|
110
|
-
within such NOTICE file, excluding those notices that do not
|
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
|
112
|
-
of the following places: within a NOTICE text file distributed
|
|
113
|
-
as part of the Derivative Works; within the Source form or
|
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
|
115
|
-
within a display generated by the Derivative Works, if and
|
|
116
|
-
wherever such third-party notices normally appear. The contents
|
|
117
|
-
of the NOTICE file are for informational purposes only and
|
|
118
|
-
do not modify the License. You may add Your own attribution
|
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
-
that such additional attribution notices cannot be construed
|
|
122
|
-
as modifying the License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
-
|
|
181
|
-
To apply the Apache License to your work, attach the following
|
|
182
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
-
replaced with your own identifying information. (Don't include
|
|
184
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
-
comment syntax for the file format. We also recommend that a
|
|
186
|
-
file or class name and description of purpose be included on the
|
|
187
|
-
same "printed page" as the copyright notice for easier
|
|
188
|
-
identification within third-party archives.
|
|
189
|
-
|
|
190
|
-
Copyright [yyyy] [name of copyright owner]
|
|
191
|
-
|
|
192
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
-
you may not use this file except in compliance with the License.
|
|
194
|
-
You may obtain a copy of the License at
|
|
195
|
-
|
|
196
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
-
|
|
198
|
-
Unless required by applicable law or agreed to in writing, software
|
|
199
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
-
See the License for the specific language governing permissions and
|
|
202
|
-
limitations under the License.
|