@iota/signing
Advanced tools
Comparing version 1.0.0-beta.5 to 1.0.0-beta.6
@@ -7,2 +7,3 @@ "use strict"; | ||
var pad_1 = require("@iota/pad"); | ||
require("../../typed-array"); | ||
var add_1 = require("./add"); | ||
@@ -26,11 +27,11 @@ var errors = require("./errors"); | ||
var indexTrits = converter_1.fromValue(index); | ||
var subseed = add_1["default"](seed, indexTrits); | ||
while (subseed.length % 243 !== 0) { | ||
subseed = pad_1.padTrits(subseed.length + 3)(subseed); | ||
var subseedTrits = add_1["default"](seed, indexTrits); | ||
while (subseedTrits.length % 243 !== 0) { | ||
subseedTrits = pad_1.padTrits(subseedTrits.length + 3)(subseedTrits); | ||
} | ||
var kerl = new kerl_1["default"](); | ||
kerl.initialize(); | ||
kerl.absorb(subseed, 0, subseed.length); | ||
kerl.squeeze(subseed, 0, subseed.length); | ||
return subseed; | ||
kerl.absorb(subseedTrits, 0, subseedTrits.length); | ||
kerl.squeeze(subseedTrits, 0, subseedTrits.length); | ||
return subseedTrits; | ||
} | ||
@@ -41,3 +42,3 @@ exports.subseed = subseed; | ||
* | ||
* @param {Int8Array} subseed - Subseed trits | ||
* @param {Int8Array} subseedTrits - Subseed trits | ||
* @param {number} length - Private key length | ||
@@ -47,4 +48,4 @@ * | ||
*/ | ||
function key(subseed, length) { | ||
if (subseed.length % 3 !== 0) { | ||
function key(subseedTrits, length) { | ||
if (subseedTrits.length % 3 !== 0) { | ||
throw new Error(errors.ILLEGAL_SUBSEED_LENGTH); | ||
@@ -54,3 +55,3 @@ } | ||
kerl.initialize(); | ||
kerl.absorb(subseed, 0, subseed.length); | ||
kerl.absorb(subseedTrits, 0, subseedTrits.length); | ||
var buffer = new Int8Array(kerl_1["default"].HASH_LENGTH); | ||
@@ -61,3 +62,3 @@ var result = new Int8Array(length * 27 * 243); | ||
for (var i = 0; i < 27; i++) { | ||
kerl.squeeze(buffer, 0, subseed.length); | ||
kerl.squeeze(buffer, 0, subseedTrits.length); | ||
for (var j = 0; j < 243; j++) { | ||
@@ -64,0 +65,0 @@ result[offset++] = buffer[j]; |
{ | ||
"name": "@iota/signing", | ||
"version": "1.0.0-beta.5", | ||
"version": "1.0.0-beta.6", | ||
"description": "IOTA Signing Scheme", | ||
@@ -13,3 +13,4 @@ "main": "./out/signing/src/index.js", | ||
"test": "tsc", | ||
"format": "prettier", | ||
"test-ci": "echo \"Warning: no test specified\" && exit 0", | ||
"lint": "tslint --project .", | ||
"docs": "tsc && jsdoc2md --no-cache --plugin dmd-clear -t README_tpl.hbs --files './out/**/*.js' > README.md" | ||
@@ -47,6 +48,6 @@ }, | ||
"dependencies": { | ||
"@iota/converter": "^1.0.0-beta.5", | ||
"@iota/kerl": "^1.0.0-beta.5", | ||
"@iota/pad": "^1.0.0-beta.5" | ||
"@iota/converter": "^1.0.0-beta.6", | ||
"@iota/kerl": "^1.0.0-beta.6", | ||
"@iota/pad": "^1.0.0-beta.6" | ||
} | ||
} |
@@ -6,5 +6,6 @@ /** @module signing */ | ||
import { padTrits } from '@iota/pad' | ||
import '../../typed-array' | ||
import { Hash } from '../../types' | ||
import add from './add' | ||
import * as errors from './errors' | ||
import { Hash } from '../../types' | ||
@@ -29,6 +30,6 @@ /** | ||
const indexTrits = fromValue(index) | ||
let subseed: Int8Array = add(seed, indexTrits) | ||
let subseedTrits: Int8Array = add(seed, indexTrits) | ||
while (subseed.length % 243 !== 0) { | ||
subseed = padTrits(subseed.length + 3)(subseed) | ||
while (subseedTrits.length % 243 !== 0) { | ||
subseedTrits = padTrits(subseedTrits.length + 3)(subseedTrits) | ||
} | ||
@@ -39,6 +40,6 @@ | ||
kerl.initialize() | ||
kerl.absorb(subseed, 0, subseed.length) | ||
kerl.squeeze(subseed, 0, subseed.length) | ||
kerl.absorb(subseedTrits, 0, subseedTrits.length) | ||
kerl.squeeze(subseedTrits, 0, subseedTrits.length) | ||
return subseed | ||
return subseedTrits | ||
} | ||
@@ -49,3 +50,3 @@ | ||
* | ||
* @param {Int8Array} subseed - Subseed trits | ||
* @param {Int8Array} subseedTrits - Subseed trits | ||
* @param {number} length - Private key length | ||
@@ -55,4 +56,4 @@ * | ||
*/ | ||
export function key(subseed: Int8Array, length: number): Int8Array { | ||
if (subseed.length % 3 !== 0) { | ||
export function key(subseedTrits: Int8Array, length: number): Int8Array { | ||
if (subseedTrits.length % 3 !== 0) { | ||
throw new Error(errors.ILLEGAL_SUBSEED_LENGTH) | ||
@@ -64,3 +65,3 @@ } | ||
kerl.initialize() | ||
kerl.absorb(subseed, 0, subseed.length) | ||
kerl.absorb(subseedTrits, 0, subseedTrits.length) | ||
@@ -73,3 +74,3 @@ const buffer = new Int8Array(Kerl.HASH_LENGTH) | ||
for (let i = 0; i < 27; i++) { | ||
kerl.squeeze(buffer, 0, subseed.length) | ||
kerl.squeeze(buffer, 0, subseedTrits.length) | ||
for (let j = 0; j < 243; j++) { | ||
@@ -76,0 +77,0 @@ result[offset++] = buffer[j] |
@@ -0,1 +1,3 @@ | ||
/** @module signing */ | ||
import '../../typed-array'; | ||
/** | ||
@@ -13,3 +15,3 @@ * @method subseed | ||
* | ||
* @param {Int8Array} subseed - Subseed trits | ||
* @param {Int8Array} subseedTrits - Subseed trits | ||
* @param {number} length - Private key length | ||
@@ -19,3 +21,3 @@ * | ||
*/ | ||
export declare function key(subseed: Int8Array, length: number): Int8Array; | ||
export declare function key(subseedTrits: Int8Array, length: number): Int8Array; | ||
/** | ||
@@ -22,0 +24,0 @@ * @method digests |
@@ -1,2 +0,1 @@ | ||
/// <reference types="bluebird" /> | ||
import * as Promise from 'bluebird'; | ||
@@ -72,3 +71,3 @@ export declare type Maybe<T> = T | void; | ||
CHECK_CONSISTENCY = "checkConsistency", | ||
WERE_ADDRESSES_SPENT_FROM = "wereAddressesSpentFrom", | ||
WERE_ADDRESSES_SPENT_FROM = "wereAddressesSpentFrom" | ||
} | ||
@@ -75,0 +74,0 @@ export interface BaseCommand { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
53366
27
1024
Updated@iota/kerl@^1.0.0-beta.6
Updated@iota/pad@^1.0.0-beta.6