KeySAVCoreJS
This is a library for all your Pokémon Generation 6 and 7 breaking needs. It has support for exporting data from Powersaves backups/backups from digital copies, main files as well as battle videos.
Basically, this is the logic part of KeySAV2 rewritten. Data is returned in the form of an object containing all relevant information about the Pokémon.
TypeScript definition files are provided and an API documentation is available.
Credits
Original exploit by Kaphotics and OmegaDonut used with permission. Thank you for all your hard work!
History
Originally I forked the KeySAV2 project to add some features, since then I refactored the code multiple times, extracted this code from the interface logic, ported it to JavaScript and have eventually rewritten it.
License
All code is Copyright 2014-2017 Tobias "Copper Phosphate" Zimmermann and distributed under the terms of the MIT license. The Pokémon character names, stats and other data is Copyright 2002-2017 Pokémon, Copyright 1995-2017 Nintendo/Creatures Inc./GAME FREAK Inc.
Variables
eggnames
eggnames: string [] = ["タマゴ", "Egg", "Œuf", "Uovo", "Ei", "", "Huevo", "알", "蛋", "蛋"]
Functions
base64Encode
base64Encode( arr: Uint8Array ) : string
Parameters
Returns string
breakKey
breakKey( break1: Uint8Array , break2: Uint8Array ) : Promise < string >
breakSavOrBv
breakSavOrBv( file1: Uint8Array , file2: Uint8Array ) : Promise < object >
Parameters
file1: Uint8Array
file2: Uint8Array
Returns Promise < object >
clear
clear( src: Uint8Array , offset: number , length: number ) : void
clear( src: Uint8Array ) : void
Parameters
src: Uint8Array
offset: number
length: number
Returns void
Parameters
Returns void
copy
copy( src: Uint8Array , off1: number , dest: Uint8Array , off2: number , length: number ) : void
Parameters
src: Uint8Array
off1: number
dest: Uint8Array
off2: number
length: number
Returns void
createBuffer
createBuffer( arr: Uint8Array | Uint16Array | Uint32Array ) : Buffer
Parameters
arr: Uint8Array | Uint16Array | Uint32Array
Returns Buffer
createDataView
createDataView( arr: any ) : DataView
Parameters
Returns DataView
createNoKeyError
createNoKeyError( stamp: string , isSav: boolean ) : Error
Parameters
stamp: string
isSav: boolean
Returns Error
createNotStoredKeyError
createNotStoredKeyError( stamp: string , isSav: boolean ) : Error
Parameters
stamp: string
isSav: boolean
Returns Error
createUint16Array
createUint16Array( arr: any ) : Uint16Array
Parameters
Returns Uint16Array
createUint32Array
createUint32Array( arr: any ) : Uint32Array
Parameters
Returns Uint32Array
createUint8Array
createUint8Array( arr: any ) : Uint8Array
Parameters
Returns Uint8Array
decodeUnicode16LE
decodeUnicode16LE( arr: Uint8Array , offset: number , length: number ) : string
Parameters
arr: Uint8Array
offset: number
length: number
Returns string
empty
empty( src: Uint8Array , offset: number , length: number ) : boolean
empty( src: Uint8Array ) : boolean
Parameters
src: Uint8Array
offset: number
length: number
Returns boolean
Parameters
Returns boolean
encodeUnicode16LE
encodeUnicode16LE( str: string ) : Uint8Array
Parameters
Returns Uint8Array
getStampAndKindFromKey
getStampAndKindFromKey( arr: Uint8Array , size: number ) : object
getStampBv
getStampBv( arr: Uint8Array , off: number ) : string
Parameters
arr: Uint8Array
off: number
Returns string
getStampSav
getStampSav( arr: Uint8Array , off: number ) : string
Parameters
arr: Uint8Array
off: number
Returns string
load
load( input: Uint8Array ) : Promise < SaveReader >
loadSavOrBv
loadSavOrBv( file: Uint8Array ) : Promise < object >
Parameters
Returns Promise < object >
next
Parameters
Returns number
The next seed
pad4
Parameters
Returns string
pad5
Parameters
Returns string
promisify
promisify<T>( fn: function ) : function
promisify<T, A1>( fn: function ) : function
promisify<T, A1, A2>( fn: function ) : function
promisify<T, A1, A2, A3>( fn: function ) : function
promisify<T, A1, A2, A3, A4>( fn: function ) : function
promisify<T, A1, A2, A3, A4, A5>( fn: function ) : function
promisify<T, A1, A2, A3, A4, A5, A6>( fn: function ) : function
promisify<T, A1, A2, A3, A4, A5, A6, A7>( fn: function ) : function
Type parameters
Parameters
fn: function
Parameters
cb: function
( err: Error , res?: T ) : void
Parameters
err: Error
Optional res: T
Returns void
Returns void
Returns function
Type parameters
Parameters
fn: function
( arg1: A1 , cb: function ) : void
Parameters
arg1: A1
cb: function
( err: Error , res?: T ) : void
Parameters
err: Error
Optional res: T
Returns void
Returns void
Returns function
Parameters
Returns Promise < T >
Type parameters
Parameters
fn: function
( arg1: A1 , arg2: A2 , cb: function ) : void
Parameters
arg1: A1
arg2: A2
cb: function
( err: Error , res?: T ) : void
Parameters
err: Error
Optional res: T
Returns void
Returns void
Returns function
( arg1: A1 , arg2: A2 ) : Promise < T >
Parameters
Returns Promise < T >
Type parameters
Parameters
fn: function
( arg1: A1 , arg2: A2 , arg3: A3 , cb: function ) : void
Parameters
arg1: A1
arg2: A2
arg3: A3
cb: function
( err: Error , res?: T ) : void
Parameters
err: Error
Optional res: T
Returns void
Returns void
Returns function
( arg1: A1 , arg2: A2 , arg3: A3 ) : Promise < T >
Parameters
arg1: A1
arg2: A2
arg3: A3
Returns Promise < T >
Type parameters
Parameters
fn: function
( arg1: A1 , arg2: A2 , arg3: A3 , arg4: A4 , cb: function ) : void
Parameters
arg1: A1
arg2: A2
arg3: A3
arg4: A4
cb: function
( err: Error , res?: T ) : void
Parameters
err: Error
Optional res: T
Returns void
Returns void
Returns function
( arg1: A1 , arg2: A2 , arg3: A3 , arg4: A4 ) : Promise < T >
Parameters
arg1: A1
arg2: A2
arg3: A3
arg4: A4
Returns Promise < T >
Type parameters
Parameters
fn: function
( arg1: A1 , arg2: A2 , arg3: A3 , arg4: A4 , arg5: A5 , cb: function ) : void
Parameters
arg1: A1
arg2: A2
arg3: A3
arg4: A4
arg5: A5
cb: function
( err: Error , res?: T ) : void
Parameters
err: Error
Optional res: T
Returns void
Returns void
Returns function
( arg1: A1 , arg2: A2 , arg3: A3 , arg4: A4 , arg5: A5 ) : Promise < T >
Parameters
arg1: A1
arg2: A2
arg3: A3
arg4: A4
arg5: A5
Returns Promise < T >
Type parameters
Parameters
fn: function
( arg1: A1 , arg2: A2 , arg3: A3 , arg4: A4 , arg5: A5 , arg6: A6 , cb: function ) : void
Parameters
arg1: A1
arg2: A2
arg3: A3
arg4: A4
arg5: A5
arg6: A6
cb: function
( err: Error , res?: T ) : void
Parameters
err: Error
Optional res: T
Returns void
Returns void
Returns function
( arg1: A1 , arg2: A2 , arg3: A3 , arg4: A4 , arg5: A5 , arg6: A6 ) : Promise < T >
Parameters
arg1: A1
arg2: A2
arg3: A3
arg4: A4
arg5: A5
arg6: A6
Returns Promise < T >
Type parameters
Parameters
fn: function
( arg1: A1 , arg2: A2 , arg3: A3 , arg4: A4 , arg5: A5 , arg6: A6 , arg7: A7 , cb: function ) : void
Parameters
arg1: A1
arg2: A2
arg3: A3
arg4: A4
arg5: A5
arg6: A6
arg7: A7
cb: function
( err: Error , res?: T ) : void
Parameters
err: Error
Optional res: T
Returns void
Returns void
Returns function
( arg1: A1 , arg2: A2 , arg3: A3 , arg4: A4 , arg5: A5 , arg6: A6 , arg7: A7 ) : Promise < T >
Parameters
arg1: A1
arg2: A2
arg3: A3
arg4: A4
arg5: A5
arg6: A6
arg7: A7
Returns Promise < T >
registerPkmImpl
registerPkmImpl( generation: number , impl: object ) : void
Parameters
generation: number
impl: object
Returns void
sequenceEqual
sequenceEqual( src1: Uint8Array , src2: Uint8Array ) : boolean
sequenceEqual( src1: Uint8Array , src2: Uint8Array , offset: number ) : boolean
sequenceEqual( src1: Uint8Array , off1: number , src2: Uint8Array , off2: number , length: number ) : boolean
Parameters
src1: Uint8Array
src2: Uint8Array
Returns boolean
Parameters
src1: Uint8Array
src2: Uint8Array
offset: number
Returns boolean
Parameters
src1: Uint8Array
off1: number
src2: Uint8Array
off2: number
length: number
Returns boolean
xor
xor( src1: Uint8Array , src2: Uint8Array ) : Uint8Array
xor( src1: Uint8Array , src2: Uint8Array , length: number ) : Uint8Array
xor( src1: Uint8Array , off1: number , src2: Uint8Array , off2: number , len: number ) : Uint8Array
xor( src1: Uint8Array , off1: number , src2: Uint8Array , off2: number , dest: Uint8Array , off3: number , len: number ) : void
Parameters
src1: Uint8Array
src2: Uint8Array
Returns Uint8Array
Parameters
src1: Uint8Array
src2: Uint8Array
length: number
Returns Uint8Array
Parameters
src1: Uint8Array
off1: number
src2: Uint8Array
off2: number
len: number
Returns Uint8Array
Parameters
src1: Uint8Array
off1: number
src2: Uint8Array
off2: number
dest: Uint8Array
off3: number
len: number
Returns void
xorInPlace
xorInPlace( dest: Uint8Array , off1: number , src: Uint8Array , off2: number , length: number ) : void
Parameters
dest: Uint8Array
off1: number
src: Uint8Array
off2: number
length: number
Returns void
xorThree
xorThree( src1: Uint8Array , off1: number , src2: Uint8Array , off2: number , src3: Uint8Array , off3: number , length: number ) : Uint8Array
Parameters
src1: Uint8Array
off1: number
src2: Uint8Array
off2: number
src3: Uint8Array
off3: number
length: number
Returns Uint8Array
Legend
Module
Object literal
Variable
Function
Function with type parameter
Index signature
Type alias
Enumeration
Enumeration member
Property
Method
Interface
Interface with type parameter
Constructor
Property
Method
Index signature
Class
Class with type parameter
Constructor
Property
Method
Accessor
Index signature
Inherited constructor
Inherited property
Inherited method
Inherited accessor
Protected property
Protected method
Protected accessor
Private property
Private method
Private accessor
Static property
Static method
Create a new key for the given saves.
The two saves should satisfy the following:
If the second save was also saved twice, an old-style key will be created rather than a new-style key. This means that only one of the save slots in a save will be decrypted and the user will need to save twice on every save that should be dumped later.
After creation the key will be stored in the global key store.