kidscipher 0.2.0 → 0.3.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.
- package/README.md +6 -4
- package/dist/font.cjs.js +27 -2
- package/dist/font.esm.js +27 -2
- package/dist/index.cjs.js +505 -139
- package/dist/index.esm.js +502 -140
- package/dist/types/cipher/fraction/FractionCipher.d.ts +6 -0
- package/dist/types/cipher/mobile/MobileCipher.d.ts +11 -0
- package/dist/types/cipher/shift/ShiftAlphabetCipher.d.ts +1 -8
- package/dist/types/cipher/shift/ShiftCipher.d.ts +9 -7
- package/dist/types/cipher/shift/ShiftRotorABCDCipher.d.ts +9 -0
- package/dist/types/cipher/shift/ShiftRotorCipher.d.ts +18 -0
- package/dist/types/cipher/spider/SpiderCipher.d.ts +10 -0
- package/dist/types/cipher/substitution/SubstitutionCyclicCipher.d.ts +4 -1
- package/dist/types/core/cipher-options/Processor.d.ts +3 -1
- package/dist/types/index.d.ts +5 -1
- package/package.json +2 -1
|
@@ -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(
|
|
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
|
-
|
|
3
|
+
export type ShiftCipherOptions = CipherConfigurationsRecord | {
|
|
4
|
+
shift: number;
|
|
5
|
+
outputAsIndex?: boolean;
|
|
6
|
+
inputAsIndex?: boolean;
|
|
5
7
|
};
|
|
6
|
-
declare
|
|
7
|
-
private
|
|
8
|
-
|
|
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;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import
|
|
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;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { CasingOptions } from
|
|
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;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ 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 MobileCipher } from './cipher/mobile/MobileCipher';
|
|
6
|
+
export { default as SpiderCipher } from './cipher/spider/SpiderCipher';
|
|
7
|
+
export { default as FractionCipher } from './cipher/fraction/FractionCipher';
|
|
5
8
|
export { default as PolandCrossCipher } from './cipher/cross/poland/PolandCrossCipher';
|
|
6
|
-
export { default as ShiftAlphabetCipher } from './cipher/shift/ShiftAlphabetCipher';
|
|
7
9
|
export { default as ChineseCipher } from './cipher/chinese/ChineseCipher';
|
|
10
|
+
export { default as ShiftAlphabetCipher } from './cipher/shift/ShiftAlphabetCipher';
|
|
11
|
+
export { default as ShiftRotorABCDCipher } from './cipher/shift/ShiftRotorABCDCipher';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kidscipher",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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",
|