mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-21 23:48:05 +00:00
ec06da0ebc
- Package namespace: @polkadot/* -> @pezkuwi/* - Repository: polkadot-js/common -> pezkuwichain/pezkuwi-common - Author: Pezkuwi Team <team@pezkuwichain.io> Core packages: - @pezkuwi/util (utilities) - @pezkuwi/util-crypto (crypto primitives) - @pezkuwi/keyring (account management) - @pezkuwi/networks (chain metadata) - @pezkuwi/hw-ledger (Ledger hardware wallet) - @pezkuwi/x-* (10 polyfill packages) Total: 14 packages Upstream: polkadot-js/common v14.0.1
21 lines
674 B
TypeScript
21 lines
674 B
TypeScript
// Copyright 2017-2025 @polkadot/keyring authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import type { KeypairType } from '@pezkuwi/util-crypto/types';
|
|
import type { KeyringPair$Json, KeyringPair$Meta } from '../types.js';
|
|
|
|
import { objectSpread } from '@pezkuwi/util';
|
|
import { jsonEncryptFormat } from '@pezkuwi/util-crypto';
|
|
|
|
interface PairStateJson {
|
|
address: string;
|
|
meta: KeyringPair$Meta;
|
|
}
|
|
|
|
export function pairToJson (type: KeypairType, { address, meta }: PairStateJson, encoded: Uint8Array, isEncrypted: boolean): KeyringPair$Json {
|
|
return objectSpread(jsonEncryptFormat(encoded, ['pkcs8', type], isEncrypted), {
|
|
address,
|
|
meta
|
|
});
|
|
}
|