@polkadot/keyring
Advanced tools
Comparing version 12.3.2 to 12.6.1
@@ -9,2 +9,3 @@ (function (global, factory) { | ||
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; | ||
const PKCS8_DIVIDER = new Uint8Array([161, 35, 3, 33, 0]); | ||
@@ -210,5 +211,3 @@ const PKCS8_HEADER = new Uint8Array([48, 83, 2, 1, 1, 48, 5, 6, 3, 43, 101, 112, 4, 34, 4, 32]); | ||
class Pairs { | ||
constructor() { | ||
this.__internal__map = {}; | ||
} | ||
__internal__map = {}; | ||
add(pair) { | ||
@@ -245,9 +244,7 @@ this.__internal__map[utilCrypto.decodeAddress(pair.address).toString()] = pair; | ||
class Keyring { | ||
__internal__pairs; | ||
__internal__type; | ||
__internal__ss58; | ||
decodeAddress = utilCrypto.decodeAddress; | ||
constructor(options = {}) { | ||
this.decodeAddress = utilCrypto.decodeAddress; | ||
this.encodeAddress = (address, ss58Format) => { | ||
return this.type === 'ethereum' | ||
? utilCrypto.ethereumEncode(address) | ||
: utilCrypto.encodeAddress(address, ss58Format ?? this.__internal__ss58); | ||
}; | ||
options.type = options.type || 'ed25519'; | ||
@@ -347,2 +344,7 @@ if (!['ecdsa', 'ethereum', 'ed25519', 'sr25519'].includes(options.type || 'undefined')) { | ||
} | ||
encodeAddress = (address, ss58Format) => { | ||
return this.type === 'ethereum' | ||
? utilCrypto.ethereumEncode(address) | ||
: utilCrypto.encodeAddress(address, ss58Format ?? this.__internal__ss58); | ||
}; | ||
getPair(address) { | ||
@@ -368,3 +370,3 @@ return this.__internal__pairs.get(address); | ||
const packageInfo = { name: '@polkadot/keyring', path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '12.3.2' }; | ||
const packageInfo = { name: '@polkadot/keyring', path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.src || new URL('bundle-polkadot-keyring.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '12.6.1' }; | ||
@@ -465,3 +467,3 @@ const PAIRSSR25519 = [ | ||
isTesting: true, | ||
name: name || (seed && seed.replace('//', '_').toLowerCase()) | ||
name: name || seed?.replace('//', '_').toLowerCase() | ||
}; | ||
@@ -530,3 +532,5 @@ } | ||
for (const p of pairs) { | ||
map[p.meta.name] = p; | ||
if (p.meta.name) { | ||
map[p.meta.name] = p; | ||
} | ||
} | ||
@@ -533,0 +537,0 @@ return map; |
@@ -35,13 +35,7 @@ "use strict"; | ||
class Keyring { | ||
__internal__pairs; | ||
__internal__type; | ||
__internal__ss58; | ||
decodeAddress = util_crypto_1.decodeAddress; | ||
constructor(options = {}) { | ||
this.decodeAddress = util_crypto_1.decodeAddress; | ||
/** | ||
* @name encodeAddress | ||
* @description Encodes the input into an ss58 representation | ||
*/ | ||
this.encodeAddress = (address, ss58Format) => { | ||
return this.type === 'ethereum' | ||
? (0, util_crypto_1.ethereumEncode)(address) | ||
: (0, util_crypto_1.encodeAddress)(address, ss58Format ?? this.__internal__ss58); | ||
}; | ||
options.type = options.type || 'ed25519'; | ||
@@ -209,2 +203,11 @@ if (!['ecdsa', 'ethereum', 'ed25519', 'sr25519'].includes(options.type || 'undefined')) { | ||
/** | ||
* @name encodeAddress | ||
* @description Encodes the input into an ss58 representation | ||
*/ | ||
encodeAddress = (address, ss58Format) => { | ||
return this.type === 'ethereum' | ||
? (0, util_crypto_1.ethereumEncode)(address) | ||
: (0, util_crypto_1.encodeAddress)(address, ss58Format ?? this.__internal__ss58); | ||
}; | ||
/** | ||
* @name getPair | ||
@@ -211,0 +214,0 @@ * @summary Retrieves an account keyring pair from the Keyring Pair Dictionary, given an account address |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.packageInfo = void 0; | ||
exports.packageInfo = { name: '@polkadot/keyring', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '12.3.2' }; | ||
exports.packageInfo = { name: '@polkadot/keyring', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '12.6.1' }; |
@@ -7,5 +7,3 @@ "use strict"; | ||
class Pairs { | ||
constructor() { | ||
this.__internal__map = {}; | ||
} | ||
__internal__map = {}; | ||
add(pair) { | ||
@@ -12,0 +10,0 @@ this.__internal__map[(0, util_crypto_1.decodeAddress)(pair.address).toString()] = pair; |
@@ -101,3 +101,3 @@ "use strict"; | ||
isTesting: true, | ||
name: name || (seed && seed.replace('//', '_').toLowerCase()) | ||
name: name || seed?.replace('//', '_').toLowerCase() | ||
}; | ||
@@ -104,0 +104,0 @@ } |
@@ -11,3 +11,5 @@ "use strict"; | ||
for (const p of pairs) { | ||
map[p.meta.name] = p; | ||
if (p.meta.name) { | ||
map[p.meta.name] = p; | ||
} | ||
} | ||
@@ -14,0 +16,0 @@ return map; |
@@ -32,13 +32,7 @@ import { hexToU8a, isHex, stringToU8a } from '@polkadot/util'; | ||
export class Keyring { | ||
__internal__pairs; | ||
__internal__type; | ||
__internal__ss58; | ||
decodeAddress = decodeAddress; | ||
constructor(options = {}) { | ||
this.decodeAddress = decodeAddress; | ||
/** | ||
* @name encodeAddress | ||
* @description Encodes the input into an ss58 representation | ||
*/ | ||
this.encodeAddress = (address, ss58Format) => { | ||
return this.type === 'ethereum' | ||
? ethereumEncode(address) | ||
: encodeAddress(address, ss58Format ?? this.__internal__ss58); | ||
}; | ||
options.type = options.type || 'ed25519'; | ||
@@ -206,2 +200,11 @@ if (!['ecdsa', 'ethereum', 'ed25519', 'sr25519'].includes(options.type || 'undefined')) { | ||
/** | ||
* @name encodeAddress | ||
* @description Encodes the input into an ss58 representation | ||
*/ | ||
encodeAddress = (address, ss58Format) => { | ||
return this.type === 'ethereum' | ||
? ethereumEncode(address) | ||
: encodeAddress(address, ss58Format ?? this.__internal__ss58); | ||
}; | ||
/** | ||
* @name getPair | ||
@@ -208,0 +211,0 @@ * @summary Retrieves an account keyring pair from the Keyring Pair Dictionary, given an account address |
@@ -6,3 +6,3 @@ { | ||
"engines": { | ||
"node": ">=16" | ||
"node": ">=18" | ||
}, | ||
@@ -22,3 +22,3 @@ "homepage": "https://github.com/polkadot-js/common/tree/master/packages/keyring#readme", | ||
"type": "module", | ||
"version": "12.3.2", | ||
"version": "12.6.1", | ||
"main": "./cjs/index.js", | ||
@@ -150,10 +150,10 @@ "module": "./index.js", | ||
"dependencies": { | ||
"@polkadot/util": "12.3.2", | ||
"@polkadot/util-crypto": "12.3.2", | ||
"tslib": "^2.5.3" | ||
"@polkadot/util": "12.6.1", | ||
"@polkadot/util-crypto": "12.6.1", | ||
"tslib": "^2.6.2" | ||
}, | ||
"peerDependencies": { | ||
"@polkadot/util": "12.3.2", | ||
"@polkadot/util-crypto": "12.3.2" | ||
"@polkadot/util": "12.6.1", | ||
"@polkadot/util-crypto": "12.6.1" | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
export const packageInfo = { name: '@polkadot/keyring', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '12.3.2' }; | ||
export const packageInfo = { name: '@polkadot/keyring', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '12.6.1' }; |
@@ -1,2 +0,1 @@ | ||
import type { HexString } from '@polkadot/util/types'; | ||
import type { KeyringPair, KeyringPairs } from './types.js'; | ||
@@ -7,4 +6,4 @@ export declare class Pairs implements KeyringPairs { | ||
all(): KeyringPair[]; | ||
get(address: HexString | string | Uint8Array): KeyringPair; | ||
remove(address: HexString | string | Uint8Array): void; | ||
get(address: string | Uint8Array): KeyringPair; | ||
remove(address: string | Uint8Array): void; | ||
} |
import { isHex, isU8a, u8aToHex, u8aToU8a } from '@polkadot/util'; | ||
import { decodeAddress } from '@polkadot/util-crypto'; | ||
export class Pairs { | ||
constructor() { | ||
this.__internal__map = {}; | ||
} | ||
__internal__map = {}; | ||
add(pair) { | ||
@@ -8,0 +6,0 @@ this.__internal__map[decodeAddress(pair.address).toString()] = pair; |
@@ -98,3 +98,3 @@ import { hexToU8a } from '@polkadot/util'; | ||
isTesting: true, | ||
name: name || (seed && seed.replace('//', '_').toLowerCase()) | ||
name: name || seed?.replace('//', '_').toLowerCase() | ||
}; | ||
@@ -101,0 +101,0 @@ } |
@@ -8,5 +8,7 @@ import { nobody } from './pair/nobody.js'; | ||
for (const p of pairs) { | ||
map[p.meta.name] = p; | ||
if (p.meta.name) { | ||
map[p.meta.name] = p; | ||
} | ||
} | ||
return map; | ||
} |
import type { HexString } from '@polkadot/util/types'; | ||
import type { EncryptedJson, Keypair, KeypairType, Prefix } from '@polkadot/util-crypto/types'; | ||
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; | ||
@@ -60,3 +56,3 @@ } | ||
/** The ss58 encoded address or the hex-encoded version (the latter is for ETH-compat chains) */ | ||
address: string | HexString; | ||
address: string; | ||
/** The underlying metadata associated with the keypair */ | ||
@@ -66,5 +62,3 @@ meta: KeyringPair$Meta; | ||
export interface SignOptions { | ||
/** | ||
* @description Create a MultiSignature-compatible output with an indicator type | ||
**/ | ||
/** Create a MultiSignature-compatible output with an indicator type */ | ||
withType?: boolean; | ||
@@ -84,8 +78,8 @@ } | ||
setMeta(meta: KeyringPair$Meta): void; | ||
sign(message: HexString | string | Uint8Array, options?: SignOptions): Uint8Array; | ||
sign(message: string | Uint8Array, options?: SignOptions): Uint8Array; | ||
toJson(passphrase?: string): KeyringPair$Json; | ||
unlock(passphrase?: string): void; | ||
verify(message: HexString | string | Uint8Array, signature: Uint8Array, signerPublic: HexString | string | Uint8Array): boolean; | ||
vrfSign(message: HexString | string | Uint8Array, context?: HexString | string | Uint8Array, extra?: HexString | string | Uint8Array): Uint8Array; | ||
vrfVerify(message: HexString | string | Uint8Array, vrfResult: Uint8Array, signerPublic: HexString | Uint8Array | string, context?: HexString | string | Uint8Array, extra?: HexString | string | Uint8Array): boolean; | ||
verify(message: string | Uint8Array, signature: Uint8Array, signerPublic: string | Uint8Array): boolean; | ||
vrfSign(message: string | Uint8Array, context?: string | Uint8Array, extra?: string | Uint8Array): Uint8Array; | ||
vrfVerify(message: string | Uint8Array, vrfResult: Uint8Array, signerPublic: string | Uint8Array, context?: string | Uint8Array, extra?: string | Uint8Array): boolean; | ||
} | ||
@@ -92,0 +86,0 @@ export interface KeyringPairs { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2460
129959
+ Added@noble/curves@1.6.0(transitive)
+ Added@noble/hashes@1.5.0(transitive)
+ Added@polkadot/networks@12.6.1(transitive)
+ Added@polkadot/util@12.6.1(transitive)
+ Added@polkadot/util-crypto@12.6.1(transitive)
+ Added@polkadot/x-bigint@12.6.1(transitive)
+ Added@polkadot/x-global@12.6.1(transitive)
+ Added@polkadot/x-randomvalues@12.6.1(transitive)
+ Added@polkadot/x-textdecoder@12.6.1(transitive)
+ Added@polkadot/x-textencoder@12.6.1(transitive)
+ Added@scure/base@1.1.9(transitive)
- Removed@noble/curves@1.1.0(transitive)
- Removed@noble/hashes@1.3.1(transitive)
- Removed@polkadot/networks@12.3.2(transitive)
- Removed@polkadot/util@12.3.2(transitive)
- Removed@polkadot/util-crypto@12.3.2(transitive)
- Removed@polkadot/x-bigint@12.3.2(transitive)
- Removed@polkadot/x-global@12.3.2(transitive)
- Removed@polkadot/x-randomvalues@12.3.2(transitive)
- Removed@polkadot/x-textdecoder@12.3.2(transitive)
- Removed@polkadot/x-textencoder@12.3.2(transitive)
- Removed@scure/base@1.1.1(transitive)
Updated@polkadot/util@12.6.1
Updated@polkadot/util-crypto@12.6.1
Updatedtslib@^2.6.2