1 | // Copyright 2017-2022 @polkadot/util-crypto authors & contributors
|
2 | // SPDX-License-Identifier: Apache-2.0
|
3 | import { assert, hexToU8a, isHex } from '@polkadot/util';
|
4 | import { base64Decode } from "../base64/index.js";
|
5 | import { jsonDecryptData } from "./decryptData.js";
|
6 | export function jsonDecrypt({
|
7 | encoded,
|
8 | encoding
|
9 | }, passphrase) {
|
10 | assert(encoded, 'No encrypted data available to decode');
|
11 | return jsonDecryptData(isHex(encoded) ? hexToU8a(encoded) : base64Decode(encoded), passphrase, Array.isArray(encoding.type) ? encoding.type : [encoding.type]);
|
12 | } |
\ | No newline at end of file |