Skip to content

Commit 1719108

Browse files
fixup! feat!: remove async from crypto API
1 parent 0d664a6 commit 1719108

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

packages/crypto/src/Bip32/Bip32PrivateKey.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class Bip32PrivateKey {
7171
* - 32 bytes: Ed25519 curve scalar from which few bits have been tweaked according to ED25519-BIP32
7272
* - 32 bytes: Ed25519 binary blob used as IV for signing
7373
*
74-
* NOTE: You must call `Crypto.ready()` at least once before calling this function.
74+
* NOTE: You must await `Crypto.ready()` at least once before calling this function.
7575
*
7676
* @param entropy Random stream of bytes generated from a BIP39 seed phrase.
7777
* @param password The second factor authentication password for the mnemonic phrase.
@@ -125,7 +125,7 @@ export class Bip32PrivateKey {
125125
* This is why deriving the private key should not fail while deriving
126126
* the public key may fail (if the derivation index is invalid).
127127
*
128-
* NOTE: You must call `Crypto.ready()` at least once before calling this function.
128+
* NOTE: You must await `Crypto.ready()` at least once before calling this function.
129129
*
130130
* @param derivationIndices The derivation indices.
131131
* @returns The child BIP-32 key.
@@ -148,7 +148,7 @@ export class Bip32PrivateKey {
148148
/**
149149
* Computes the BIP-32 public key from this BIP-32 private key.
150150
*
151-
* NOTE: You must call `Crypto.ready()` at least once before calling this function.
151+
* NOTE: You must await `Crypto.ready()` at least once before calling this function.
152152
*
153153
* @returns the public key.
154154
*/

packages/crypto/src/Bip32/Bip32PublicKey.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class Bip32PublicKey {
5353
/**
5454
* Given a set of indices, this function computes the corresponding child extended key.
5555
*
56-
* NOTE: You must call `Crypto.ready()` at least once before calling this function.
56+
* NOTE: You must await `Crypto.ready()` at least once before calling this function.
5757
*
5858
* @param derivationIndices The list of derivation indices.
5959
* @returns The child extended private key.
@@ -78,7 +78,7 @@ export class Bip32PublicKey {
7878
return Bip32PublicKeyHex(Buffer.from(this.#key).toString('hex'));
7979
}
8080

81-
/** Gets the blake2 hash of the key. NOTE: You must call `Crypto.ready()` at least once before calling this function. */
81+
/** Gets the blake2 hash of the key. NOTE: You must await `Crypto.ready()` at least once before calling this function. */
8282
hash(): Bip32PublicKeyHashHex {
8383
const hash = sodium.crypto_generichash(BIP32_PUBLIC_KEY_HASH_LENGTH, this.#key);
8484
return Bip32PublicKeyHashHex(Buffer.from(hash).toString('hex'));

packages/crypto/src/Ed25519e/Ed25519PrivateKey.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class Ed25519PrivateKey {
7878
/**
7979
* Computes the raw public key from this raw private key.
8080
*
81-
* NOTE: You must call `Crypto.ready()` at least once before calling this function.
81+
* NOTE: You must await `Crypto.ready()` at least once before calling this function.
8282
*
8383
* @returns the public key.
8484
*/
@@ -93,7 +93,7 @@ export class Ed25519PrivateKey {
9393
/**
9494
* Generates an Ed25519 signature.
9595
*
96-
* NOTE: You must call `Crypto.ready()` at least once before calling this function.
96+
* NOTE: You must await `Crypto.ready()` at least once before calling this function.
9797
*
9898
* @param message The message to be signed.
9999
* @returns The Ed25519 digital signature.

packages/crypto/src/Ed25519e/Ed25519PublicKey.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class Ed25519PublicKey {
2626
* Verifies that the passed-in signature was generated with a private key that matches
2727
* the given public key.
2828
*
29-
* NOTE: You must call `Crypto.ready()` at least once before calling this function.
29+
* NOTE: You must await `Crypto.ready()` at least once before calling this function.
3030
*
3131
* @param signature The signature bytes to be verified.
3232
* @param message The original message the signature was computed from.
@@ -59,7 +59,7 @@ export class Ed25519PublicKey {
5959
return Ed25519PublicKey.fromBytes(Buffer.from(keyMaterial, 'hex'));
6060
}
6161

62-
/** Gets the blake2 hash of the key material. NOTE: You must call `Crypto.ready()` at least once before calling this function. */
62+
/** Gets the blake2 hash of the key material. NOTE: You must await `Crypto.ready()` at least once before calling this function. */
6363
hash(): Ed25519KeyHash {
6464
const hash = sodium.crypto_generichash(ED25519_PUBLIC_KEY_HASH_LENGTH, this.#keyMaterial);
6565
return Ed25519KeyHash.fromBytes(hash);

packages/crypto/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ export * from './strategies';
99
export * from './hexTypes';
1010
export * from './types';
1111

12-
/** This function must be called before any other function in this module. it is safe to call this function multiple times. */
12+
/** This function must be awaited before calling any other function in this module. It is safe to await this function multiple times. */
1313
export const ready = async (): Promise<void> => await sodium.ready;

0 commit comments

Comments
 (0)