Socket
Socket
Sign inDemoInstall

multiformats

Package Overview
Dependencies
Maintainers
2
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multiformats - npm Package Compare versions

Comparing version 9.6.5 to 9.7.0

bases/base256emoji

70

cjs/browser-test/test-multibase-spec.js

@@ -111,2 +111,6 @@ 'use strict';

'URGVjZW50cmFsaXplIGV2ZXJ5dGhpbmchIQ=='
],
[
'base256emoji',
'\uD83D\uDE80\uD83D\uDC9B\u270B\uD83D\uDC83\u270B\uD83D\uDE3B\uD83D\uDE08\uD83E\uDD7A\uD83E\uDD24\uD83C\uDF40\uD83C\uDF1F\uD83D\uDC90\u270B\uD83D\uDE05\u270B\uD83D\uDCA6\u270B\uD83E\uDD7A\uD83C\uDFC3\uD83D\uDE08\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE3B\uD83D\uDE1D\uD83D\uDC4F\uD83D\uDC4F'
]

@@ -209,2 +213,6 @@ ]

'UeWVzIG1hbmkgIQ=='
],
[
'base256emoji',
'\uD83D\uDE80\uD83C\uDFC3\u270B\uD83C\uDF08\uD83D\uDE05\uD83C\uDF37\uD83E\uDD24\uD83D\uDE3B\uD83C\uDF1F\uD83D\uDE05\uD83D\uDC4F'
]

@@ -307,2 +315,6 @@ ]

'UaGVsbG8gd29ybGQ='
],
[
'base256emoji',
'\uD83D\uDE80\uD83D\uDE34\u270B\uD83C\uDF40\uD83C\uDF40\uD83D\uDE13\uD83D\uDE05\u2714\uD83D\uDE13\uD83E\uDD7A\uD83C\uDF40\uD83D\uDE33'
]

@@ -405,2 +417,6 @@ ]

'UAHllcyBtYW5pICE='
],
[
'base256emoji',
'\uD83D\uDE80\uD83D\uDE80\uD83C\uDFC3\u270B\uD83C\uDF08\uD83D\uDE05\uD83C\uDF37\uD83E\uDD24\uD83D\uDE3B\uD83C\uDF1F\uD83D\uDE05\uD83D\uDC4F'
]

@@ -503,55 +519,6 @@ ]

'UAAB5ZXMgbWFuaSAh'
]
]
},
{
input: 'hello world',
tests: [
[
'base16',
'f68656c6c6f20776f726c64'
],
[
'base16upper',
'F68656C6C6F20776F726C64'
],
[
'base32',
'bnbswy3dpeb3w64tmmq'
],
[
'base32upper',
'BNBSWY3DPEB3W64TMMQ'
],
[
'base32hex',
'vd1imor3f41rmusjccg'
],
[
'base32hexupper',
'VD1IMOR3F41RMUSJCCG'
],
[
'base32pad',
'cnbswy3dpeb3w64tmmq======'
],
[
'base32padupper',
'CNBSWY3DPEB3W64TMMQ======'
],
[
'base32hexpad',
'td1imor3f41rmusjccg======'
],
[
'base32hexpadupper',
'TD1IMOR3F41RMUSJCCG======'
],
[
'base36',
'kfuvrsivvnfrbjwajo'
],
[
'base36upper',
'KFUVRSIVVNFRBJWAJO'
'base256emoji',
'\uD83D\uDE80\uD83D\uDE80\uD83D\uDE80\uD83C\uDFC3\u270B\uD83C\uDF08\uD83D\uDE05\uD83C\uDF37\uD83E\uDD24\uD83D\uDE3B\uD83C\uDF1F\uD83D\uDE05\uD83D\uDC4F'
]

@@ -584,3 +551,2 @@ ]

}
console.info('expect', `Non-${ base.name } character`);
assert.throws(() => base.decode(base.prefix + '^!@$%!#$%@#y'), `Non-${ base.name } character`);

