kidscipher 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import SubstitutionCipher from '../../substitution/SubstitutionCipher';
1
+ import SubstitutionCipher from '../substitution/SubstitutionCipher';
2
2
  declare class PolandCrossCipher extends SubstitutionCipher {
3
3
  static POLAND_CROSS_MAP: Record<string, string>;
4
4
  constructor();
@@ -0,0 +1,6 @@
1
+ import SubstitutionCipher from '../substitution/SubstitutionCipher';
2
+ declare class SmallCrossCipher extends SubstitutionCipher {
3
+ static SMALL_CROSS_MAP: Record<string, string>;
4
+ constructor();
5
+ }
6
+ export default SmallCrossCipher;
@@ -0,0 +1,6 @@
1
+ import SubstitutionCipher from '../substitution/SubstitutionCipher';
2
+ declare class FractionCipher extends SubstitutionCipher {
3
+ static FRACTION_MAP: Record<string, string>;
4
+ constructor();
5
+ }
6
+ export default FractionCipher;
@@ -0,0 +1,11 @@
1
+ import SubstitutionCipher from '../substitution/SubstitutionCipher';
2
+ import { CipherOptions } from '../../core/cipher-options/CipherOptions';
3
+ import { CipherConfigurationsRecord } from '../Cipher';
4
+ export type MobileCipherOptions = CipherConfigurationsRecord;
5
+ declare class MobileCipher extends SubstitutionCipher {
6
+ static MOBILE_KEYPAD_MAP: Record<string, string>;
7
+ constructor();
8
+ encode(input: string, configuration?: MobileCipherOptions, opts?: CipherOptions): string;
9
+ decode(input: string, configuration?: MobileCipherOptions, opts?: CipherOptions): string;
10
+ }
11
+ export default MobileCipher;
@@ -1,13 +1,6 @@
1
- import { CipherOptions } from '../../core/cipher-options/CipherOptions';
2
- import { CipherConfigurationsRecord } from '../Cipher';
3
1
  import ShiftCipher from './ShiftCipher';
4
- type ShiftAlphabetCipherOptions = CipherConfigurationsRecord | {
5
- shift: number;
6
- };
7
2
  declare class ShiftAlphabetCipher extends ShiftCipher {
8
3
  static DEFAULT_ALPHABET: string[];
9
- constructor(alphabet?: string[]);
10
- encode(input: string, { shift }: ShiftAlphabetCipherOptions, opts?: CipherOptions): string;
11
- decode(input: string, { shift }: ShiftAlphabetCipherOptions, opts?: CipherOptions): string;
4
+ constructor();
12
5
  }
13
6
  export default ShiftAlphabetCipher;
@@ -1,15 +1,17 @@
1
1
  import { CipherOptions } from '../../core/cipher-options/CipherOptions';
2
2
  import Cipher, { CipherConfigurationsRecord } from '../Cipher';
3
- type ShiftCipherOptions = CipherConfigurationsRecord | {
4
- shifts: number[];
3
+ export type ShiftCipherOptions = CipherConfigurationsRecord | {
4
+ shift: number;
5
+ outputAsIndex?: boolean;
6
+ inputAsIndex?: boolean;
5
7
  };
6
- declare abstract class ShiftCipher extends Cipher {
7
- private baseAlphabet;
8
- private rotors;
9
- constructor(baseAlphabet: string[], rotors: string[][]);
8
+ declare class ShiftCipher extends Cipher {
9
+ private alphabet;
10
+ constructor(alphabet: string[]);
10
11
  encodeToken(token: string, configuration: ShiftCipherOptions): string;
11
- encode(input: string, configuration?: ShiftCipherOptions, opts?: CipherOptions): string;
12
12
  decodeToken(token: string, configuration: ShiftCipherOptions): string;
13
+ getAllTokenIndexes(token: string, shift: number): number[];
14
+ encode(input: string, configuration?: ShiftCipherOptions, opts?: CipherOptions): string;
13
15
  decode(input: string, configuration?: ShiftCipherOptions, opts?: CipherOptions): string;
14
16
  }
15
17
  export default ShiftCipher;
@@ -0,0 +1,9 @@
1
+ import ShiftRotorCipher from './ShiftRotorCipher';
2
+ declare class ShiftRotorABCDCipher extends ShiftRotorCipher {
3
+ static BASE_ALPHABET: string[];
4
+ static REPEAT_ALPHABET: string[];
5
+ private static generateRepeatRotorAlphabet;
6
+ static ROTOR_ALPHABETS: string[][];
7
+ constructor();
8
+ }
9
+ export default ShiftRotorABCDCipher;
@@ -0,0 +1,18 @@
1
+ import { CipherOptions } from '../../core/cipher-options/CipherOptions';
2
+ import Cipher, { CipherConfigurationsRecord } from '../Cipher';
3
+ import ShiftCipher from './ShiftCipher';
4
+ export type ShiftRotorCipherOptions = CipherConfigurationsRecord | {
5
+ shifts: number[];
6
+ outputAsIndex?: boolean;
7
+ inputAsIndex?: boolean;
8
+ };
9
+ declare class ShiftRotorCipher extends Cipher {
10
+ baseAlphabet: ShiftCipher;
11
+ rotors: ShiftCipher[];
12
+ constructor(baseAlphabet: ShiftCipher, rotors: ShiftCipher[]);
13
+ encodeToken(token: string, configuration: ShiftRotorCipherOptions): string;
14
+ decodeToken(token: string, configuration: ShiftRotorCipherOptions): string;
15
+ encode(input: string, configuration?: ShiftRotorCipherOptions, opts?: CipherOptions): string;
16
+ decode(input: string, configuration?: ShiftRotorCipherOptions, opts?: CipherOptions): string;
17
+ }
18
+ export default ShiftRotorCipher;
@@ -0,0 +1,10 @@
1
+ import { CipherOptions } from '../../core/cipher-options/CipherOptions';
2
+ import { MobileCipherOptions } from '../mobile/MobileCipher';
3
+ import SubstitutionCyclicCipher from '../substitution/SubstitutionCyclicCipher';
4
+ declare class SpiderCipher extends SubstitutionCyclicCipher {
5
+ static SPIDER_MAP: Record<string, string[]>;
6
+ constructor();
7
+ encode(input: string, configuration?: MobileCipherOptions, opts?: CipherOptions): string;
8
+ decode(input: string, configuration?: MobileCipherOptions, opts?: CipherOptions): string;
9
+ }
10
+ export default SpiderCipher;
@@ -0,0 +1,10 @@
1
+ import { CipherOptions } from '../../core/cipher-options/CipherOptions';
2
+ import { CipherConfigurationsRecord } from '../Cipher';
3
+ import SubstitutionCyclicCipher from './SubstitutionCyclicCipher';
4
+ export type Substitution2DCipherOptions = CipherConfigurationsRecord;
5
+ declare class Substitution2DCipher extends SubstitutionCyclicCipher {
6
+ constructor(alphabet: string[][], horizontalKey: string[], verticalKey: string[]);
7
+ encode(input: string, configuration?: Substitution2DCipherOptions, opts?: CipherOptions): string;
8
+ decode(input: string, configuration?: Substitution2DCipherOptions, opts?: CipherOptions): string;
9
+ }
10
+ export default Substitution2DCipher;
@@ -1,10 +1,13 @@
1
- import Cipher from '../Cipher';
1
+ import { CipherOptions } from '../../core/cipher-options/CipherOptions';
2
+ import Cipher, { CipherConfigurationsRecord } from '../Cipher';
2
3
  declare class SubstitutionCyclicCipher extends Cipher {
3
4
  protected encodeMap: Record<string, string[]>;
4
5
  protected decodeMap: Record<string, string>;
5
6
  protected counters: Record<string, number>;
6
7
  constructor(encodeMap: Record<string, string | string[]>);
8
+ resetCounters: () => void;
7
9
  encodeToken(token: string): string;
10
+ encode(input: string, configuration?: CipherConfigurationsRecord, opts?: CipherOptions): string;
8
11
  decodeToken(token: string): string;
9
12
  }
10
13
  export default SubstitutionCyclicCipher;
@@ -0,0 +1,6 @@
1
+ import Substitution2DCipher from '../substitution/Substitution2DCipher';
2
+ declare class ChessCipher extends Substitution2DCipher {
3
+ static BASE_ALPHABET: string[];
4
+ constructor(height: number, width: number);
5
+ }
6
+ export default ChessCipher;
@@ -0,0 +1,6 @@
1
+ import Substitution2DCipher from '../substitution/Substitution2DCipher';
2
+ declare class TableKeyFiveToFiveCipher extends Substitution2DCipher {
3
+ static ALPHABET: string[][];
4
+ constructor(horizontalKey: string[], verticalKey: string[]);
5
+ }
6
+ export default TableKeyFiveToFiveCipher;
@@ -1,7 +1,9 @@
1
- import { CasingOptions } from "./CipherOptions";
1
+ import { CasingOptions } from './CipherOptions';
2
2
  export type TextProcessor = (text: string) => string;
3
+ export declare const normalizeDiacritics: (normalize: boolean) => TextProcessor;
3
4
  declare const Processor: {
4
5
  ignoreCasingSensitive: (caseSensitive?: boolean) => TextProcessor;
5
6
  casing: (casingOption: CasingOptions) => TextProcessor;
7
+ normalizeDiacritics: (normalize: boolean) => TextProcessor;
6
8
  };
7
9
  export default Processor;
@@ -2,6 +2,14 @@ import './font';
2
2
  export { default as Cipher } from './cipher/Cipher';
3
3
  export { default as SubstitutionCipher } from './cipher/substitution/SubstitutionCipher';
4
4
  export { default as MorseCodeCipher } from './cipher/morsecode/MorseCodeCipher';
5
- export { default as PolandCrossCipher } from './cipher/cross/poland/PolandCrossCipher';
6
- export { default as ShiftAlphabetCipher } from './cipher/shift/ShiftAlphabetCipher';
5
+ export { default as MobileCipher } from './cipher/mobile/MobileCipher';
6
+ export { default as SpiderCipher } from './cipher/spider/SpiderCipher';
7
+ export { default as FractionCipher } from './cipher/fraction/FractionCipher';
8
+ export { default as PolandCrossCipher } from './cipher/cross/PolandCrossCipher';
9
+ export { default as SmallCrossCipher } from './cipher/cross/SmallCrossCipher';
7
10
  export { default as ChineseCipher } from './cipher/chinese/ChineseCipher';
11
+ export { default as ShiftAlphabetCipher } from './cipher/shift/ShiftAlphabetCipher';
12
+ export { default as ShiftRotorABCDCipher } from './cipher/shift/ShiftRotorABCDCipher';
13
+ export { default as Substitution2DCipher } from './cipher/substitution/Substitution2DCipher';
14
+ export { default as TableKeyFiveToFiveCipher } from './cipher/table/TableKeyFiveToFiveCipher';
15
+ export { default as ChessCipher } from './cipher/table/ChessCipher';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kidscipher",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/fandau1/kidscipher",
6
6
  "type": "module",
@@ -37,6 +37,7 @@
37
37
  "eslint": "^9.35.0",
38
38
  "eslint-config-prettier": "^10.1.8",
39
39
  "eslint-plugin-prettier": "^5.5.4",
40
+ "opentype.js": "^1.3.4",
40
41
  "prettier": "^3.6.2",
41
42
  "rollup": "^4.50.0",
42
43
  "rollup-plugin-postcss": "^4.0.2",
@@ -1,8 +0,0 @@
1
- export type DifferentCrossConfig = {
2
- topLine: boolean;
3
- bottomLine: boolean;
4
- leftLine: 0 | 1 | 2;
5
- rightLine: 0 | 1 | 2;
6
- maxDots: 2 | 3;
7
- dotPosition: 0 | 1 | 2;
8
- };
@@ -1,7 +0,0 @@
1
- export type HebrewCrossConfig = {
2
- topLine: boolean;
3
- bottomLine: boolean;
4
- leftLine: boolean;
5
- rightLine: boolean;
6
- dots: 0 | 1 | 2;
7
- };
@@ -1,8 +0,0 @@
1
- export type SmallCrossConfig = {
2
- isSquare: boolean;
3
- topLine: boolean;
4
- bottomLine: boolean;
5
- leftLine: boolean;
6
- rightLine: boolean;
7
- dot: boolean;
8
- };