@solana/keys 2.0.0-experimental.8936f2f → 2.0.0-experimental.8a4cd99
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/README.md +0 -41
- package/dist/index.browser.cjs +4 -121
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +4 -115
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +1 -325
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +2 -102
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +4 -108
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +2 -102
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +5 -9
- package/dist/types/index.d.ts +0 -2
- package/dist/types/signatures.d.ts +1 -1
- package/package.json +12 -15
- package/dist/types/base58.d.ts +0 -10
- package/dist/types/guard.d.ts +0 -5
- package/dist/types/pubkey.d.ts +0 -3
package/dist/index.node.cjs
CHANGED
|
@@ -1,97 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
// ../build-scripts/env-shim.ts
|
|
6
|
-
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
|
|
7
|
-
function assertIsBase58EncodedAddress(putativeBase58EncodedAddress) {
|
|
8
|
-
try {
|
|
9
|
-
if (
|
|
10
|
-
// Lowest address (32 bytes of zeroes)
|
|
11
|
-
putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255)
|
|
12
|
-
putativeBase58EncodedAddress.length > 44
|
|
13
|
-
) {
|
|
14
|
-
throw new Error("Expected input string to decode to a byte array of length 32.");
|
|
15
|
-
}
|
|
16
|
-
const bytes = umiSerializers.base58.serialize(putativeBase58EncodedAddress);
|
|
17
|
-
const numBytes = bytes.byteLength;
|
|
18
|
-
if (numBytes !== 32) {
|
|
19
|
-
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
20
|
-
}
|
|
21
|
-
} catch (e) {
|
|
22
|
-
throw new Error(`\`${putativeBase58EncodedAddress}\` is not a base-58 encoded address`, {
|
|
23
|
-
cause: e
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function getBase58EncodedAddressCodec(config) {
|
|
28
|
-
return umiSerializers.string({
|
|
29
|
-
description: config?.description ?? (__DEV__ ? "A 32-byte account address" : ""),
|
|
30
|
-
encoding: umiSerializers.base58,
|
|
31
|
-
size: 32
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function getBase58EncodedAddressComparator() {
|
|
35
|
-
return new Intl.Collator("en", {
|
|
36
|
-
caseFirst: "lower",
|
|
37
|
-
ignorePunctuation: false,
|
|
38
|
-
localeMatcher: "best fit",
|
|
39
|
-
numeric: false,
|
|
40
|
-
sensitivity: "variant",
|
|
41
|
-
usage: "sort"
|
|
42
|
-
}).compare;
|
|
43
|
-
}
|
|
44
|
-
var cachedEd25519Decision;
|
|
45
|
-
async function isEd25519CurveSupported(subtle) {
|
|
46
|
-
if (cachedEd25519Decision === void 0) {
|
|
47
|
-
cachedEd25519Decision = new Promise((resolve) => {
|
|
48
|
-
subtle.generateKey(
|
|
49
|
-
"Ed25519",
|
|
50
|
-
/* extractable */
|
|
51
|
-
false,
|
|
52
|
-
["sign", "verify"]
|
|
53
|
-
).catch(() => {
|
|
54
|
-
resolve(cachedEd25519Decision = false);
|
|
55
|
-
}).then(() => {
|
|
56
|
-
resolve(cachedEd25519Decision = true);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (typeof cachedEd25519Decision === "boolean") {
|
|
61
|
-
return cachedEd25519Decision;
|
|
62
|
-
} else {
|
|
63
|
-
return await cachedEd25519Decision;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
async function assertKeyGenerationIsAvailable() {
|
|
67
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.generateKey !== "function") {
|
|
68
|
-
throw new Error("No key generation implementation could be found");
|
|
69
|
-
}
|
|
70
|
-
if (!await isEd25519CurveSupported(globalThis.crypto.subtle)) {
|
|
71
|
-
throw new Error(
|
|
72
|
-
"This runtime does not support the generation of Ed25519 key pairs.\n\nInstall and import `@solana/webcrypto-ed25519-polyfill` before generating keys in environments that do not support Ed25519.\n\nFor a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20"
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async function assertKeyExporterIsAvailable() {
|
|
77
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.exportKey !== "function") {
|
|
78
|
-
throw new Error("No key export implementation could be found");
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
async function assertSigningCapabilityIsAvailable() {
|
|
82
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.sign !== "function") {
|
|
83
|
-
throw new Error("No signing implementation could be found");
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
async function assertVerificationCapabilityIsAvailable() {
|
|
87
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.verify !== "function") {
|
|
88
|
-
throw new Error("No signature verification implementation could be found");
|
|
89
|
-
}
|
|
90
|
-
}
|
|
3
|
+
var assertions = require('@solana/assertions');
|
|
91
4
|
|
|
92
5
|
// src/key-pair.ts
|
|
93
6
|
async function generateKeyPair() {
|
|
94
|
-
await assertKeyGenerationIsAvailable();
|
|
7
|
+
await assertions.assertKeyGenerationIsAvailable();
|
|
95
8
|
const keyPair = await crypto.subtle.generateKey(
|
|
96
9
|
/* algorithm */
|
|
97
10
|
"Ed25519",
|
|
@@ -104,34 +17,17 @@ async function generateKeyPair() {
|
|
|
104
17
|
);
|
|
105
18
|
return keyPair;
|
|
106
19
|
}
|
|
107
|
-
|
|
108
|
-
// src/pubkey.ts
|
|
109
|
-
async function getBase58EncodedAddressFromPublicKey(publicKey) {
|
|
110
|
-
await assertKeyExporterIsAvailable();
|
|
111
|
-
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
|
|
112
|
-
throw new Error("The `CryptoKey` must be an `Ed25519` public key");
|
|
113
|
-
}
|
|
114
|
-
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
|
|
115
|
-
const [base58EncodedAddress] = getBase58EncodedAddressCodec().deserialize(new Uint8Array(publicKeyBytes));
|
|
116
|
-
return base58EncodedAddress;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// src/signatures.ts
|
|
120
20
|
async function signBytes(key, data) {
|
|
121
|
-
await assertSigningCapabilityIsAvailable();
|
|
21
|
+
await assertions.assertSigningCapabilityIsAvailable();
|
|
122
22
|
const signedData = await crypto.subtle.sign("Ed25519", key, data);
|
|
123
23
|
return new Uint8Array(signedData);
|
|
124
24
|
}
|
|
125
25
|
async function verifySignature(key, signature, data) {
|
|
126
|
-
await assertVerificationCapabilityIsAvailable();
|
|
26
|
+
await assertions.assertVerificationCapabilityIsAvailable();
|
|
127
27
|
return await crypto.subtle.verify("Ed25519", key, signature, data);
|
|
128
28
|
}
|
|
129
29
|
|
|
130
|
-
exports.assertIsBase58EncodedAddress = assertIsBase58EncodedAddress;
|
|
131
30
|
exports.generateKeyPair = generateKeyPair;
|
|
132
|
-
exports.getBase58EncodedAddressCodec = getBase58EncodedAddressCodec;
|
|
133
|
-
exports.getBase58EncodedAddressComparator = getBase58EncodedAddressComparator;
|
|
134
|
-
exports.getBase58EncodedAddressFromPublicKey = getBase58EncodedAddressFromPublicKey;
|
|
135
31
|
exports.signBytes = signBytes;
|
|
136
32
|
exports.verifySignature = verifySignature;
|
|
137
33
|
//# sourceMappingURL=out.js.map
|
package/dist/index.node.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../src/key-pair.ts","../src/signatures.ts"],"names":[],"mappings":";AAAA,SAAS,sCAAsC;AAE/C,eAAsB,kBAA0C;AAC5D,QAAM,+BAA+B;AACrC,QAAM,UAAU,MAAM,OAAO,OAAO;AAAA;AAAA,IAChB;AAAA;AAAA;AAAA,IACE;AAAA;AAAA;AAAA,IACC,CAAC,QAAQ,QAAQ;AAAA,EACxC;AACA,SAAO;AACX;;;ACVA,SAAS,oCAAoC,+CAA+C;AAI5F,eAAsB,UAAU,KAAgB,MAA6C;AACzF,QAAM,mCAAmC;AACzC,QAAM,aAAa,MAAM,OAAO,OAAO,KAAK,WAAW,KAAK,IAAI;AAChE,SAAO,IAAI,WAAW,UAAU;AACpC;AAEA,eAAsB,gBAAgB,KAAgB,WAA6B,MAAoC;AACnH,QAAM,wCAAwC;AAC9C,SAAO,MAAM,OAAO,OAAO,OAAO,WAAW,KAAK,WAAW,IAAI;AACrE","sourcesContent":["import { assertKeyGenerationIsAvailable } from '@solana/assertions';\n\nexport async function generateKeyPair(): Promise<CryptoKeyPair> {\n await assertKeyGenerationIsAvailable();\n const keyPair = await crypto.subtle.generateKey(\n /* algorithm */ 'Ed25519', // Native implementation status: https://github.com/WICG/webcrypto-secure-curves/issues/20\n /* extractable */ false, // Prevents the bytes of the private key from being visible to JS.\n /* allowed uses */ ['sign', 'verify']\n );\n return keyPair as CryptoKeyPair;\n}\n","import { assertSigningCapabilityIsAvailable, assertVerificationCapabilityIsAvailable } from '@solana/assertions';\n\nexport type Ed25519Signature = Uint8Array & { readonly __brand: unique symbol };\n\nexport async function signBytes(key: CryptoKey, data: Uint8Array): Promise<Ed25519Signature> {\n await assertSigningCapabilityIsAvailable();\n const signedData = await crypto.subtle.sign('Ed25519', key, data);\n return new Uint8Array(signedData) as Ed25519Signature;\n}\n\nexport async function verifySignature(key: CryptoKey, signature: Ed25519Signature, data: Uint8Array): Promise<boolean> {\n await assertVerificationCapabilityIsAvailable();\n return await crypto.subtle.verify('Ed25519', key, signature, data);\n}\n"]}
|
package/dist/index.node.js
CHANGED
|
@@ -1,91 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
// ../build-scripts/env-shim.ts
|
|
4
|
-
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
|
|
5
|
-
function assertIsBase58EncodedAddress(putativeBase58EncodedAddress) {
|
|
6
|
-
try {
|
|
7
|
-
if (
|
|
8
|
-
// Lowest address (32 bytes of zeroes)
|
|
9
|
-
putativeBase58EncodedAddress.length < 32 || // Highest address (32 bytes of 255)
|
|
10
|
-
putativeBase58EncodedAddress.length > 44
|
|
11
|
-
) {
|
|
12
|
-
throw new Error("Expected input string to decode to a byte array of length 32.");
|
|
13
|
-
}
|
|
14
|
-
const bytes = base58.serialize(putativeBase58EncodedAddress);
|
|
15
|
-
const numBytes = bytes.byteLength;
|
|
16
|
-
if (numBytes !== 32) {
|
|
17
|
-
throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);
|
|
18
|
-
}
|
|
19
|
-
} catch (e) {
|
|
20
|
-
throw new Error(`\`${putativeBase58EncodedAddress}\` is not a base-58 encoded address`, {
|
|
21
|
-
cause: e
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function getBase58EncodedAddressCodec(config) {
|
|
26
|
-
return string({
|
|
27
|
-
description: config?.description ?? (__DEV__ ? "A 32-byte account address" : ""),
|
|
28
|
-
encoding: base58,
|
|
29
|
-
size: 32
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
function getBase58EncodedAddressComparator() {
|
|
33
|
-
return new Intl.Collator("en", {
|
|
34
|
-
caseFirst: "lower",
|
|
35
|
-
ignorePunctuation: false,
|
|
36
|
-
localeMatcher: "best fit",
|
|
37
|
-
numeric: false,
|
|
38
|
-
sensitivity: "variant",
|
|
39
|
-
usage: "sort"
|
|
40
|
-
}).compare;
|
|
41
|
-
}
|
|
42
|
-
var cachedEd25519Decision;
|
|
43
|
-
async function isEd25519CurveSupported(subtle) {
|
|
44
|
-
if (cachedEd25519Decision === void 0) {
|
|
45
|
-
cachedEd25519Decision = new Promise((resolve) => {
|
|
46
|
-
subtle.generateKey(
|
|
47
|
-
"Ed25519",
|
|
48
|
-
/* extractable */
|
|
49
|
-
false,
|
|
50
|
-
["sign", "verify"]
|
|
51
|
-
).catch(() => {
|
|
52
|
-
resolve(cachedEd25519Decision = false);
|
|
53
|
-
}).then(() => {
|
|
54
|
-
resolve(cachedEd25519Decision = true);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
if (typeof cachedEd25519Decision === "boolean") {
|
|
59
|
-
return cachedEd25519Decision;
|
|
60
|
-
} else {
|
|
61
|
-
return await cachedEd25519Decision;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async function assertKeyGenerationIsAvailable() {
|
|
65
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.generateKey !== "function") {
|
|
66
|
-
throw new Error("No key generation implementation could be found");
|
|
67
|
-
}
|
|
68
|
-
if (!await isEd25519CurveSupported(globalThis.crypto.subtle)) {
|
|
69
|
-
throw new Error(
|
|
70
|
-
"This runtime does not support the generation of Ed25519 key pairs.\n\nInstall and import `@solana/webcrypto-ed25519-polyfill` before generating keys in environments that do not support Ed25519.\n\nFor a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20"
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
async function assertKeyExporterIsAvailable() {
|
|
75
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.exportKey !== "function") {
|
|
76
|
-
throw new Error("No key export implementation could be found");
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async function assertSigningCapabilityIsAvailable() {
|
|
80
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.sign !== "function") {
|
|
81
|
-
throw new Error("No signing implementation could be found");
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
async function assertVerificationCapabilityIsAvailable() {
|
|
85
|
-
if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.verify !== "function") {
|
|
86
|
-
throw new Error("No signature verification implementation could be found");
|
|
87
|
-
}
|
|
88
|
-
}
|
|
1
|
+
import { assertKeyGenerationIsAvailable, assertSigningCapabilityIsAvailable, assertVerificationCapabilityIsAvailable } from '@solana/assertions';
|
|
89
2
|
|
|
90
3
|
// src/key-pair.ts
|
|
91
4
|
async function generateKeyPair() {
|
|
@@ -102,19 +15,6 @@ async function generateKeyPair() {
|
|
|
102
15
|
);
|
|
103
16
|
return keyPair;
|
|
104
17
|
}
|
|
105
|
-
|
|
106
|
-
// src/pubkey.ts
|
|
107
|
-
async function getBase58EncodedAddressFromPublicKey(publicKey) {
|
|
108
|
-
await assertKeyExporterIsAvailable();
|
|
109
|
-
if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
|
|
110
|
-
throw new Error("The `CryptoKey` must be an `Ed25519` public key");
|
|
111
|
-
}
|
|
112
|
-
const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
|
|
113
|
-
const [base58EncodedAddress] = getBase58EncodedAddressCodec().deserialize(new Uint8Array(publicKeyBytes));
|
|
114
|
-
return base58EncodedAddress;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// src/signatures.ts
|
|
118
18
|
async function signBytes(key, data) {
|
|
119
19
|
await assertSigningCapabilityIsAvailable();
|
|
120
20
|
const signedData = await crypto.subtle.sign("Ed25519", key, data);
|
|
@@ -125,6 +25,6 @@ async function verifySignature(key, signature, data) {
|
|
|
125
25
|
return await crypto.subtle.verify("Ed25519", key, signature, data);
|
|
126
26
|
}
|
|
127
27
|
|
|
128
|
-
export {
|
|
28
|
+
export { generateKeyPair, signBytes, verifySignature };
|
|
129
29
|
//# sourceMappingURL=out.js.map
|
|
130
30
|
//# sourceMappingURL=index.node.js.map
|
package/dist/index.node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../src/key-pair.ts","../src/signatures.ts"],"names":[],"mappings":";AAAA,SAAS,sCAAsC;AAE/C,eAAsB,kBAA0C;AAC5D,QAAM,+BAA+B;AACrC,QAAM,UAAU,MAAM,OAAO,OAAO;AAAA;AAAA,IAChB;AAAA;AAAA;AAAA,IACE;AAAA;AAAA;AAAA,IACC,CAAC,QAAQ,QAAQ;AAAA,EACxC;AACA,SAAO;AACX;;;ACVA,SAAS,oCAAoC,+CAA+C;AAI5F,eAAsB,UAAU,KAAgB,MAA6C;AACzF,QAAM,mCAAmC;AACzC,QAAM,aAAa,MAAM,OAAO,OAAO,KAAK,WAAW,KAAK,IAAI;AAChE,SAAO,IAAI,WAAW,UAAU;AACpC;AAEA,eAAsB,gBAAgB,KAAgB,WAA6B,MAAoC;AACnH,QAAM,wCAAwC;AAC9C,SAAO,MAAM,OAAO,OAAO,OAAO,WAAW,KAAK,WAAW,IAAI;AACrE","sourcesContent":["import { assertKeyGenerationIsAvailable } from '@solana/assertions';\n\nexport async function generateKeyPair(): Promise<CryptoKeyPair> {\n await assertKeyGenerationIsAvailable();\n const keyPair = await crypto.subtle.generateKey(\n /* algorithm */ 'Ed25519', // Native implementation status: https://github.com/WICG/webcrypto-secure-curves/issues/20\n /* extractable */ false, // Prevents the bytes of the private key from being visible to JS.\n /* allowed uses */ ['sign', 'verify']\n );\n return keyPair as CryptoKeyPair;\n}\n","import { assertSigningCapabilityIsAvailable, assertVerificationCapabilityIsAvailable } from '@solana/assertions';\n\nexport type Ed25519Signature = Uint8Array & { readonly __brand: unique symbol };\n\nexport async function signBytes(key: CryptoKey, data: Uint8Array): Promise<Ed25519Signature> {\n await assertSigningCapabilityIsAvailable();\n const signedData = await crypto.subtle.sign('Ed25519', key, data);\n return new Uint8Array(signedData) as Ed25519Signature;\n}\n\nexport async function verifySignature(key: CryptoKey, signature: Ed25519Signature, data: Uint8Array): Promise<boolean> {\n await assertVerificationCapabilityIsAvailable();\n return await crypto.subtle.verify('Ed25519', key, signature, data);\n}\n"]}
|
|
@@ -2,19 +2,15 @@ this.globalThis = this.globalThis || {};
|
|
|
2
2
|
this.globalThis.solanaWeb3 = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function n(){if(!globalThis.isSecureContext)throw new Error("Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts")}var e;async function y(t){return e===void 0&&(e=new Promise(o=>{t.generateKey("Ed25519",!1,["sign","verify"]).catch(()=>{o(e=!1);}).then(()=>{o(e=!0);});})),typeof e=="boolean"?e:await e}async function a(){if(n(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.generateKey!="function")throw new Error("No key generation implementation could be found");if(!await y(globalThis.crypto.subtle))throw new Error(`This runtime does not support the generation of Ed25519 key pairs.
|
|
6
6
|
|
|
7
7
|
Install and import \`@solana/webcrypto-ed25519-polyfill\` before generating keys in environments that do not support Ed25519.
|
|
8
8
|
|
|
9
|
-
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20`)}async function
|
|
9
|
+
For a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20`)}async function s(){if(n(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.sign!="function")throw new Error("No signing implementation could be found")}async function l(){if(n(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.verify!="function")throw new Error("No signature verification implementation could be found")}async function d(){return await a(),await crypto.subtle.generateKey("Ed25519",!1,["sign","verify"])}async function m(t,o){await s();let r=await crypto.subtle.sign("Ed25519",t,o);return new Uint8Array(r)}async function w(t,o,r){return await l(),await crypto.subtle.verify("Ed25519",t,o,r)}
|
|
10
10
|
|
|
11
|
-
exports.
|
|
12
|
-
exports.
|
|
13
|
-
exports.
|
|
14
|
-
exports.getBase58EncodedAddressComparator = ir;
|
|
15
|
-
exports.getBase58EncodedAddressFromPublicKey = xr;
|
|
16
|
-
exports.signBytes = wr;
|
|
17
|
-
exports.verifySignature = zr;
|
|
11
|
+
exports.generateKeyPair = d;
|
|
12
|
+
exports.signBytes = m;
|
|
13
|
+
exports.verifySignature = w;
|
|
18
14
|
|
|
19
15
|
return exports;
|
|
20
16
|
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type Ed25519Signature = Uint8Array & {
|
|
2
|
-
readonly
|
|
2
|
+
readonly __brand: unique symbol;
|
|
3
3
|
};
|
|
4
4
|
export declare function signBytes(key: CryptoKey, data: Uint8Array): Promise<Ed25519Signature>;
|
|
5
5
|
export declare function verifySignature(key: CryptoKey, signature: Ed25519Signature, data: Uint8Array): Promise<boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/keys",
|
|
3
|
-
"version": "2.0.0-experimental.
|
|
3
|
+
"version": "2.0.0-experimental.8a4cd99",
|
|
4
4
|
"description": "Helpers for generating and transforming key material",
|
|
5
5
|
"exports": {
|
|
6
6
|
"browser": {
|
|
@@ -49,29 +49,25 @@
|
|
|
49
49
|
"node": ">=17.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@
|
|
52
|
+
"@solana/assertions": "2.0.0-experimental.8a4cd99"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@solana/eslint-config-solana": "^1.0.2",
|
|
56
|
-
"@swc/
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@typescript-eslint/
|
|
60
|
-
"@typescript-eslint/parser": "^6.0.0",
|
|
56
|
+
"@swc/jest": "^0.2.28",
|
|
57
|
+
"@types/jest": "^29.5.5",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
|
59
|
+
"@typescript-eslint/parser": "^6.3.0",
|
|
61
60
|
"agadoo": "^3.0.0",
|
|
62
61
|
"eslint": "^8.45.0",
|
|
63
62
|
"eslint-plugin-jest": "^27.2.3",
|
|
64
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
65
63
|
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
|
66
|
-
"jest": "^29.
|
|
67
|
-
"jest-environment-jsdom": "^29.6.
|
|
64
|
+
"jest": "^29.7.0",
|
|
65
|
+
"jest-environment-jsdom": "^29.6.4",
|
|
68
66
|
"jest-runner-eslint": "^2.1.0",
|
|
69
67
|
"jest-runner-prettier": "^1.0.0",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"tsup": "6.7.0",
|
|
74
|
-
"typescript": "^5.1.6",
|
|
68
|
+
"prettier": "^2.8",
|
|
69
|
+
"tsup": "7.2.0",
|
|
70
|
+
"typescript": "^5.2.2",
|
|
75
71
|
"version-from-git": "^1.1.1",
|
|
76
72
|
"build-scripts": "0.0.0",
|
|
77
73
|
"test-config": "0.0.0",
|
|
@@ -90,6 +86,7 @@
|
|
|
90
86
|
"compile:typedefs": "tsc -p ./tsconfig.declarations.json",
|
|
91
87
|
"dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch",
|
|
92
88
|
"publish-packages": "pnpm publish --tag experimental --access public --no-git-checks",
|
|
89
|
+
"style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/*",
|
|
93
90
|
"test:lint": "jest -c node_modules/test-config/jest-lint.config.ts --rootDir . --silent",
|
|
94
91
|
"test:prettier": "jest -c node_modules/test-config/jest-prettier.config.ts --rootDir . --silent",
|
|
95
92
|
"test:treeshakability:browser": "agadoo dist/index.browser.js",
|
package/dist/types/base58.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Serializer } from '@metaplex-foundation/umi-serializers';
|
|
2
|
-
export type Base58EncodedAddress<TAddress extends string = string> = TAddress & {
|
|
3
|
-
readonly __base58EncodedAddress: unique symbol;
|
|
4
|
-
};
|
|
5
|
-
export declare function assertIsBase58EncodedAddress(putativeBase58EncodedAddress: string): asserts putativeBase58EncodedAddress is Base58EncodedAddress<typeof putativeBase58EncodedAddress>;
|
|
6
|
-
export declare function getBase58EncodedAddressCodec(config?: Readonly<{
|
|
7
|
-
description: string;
|
|
8
|
-
}>): Serializer<Base58EncodedAddress>;
|
|
9
|
-
export declare function getBase58EncodedAddressComparator(): (x: string, y: string) => number;
|
|
10
|
-
//# sourceMappingURL=base58.d.ts.map
|
package/dist/types/guard.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function assertKeyGenerationIsAvailable(): Promise<void>;
|
|
2
|
-
export declare function assertKeyExporterIsAvailable(): Promise<void>;
|
|
3
|
-
export declare function assertSigningCapabilityIsAvailable(): Promise<void>;
|
|
4
|
-
export declare function assertVerificationCapabilityIsAvailable(): Promise<void>;
|
|
5
|
-
//# sourceMappingURL=guard.d.ts.map
|
package/dist/types/pubkey.d.ts
DELETED