diff --git a/packages/sdk38/src/wallet.spec.ts b/packages/sdk38/src/wallet.spec.ts index c83b07ac..8217c95c 100644 --- a/packages/sdk38/src/wallet.spec.ts +++ b/packages/sdk38/src/wallet.spec.ts @@ -69,10 +69,10 @@ describe("Secp256k1Wallet", () => { }); }); - describe("save", () => { + describe("serialize", () => { it("can save with password", async () => { const wallet = await Secp256k1Wallet.fromMnemonic(defaultMnemonic); - const serialized = await wallet.save("123"); + const serialized = await wallet.serialize("123"); expect(JSON.parse(serialized)).toEqual( jasmine.objectContaining({ type: "v1", @@ -96,7 +96,7 @@ describe("Secp256k1Wallet", () => { }); }); - describe("saveWithEncryptionKey", () => { + describe("serializeWithEncryptionKey", () => { it("can save with password", async () => { const wallet = await Secp256k1Wallet.fromMnemonic(defaultMnemonic); @@ -106,7 +106,7 @@ describe("Secp256k1Wallet", () => { opsLimit: 321, memLimitKib: 11 * 1024, }; - const serialized = await wallet.saveWithEncryptionKey(key, customKdfParams); + const serialized = await wallet.serializeWithEncryptionKey(key, customKdfParams); expect(JSON.parse(serialized)).toEqual( jasmine.objectContaining({ type: "v1", diff --git a/packages/sdk38/src/wallet.ts b/packages/sdk38/src/wallet.ts index 602d9484..330e49a0 100644 --- a/packages/sdk38/src/wallet.ts +++ b/packages/sdk38/src/wallet.ts @@ -241,22 +241,22 @@ export class Secp256k1Wallet implements OfflineSigner { * @param password The user provided password used to generate an encryption key via a KDF. * This is not normalized internally (see "Unicode normalization" to learn more). */ - public async save(password: string): Promise { + public async serialize(password: string): Promise { const kdfOption = basicPasswordHashingOptions; const encryptionKey = await Argon2id.execute(password, secp256k1WalletSalt, kdfOption); - return this.saveWithEncryptionKey(encryptionKey, kdfOption); + return this.serializeWithEncryptionKey(encryptionKey, kdfOption); } /** * Generates an encrypted serialization of this wallet. * - * This is an advanced alternative of calling `save(password)` directly, which allows you to + * This is an advanced alternative of calling `serialize(password)` directly, which allows you to * offload the KDF execution to an non-UI thread (e.g. in a WebWorker). * * The caller is responsible for ensuring the key was derived with the given kdf options. If this * is not the case, the wallet cannot be restored with the original password. */ - public async saveWithEncryptionKey( + public async serializeWithEncryptionKey( encryptionKey: Uint8Array, kdfOptions: Argon2idOptions, ): Promise { diff --git a/packages/sdk38/types/wallet.d.ts b/packages/sdk38/types/wallet.d.ts index 486513b5..9cb46ede 100644 --- a/packages/sdk38/types/wallet.d.ts +++ b/packages/sdk38/types/wallet.d.ts @@ -100,15 +100,15 @@ export declare class Secp256k1Wallet implements OfflineSigner { * @param password The user provided password used to generate an encryption key via a KDF. * This is not normalized internally (see "Unicode normalization" to learn more). */ - save(password: string): Promise; + serialize(password: string): Promise; /** * Generates an encrypted serialization of this wallet. * - * This is an advanced alternative of calling `save(password)` directly, which allows you to + * This is an advanced alternative of calling `serialize(password)` directly, which allows you to * offload the KDF execution to an non-UI thread (e.g. in a WebWorker). * * The caller is responsible for ensuring the key was derived with the given kdf options. If this * is not the case, the wallet cannot be restored with the original password. */ - saveWithEncryptionKey(encryptionKey: Uint8Array, kdfOptions: Argon2idOptions): Promise; + serializeWithEncryptionKey(encryptionKey: Uint8Array, kdfOptions: Argon2idOptions): Promise; }