Local base58 alphabet check for better errors (#622)
* Local base58 alphabet check for better errors
* Rewrite yarn.lock
* Align error return values
* Split base58{Encode, Decode}
* base58Encode input types
* Function names, some docs
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import bs58 from 'bs58';
|
||||
import { u8aToBuffer, u8aToU8a } from '@polkadot/util';
|
||||
|
||||
/**
|
||||
* @name base58Encode
|
||||
* @summary Creates a base58 value.
|
||||
* @description
|
||||
* From the provided input, create the base58 and return the result as a string.
|
||||
*/
|
||||
export default function base58Encode (value: Uint8Array | string | Buffer | number[]): string {
|
||||
return bs58.encode(
|
||||
u8aToBuffer(u8aToU8a(value))
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user