@solana/keys 2.0.0-experimental.ee9f3d8 → 2.0.0-experimental.f040ea3

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.
@@ -1,85 +1,10 @@
1
1
  'use strict';
2
2
 
3
- var umiSerializers = require('@metaplex-foundation/umi-serializers');
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("This runtime does not support the generation of Ed25519 keypairs");
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
- }
3
+ var assertions = require('@solana/assertions');
79
4
 
80
5
  // src/key-pair.ts
81
6
  async function generateKeyPair() {
82
- await assertKeyGenerationIsAvailable();
7
+ await assertions.assertKeyGenerationIsAvailable();
83
8
  const keyPair = await crypto.subtle.generateKey(
84
9
  /* algorithm */
85
10
  "Ed25519",
@@ -92,22 +17,18 @@ async function generateKeyPair() {
92
17
  );
93
18
  return keyPair;
94
19
  }
95
-
96
- // src/pubkey.ts
97
- async function getBase58EncodedAddressFromPublicKey(publicKey) {
98
- await assertKeyExporterIsAvailable();
99
- if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
100
- throw new Error("The `CryptoKey` must be an `Ed25519` public key");
101
- }
102
- const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
103
- const [base58EncodedAddress] = getBase58EncodedAddressCodec().deserialize(new Uint8Array(publicKeyBytes));
104
- return base58EncodedAddress;
20
+ async function signBytes(key, data) {
21
+ await assertions.assertSigningCapabilityIsAvailable();
22
+ const signedData = await crypto.subtle.sign("Ed25519", key, data);
23
+ return new Uint8Array(signedData);
24
+ }
25
+ async function verifySignature(key, signature, data) {
26
+ await assertions.assertVerificationCapabilityIsAvailable();
27
+ return await crypto.subtle.verify("Ed25519", key, signature, data);
105
28
  }
106
29
 
107
- exports.assertIsBase58EncodedAddress = assertIsBase58EncodedAddress;
108
30
  exports.generateKeyPair = generateKeyPair;
109
- exports.getBase58EncodedAddressCodec = getBase58EncodedAddressCodec;
110
- exports.getBase58EncodedAddressComparator = getBase58EncodedAddressComparator;
111
- exports.getBase58EncodedAddressFromPublicKey = getBase58EncodedAddressFromPublicKey;
31
+ exports.signBytes = signBytes;
32
+ exports.verifySignature = verifySignature;
112
33
  //# sourceMappingURL=out.js.map
113
34
  //# sourceMappingURL=index.node.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../build-scripts/env-shim.ts","../src/base58.ts","../src/guard.ts","../src/key-pair.ts","../src/pubkey.ts"],"names":[],"mappings":";AACO,IAAM,UAA2B,uBAAO,QAAgB,KAAU,EAAE,aAAa,eAAe;;;ACDvG,SAAS,QAAoB,cAAc;AAMpC,SAAS,6BACZ,8BACiG;AACjG,MAAI;AAEA;AAAA;AAAA,MAEI,6BAA6B,SAAS;AAAA,MAEtC,6BAA6B,SAAS;AAAA,MACxC;AACE,YAAM,IAAI,MAAM,+DAA+D;AAAA,IACnF;AAEA,UAAM,QAAQ,OAAO,UAAU,4BAA4B;AAC3D,UAAM,WAAW,MAAM;AACvB,QAAI,aAAa,IAAI;AACjB,YAAM,IAAI,MAAM,gFAAgF,UAAU;AAAA,IAC9G;AAAA,EACJ,SAAS,GAAP;AACE,UAAM,IAAI,MAAM,KAAK,mEAAmE;AAAA,MACpF,OAAO;AAAA,IACX,CAAC;AAAA,EACL;AACJ;AAEO,SAAS,6BACZ,QAGgC;AAChC,SAAO,OAAO;AAAA,IACV,aAAa,QAAQ,gBAAgB,UAAU,8BAA8B;AAAA,IAC7E,UAAU;AAAA,IACV,MAAM;AAAA,EACV,CAAC;AACL;AAEO,SAAS,oCAAsE;AAClF,SAAO,IAAI,KAAK,SAAS,MAAM;AAAA,IAC3B,WAAW;AAAA,IACX,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,SAAS;AAAA,IACT,aAAa;AAAA,IACb,OAAO;AAAA,EACX,CAAC,EAAE;AACP;;;ACrDA,SAAS,wBAAwB;AAC7B,MAAI,OAA4C;AAE5C,UAAM,IAAI;AAAA,MACN;AAAA,IAEJ;AAAA,EACJ;AACJ;AAEA,IAAI;AACJ,eAAe,wBAAwB,QAAwC;AAC3E,MAAI,0BAA0B,QAAW;AACrC,4BAAwB,IAAI,QAAQ,aAAW;AAC3C,aACK;AAAA,QAAY;AAAA;AAAA,QAA6B;AAAA,QAAO,CAAC,QAAQ,QAAQ;AAAA,MAAC,EAClE,MAAM,MAAM;AACT,gBAAS,wBAAwB,KAAM;AAAA,MAC3C,CAAC,EACA,KAAK,MAAM;AACR,gBAAS,wBAAwB,IAAK;AAAA,MAC1C,CAAC;AAAA,IACT,CAAC;AAAA,EACL;AACA,MAAI,OAAO,0BAA0B,WAAW;AAC5C,WAAO;AAAA,EACX,OAAO;AACH,WAAO,MAAM;AAAA,EACjB;AACJ;AAEA,eAAsB,iCAAiC;AACnD,wBAAsB;AACtB,MAAI,OAAO,WAAW,WAAW,eAAe,OAAO,WAAW,OAAO,QAAQ,gBAAgB,YAAY;AAEzG,UAAM,IAAI,MAAM,iDAAiD;AAAA,EACrE;AACA,MAAI,CAAE,MAAM,wBAAwB,WAAW,OAAO,MAAM,GAAI;AAE5D,UAAM,IAAI,MAAM,kEAAkE;AAAA,EACtF;AACJ;AAEA,eAAsB,+BAA+B;AACjD,wBAAsB;AACtB,MAAI,OAAO,WAAW,WAAW,eAAe,OAAO,WAAW,OAAO,QAAQ,cAAc,YAAY;AAEvG,UAAM,IAAI,MAAM,6CAA6C;AAAA,EACjE;AACJ;;;AC/CA,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;;;ACPA,eAAsB,qCAAqC,WAAqD;AAC5G,QAAM,6BAA6B;AACnC,MAAI,UAAU,SAAS,YAAY,UAAU,UAAU,SAAS,WAAW;AAEvE,UAAM,IAAI,MAAM,iDAAiD;AAAA,EACrE;AACA,QAAM,iBAAiB,MAAM,OAAO,OAAO,UAAU,OAAO,SAAS;AACrE,QAAM,CAAC,oBAAoB,IAAI,6BAA6B,EAAE,YAAY,IAAI,WAAW,cAAc,CAAC;AACxG,SAAO;AACX","sourcesContent":["// Clever obfuscation to prevent the build system from inlining the value of `NODE_ENV`\nexport const __DEV__ = /* @__PURE__ */ (() => (process as any)['en' + 'v'].NODE_ENV === 'development')();\n","import { base58, Serializer, string } from '@metaplex-foundation/umi-serializers';\n\nexport type Base58EncodedAddress<TAddress extends string = string> = TAddress & {\n readonly __base58EncodedAddress: unique symbol;\n};\n\nexport function assertIsBase58EncodedAddress(\n putativeBase58EncodedAddress: string\n): asserts putativeBase58EncodedAddress is Base58EncodedAddress<typeof putativeBase58EncodedAddress> {\n try {\n // Fast-path; see if the input string is of an acceptable length.\n if (\n // Lowest address (32 bytes of zeroes)\n putativeBase58EncodedAddress.length < 32 ||\n // Highest address (32 bytes of 255)\n putativeBase58EncodedAddress.length > 44\n ) {\n throw new Error('Expected input string to decode to a byte array of length 32.');\n }\n // Slow-path; actually attempt to decode the input string.\n const bytes = base58.serialize(putativeBase58EncodedAddress);\n const numBytes = bytes.byteLength;\n if (numBytes !== 32) {\n throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);\n }\n } catch (e) {\n throw new Error(`\\`${putativeBase58EncodedAddress}\\` is not a base-58 encoded address`, {\n cause: e,\n });\n }\n}\n\nexport function getBase58EncodedAddressCodec(\n config?: Readonly<{\n description: string;\n }>\n): Serializer<Base58EncodedAddress> {\n return string({\n description: config?.description ?? (__DEV__ ? 'A 32-byte account address' : ''),\n encoding: base58,\n size: 32,\n }) as unknown as Serializer<Base58EncodedAddress>;\n}\n\nexport function getBase58EncodedAddressComparator(): (x: string, y: string) => number {\n return new Intl.Collator('en', {\n caseFirst: 'lower',\n ignorePunctuation: false,\n localeMatcher: 'best fit',\n numeric: false,\n sensitivity: 'variant',\n usage: 'sort',\n }).compare;\n}\n","function assertIsSecureContext() {\n if (__BROWSER__ && !globalThis.isSecureContext) {\n // TODO: Coded error.\n throw new Error(\n 'Cryptographic operations are only allowed in secure browser contexts. Read more ' +\n 'here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts'\n );\n }\n}\n\nlet cachedEd25519Decision: PromiseLike<boolean> | boolean | undefined;\nasync function isEd25519CurveSupported(subtle: SubtleCrypto): Promise<boolean> {\n if (cachedEd25519Decision === undefined) {\n cachedEd25519Decision = new Promise(resolve => {\n subtle\n .generateKey('Ed25519', /* extractable */ false, ['sign', 'verify'])\n .catch(() => {\n resolve((cachedEd25519Decision = false));\n })\n .then(() => {\n resolve((cachedEd25519Decision = true));\n });\n });\n }\n if (typeof cachedEd25519Decision === 'boolean') {\n return cachedEd25519Decision;\n } else {\n return await cachedEd25519Decision;\n }\n}\n\nexport async function assertKeyGenerationIsAvailable() {\n assertIsSecureContext();\n if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle?.generateKey !== 'function') {\n // TODO: Coded error.\n throw new Error('No key generation implementation could be found');\n }\n if (!(await isEd25519CurveSupported(globalThis.crypto.subtle))) {\n // TODO: Coded error.\n throw new Error('This runtime does not support the generation of Ed25519 keypairs');\n }\n}\n\nexport async function assertKeyExporterIsAvailable() {\n assertIsSecureContext();\n if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle?.exportKey !== 'function') {\n // TODO: Coded error.\n throw new Error('No key export implementation could be found');\n }\n}\n\nexport async function assertSigningCapabilityIsAvailable() {\n assertIsSecureContext();\n if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle?.sign !== 'function') {\n // TODO: Coded error.\n throw new Error('No signing implementation could be found');\n }\n}\n\nexport async function assertVerificationCapabilityIsAvailable() {\n assertIsSecureContext();\n if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle?.verify !== 'function') {\n // TODO: Coded error.\n throw new Error('No signature verification implementation could be found');\n }\n}\n","import { assertKeyGenerationIsAvailable } from './guard';\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 { Base58EncodedAddress, getBase58EncodedAddressCodec } from './base58';\nimport { assertKeyExporterIsAvailable } from './guard';\n\nexport async function getBase58EncodedAddressFromPublicKey(publicKey: CryptoKey): Promise<Base58EncodedAddress> {\n await assertKeyExporterIsAvailable();\n if (publicKey.type !== 'public' || publicKey.algorithm.name !== 'Ed25519') {\n // TODO: Coded error.\n throw new Error('The `CryptoKey` must be an `Ed25519` public key');\n }\n const publicKeyBytes = await crypto.subtle.exportKey('raw', publicKey);\n const [base58EncodedAddress] = getBase58EncodedAddressCodec().deserialize(new Uint8Array(publicKeyBytes));\n return base58EncodedAddress;\n}\n"]}
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"]}
@@ -1,79 +1,4 @@
1
- import { base58, string } from '@metaplex-foundation/umi-serializers';
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("This runtime does not support the generation of Ed25519 keypairs");
70
- }
71
- }
72
- async function assertKeyExporterIsAvailable() {
73
- if (typeof globalThis.crypto === "undefined" || typeof globalThis.crypto.subtle?.exportKey !== "function") {
74
- throw new Error("No key export implementation could be found");
75
- }
76
- }
1
+ import { assertKeyGenerationIsAvailable, assertSigningCapabilityIsAvailable, assertVerificationCapabilityIsAvailable } from '@solana/assertions';
77
2
 