@@ -587,0 +553,0 @@ });

@@ -166,3 +166,3 @@ 'use strict';

const block$1 = await block.encode({
value: value,
value,
codec: json,

@@ -169,0 +169,0 @@ hasher: sha2Browser.sha256

@@ -111,2 +111,6 @@ 'use strict';

'URGVjZW50cmFsaXplIGV2ZXJ5dGhpbmchIQ=='
],
[
'base256emoji',
'\uD83D\uDE80\uD83D\uDC9B\u270B\uD83D\uDC83\u270B\uD83D\uDE3B\uD83D\uDE08\uD83E\uDD7A\uD83E\uDD24\uD83C\uDF40\uD83C\uDF1F\uD83D\uDC90\u270B\uD83D\uDE05\u270B\uD83D\uDCA6\u270B\uD83E\uDD7A\uD83C\uDFC3\uD83D\uDE08\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE3B\uD83D\uDE1D\uD83D\uDC4F\uD83D\uDC4F'
]

@@ -209,2 +213,6 @@ ]

'UeWVzIG1hbmkgIQ=='
],
[
'base256emoji',
'\uD83D\uDE80\uD83C\uDFC3\u270B\uD83C\uDF08\uD83D\uDE05\uD83C\uDF37\uD83E\uDD24\uD83D\uDE3B\uD83C\uDF1F\uD83D\uDE05\uD83D\uDC4F'
]

@@ -307,2 +315,6 @@ ]

'UaGVsbG8gd29ybGQ='
],
[
'base256emoji',
'\uD83D\uDE80\uD83D\uDE34\u270B\uD83C\uDF40\uD83C\uDF40\uD83D\uDE13\uD83D\uDE05\u2714\uD83D\uDE13\uD83E\uDD7A\uD83C\uDF40\uD83D\uDE33'
]

@@ -405,2 +417,6 @@ ]

'UAHllcyBtYW5pICE='
],
[
'base256emoji',
'\uD83D\uDE80\uD83D\uDE80\uD83C\uDFC3\u270B\uD83C\uDF08\uD83D\uDE05\uD83C\uDF37\uD83E\uDD24\uD83D\uDE3B\uD83C\uDF1F\uD83D\uDE05\uD83D\uDC4F'
]

@@ -503,55 +519,6 @@ ]

'UAAB5ZXMgbWFuaSAh'
]
]
},
{
input: 'hello world',
tests: [
[
'base16',
'f68656c6c6f20776f726c64'
],
[
'base16upper',
'F68656C6C6F20776F726C64'
],
[
'base32',
'bnbswy3dpeb3w64tmmq'
],
[
'base32upper',
'BNBSWY3DPEB3W64TMMQ'
],
[
'base32hex',
'vd1imor3f41rmusjccg'
],
[
'base32hexupper',
'VD1IMOR3F41RMUSJCCG'
],
[
'base32pad',
'cnbswy3dpeb3w64tmmq======'
],
[
'base32padupper',
'CNBSWY3DPEB3W64TMMQ======'
],
[
'base32hexpad',
'td1imor3f41rmusjccg======'
],
[
'base32hexpadupper',
'TD1IMOR3F41RMUSJCCG======'
],
[
'base36',
'kfuvrsivvnfrbjwajo'
],
[
'base36upper',
'KFUVRSIVVNFRBJWAJO'
'base256emoji',
'\uD83D\uDE80\uD83D\uDE80\uD83D\uDE80\uD83C\uDFC3\u270B\uD83C\uDF08\uD83D\uDE05\uD83C\uDF37\uD83E\uDD24\uD83D\uDE3B\uD83C\uDF1F\uD83D\uDE05\uD83D\uDC4F'
]

@@ -584,3 +551,2 @@ ]

}
console.info('expect', `Non-${ base.name } character`);
assert.throws(() => base.decode(base.prefix + '^!@$%!#$%@#y'), `Non-${ base.name } character`);

