Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@scure/base

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scure/base - npm Package Compare versions

Comparing version 1.1.8 to 1.1.9

19

index.ts

@@ -483,3 +483,3 @@ /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */

words: number[] | Uint8Array,
limit: number | false
limit?: number | false
): `${Lowercase<Prefix>}1${string}`;

@@ -490,2 +490,3 @@ decode<Prefix extends string>(

): Bech32Decoded<Prefix>;
encodeFromBytes(prefix: string, bytes: Uint8Array): string;
decodeToBytes(str: string): Bech32DecodedWithArray;

@@ -514,2 +515,3 @@ decodeUnsafe(str: string, limit?: number | false): void | Bech32Decoded<string>;

throw new Error(`bech32.encode prefix should be string, not ${typeof prefix}`);
if (words instanceof Uint8Array) words = Array.from(words);
if (!Array.isArray(words) || (words.length && typeof words[0] !== 'number'))

@@ -559,3 +561,16 @@ throw new Error(`bech32.encode words should be array of numbers, not ${typeof words}`);

return { encode, decode, decodeToBytes, decodeUnsafe, fromWords, fromWordsUnsafe, toWords };
function encodeFromBytes(prefix: string, bytes: Uint8Array) {
return encode(prefix, toWords(bytes));
}
return {
encode,
decode,
encodeFromBytes,
decodeToBytes,
decodeUnsafe,
fromWords,
fromWordsUnsafe,
toWords,
};
}

@@ -562,0 +577,0 @@

3

lib/esm/index.d.ts

@@ -103,4 +103,5 @@ /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */

export interface Bech32 {
encode<Prefix extends string>(prefix: Prefix, words: number[] | Uint8Array, limit: number | false): `${Lowercase<Prefix>}1${string}`;
encode<Prefix extends string>(prefix: Prefix, words: number[] | Uint8Array, limit?: number | false): `${Lowercase<Prefix>}1${string}`;
decode<Prefix extends string>(str: `${Prefix}1${string}`, limit?: number | false): Bech32Decoded<Prefix>;
encodeFromBytes(prefix: string, bytes: Uint8Array): string;
decodeToBytes(str: string): Bech32DecodedWithArray;

@@ -107,0 +108,0 @@ decodeUnsafe(str: string, limit?: number | false): void | Bech32Decoded<string>;

@@ -403,2 +403,4 @@ /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */

throw new Error(`bech32.encode prefix should be string, not ${typeof prefix}`);
if (words instanceof Uint8Array)
words = Array.from(words);
if (!Array.isArray(words) || (words.length && typeof words[0] !== 'number'))

@@ -442,3 +444,15 @@ throw new Error(`bech32.encode words should be array of numbers, not ${typeof words}`);

}
return { encode, decode, decodeToBytes, decodeUnsafe, fromWords, fromWordsUnsafe, toWords };
function encodeFromBytes(prefix, bytes) {
return encode(prefix, toWords(bytes));
}
return {
encode,
decode,
encodeFromBytes,
decodeToBytes,
decodeUnsafe,
fromWords,
fromWordsUnsafe,
toWords,
};
}

@@ -445,0 +459,0 @@ export const bech32 = /* @__PURE__ */ genBech32('bech32');

@@ -103,4 +103,5 @@ /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */

export interface Bech32 {
encode<Prefix extends string>(prefix: Prefix, words: number[] | Uint8Array, limit: number | false): `${Lowercase<Prefix>}1${string}`;
encode<Prefix extends string>(prefix: Prefix, words: number[] | Uint8Array, limit?: number | false): `${Lowercase<Prefix>}1${string}`;
decode<Prefix extends string>(str: `${Prefix}1${string}`, limit?: number | false): Bech32Decoded<Prefix>;
encodeFromBytes(prefix: string, bytes: Uint8Array): string;
decodeToBytes(str: string): Bech32DecodedWithArray;

@@ -107,0 +108,0 @@ decodeUnsafe(str: string, limit?: number | false): void | Bech32Decoded<string>;

@@ -408,2 +408,4 @@ "use strict";

throw new Error(`bech32.encode prefix should be string, not ${typeof prefix}`);
if (words instanceof Uint8Array)
words = Array.from(words);
if (!Array.isArray(words) || (words.length && typeof words[0] !== 'number'))

@@ -447,3 +449,15 @@ throw new Error(`bech32.encode words should be array of numbers, not ${typeof words}`);

}
return { encode, decode, decodeToBytes, decodeUnsafe, fromWords, fromWordsUnsafe, toWords };
function encodeFromBytes(prefix, bytes) {
return encode(prefix, toWords(bytes));
}
return {
encode,
decode,
encodeFromBytes,
decodeToBytes,
decodeUnsafe,
fromWords,
fromWordsUnsafe,
toWords,
};
}

@@ -450,0 +464,0 @@ exports.bech32 = genBech32('bech32');

{
"name": "@scure/base",
"version": "1.1.8",
"version": "1.1.9",
"description": "Secure, audited & 0-dep implementation of base64, bech32, base58, base32 & base16",

@@ -5,0 +5,0 @@ "files": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc