-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'import' syntax compatible and TypeScript declaration file #1038
Changes from 17 commits
7cafa69
abe6207
a1cdad8
473401d
4864b00
dfc73ca
ede00cd
c1d4275
c0694b3
688a7dc
2bfd34a
b19cc94
671fc81
91a1275
a8c0865
dcc1182
f7c1f2d
57cc538
a7f1af8
5f12c5b
576c69a
2c35b56
5040c7b
8fde76e
dddc4ca
1072e0f
a9d0a5e
8457223
3afd6af
a393159
1f28271
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,58 @@ | ||||
export declare class KeyPair { | ||||
public(): Uint8Array; | ||||
private(): Uint8Array; | ||||
} | ||||
|
||||
export declare class SymmetricKey { | ||||
constructor(); | ||||
} | ||||
|
||||
export declare class SecureCellSeal { | ||||
static withKey(key: SymmetricKey): SecureCellSeal; | ||||
static withPassphrase(passphrase: string): SecureCellSeal; | ||||
encrypt(plaintext: Uint8Array, context?: Uint8Array): Uint8Array; | ||||
decrypt(encrypted: Uint8Array, context?: Uint8Array): Uint8Array; | ||||
} | ||||
|
||||
export declare interface SecureCellTokenProtectResult { | ||||
data: Uint8Array; | ||||
token: Uint8Array; | ||||
} | ||||
|
||||
export declare class SecureCellTokenProtect { | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like TokenProtect has constructor that expects key too -
or somehow used as WithKey. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've checked. We do not announce that we can do it, but construction with |
||||
static withKey(key: SymmetricKey): SecureCellTokenProtect; | ||||
encrypt(plaintext: Uint8Array, context?: Uint8Array): SecureCellTokenProtectResult; | ||||
decrypt(encrypted: Uint8Array, token: Uint8Array, context?: Uint8Array): Uint8Array; | ||||
} | ||||
|
||||
export declare class SecureCellContextImprint { | ||||
static withKey(key: SymmetricKey): SecureCellContextImprint; | ||||
encrypt(plaintext: Uint8Array, context: Uint8Array): Uint8Array; | ||||
decrypt(encrypted: Uint8Array, context: Uint8Array): Uint8Array; | ||||
} | ||||
|
||||
export declare class SecureMessage { | ||||
constructor(privateKey: Uint8Array | null, publicKey: Uint8Array | null); | ||||
sign(message: Uint8Array): Uint8Array; | ||||
verify(message: Uint8Array): Uint8Array; | ||||
encrypt(message: Uint8Array): Uint8Array; | ||||
decrypt(message: Uint8Array): Uint8Array; | ||||
} | ||||
|
||||
type GetPublicKeyCallback = (peerID: Uint8Array) => Uint8Array | null; | ||||
|
||||
export declare class SecureSession { | ||||
constructor(peerID: Uint8Array, privateKey: Uint8Array, getPublicKeyCallback: GetPublicKeyCallback); | ||||
isEstablished(): boolean; | ||||
connectRequest(): Uint8Array; | ||||
wrap(message: Uint8Array): Uint8Array; | ||||
unwrap(message: Uint8Array): Uint8Array; | ||||
} | ||||
|
||||
export declare class SecureComparator { | ||||
constructor(sharedSecret: Uint8Array); | ||||
beginCompare(): Uint8Array; | ||||
proceedCompare(request: Uint8Array): Uint8Array; | ||||
isCompareComplete(): boolean; | ||||
isMatch(): boolean; | ||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
...require('./build/Release/jsthemis.node') | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you write this file manually or somehow generated from the sources?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Manually. I did not find the tool that can read
.node
file to make a declaration file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need
constructor()
here too similar to SymmetricKey? KeyPair looks like has constructor too -themis/src/wrappers/themis/jsthemis/secure_keygen.cpp
Line 57 in f7c1f2d
And not obvious that it constructed from public + private