@@ -587,0 +553,0 @@ });

@@ -166,3 +166,3 @@ 'use strict';

const block$1 = await block.encode({
value: value,
value,
codec: json,

@@ -169,0 +169,0 @@ hasher: sha2.sha256

@@ -26,2 +26,6 @@ 'use strict';

this.prefix = prefix;
if (prefix.codePointAt(0) === undefined) {
throw new Error('Invalid prefix character');
}
this.prefixCodePoint = prefix.codePointAt(0);
this.baseDecode = baseDecode;

@@ -31,10 +35,6 @@ }

if (typeof text === 'string') {
switch (text[0]) {
case this.prefix: {
return this.baseDecode(text.slice(1));
}
default: {
throw Error(`Unable to decode multibase string ${ JSON.stringify(text) }, ${ this.name } decoder only supports inputs prefixed with ${ this.prefix }`);
}
if (text.codePointAt(0) !== this.prefixCodePoint) {
throw Error(`Unable to decode multibase string ${ JSON.stringify(text) }, ${ this.name } decoder only supports inputs prefixed with ${ this.prefix }`);
}
return this.baseDecode(text.slice(this.prefix.length));
} else {

@@ -41,0 +41,0 @@ throw Error('Can only multibase decode strings');

@@ -14,2 +14,3 @@ 'use strict';

var base64 = require('./bases/base64.js');
var base256emoji = require('./bases/base256emoji.js');
var sha2 = require('./hashes/sha2.js');

@@ -35,3 +36,4 @@ var identity$1 = require('./hashes/identity.js');

...base58,
...base64
...base64,
...base256emoji
};

@@ -38,0 +40,0 @@ const hashes = {

@@ -103,2 +103,6 @@ 'use strict';

'URGVjZW50cmFsaXplIGV2ZXJ5dGhpbmchIQ=='
],
[
'base256emoji',
'\uD83D\uDE80\uD83D\uDC9B\u270B\uD83D\uDC83\u270B\uD83D\uDE3B\uD83D\uDE08\uD83E\uDD7A\uD83E\uDD24\uD83C\uDF40\uD83C\uDF1F\uD83D\uDC90\u270B\uD83D\uDE05\u270B\uD83D\uDCA6\u270B\uD83E\uDD7A\uD83C\uDFC3\uD83D\uDE08\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE3B\uD83D\uDE1D\uD83D\uDC4F\uD83D\uDC4F'
]

@@ -201,2 +205,6 @@ ]

'UeWVzIG1hbmkgIQ=='
],
[
'base256emoji',
'\uD83D\uDE80\uD83C\uDFC3\u270B\uD83C\uDF08\uD83D\uDE05\uD83C\uDF37\uD83E\uDD24\uD83D\uDE3B\uD83C\uDF1F\uD83D\uDE05\uD83D\uDC4F'
]

@@ -299,2 +307,6 @@ ]

'UaGVsbG8gd29ybGQ='
],
[
'base256emoji',
'\uD83D\uDE80\uD83D\uDE34\u270B\uD83C\uDF40\uD83C\uDF40\uD83D\uDE13\uD83D\uDE05\u2714\uD83D\uDE13\uD83E\uDD7A\uD83C\uDF40\uD83D\uDE33'
]

@@ -397,2 +409,6 @@ ]

'UAHllcyBtYW5pICE='
],
[
'base256emoji',
'\uD83D\uDE80\uD83D\uDE80\uD83C\uDFC3\u270B\uD83C\uDF08\uD83D\uDE05\uD83C\uDF37\uD83E\uDD24\uD83D\uDE3B\uD83C\uDF1F\uD83D\uDE05\uD83D\uDC4F'
]

@@ -495,55 +511,6 @@ ]

