Skip to content

Commit

Permalink
hw-{ledger, ledger-transports}, keyring, networks, util, util-crypto,…
Browse files Browse the repository at this point in the history
… x-{bigint, fetch, global, randomvalues, textdecoder, textencoder, ws} 12.5.1
  • Loading branch information
github-actions[bot] committed Sep 15, 2023
1 parent eac706b commit 90f2482
Show file tree
Hide file tree
Showing 49 changed files with 109 additions and 68 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## master

- hw-{ledger, ledger-transports}, keyring, networks, util, util-crypto, x-{bigint, fetch, global, randomvalues, textdecoder, textencoder, ws} 12.5.1
- phishing 0.21.6
- hw-{ledger, ledger-transports}, keyring, networks, util, util-crypto, x-{bigint, fetch, global, randomvalues, textdecoder, textencoder, ws} 12.4.2
- hw-{ledger, ledger-transports}, keyring, networks, util, util-crypto, x-{bigint, fetch, global, randomvalues, textdecoder, textencoder, ws} 12.4.1
Expand Down
2 changes: 1 addition & 1 deletion hw-ledger-transports/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/hw-ledger-transports', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.4.2' };
export const packageInfo = { name: '@polkadot/hw-ledger-transports', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.5.1' };
4 changes: 2 additions & 2 deletions hw-ledger/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

import type { SubstrateApp } from 'https://esm.sh/@zondax/ledger-substrate@0.41.1';
import type { SubstrateApp } from 'https://esm.sh/@zondax/ledger-substrate@0.41.2';
import type { TransportDef, TransportType } from 'https://deno.land/x/polkadot/hw-ledger-transports/types.ts';
import type { AccountOptions, LedgerAddress, LedgerSignature, LedgerVersion } from './types.ts';

import { newSubstrateApp } from 'https://esm.sh/@zondax/ledger-substrate@0.41.1';
import { newSubstrateApp } from 'https://esm.sh/@zondax/ledger-substrate@0.41.2';

import { transports } from 'https://deno.land/x/polkadot/hw-ledger-transports/mod.ts';
import { hexAddPrefix, u8aToBuffer, u8aWrapBytes } from 'https://deno.land/x/polkadot/util/mod.ts';
Expand Down
2 changes: 2 additions & 0 deletions hw-ledger/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ export const ledgerApps: Record<string, string> = {
darwinia: 'Darwinia',
'dock-mainnet': 'Dock',
edgeware: 'Edgeware',
enjin: 'Enjin',
equilibrium: 'Equilibrium',
genshiro: 'Genshiro',
hydradx: 'HydraDX',
'interlay-parachain': 'Interlay',
karura: 'Karura',
khala: 'Khala',
kusama: 'Kusama',
matrixchain: 'Matrixchain',
nodle: 'Nodle',
origintrail: 'OriginTrail',
parallel: 'Parallel',
Expand Down
2 changes: 1 addition & 1 deletion hw-ledger/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/hw-ledger', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.4.2' };
export const packageInfo = { name: '@polkadot/hw-ledger', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.5.1' };
2 changes: 1 addition & 1 deletion keyring/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/keyring', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.4.2' };
export const packageInfo = { name: '@polkadot/keyring', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.5.1' };
12 changes: 3 additions & 9 deletions keyring/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ import type { HexString } from 'https://deno.land/x/polkadot/util/types.ts';
import type { EncryptedJson, Keypair, KeypairType, Prefix } from 'https://deno.land/x/polkadot/util-crypto/types.ts';

export interface KeyringOptions {
/**
* @description The ss58Format to use for address encoding (defaults to 42)
*/
/** The ss58Format to use for address encoding (defaults to 42) */
ss58Format?: Prefix;
/**
* @description The type of keyring to create (defaults to ed25519)
*/
/** The type of keyring to create (defaults to ed25519) */
type?: KeypairType;
}

Expand Down Expand Up @@ -74,9 +70,7 @@ export interface KeyringPair$Json extends EncryptedJson {
}

export interface SignOptions {
/**
* @description Create a MultiSignature-compatible output with an indicator type
**/
/** Create a MultiSignature-compatible output with an indicator type */
withType?: boolean;
}

Expand Down
6 changes: 6 additions & 0 deletions networks/defaults/genesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ export const knownGenesis: KnownGenesis = {
edgeware: [
'0x742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b'
],
enjin: [
'0xd8761d3c88f26dc12875c00d3165f7d67243d56fc85b4cf19937601a7916e5a9'
],
equilibrium: [
'0x6f1a800de3daff7f5e037ddf66ab22ce03ab91874debeddb1086f5f7dbd48925'
],
Expand Down Expand Up @@ -76,6 +79,9 @@ export const knownGenesis: KnownGenesis = {
'0xe3777fa922cafbff200cadeaea1a76bd7898ad5b89f7848999058b50e715f636', // Kusama CC2
'0x3fd7b9eb6a00376e5be61f01abb429ffb0b104be05eaff4d458da48fcd425baf' // Kusama CC1
],
matrixchain: [
'0x3af4ff48ec76d2efc8476730f423ac07e25ad48f5f4c9dc39c778b164d808615'
],
nodle: [
'0x97da7ede98d7bad4e36b4d734b6055425a3be036da2a332ea5a7037656427a21'
],
Expand Down
2 changes: 2 additions & 0 deletions networks/defaults/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ export const knownLedger: KnownLedger = {
darwinia: 0x00000162,
'dock-mainnet': 0x00000252,
edgeware: 0x0000020b,
enjin: 0x00000483,
equilibrium: 0x05f5e0fd,
genshiro: 0x05f5e0fc,
hydradx: 0x00000162,
'interlay-parachain': 0x00000162,
karura: 0x000002ae,
khala: 0x000001b2,
kusama: 0x000001b2,
matrixchain: 0x00000483,
nodle: 0x000003eb,
origintrail: 0x00000162,
parallel: 0x00000162,
Expand Down
2 changes: 1 addition & 1 deletion networks/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/networks', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.4.2' };
export const packageInfo = { name: '@polkadot/networks', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.5.1' };
7 changes: 7 additions & 0 deletions networks/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@ export type KnownSubstrate = RegistryEntry;
export type KnownTestnet = Record<string, true>;

export interface SubstrateNetwork extends KnownSubstrate {
/** The genesisHash for the chain */
genesisHash: HexString[];
/** Does the chain has support for Ledger devices */
hasLedgerSupport: boolean;
/** The IdentityIcon to use for the chain */
icon: Icon;
/** Flag set when we don't include this chain */
isIgnored: boolean;
/** Flag to indicate a testnet */
isTestnet: boolean;
/** The Ledger-specific/required slip44 for the chain */
slip44?: number | null;
}

export interface Network extends SubstrateNetwork {
/** The network assigned to this chain */
network: string;
}

Expand Down
2 changes: 1 addition & 1 deletion util-crypto/base32/bs32.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { utils } from 'https://esm.sh/@scure/base@1.1.1';
import { utils } from 'https://esm.sh/@scure/base@1.1.3';

import { createDecode, createEncode, createIs, createValidate } from './helpers.ts';

Expand Down
2 changes: 1 addition & 1 deletion util-crypto/base58/bs58.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { base58 } from 'https://esm.sh/@scure/base@1.1.1';
import { base58 } from 'https://esm.sh/@scure/base@1.1.3';

import { createDecode, createEncode, createIs, createValidate } from '../base32/helpers.ts';

Expand Down
2 changes: 1 addition & 1 deletion util-crypto/base64/bs64.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { base64 } from 'https://esm.sh/@scure/base@1.1.1';
import { base64 } from 'https://esm.sh/@scure/base@1.1.3';

import { createDecode, createEncode, createIs, createValidate } from '../base32/helpers.ts';

Expand Down
2 changes: 1 addition & 1 deletion util-crypto/blake2/asU8a.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { blake2b as blake2bJs } from 'https://esm.sh/@noble/hashes@1.3.1/blake2b.js';
import { blake2b as blake2bJs } from 'https://esm.sh/@noble/hashes@1.3.2/blake2b.js';

import { hasBigInt, u8aToU8a } from 'https://deno.land/x/polkadot/util/mod.ts';
import { blake2b, isReady } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';
Expand Down
2 changes: 1 addition & 1 deletion util-crypto/ed25519/pair/fromSeed.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import type { Keypair } from '../../types.ts';

import { ed25519 } from 'https://esm.sh/@noble/curves@1.1.0/ed25519.js';
import { ed25519 } from 'https://esm.sh/@noble/curves@1.2.0/ed25519.js';

import { hasBigInt, u8aConcatStrict } from 'https://deno.land/x/polkadot/util/mod.ts';
import { ed25519KeypairFromSeed, isReady } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';
Expand Down
2 changes: 1 addition & 1 deletion util-crypto/ed25519/sign.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import type { Keypair } from '../types.ts';

import { ed25519 } from 'https://esm.sh/@noble/curves@1.1.0/ed25519.js';
import { ed25519 } from 'https://esm.sh/@noble/curves@1.2.0/ed25519.js';

import { hasBigInt, u8aToU8a } from 'https://deno.land/x/polkadot/util/mod.ts';
import { ed25519Sign as wasmSign, isReady } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';
Expand Down
2 changes: 1 addition & 1 deletion util-crypto/ed25519/verify.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { ed25519 } from 'https://esm.sh/@noble/curves@1.1.0/ed25519.js';
import { ed25519 } from 'https://esm.sh/@noble/curves@1.2.0/ed25519.js';

import { hasBigInt, u8aToU8a } from 'https://deno.land/x/polkadot/util/mod.ts';
import { ed25519Verify as wasmVerify, isReady } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';
Expand Down
6 changes: 3 additions & 3 deletions util-crypto/hmac/shaAsU8a.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { hmac } from 'https://esm.sh/@noble/hashes@1.3.1/hmac.js';
import { sha256 } from 'https://esm.sh/@noble/hashes@1.3.1/sha256.js';
import { sha512 } from 'https://esm.sh/@noble/hashes@1.3.1/sha512.js';
import { hmac } from 'https://esm.sh/@noble/hashes@1.3.2/hmac.js';
import { sha256 } from 'https://esm.sh/@noble/hashes@1.3.2/sha256.js';
import { sha512 } from 'https://esm.sh/@noble/hashes@1.3.2/sha512.js';

import { hasBigInt, u8aToU8a } from 'https://deno.land/x/polkadot/util/mod.ts';
import { hmacSha256, hmacSha512, isReady } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';
Expand Down
5 changes: 5 additions & 0 deletions util-crypto/json/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ export type EncryptedJsonVersion = '0' | '1' | '2' | '3';
export type EncryptedJsonEncoding = 'none' | 'scrypt' | 'xsalsa20-poly1305';

export interface EncryptedJsonDescriptor {
/** Descriptor for the content */
content: string[];
/** The encoding (in current/latest versions this is always an array) */
type: EncryptedJsonEncoding | EncryptedJsonEncoding[];
/** The version of encoding applied */
version: EncryptedJsonVersion;
}

export interface EncryptedJson {
/** The encoded string */
encoded: string;
/** The encoding used */
encoding: EncryptedJsonDescriptor;
}
2 changes: 1 addition & 1 deletion util-crypto/keccak/asU8a.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { keccak_256 as keccak256Js, keccak_512 as keccak512Js } from 'https://esm.sh/@noble/hashes@1.3.1/sha3.js';
import { keccak_256 as keccak256Js, keccak_512 as keccak512Js } from 'https://esm.sh/@noble/hashes@1.3.2/sha3.js';

import { keccak256, keccak512 } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';

Expand Down
2 changes: 1 addition & 1 deletion util-crypto/key/extractPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DeriveJunction } from './DeriveJunction.ts';
const RE_JUNCTION = /\/(\/?)([^/]+)/g;

export interface ExtractResult {
parts: null | string[];
parts: string[] | null;
path: DeriveJunction[];
}

Expand Down
2 changes: 1 addition & 1 deletion util-crypto/key/extractSuri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function keyExtractSuri (suri: string): ExtractResult {
throw new Error('Unable to match provided value to a secret URI');
}

const [, phrase, , derivePath, , , password] = matches as string[];
const [, phrase, , derivePath, , , password] = matches;
const { path } = keyExtractPath(derivePath);

return {
Expand Down
2 changes: 1 addition & 1 deletion util-crypto/packageInfo.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export const packageInfo = { name: '@polkadot/util-crypto', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.4.2' };
export const packageInfo = { name: '@polkadot/util-crypto', path: new URL(import.meta.url).pathname, type: 'deno', version: '12.5.1' };
4 changes: 2 additions & 2 deletions util-crypto/pbkdf2/encode.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { pbkdf2 as pbkdf2Js } from 'https://esm.sh/@noble/hashes@1.3.1/pbkdf2.js';
import { sha512 } from 'https://esm.sh/@noble/hashes@1.3.1/sha512.js';
import { pbkdf2 as pbkdf2Js } from 'https://esm.sh/@noble/hashes@1.3.2/pbkdf2.js';
import { sha512 } from 'https://esm.sh/@noble/hashes@1.3.2/sha512.js';

import { hasBigInt, u8aToU8a } from 'https://deno.land/x/polkadot/util/mod.ts';
import { isReady, pbkdf2 } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';
Expand Down
4 changes: 3 additions & 1 deletion util-crypto/scrypt/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

export const DEFAULT_PARAMS = {
import type { ScryptParams } from './types.ts';

export const DEFAULT_PARAMS: ScryptParams = {
N: 1 << 15,
p: 1,
r: 8
Expand Down
6 changes: 3 additions & 3 deletions util-crypto/scrypt/encode.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import type { Params } from './types.ts';
import type { ScryptParams } from './types.ts';

import { scrypt as scryptJs } from 'https://esm.sh/@noble/hashes@1.3.1/scrypt.js';
import { scrypt as scryptJs } from 'https://esm.sh/@noble/hashes@1.3.2/scrypt.js';

import { hasBigInt, objectSpread, u8aToU8a } from 'https://deno.land/x/polkadot/util/mod.ts';
import { isReady, scrypt } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';
Expand All @@ -10,7 +10,7 @@ import { randomAsU8a } from '../random/asU8a.ts';
import { DEFAULT_PARAMS } from './defaults.ts';

interface Result {
params: Params,
params: ScryptParams,
password: Uint8Array;
salt: Uint8Array;
}
Expand Down
11 changes: 6 additions & 5 deletions util-crypto/scrypt/fromU8a.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

import type { Params } from './types.ts';
import type { ScryptParams } from './types.ts';

import { u8aToBn } from 'https://deno.land/x/polkadot/util/mod.ts';

import { BN_LE_OPTS } from '../bn.ts';
import { DEFAULT_PARAMS } from './defaults.ts';

interface Result {
params: Params,
params: ScryptParams,
salt: Uint8Array;
}

Expand All @@ -17,9 +17,10 @@ export function scryptFromU8a (data: Uint8Array): Result {
const p = u8aToBn(data.subarray(32 + 4, 32 + 8), BN_LE_OPTS).toNumber();
const r = u8aToBn(data.subarray(32 + 8, 32 + 12), BN_LE_OPTS).toNumber();

// FIXME At this moment we assume these to be fixed params, this is not a great idea since we lose flexibility
// and updates for greater security. However we need some protection against carefully-crafted params that can
// eat up CPU since these are user inputs. So we need to get very clever here, but atm we only allow the defaults
// FIXME At this moment we assume these to be fixed params, this is not a great idea
// since we lose flexibility and updates for greater security. However we need some
// protection against carefully-crafted params that can eat up CPU since these are user
// inputs. So we need to get very clever here, but atm we only allow the defaults
// and if no match, bail out
if (N !== DEFAULT_PARAMS.N || p !== DEFAULT_PARAMS.p || r !== DEFAULT_PARAMS.r) {
throw new Error('Invalid injected scrypt params found');
Expand Down
4 changes: 2 additions & 2 deletions util-crypto/scrypt/toU8a.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

import type { Params } from './types.ts';
import type { ScryptParams } from './types.ts';

import { bnToU8a, u8aConcat } from 'https://deno.land/x/polkadot/util/mod.ts';

import { BN_LE_32_OPTS } from '../bn.ts';

export function scryptToU8a (salt: Uint8Array, { N, p, r }: Params): Uint8Array {
export function scryptToU8a (salt: Uint8Array, { N, p, r }: ScryptParams): Uint8Array {
return u8aConcat(
salt,
bnToU8a(N, BN_LE_32_OPTS),
Expand Down
3 changes: 2 additions & 1 deletion util-crypto/scrypt/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

export interface Params {
/** The params that control scrypt generation */
export interface ScryptParams {
N: number;
p: number;
r: number;
Expand Down
2 changes: 1 addition & 1 deletion util-crypto/secp256k1/compress.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { secp256k1 } from 'https://esm.sh/@noble/curves@1.1.0/secp256k1.js';
import { secp256k1 } from 'https://esm.sh/@noble/curves@1.2.0/secp256k1.js';

import { hasBigInt } from 'https://deno.land/x/polkadot/util/mod.ts';
import { isReady, secp256k1Compress as wasm } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';
Expand Down
2 changes: 1 addition & 1 deletion util-crypto/secp256k1/expand.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { secp256k1 } from 'https://esm.sh/@noble/curves@1.1.0/secp256k1.js';
import { secp256k1 } from 'https://esm.sh/@noble/curves@1.2.0/secp256k1.js';

import { bnToU8a, hasBigInt, u8aConcat } from 'https://deno.land/x/polkadot/util/mod.ts';
import { isReady, secp256k1Expand as wasm } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';
Expand Down
2 changes: 1 addition & 1 deletion util-crypto/secp256k1/pair/fromSeed.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import type { Keypair } from '../../types.ts';

import { secp256k1 } from 'https://esm.sh/@noble/curves@1.1.0/secp256k1.js';
import { secp256k1 } from 'https://esm.sh/@noble/curves@1.2.0/secp256k1.js';

import { hasBigInt, u8aEmpty } from 'https://deno.land/x/polkadot/util/mod.ts';
import { isReady, secp256k1FromSeed } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';
Expand Down
2 changes: 1 addition & 1 deletion util-crypto/secp256k1/recover.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import type { HashType } from './types.ts';

import { secp256k1 } from 'https://esm.sh/@noble/curves@1.1.0/secp256k1.js';
import { secp256k1 } from 'https://esm.sh/@noble/curves@1.2.0/secp256k1.js';

import { hasBigInt, u8aToU8a } from 'https://deno.land/x/polkadot/util/mod.ts';
import { isReady, secp256k1Recover as wasm } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';
Expand Down
2 changes: 1 addition & 1 deletion util-crypto/secp256k1/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { Keypair } from '../types.ts';
import type { HashType } from './types.ts';

import { secp256k1 } from 'https://esm.sh/@noble/curves@1.1.0/secp256k1.js';
import { secp256k1 } from 'https://esm.sh/@noble/curves@1.2.0/secp256k1.js';

import { bnToU8a, hasBigInt, u8aConcat } from 'https://deno.land/x/polkadot/util/mod.ts';
import { isReady, secp256k1Sign as wasm } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';
Expand Down
4 changes: 2 additions & 2 deletions util-crypto/sha/asU8a.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { sha256 as sha256Js } from 'https://esm.sh/@noble/hashes@1.3.1/sha256.js';
import { sha512 as sha512Js } from 'https://esm.sh/@noble/hashes@1.3.1/sha512.js';
import { sha256 as sha256Js } from 'https://esm.sh/@noble/hashes@1.3.2/sha256.js';
import { sha512 as sha512Js } from 'https://esm.sh/@noble/hashes@1.3.2/sha512.js';

import { sha256, sha512 } from 'https://deno.land/x/polkadot/wasm-crypto/mod.ts';

Expand Down
Loading

0 comments on commit 90f2482

Please sign in to comment.