Skip to content

Commit 6bc8077

Browse files
authored
Merge pull request #1797 from dynst/desalinate-deprecate
amino: mark encryption functions as `@deprecated`
2 parents 1264c2c + 9b37759 commit 6bc8077

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

packages/amino/src/secp256k1hdwallet.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ export class Secp256k1HdWallet implements OfflineAminoSigner {
171171
*
172172
* @param password The user provided password used to generate an encryption key via a KDF.
173173
* This is not normalized internally (see "Unicode normalization" to learn more).
174+
*
175+
* @deprecated Encryption support may be removed from CosmJS in a future version. If you actually use this, comment at https://github.com/cosmos/cosmjs/issues/1796
174176
*/
175177
public static async deserialize(serialization: string, password: string): Promise<Secp256k1HdWallet> {
176178
const root = JSON.parse(serialization);
@@ -191,6 +193,8 @@ export class Secp256k1HdWallet implements OfflineAminoSigner {
191193
*
192194
* The caller is responsible for ensuring the key was derived with the given KDF configuration. This can be
193195
* done using `extractKdfConfiguration(serialization)` and `executeKdf(password, kdfConfiguration)` from this package.
196+
*
197+
* @deprecated Encryption support may be removed from CosmJS in a future version. If you actually use this, comment at https://github.com/cosmos/cosmjs/issues/1796
194198
*/
195199
public static async deserializeWithEncryptionKey(
196200
serialization: string,
@@ -290,6 +294,8 @@ export class Secp256k1HdWallet implements OfflineAminoSigner {
290294
*
291295
* @param password The user provided password used to generate an encryption key via a KDF.
292296
* This is not normalized internally (see "Unicode normalization" to learn more).
297+
*
298+
* @deprecated Encryption support may be removed from CosmJS in a future version. If you actually use this, comment at https://github.com/cosmos/cosmjs/issues/1796
293299
*/
294300
public async serialize(password: string): Promise<string> {
295301
const kdfConfiguration = basicPasswordHashingOptions;
@@ -305,6 +311,8 @@ export class Secp256k1HdWallet implements OfflineAminoSigner {
305311
*
306312
* The caller is responsible for ensuring the key was derived with the given KDF options. If this
307313
* is not the case, the wallet cannot be restored with the original password.
314+
*
315+
* @deprecated Encryption support may be removed from CosmJS in a future version. If you actually use this, comment at https://github.com/cosmos/cosmjs/issues/1796
308316
*/
309317
public async serializeWithEncryptionKey(
310318
encryptionKey: Uint8Array,

packages/amino/src/wallet.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export interface KdfConfiguration {
2323
readonly params: Record<string, unknown>;
2424
}
2525

26+
/**
27+
* @deprecated Encryption support may be removed from CosmJS in a future version. If you actually use this, comment at https://github.com/cosmos/cosmjs/issues/1796
28+
*/
2629
export async function executeKdf(password: string, configuration: KdfConfiguration): Promise<Uint8Array> {
2730
switch (configuration.algorithm) {
2831
case "argon2id": {
@@ -52,6 +55,9 @@ export const supportedAlgorithms = {
5255
xchacha20poly1305Ietf: "xchacha20poly1305-ietf",
5356
};
5457

58+
/**
59+
* @deprecated Encryption support may be removed from CosmJS in a future version. If you actually use this, comment at https://github.com/cosmos/cosmjs/issues/1796
60+
*/
5561
export async function encrypt(
5662
plaintext: Uint8Array,
5763
encryptionKey: Uint8Array,
@@ -71,6 +77,9 @@ export async function encrypt(
7177
}
7278
}
7379

80+
/**
81+
* @deprecated Encryption support may be removed from CosmJS in a future version. If you actually use this, comment at https://github.com/cosmos/cosmjs/issues/1796
82+
*/
7483
export async function decrypt(
7584
ciphertext: Uint8Array,
7685
encryptionKey: Uint8Array,

packages/proto-signing/src/directsecp256k1hdwallet.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ export class DirectSecp256k1HdWallet implements OfflineDirectSigner {
170170
*
171171
* @param password The user provided password used to generate an encryption key via a KDF.
172172
* This is not normalized internally (see "Unicode normalization" to learn more).
173+
*
174+
* @deprecated Encryption support may be removed from CosmJS in a future version. If you actually use this, comment at https://github.com/cosmos/cosmjs/issues/1796
173175
*/
174176
public static async deserialize(serialization: string, password: string): Promise<DirectSecp256k1HdWallet> {
175177
const root = JSON.parse(serialization);
@@ -189,6 +191,8 @@ export class DirectSecp256k1HdWallet implements OfflineDirectSigner {
189191
*
190192
* The caller is responsible for ensuring the key was derived with the given KDF configuration. This can be
191193
* done using `extractKdfConfiguration(serialization)` and `executeKdf(password, kdfConfiguration)` from this package.
194+
*
195+
* @deprecated Encryption support may be removed from CosmJS in a future version. If you actually use this, comment at https://github.com/cosmos/cosmjs/issues/1796
192196
*/
193197
public static async deserializeWithEncryptionKey(
194198
serialization: string,
@@ -290,6 +294,8 @@ export class DirectSecp256k1HdWallet implements OfflineDirectSigner {
290294
*
291295
* @param password The user provided password used to generate an encryption key via a KDF.
292296
* This is not normalized internally (see "Unicode normalization" to learn more).
297+
*
298+
* @deprecated Encryption support may be removed from CosmJS in a future version. If you actually use this, comment at https://github.com/cosmos/cosmjs/issues/1796
293299
*/
294300
public async serialize(password: string): Promise<string> {
295301
const kdfConfiguration = basicPasswordHashingOptions;
@@ -305,6 +311,8 @@ export class DirectSecp256k1HdWallet implements OfflineDirectSigner {
305311
*
306312
* The caller is responsible for ensuring the key was derived with the given KDF options. If this
307313
* is not the case, the wallet cannot be restored with the original password.
314+
*
315+
* @deprecated Encryption support may be removed from CosmJS in a future version. If you actually use this, comment at https://github.com/cosmos/cosmjs/issues/1796
308316
*/
309317
public async serializeWithEncryptionKey(
310318
encryptionKey: Uint8Array,

0 commit comments

Comments
 (0)