'UAAB5ZXMgbWFuaSAh'
]
]
},
{
input: 'hello world',
tests: [
[
'base16',
'f68656c6c6f20776f726c64'
],
[
'base16upper',
'F68656C6C6F20776F726C64'
],
[
'base32',
'bnbswy3dpeb3w64tmmq'
],
[
'base32upper',
'BNBSWY3DPEB3W64TMMQ'
],
[
'base32hex',
'vd1imor3f41rmusjccg'
],
[
'base32hexupper',
'VD1IMOR3F41RMUSJCCG'
],
[
'base32pad',
'cnbswy3dpeb3w64tmmq======'
],
[
'base32padupper',
'CNBSWY3DPEB3W64TMMQ======'
],
[
'base32hexpad',
'td1imor3f41rmusjccg======'
],
[
'base32hexpadupper',
'TD1IMOR3F41RMUSJCCG======'
],
[
'base36',
'kfuvrsivvnfrbjwajo'
],
[
'base36upper',
'KFUVRSIVVNFRBJWAJO'
'base256emoji',
'\uD83D\uDE80\uD83D\uDE80\uD83D\uDE80\uD83C\uDFC3\u270B\uD83C\uDF08\uD83D\uDE05\uD83C\uDF37\uD83E\uDD24\uD83D\uDE3B\uD83C\uDF1F\uD83D\uDE05\uD83D\uDC4F'
]

@@ -576,3 +543,2 @@ ]

}
console.info('expect', `Non-${ base.name } character`);
assert.throws(() => base.decode(base.prefix + '^!@$%!#$%@#y'), `Non-${ base.name } character`);

@@ -579,0 +545,0 @@ });

@@ -143,3 +143,3 @@ import * as codec from '../src/codecs/json.js';

const block = await main.encode({
value: value,
value,
codec,

@@ -146,0 +146,0 @@ hasher

@@ -103,2 +103,6 @@ 'use strict';

'URGVjZW50cmFsaXplIGV2ZXJ5dGhpbmchIQ=='
],
[
'base256emoji',
'\uD83D\uDE80\uD83D\uDC9B\u270B\uD83D\uDC83\u270B\uD83D\uDE3B\uD83D\uDE08\uD83E\uDD7A\uD83E\uDD24\uD83C\uDF40\uD83C\uDF1F\uD83D\uDC90\u270B\uD83D\uDE05\u270B\uD83D\uDCA6\u270B\uD83E\uDD7A\uD83C\uDFC3\uD83D\uDE08\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE3B\uD83D\uDE1D\uD83D\uDC4F\uD83D\uDC4F'
]

@@ -201,2 +205,6 @@ ]

'UeWVzIG1hbmkgIQ=='
],
[
'base256emoji',
'\uD83D\uDE80\uD83C\uDFC3\u270B\uD83C\uDF08\uD83D\uDE05\uD83C\uDF37\uD83E\uDD24\uD83D\uDE3B\uD83C\uDF1F\uD83D\uDE05\uD83D\uDC4F'
]

@@ -299,2 +307,6 @@ ]

'UaGVsbG8gd29ybGQ='
],
[
'base256emoji',
'\uD83D\uDE80\uD83D\uDE34\u270B\uD83C\uDF40\uD83C\uDF40\uD83D\uDE13\uD83D\uDE05\u2714\uD83D\uDE13\uD83E\uDD7A\uD83C\uDF40\uD83D\uDE33'
]

@@ -397,2 +409,6 @@ ]

'UAHllcyBtYW5pICE='
],
[
'base256emoji',
'\uD83D\uDE80\uD83D\uDE80\uD83C\uDFC3\u270B\uD83C\uDF08\uD83D\uDE05\uD83C\uDF37\uD83E\uDD24\uD83D\uDE3B\uD83C\uDF1F\uD83D\uDE05\uD83D\uDC4F'
]

@@ -495,55 +511,6 @@ ]

