mirror of
https://github.com/fluencelabs/libp2p-ts
synced 2025-03-16 02:00:50 +00:00
Add tweetnacl
This commit is contained in:
parent
ad92cf7166
commit
490677baf1
@ -29,3 +29,4 @@ This following libraries are currently included. Where possible add the relevant
|
||||
- [peer-info](https://github.com/libp2p/js-peer-info)
|
||||
- [pull-pushable](https://github.com/pull-stream/pull-pushable)
|
||||
- [pull-stream](https://github.com/pull-stream/pull-stream)
|
||||
- [tweetnacl](https://github.com/dchest/tweetnacl-js)
|
||||
|
58
tweetnacl/index.d.ts
vendored
Normal file
58
tweetnacl/index.d.ts
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
// Type definitions for tweetnacl 1.0.0
|
||||
// Project: https://github.com/dchest/tweetnacl-js
|
||||
// Definitions by: Jaco Greeff <https://github.com/jacogr>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
type KeypairType = {
|
||||
publicKey: Uint8Array,
|
||||
secretKey: Uint8Array
|
||||
};
|
||||
|
||||
type Hash = {
|
||||
(message: Uint8Array): Uint8Array,
|
||||
|
||||
hashLength: number
|
||||
};
|
||||
|
||||
type SecretBox = {
|
||||
(message: Uint8Array, nonce: Uint8Array, secret: Uint8Array): Uint8Array,
|
||||
|
||||
open: (encrypted: Uint8Array, nonce: Uint8Array, secret: Uint8Array) => Uint8Array | null
|
||||
};
|
||||
|
||||
type SignDetached = {
|
||||
(message: Uint8Array, secretKey: Uint8Array): Uint8Array,
|
||||
|
||||
verify: (message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array) => boolean
|
||||
};
|
||||
|
||||
type SignKeypair = {
|
||||
(): KeypairType,
|
||||
|
||||
fromSecretKey: (secretKey: Uint8Array) => KeypairType,
|
||||
fromSeed: (seed: Uint8Array) => KeypairType,
|
||||
};
|
||||
|
||||
type Sign = {
|
||||
(message: Uint8Array, secretKey: Uint8Array): Uint8Array,
|
||||
detached: SignDetached,
|
||||
|
||||
open: (signedMsg: Uint8Array, publicKey: Uint8Array) => Uint8Array,
|
||||
keyPair: SignKeypair,
|
||||
|
||||
publicKeyLength: number,
|
||||
secretKeyLength: number,
|
||||
seedLength: number,
|
||||
signatureLength: number,
|
||||
};
|
||||
|
||||
type TweetNacl = {
|
||||
randomBytes: (length: number) => Uint8Array,
|
||||
hash: Hash,
|
||||
secretbox: SecretBox,
|
||||
sign: Sign
|
||||
};
|
||||
|
||||
export = TweetNacl;
|
16
tweetnacl/tsconfig.json
Normal file
16
tweetnacl/tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "bn.js-tests.ts"]
|
||||
}
|
1
tweetnacl/tslint.json
Normal file
1
tweetnacl/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
0
tweetnacl/tweetnacl-tests.ts
Normal file
0
tweetnacl/tweetnacl-tests.ts
Normal file
Loading…
x
Reference in New Issue
Block a user