@leofcoin/codec-format-interface 1.6.12 → 1.6.13
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/LICENSE +20 -20
- package/dist/basic-interface.d.ts +33 -33
- package/dist/codec-format-interface.d.ts +32 -32
- package/dist/codec-hash.d.ts +27 -26
- package/dist/codec.d.ts +15 -15
- package/dist/index.d.ts +9 -9
- package/dist/index.js +435 -433
- package/package.json +48 -48
- package/dist/codecs.d.ts +0 -75
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 vandeurenglenn
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 vandeurenglenn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
export default class BasicInterface {
|
|
2
|
-
#private;
|
|
3
|
-
encoded: Uint8Array;
|
|
4
|
-
decoded: object;
|
|
5
|
-
keys: string[];
|
|
6
|
-
name: string;
|
|
7
|
-
set proto(value: object);
|
|
8
|
-
get proto(): object;
|
|
9
|
-
decode(encoded?: Uint8Array): Object;
|
|
10
|
-
encode(decoded?: object): Uint8Array;
|
|
11
|
-
protoEncode(data: object): Uint8Array;
|
|
12
|
-
protoDecode(data: Uint8Array): object;
|
|
13
|
-
isHex(string: string): boolean;
|
|
14
|
-
isBase32(string: string): boolean;
|
|
15
|
-
isBase58(string: string): boolean;
|
|
16
|
-
fromBs32(encoded: string): object;
|
|
17
|
-
fromBs58(encoded: base58String): object;
|
|
18
|
-
toArray(): Promise<number[]>;
|
|
19
|
-
fromString(string: string): object;
|
|
20
|
-
fromHex(string: string): object;
|
|
21
|
-
fromArray(array: number[]): object;
|
|
22
|
-
fromEncoded(encoded: Uint8Array): Object;
|
|
23
|
-
toString(): string;
|
|
24
|
-
toHex(): string;
|
|
25
|
-
/**
|
|
26
|
-
* @return {String} encoded
|
|
27
|
-
*/
|
|
28
|
-
toBs32(): string;
|
|
29
|
-
/**
|
|
30
|
-
* @return {String} encoded
|
|
31
|
-
*/
|
|
32
|
-
toBs58(): base58String;
|
|
33
|
-
}
|
|
1
|
+
export default class BasicInterface {
|
|
2
|
+
#private;
|
|
3
|
+
encoded: Uint8Array;
|
|
4
|
+
decoded: object;
|
|
5
|
+
keys: string[];
|
|
6
|
+
name: string;
|
|
7
|
+
set proto(value: object);
|
|
8
|
+
get proto(): object;
|
|
9
|
+
decode(encoded?: Uint8Array): Object;
|
|
10
|
+
encode(decoded?: object): Uint8Array;
|
|
11
|
+
protoEncode(data: object): Uint8Array;
|
|
12
|
+
protoDecode(data: Uint8Array): object;
|
|
13
|
+
isHex(string: string): boolean;
|
|
14
|
+
isBase32(string: string): boolean;
|
|
15
|
+
isBase58(string: string): boolean;
|
|
16
|
+
fromBs32(encoded: string): object;
|
|
17
|
+
fromBs58(encoded: base58String): object;
|
|
18
|
+
toArray(): Promise<number[]>;
|
|
19
|
+
fromString(string: string): object;
|
|
20
|
+
fromHex(string: string): object;
|
|
21
|
+
fromArray(array: number[]): object;
|
|
22
|
+
fromEncoded(encoded: Uint8Array): Object;
|
|
23
|
+
toString(): string;
|
|
24
|
+
toHex(): string;
|
|
25
|
+
/**
|
|
26
|
+
* @return {String} encoded
|
|
27
|
+
*/
|
|
28
|
+
toBs32(): string;
|
|
29
|
+
/**
|
|
30
|
+
* @return {String} encoded
|
|
31
|
+
*/
|
|
32
|
+
toBs58(): base58String;
|
|
33
|
+
}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import BasicInterface from './basic-interface.js';
|
|
2
|
-
import Hash from './codec-hash.js';
|
|
3
|
-
export default class FormatInterface extends BasicInterface implements FormatInterface {
|
|
4
|
-
hashFormat: string;
|
|
5
|
-
init(buffer: Uint8Array | ArrayBuffer | FormatInterface | string): FormatInterface;
|
|
6
|
-
hasCodec(): boolean;
|
|
7
|
-
decode(encoded?: Uint8Array): object;
|
|
8
|
-
encode(decoded?: object): Uint8Array;
|
|
9
|
-
/**
|
|
10
|
-
* @param {Buffer|String|Object} buffer - data - The data needed to create the desired message
|
|
11
|
-
* @param {Object} proto - {protoObject}
|
|
12
|
-
* @param {Object} options - {hashFormat, name}
|
|
13
|
-
*/
|
|
14
|
-
constructor(buffer: any, proto: any, options?: {
|
|
15
|
-
hashFormat?: string;
|
|
16
|
-
name?: string;
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* @return {PeernetHash}
|
|
20
|
-
*/
|
|
21
|
-
get peernetHash(): Hash;
|
|
22
|
-
/**
|
|
23
|
-
* @return {peernetHash}
|
|
24
|
-
*/
|
|
25
|
-
hash(): Promise<any>;
|
|
26
|
-
fromUint8Array(buffer: any): object;
|
|
27
|
-
fromArrayBuffer(buffer: any): object;
|
|
28
|
-
/**
|
|
29
|
-
* @param {Object} data
|
|
30
|
-
*/
|
|
31
|
-
create(data: object): Uint8Array;
|
|
32
|
-
}
|
|
1
|
+
import BasicInterface from './basic-interface.js';
|
|
2
|
+
import Hash from './codec-hash.js';
|
|
3
|
+
export default class FormatInterface extends BasicInterface implements FormatInterface {
|
|
4
|
+
hashFormat: string;
|
|
5
|
+
init(buffer: Uint8Array | ArrayBuffer | FormatInterface | string): FormatInterface;
|
|
6
|
+
hasCodec(): boolean;
|
|
7
|
+
decode(encoded?: Uint8Array): object;
|
|
8
|
+
encode(decoded?: object): Uint8Array;
|
|
9
|
+
/**
|
|
10
|
+
* @param {Buffer|String|Object} buffer - data - The data needed to create the desired message
|
|
11
|
+
* @param {Object} proto - {protoObject}
|
|
12
|
+
* @param {Object} options - {hashFormat, name}
|
|
13
|
+
*/
|
|
14
|
+
constructor(buffer: any, proto: any, options?: {
|
|
15
|
+
hashFormat?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* @return {PeernetHash}
|
|
20
|
+
*/
|
|
21
|
+
get peernetHash(): Hash;
|
|
22
|
+
/**
|
|
23
|
+
* @return {peernetHash}
|
|
24
|
+
*/
|
|
25
|
+
hash(): Promise<any>;
|
|
26
|
+
fromUint8Array(buffer: any): object;
|
|
27
|
+
fromArrayBuffer(buffer: any): object;
|
|
28
|
+
/**
|
|
29
|
+
* @param {Object} data
|
|
30
|
+
*/
|
|
31
|
+
create(data: object): Uint8Array;
|
|
32
|
+
}
|
package/dist/codec-hash.d.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import BasicInterface from './basic-interface.js';
|
|
2
|
+
import Codec from './codec.js';
|
|
3
|
+
export default class CodecHash extends BasicInterface {
|
|
4
|
+
codec: Codec;
|
|
5
|
+
codecs: {};
|
|
6
|
+
digest: Uint8Array;
|
|
7
|
+
size: number;
|
|
8
|
+
constructor(buffer: any, options?: {
|
|
9
|
+
name: string;
|
|
10
|
+
codecs: {};
|
|
11
|
+
});
|
|
12
|
+
init(uint8Array: any): Promise<this>;
|
|
13
|
+
get prefix(): Uint8Array;
|
|
14
|
+
get length(): number[];
|
|
15
|
+
get buffer(): Uint8Array;
|
|
16
|
+
get hash(): Uint8Array;
|
|
17
|
+
fromJSON(json: any): Promise<Uint8Array>;
|
|
18
|
+
encode(buffer: Uint8Array, name?: string): Promise<Uint8Array>;
|
|
19
|
+
validate(buffer: any): Promise<void>;
|
|
20
|
+
decode(buffer: any): {
|
|
21
|
+
codec: Codec;
|
|
22
|
+
name: string;
|
|
23
|
+
size: number;
|
|
24
|
+
length: number[];
|
|
25
|
+
digest: Uint8Array;
|
|
26
|
+
};
|
|
27
|
+
}
|
package/dist/codec.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import BasicInterface from './basic-interface.js';
|
|
2
|
-
export default class Codec extends BasicInterface {
|
|
3
|
-
codecBuffer: Uint8Array;
|
|
4
|
-
codec: number;
|
|
5
|
-
hashAlg: string;
|
|
6
|
-
constructor(buffer: string | number | object | Uint8Array | ArrayBuffer);
|
|
7
|
-
fromEncoded(encoded: Uint8Array): object;
|
|
8
|
-
getCodec(name: string): number;
|
|
9
|
-
getCodecName(codec: number): string;
|
|
10
|
-
getHashAlg(name: string): string;
|
|
11
|
-
fromCodec(codec: number): void;
|
|
12
|
-
fromName(name: string): void;
|
|
13
|
-
decode(encoded?: Uint8Array): object;
|
|
14
|
-
encode(codec?: number): Uint8Array;
|
|
15
|
-
}
|
|
1
|
+
import BasicInterface from './basic-interface.js';
|
|
2
|
+
export default class Codec extends BasicInterface {
|
|
3
|
+
codecBuffer: Uint8Array;
|
|
4
|
+
codec: number;
|
|
5
|
+
hashAlg: string;
|
|
6
|
+
constructor(buffer: string | number | object | Uint8Array | ArrayBuffer);
|
|
7
|
+
fromEncoded(encoded: Uint8Array): object;
|
|
8
|
+
getCodec(name: string): number;
|
|
9
|
+
getCodecName(codec: number): string;
|
|
10
|
+
getHashAlg(name: string): string;
|
|
11
|
+
fromCodec(codec: number): void;
|
|
12
|
+
fromName(name: string): void;
|
|
13
|
+
decode(encoded?: Uint8Array): object;
|
|
14
|
+
encode(codec?: number): Uint8Array;
|
|
15
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import basicInterface from './basic-interface.js';
|
|
2
|
-
import formatInterface from './codec-format-interface.js';
|
|
3
|
-
import codecHash from './codec-hash.js';
|
|
4
|
-
import codec from './codec.js';
|
|
5
|
-
export { codecs } from '@leofcoin/codecs';
|
|
6
|
-
export declare const BasicInterface: typeof basicInterface;
|
|
7
|
-
export declare const FormatInterface: typeof formatInterface;
|
|
8
|
-
export declare const CodecHash: typeof codecHash;
|
|
9
|
-
export declare const Codec: typeof codec;
|
|
1
|
+
import basicInterface from './basic-interface.js';
|
|
2
|
+
import formatInterface from './codec-format-interface.js';
|
|
3
|
+
import codecHash from './codec-hash.js';
|
|
4
|
+
import codec from './codec.js';
|
|
5
|
+
export { codecs } from '@leofcoin/codecs';
|
|
6
|
+
export declare const BasicInterface: typeof basicInterface;
|
|
7
|
+
export declare const FormatInterface: typeof formatInterface;
|
|
8
|
+
export declare const CodecHash: typeof codecHash;
|
|
9
|
+
export declare const Codec: typeof codec;
|