'UAAB5ZXMgbWFuaSAh'
]
]
},
{
input: 'hello world',
tests: [
[
'base16',
'f68656c6c6f20776f726c64'
],
[
'base16upper',
'F68656C6C6F20776F726C64'
],
[
'base32',
'bnbswy3dpeb3w64tmmq'
],
[
'base32upper',
'BNBSWY3DPEB3W64TMMQ'
],
[
'base32hex',
'vd1imor3f41rmusjccg'
],
[
'base32hexupper',
'VD1IMOR3F41RMUSJCCG'
],
[
'base32pad',
'cnbswy3dpeb3w64tmmq======'
],
[
'base32padupper',
'CNBSWY3DPEB3W64TMMQ======'
],
[
'base32hexpad',
'td1imor3f41rmusjccg======'
],
[
'base32hexpadupper',
'TD1IMOR3F41RMUSJCCG======'
],
[
'base36',
'kfuvrsivvnfrbjwajo'
],
[
'base36upper',
'KFUVRSIVVNFRBJWAJO'
'base256emoji',
'\uD83D\uDE80\uD83D\uDE80\uD83D\uDE80\uD83C\uDFC3\u270B\uD83C\uDF08\uD83D\uDE05\uD83C\uDF37\uD83E\uDD24\uD83D\uDE3B\uD83C\uDF1F\uD83D\uDE05\uD83D\uDC4F'
]

@@ -576,3 +543,2 @@ ]

}
console.info('expect', `Non-${ base.name } character`);
assert.throws(() => base.decode(base.prefix + '^!@$%!#$%@#y'), `Non-${ base.name } character`);

@@ -579,0 +545,0 @@ });

@@ -143,3 +143,3 @@ import * as codec from '../src/codecs/json.js';