78
3
  // src/key-pair.ts
79
4
  async function generateKeyPair() {
@@ -90,18 +15,16 @@ async function generateKeyPair() {
90
15
  );
91
16
  return keyPair;
92
17
  }
93
-
94
- // src/pubkey.ts
95
- async function getBase58EncodedAddressFromPublicKey(publicKey) {
96
- await assertKeyExporterIsAvailable();
97
- if (publicKey.type !== "public" || publicKey.algorithm.name !== "Ed25519") {
98
- throw new Error("The `CryptoKey` must be an `Ed25519` public key");
99
- }
100
- const publicKeyBytes = await crypto.subtle.exportKey("raw", publicKey);
101
- const [base58EncodedAddress] = getBase58EncodedAddressCodec().deserialize(new Uint8Array(publicKeyBytes));
102
- return base58EncodedAddress;
18
+ async function signBytes(key, data) {
19
+ await assertSigningCapabilityIsAvailable();
20
+ const signedData = await crypto.subtle.sign("Ed25519", key, data);
21
+ return new Uint8Array(signedData);
22
+ }
23
+ async function verifySignature(key, signature, data) {
24
+ await assertVerificationCapabilityIsAvailable();
25
+ return await crypto.subtle.verify("Ed25519", key, signature, data);
103
26
  }
104
27
 
105
- export { assertIsBase58EncodedAddress, generateKeyPair, getBase58EncodedAddressCodec, getBase58EncodedAddressComparator, getBase58EncodedAddressFromPublicKey };
28
+ export { generateKeyPair, signBytes, verifySignature };
106
29
  //# sourceMappingURL=out.js.map
107
30
  //# sourceMappingURL=index.node.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../build-scripts/env-shim.ts","../src/base58.ts","../src/guard.ts","../src/key-pair.ts","../src/pubkey.ts"],"names":[],"mappings":";AACO,IAAM,UAA2B,uBAAO,QAAgB,KAAU,EAAE,aAAa,eAAe;;;ACDvG,SAAS,QAAoB,cAAc;AAMpC,SAAS,6BACZ,8BACiG;AACjG,MAAI;AAEA;AAAA;AAAA,MAEI,6BAA6B,SAAS;AAAA,MAEtC,6BAA6B,SAAS;AAAA,MACxC;AACE,YAAM,IAAI,MAAM,+DAA+D;AAAA,IACnF;AAEA,UAAM,QAAQ,OAAO,UAAU,4BAA4B;AAC3D,UAAM,WAAW,MAAM;AACvB,QAAI,aAAa,IAAI;AACjB,YAAM,IAAI,MAAM,gFAAgF,UAAU;AAAA,IAC9G;AAAA,EACJ,SAAS,GAAP;AACE,UAAM,IAAI,MAAM,KAAK,mEAAmE;AAAA,MACpF,OAAO;AAAA,IACX,CAAC;AAAA,EACL;AACJ;AAEO,SAAS,6BACZ,QAGgC;AAChC,SAAO,OAAO;AAAA,IACV,aAAa,QAAQ,gBAAgB,UAAU,8BAA8B;AAAA,IAC7E,UAAU;AAAA,IACV,MAAM;AAAA,EACV,CAAC;AACL;AAEO,SAAS,oCAAsE;AAClF,SAAO,IAAI,KAAK,SAAS,MAAM;AAAA,IAC3B,WAAW;AAAA,IACX,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,SAAS;AAAA,IACT,aAAa;AAAA,IACb,OAAO;AAAA,EACX,CAAC,EAAE;AACP;;;ACrDA,SAAS,wBAAwB;AAC7B,MAAI,OAA4C;AAE5C,UAAM,IAAI;AAAA,MACN;AAAA,IAEJ;AAAA,EACJ;AACJ;AAEA,IAAI;AACJ,eAAe,wBAAwB,QAAwC;AAC3E,MAAI,0BAA0B,QAAW;AACrC,4BAAwB,IAAI,QAAQ,aAAW;AAC3C,aACK;AAAA,QAAY;AAAA;AAAA,QAA6B;AAAA,QAAO,CAAC,QAAQ,QAAQ;AAAA,MAAC,EAClE,MAAM,MAAM;AACT,gBAAS,wBAAwB,KAAM;AAAA,MAC3C,CAAC,EACA,KAAK,MAAM;AACR,gBAAS,wBAAwB,IAAK;AAAA,MAC1C,CAAC;AAAA,IACT,CAAC;AAAA,EACL;AACA,MAAI,OAAO,0BAA0B,WAAW;AAC5C,WAAO;AAAA,EACX,OAAO;AACH,WAAO,MAAM;AAAA,EACjB;AACJ;AAEA,eAAsB,iCAAiC;AACnD,wBAAsB;AACtB,MAAI,OAAO,WAAW,WAAW,eAAe,OAAO,WAAW,OAAO,QAAQ,gBAAgB,YAAY;AAEzG,UAAM,IAAI,MAAM,iDAAiD;AAAA,EACrE;AACA,MAAI,CAAE,MAAM,wBAAwB,WAAW,OAAO,MAAM,GAAI;AAE5D,UAAM,IAAI,MAAM,kEAAkE;AAAA,EACtF;AACJ;AAEA,eAAsB,+BAA+B;AACjD,wBAAsB;AACtB,MAAI,OAAO,WAAW,WAAW,eAAe,OAAO,WAAW,OAAO,QAAQ,cAAc,YAAY;AAEvG,UAAM,IAAI,MAAM,6CAA6C;AAAA,EACjE;AACJ;;;AC/CA,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;;;ACPA,eAAsB,qCAAqC,WAAqD;AAC5G,QAAM,6BAA6B;AACnC,MAAI,UAAU,SAAS,YAAY,UAAU,UAAU,SAAS,WAAW;AAEvE,UAAM,IAAI,MAAM,iDAAiD;AAAA,EACrE;AACA,QAAM,iBAAiB,MAAM,OAAO,OAAO,UAAU,OAAO,SAAS;AACrE,QAAM,CAAC,oBAAoB,IAAI,6BAA6B,EAAE,YAAY,IAAI,WAAW,cAAc,CAAC;AACxG,SAAO;AACX","sourcesContent":["// Clever obfuscation to prevent the build system from inlining the value of `NODE_ENV`\nexport const __DEV__ = /* @__PURE__ */ (() => (process as any)['en' + 'v'].NODE_ENV === 'development')();\n","import { base58, Serializer, string } from '@metaplex-foundation/umi-serializers';\n\nexport type Base58EncodedAddress<TAddress extends string = string> = TAddress & {\n readonly __base58EncodedAddress: unique symbol;\n};\n\nexport function assertIsBase58EncodedAddress(\n putativeBase58EncodedAddress: string\n): asserts putativeBase58EncodedAddress is Base58EncodedAddress<typeof putativeBase58EncodedAddress> {\n try {\n // Fast-path; see if the input string is of an acceptable length.\n if (\n // Lowest address (32 bytes of zeroes)\n putativeBase58EncodedAddress.length < 32 ||\n // Highest address (32 bytes of 255)\n putativeBase58EncodedAddress.length > 44\n ) {\n throw new Error('Expected input string to decode to a byte array of length 32.');\n }\n // Slow-path; actually attempt to decode the input string.\n const bytes = base58.serialize(putativeBase58EncodedAddress);\n const numBytes = bytes.byteLength;\n if (numBytes !== 32) {\n throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${numBytes}`);\n }\n } catch (e) {\n throw new Error(`\\`${putativeBase58EncodedAddress}\\` is not a base-58 encoded address`, {\n cause: e,\n });\n }\n}\n\nexport function getBase58EncodedAddressCodec(\n config?: Readonly<{\n description: string;\n }>\n): Serializer<Base58EncodedAddress> {\n return string({\n description: config?.description ?? (__DEV__ ? 'A 32-byte account address' : ''),\n encoding: base58,\n size: 32,\n }) as unknown as Serializer<Base58EncodedAddress>;\n}\n\nexport function getBase58EncodedAddressComparator(): (x: string, y: string) => number {\n return new Intl.Collator('en', {\n caseFirst: 'lower',\n ignorePunctuation: false,\n localeMatcher: 'best fit',\n numeric: false,\n sensitivity: 'variant',\n usage: 'sort',\n }).compare;\n}\n","function assertIsSecureContext() {\n if (__BROWSER__ && !globalThis.isSecureContext) {\n // TODO: Coded error.\n throw new Error(\n 'Cryptographic operations are only allowed in secure browser contexts. Read more ' +\n 'here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts'\n );\n }\n}\n\nlet cachedEd25519Decision: PromiseLike<boolean> | boolean | undefined;\nasync function isEd25519CurveSupported(subtle: SubtleCrypto): Promise<boolean> {\n if (cachedEd25519Decision === undefined) {\n cachedEd25519Decision = new Promise(resolve => {\n subtle\n .generateKey('Ed25519', /* extractable */ false, ['sign', 'verify'])\n .catch(() => {\n resolve((cachedEd25519Decision = false));\n })\n .then(() => {\n resolve((cachedEd25519Decision = true));\n });\n });\n }\n if (typeof cachedEd25519Decision === 'boolean') {\n return cachedEd25519Decision;\n } else {\n return await cachedEd25519Decision;\n }\n}\n\nexport async function assertKeyGenerationIsAvailable() {\n assertIsSecureContext();\n if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle?.generateKey !== 'function') {\n // TODO: Coded error.\n throw new Error('No key generation implementation could be found');\n }\n if (!(await isEd25519CurveSupported(globalThis.crypto.subtle))) {\n // TODO: Coded error.\n throw new Error('This runtime does not support the generation of Ed25519 keypairs');\n }\n}\n\nexport async function assertKeyExporterIsAvailable() {\n assertIsSecureContext();\n if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle?.exportKey !== 'function') {\n // TODO: Coded error.\n throw new Error('No key export implementation could be found');\n }\n}\n\nexport async function assertSigningCapabilityIsAvailable() {\n assertIsSecureContext();\n if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle?.sign !== 'function') {\n // TODO: Coded error.\n throw new Error('No signing implementation could be found');\n }\n}\n\nexport async function assertVerificationCapabilityIsAvailable() {\n assertIsSecureContext();\n if (typeof globalThis.crypto === 'undefined' || typeof globalThis.crypto.subtle?.verify !== 'function') {\n // TODO: Coded error.\n throw new Error('No signature verification implementation could be found');\n }\n}\n","import { assertKeyGenerationIsAvailable } from './guard';\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 { Base58EncodedAddress, getBase58EncodedAddressCodec } from './base58';\nimport { assertKeyExporterIsAvailable } from './guard';\n\nexport async function getBase58EncodedAddressFromPublicKey(publicKey: CryptoKey): Promise<Base58EncodedAddress> {\n await assertKeyExporterIsAvailable();\n if (publicKey.type !== 'public' || publicKey.algorithm.name !== 'Ed25519') {\n // TODO: Coded error.\n throw new Error('The `CryptoKey` must be an `Ed25519` public key');\n }\n const publicKeyBytes = await crypto.subtle.exportKey('raw', publicKey);\n const [base58EncodedAddress] = getBase58EncodedAddressCodec().deserialize(new Uint8Array(publicKeyBytes));\n return base58EncodedAddress;\n}\n"]}
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,13 +2,15 @@ this.globalThis = this.globalThis || {};
2
2
  this.globalThis.solanaWeb3 = (function (exports) {
3
3
  'use strict';
4
4
 
5
- var U=Object.defineProperty;var O=(e,r,t)=>r in e?U(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var u=(e,r,t)=>(O(e,typeof r!="symbol"?r+"":r,t),t);var w=e=>{let r=e.reduce((n,i)=>n+i.length,0),t=new Uint8Array(r),o=0;return e.forEach(n=>{t.set(n,o),o+=n.length;}),t},I=(e,r)=>{if(e.length>=r)return e;let t=new Uint8Array(r).fill(0);return t.set(e),t},y=(e,r)=>I(e.slice(0,r),r);var g=class extends Error{constructor(t){super(`Serializer [${t}] cannot deserialize empty buffers.`);u(this,"name","DeserializingEmptyBufferError");}},f=class extends Error{constructor(t,o,n){super(`Serializer [${t}] expected ${o} bytes, got ${n}.`);u(this,"name","NotEnoughBytesError");}};function S(e,r,t){return {description:t??`fixed(${r}, ${e.description})`,fixedSize:r,maxSize:r,serialize:o=>y(e.serialize(o),r),deserialize:(o,n=0)=>{if(o=o.slice(n,n+r),o.length<r)throw new f("fixSerializer",r,o.length);e.fixedSize!==null&&(o=y(o,e.fixedSize));let[i]=e.deserialize(o,0);return [i,n+r]}}}var h=class extends Error{constructor(t,o,n){let i=`Expected a string of base ${o}, got [${t}].`;super(i);u(this,"name","InvalidBaseStringError");this.cause=n;}};var N=e=>{let r=e.length,t=BigInt(r);return {description:`base${r}`,fixedSize:null,maxSize:null,serialize(o){if(!o.match(new RegExp(`^[${e}]*$`)))throw new h(o,r);if(o==="")return new Uint8Array;let n=[...o],i=n.findIndex(d=>d!==e[0]);i=i===-1?n.length:i;let a=Array(i).fill(0);if(i===n.length)return Uint8Array.from(a);let m=n.slice(i),l=0n,c=1n;for(let d=m.length-1;d>=0;d-=1)l+=c*BigInt(e.indexOf(m[d])),c*=t;let p=[];for(;l>0n;)p.unshift(Number(l%256n)),l/=256n;return Uint8Array.from(a.concat(p))},deserialize(o,n=0){if(o.length===0)return ["",0];let i=o.slice(n),a=i.findIndex(p=>p!==0);a=a===-1?i.length:a;let m=e[0].repeat(a);if(a===i.length)return [m,o.length];let l=i.slice(a).reduce((p,d)=>p*256n+BigInt(d),0n),c=[];for(;l>0n;)c.unshift(e[Number(l%t)]),l/=t;return [m+c.join(""),o.length]}}};var E=N("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var C=e=>e.replace(/\u0000/g,"");var A={description:"utf8",fixedSize:null,maxSize:null,serialize(e){return new TextEncoder().encode(e)},deserialize(e,r=0){let t=new TextDecoder().decode(e.slice(r));return [C(t),e.length]}};var b;(function(e){e.Little="le",e.Big="be";})(b||(b={}));var z=class extends RangeError{constructor(t,o,n,i){super(`Serializer [${t}] expected number to be between ${o} and ${n}, got ${i}.`);u(this,"name","NumberOutOfRangeError");}};function $(e){let r,t=e.name;return e.size>1&&(r=!("endian"in e.options)||e.options.endian===b.Little,t+=r?"(le)":"(be)"),{description:e.options.description??t,fixedSize:e.size,maxSize:e.size,serialize(o){e.range&&L(e.name,e.range[0],e.range[1],o);let n=new ArrayBuffer(e.size);return e.set(new DataView(n),o,r),new Uint8Array(n)},deserialize(o,n=0){let i=o.slice(n,n+e.size);V("i8",i,e.size);let a=k(i);return [e.get(a,r),n+e.size]}}}var R=e=>e.buffer.slice(e.byteOffset,e.byteLength+e.byteOffset),k=e=>new DataView(R(e)),L=(e,r,t,o)=>{if(o<r||o>t)throw new z(e,r,t,o)},V=(e,r,t)=>{if(r.length===0)throw new g(e);if(r.length<t)throw new f(e,t,r.length)};var B=(e={})=>$({name:"u32",size:4,range:[0,+"0xffffffff"],set:(r,t,o)=>r.setUint32(0,Number(t),o),get:(r,t)=>r.getUint32(0,t),options:e});function D(e){return typeof e=="object"?e.description:`${e}`}function v(e={}){let r=e.size??B(),t=e.encoding??A,o=e.description??`string(${t.description}; ${D(r)})`;return r==="variable"?{...t,description:o}:typeof r=="number"?S(t,r,o):{description:o,fixedSize:null,maxSize:null,serialize:n=>{let i=t.serialize(n),a=r.serialize(i.length);return w([a,i])},deserialize:(n,i=0)=>{if(n.slice(i).length===0)throw new g("string");let[a,m]=r.deserialize(n,i),l=Number(a);i=m;let c=n.slice(i,i+l);if(c.length<l)throw new f("string",l,c.length);let[p,d]=t.deserialize(c);return i+=d,[p,i]}}}function tr(e){try{if(e.length<32||e.length>44)throw new Error("Expected input string to decode to a byte array of length 32.");let t=E.serialize(e).byteLength;if(t!==32)throw new Error(`Expected input string to decode to a byte array of length 32. Actual length: ${t}`)}catch(r){throw new Error(`\`${e}\` is not a base-58 encoded address`,{cause:r})}}function T(e){return v({description:e?.description??"",encoding:E,size:32})}function or(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}function K(){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 x;async function F(e){return x===void 0&&(x=new Promise(r=>{e.generateKey("Ed25519",!1,["sign","verify"]).catch(()=>{r(x=!1);}).then(()=>{r(x=!0);});})),typeof x=="boolean"?x:await x}async function _(){if(K(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.generateKey!="function")throw new Error("No key generation implementation could be found");if(!await F(globalThis.crypto.subtle))throw new Error("This runtime does not support the generation of Ed25519 keypairs")}async function P(){if(K(),typeof globalThis.crypto>"u"||typeof globalThis.crypto.subtle?.exportKey!="function")throw new Error("No key export implementation could be found")}async function cr(){return await _(),await crypto.subtle.generateKey("Ed25519",!1,["sign","verify"])}async function gr(e){if(await P(),e.type!=="public"||e.algorithm.name!=="Ed25519")throw new Error("The `CryptoKey` must be an `Ed25519` public key");let r=await crypto.subtle.exportKey("raw",e),[t]=T().deserialize(new Uint8Array(r));return t}
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
- exports.assertIsBase58EncodedAddress = tr;
8
- exports.generateKeyPair = cr;
9
- exports.getBase58EncodedAddressCodec = T;
10
- exports.getBase58EncodedAddressComparator = or;
11
- exports.getBase58EncodedAddressFromPublicKey = gr;
7
+ Install and import \`@solana/webcrypto-ed25519-polyfill\` before generating keys in environments that do not support Ed25519.
8
+
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
+
11
+ exports.generateKeyPair = d;
12
+ exports.signBytes = m;
13
+ exports.verifySignature = w;
12
14
 
13
15
  return exports;
14
16
 
@@ -1,4 +1,3 @@
1
- export * from './base58';
2
1
  export * from './key-pair';
3
- export * from './pubkey';
2
+ export * from './signatures';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ export type Ed25519Signature = Uint8Array & {
2
+ readonly __brand: unique symbol;
3
+ };
4
+ export declare function signBytes(key: CryptoKey, data: Uint8Array): Promise<Ed25519Signature>;
5
+ export declare function verifySignature(key: CryptoKey, signature: Ed25519Signature, data: Uint8Array): Promise<boolean>;
6
+ //# sourceMappingURL=signatures.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/keys",
3
- "version": "2.0.0-experimental.ee9f3d8",
3
+ "version": "2.0.0-experimental.f040ea3",
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
- "@metaplex-foundation/umi-serializers": "^0.8.2"
52
+ "@solana/assertions": "2.0.0-experimental.f040ea3"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@solana/eslint-config-solana": "^1.0.2",
56
- "@swc/core": "^1.3.18",
57
- "@swc/jest": "^0.2.26",
58
- "@types/jest": "^29.5.2",
59
- "@typescript-eslint/eslint-plugin": "^6.0.0",
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.6.1",
67
- "jest-environment-jsdom": "^29.6.0",
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
- "postcss": "^8.4.12",
71
- "prettier": "^2.8.8",
72
- "ts-node": "^10.9.1",
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,11 +86,12 @@
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",
96
- "test:treeshakability:native": "agadoo dist/index.node.js",
97
- "test:treeshakability:node": "agadoo dist/index.native.js",
93
+ "test:treeshakability:native": "agadoo dist/index.native.js",
94
+ "test:treeshakability:node": "agadoo dist/index.node.js",
98
95
  "test:typecheck": "tsc --noEmit",
99
96
  "test:unit:browser": "jest -c node_modules/test-config/jest-unit.config.browser.ts --rootDir . --silent",
100
97
  "test:unit:node": "jest -c node_modules/test-config/jest-unit.config.node.ts --rootDir . --silent"
@@ -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
@@ -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
@@ -1,3 +0,0 @@
1
- import { Base58EncodedAddress } from './base58';
2
- export declare function getBase58EncodedAddressFromPublicKey(publicKey: CryptoKey): Promise<Base58EncodedAddress>;
3
- //# sourceMappingURL=pubkey.d.ts.map