const block = await main.encode({
value: value,
value,
codec,

@@ -146,0 +146,0 @@ hasher

@@ -21,2 +21,6 @@ import basex from '../../vendor/base-x.js';

this.prefix = prefix;
if (prefix.codePointAt(0) === undefined) {
throw new Error('Invalid prefix character');
}
this.prefixCodePoint = prefix.codePointAt(0);
this.baseDecode = baseDecode;

@@ -26,10 +30,6 @@ }

if (typeof text === 'string') {
switch (text[0]) {
case this.prefix: {
return this.baseDecode(text.slice(1));
}
default: {
throw Error(`Unable to decode multibase string ${ JSON.stringify(text) }, ${ this.name } decoder only supports inputs prefixed with ${ this.prefix }`);
}
if (text.codePointAt(0) !== this.prefixCodePoint) {
throw Error(`Unable to decode multibase string ${ JSON.stringify(text) }, ${ this.name } decoder only supports inputs prefixed with ${ this.prefix }`);
}
return this.baseDecode(text.slice(this.prefix.length));
} else {

@@ -36,0 +36,0 @@ throw Error('Can only multibase decode strings');

@@ -10,2 +10,3 @@ import * as identityBase from './bases/identity.js';

import * as base64 from './bases/base64.js';
import * as base256emoji from './bases/base256emoji.js';
import * as sha2 from './hashes/sha2.js';

@@ -31,3 +32,4 @@ import * as identity from './hashes/identity.js';

...base58,
...base64
...base64,
...base256emoji
};

@@ -34,0 +36,0 @@ const hashes = {

{
"name": "multiformats",
"version": "9.6.5",
"version": "9.7.0",
"description": "Interface for multihash, multicodec, multibase and CID",

@@ -110,2 +110,7 @@ "main": "./cjs/src/index.js",

},
"./bases/base256emoji": {
"browser": "./esm/src/bases/base256emoji.js",
"require": "./cjs/src/bases/base256emoji.js",
"import": "./esm/src/bases/base256emoji.js"
},
"./hashes/hasher": {

@@ -149,3 +154,3 @@ "browser": "./esm/src/hashes/hasher.js",

"@types/mocha": "^9.0.0",
"@types/node": "^17.0.0",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.6.0",

@@ -292,2 +297,3 @@ "@typescript-eslint/parser": "^5.6.0",

"./bases/base64": "./cjs/src/bases/base64.js",
"./bases/base256emoji": "./cjs/src/bases/base256emoji.js",
"./hashes/hasher": "./cjs/src/hashes/hasher.js",

@@ -294,0 +300,0 @@ "./hashes/digest": "./cjs/src/hashes/digest.js",

@@ -199,2 +199,4 @@ # multiformats

Other (less useful) bases implemented in [multiformats/js-multiformats](https://github.com/multiformats/js-multiformats/tree/master/bases) include: `base2`, `base8`, `base10`, `base36` and `base256emoji`.
### Multihash hashers

@@ -201,0 +203,0 @@

@@ -87,2 +87,8 @@ import basex from '../../vendor/base-x.js'

this.prefix = prefix
/* c8 ignore next 3 */
if (prefix.codePointAt(0) === undefined) {
throw new Error('Invalid prefix character')
}
/** @private */
this.prefixCodePoint = /** @type {number} */ (prefix.codePointAt(0))
this.baseDecode = baseDecode

@@ -96,10 +102,6 @@ }

if (typeof text === 'string') {
switch (text[0]) {
case this.prefix: {
return this.baseDecode(text.slice(1))
}
default: {
throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)
}
if (text.codePointAt(0) !== this.prefixCodePoint) {
throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`)
}
return this.baseDecode(text.slice(this.prefix.length))
} else {

@@ -106,0 +108,0 @@ throw Error('Can only multibase decode strings')

@@ -12,2 +12,3 @@ // @ts-check

import * as base64 from './bases/base64.js'
import * as base256emoji from './bases/base256emoji.js'
import * as sha2 from './hashes/sha2.js'

@@ -21,3 +22,3 @@ import * as identity from './hashes/identity.js'

const bases = { ...identityBase, ...base2, ...base8, ...base10, ...base16, ...base32, ...base36, ...base58, ...base64 }
const bases = { ...identityBase, ...base2, ...base8, ...base10, ...base16, ...base32, ...base36, ...base58, ...base64, ...base256emoji }
const hashes = { ...sha2, ...identity }

@@ -24,0 +25,0 @@ const codecs = { raw, json }

@@ -200,5 +200,5 @@ import * as varint from './varint.js'

// If value isn't instance of this CID class but `this.asCID === this` is
// true it is CID instance coming from a different implemnetation (diff
// true it is CID instance coming from a different implementation (diff
// version or duplicate). In that case we rebase it to this `CID`
// implemnetation so caller is guaranteed to get instance with expected
// implementation so caller is guaranteed to get instance with expected
// API.

@@ -205,0 +205,0 @@ const { version, code, multihash, bytes } = value

@@ -38,3 +38,4 @@ /* eslint-env mocha */

['base64url', 'uRGVjZW50cmFsaXplIGV2ZXJ5dGhpbmchIQ'],
['base64urlpad', 'URGVjZW50cmFsaXplIGV2ZXJ5dGhpbmchIQ==']
['base64urlpad', 'URGVjZW50cmFsaXplIGV2ZXJ5dGhpbmchIQ=='],
['base256emoji', 'πŸš€πŸ’›βœ‹πŸ’ƒβœ‹πŸ˜»πŸ˜ˆπŸ₯ΊπŸ€€πŸ€πŸŒŸπŸ’βœ‹πŸ˜…βœ‹πŸ’¦βœ‹πŸ₯ΊπŸƒπŸ˜ˆπŸ˜΄πŸŒŸπŸ˜»πŸ˜πŸ‘πŸ‘']
]

@@ -67,3 +68,4 @@ },

['base64url', 'ueWVzIG1hbmkgIQ'],
['base64urlpad', 'UeWVzIG1hbmkgIQ==']
['base64urlpad', 'UeWVzIG1hbmkgIQ=='],
['base256emoji', 'πŸš€πŸƒβœ‹πŸŒˆπŸ˜…πŸŒ·πŸ€€πŸ˜»πŸŒŸπŸ˜…πŸ‘']
]

@@ -96,3 +98,4 @@ },

['base64url', 'uaGVsbG8gd29ybGQ'],
['base64urlpad', 'UaGVsbG8gd29ybGQ=']
['base64urlpad', 'UaGVsbG8gd29ybGQ='],
['base256emoji', 'πŸš€πŸ˜΄βœ‹πŸ€πŸ€πŸ˜“πŸ˜…βœ”πŸ˜“πŸ₯ΊπŸ€πŸ˜³']
]

@@ -125,3 +128,4 @@ },

['base64url', 'uAHllcyBtYW5pICE'],
['base64urlpad', 'UAHllcyBtYW5pICE=']
['base64urlpad', 'UAHllcyBtYW5pICE='],
['base256emoji', 'πŸš€πŸš€πŸƒβœ‹πŸŒˆπŸ˜…πŸŒ·πŸ€€πŸ˜»πŸŒŸπŸ˜…πŸ‘']
]

@@ -154,21 +158,5 @@ },

['base64url', 'uAAB5ZXMgbWFuaSAh'],
['base64urlpad', 'UAAB5ZXMgbWFuaSAh']
['base64urlpad', 'UAAB5ZXMgbWFuaSAh'],
['base256emoji', 'πŸš€πŸš€πŸš€πŸƒβœ‹πŸŒˆπŸ˜…πŸŒ·πŸ€€πŸ˜»πŸŒŸπŸ˜…πŸ‘']
]
},
{
input: 'hello world',
tests: [
['base16', 'f68656c6c6f20776f726c64'],
['base16upper', 'F68656C6C6F20776F726C64'],
['base32', 'bnbswy3dpeb3w64tmmq'],
['base32upper', 'BNBSWY3DPEB3W64TMMQ'],
['base32hex', 'vd1imor3f41rmusjccg'],
['base32hexupper', 'VD1IMOR3F41RMUSJCCG'],
['base32pad', 'cnbswy3dpeb3w64tmmq======'],
['base32padupper', 'CNBSWY3DPEB3W64TMMQ======'],
['base32hexpad', 'td1imor3f41rmusjccg======'],
['base32hexpadupper', 'TD1IMOR3F41RMUSJCCG======'],
['base36', 'kfuvrsivvnfrbjwajo'],
['base36upper', 'KFUVRSIVVNFRBJWAJO']
]
}

@@ -204,3 +192,2 @@ ]

console.info('expect', `Non-${base.name} character`)
assert.throws(() => base.decode(base.prefix + '^!@$%!#$%@#y'), `Non-${base.name} character`)

@@ -207,0 +194,0 @@ })

@@ -166,3 +166,3 @@ /* globals describe, it */

const value = createNode(fromString('test'), links)
const block = await main.encode({ value: value, codec, hasher })
const block = await main.encode({ value, codec, hasher })
const cid = block.cid

@@ -169,0 +169,0 @@ const expectedCallArray = [cid.toString()]

@@ -168,2 +168,4 @@ export function or<L extends string, R extends string>(left: import("./interface").UnibaseDecoder<L> | import("./interface").CombobaseDecoder<L>, right: import("./interface").UnibaseDecoder<R> | import("./interface").CombobaseDecoder<R>): ComposedDecoder<L | R>;

prefix: Prefix;
/** @private */
private prefixCodePoint;
baseDecode: (text: string) => Uint8Array;

@@ -170,0 +172,0 @@ /**

@@ -17,2 +17,3 @@ import { CID } from "./index.js";

export const bases: {
base256emoji: import("./bases/base.js").Codec<"base256emoji", "πŸš€">;
base64: import("./bases/base.js").Codec<"base64", "m">;

@@ -19,0 +20,0 @@ base64pad: import("./bases/base.js").Codec<"base64pad", "M">;

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