-
Notifications
You must be signed in to change notification settings - Fork 144
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
'import' syntax compatible and TypeScript declaration file #1038
Conversation
@@ -0,0 +1,60 @@ | |||
export declare class KeyPair { |
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 -
void KeyPair::New(const Nan::FunctionCallbackInfo<v8::Value>& args) |
And not obvious that it constructed from public + private
constructor(peerID: Uint8Array, privateKey: Uint8Array, getPublicKeyCallback: GetPublicKeyCallback); | ||
isEstablished(): boolean; | ||
connectRequest(): Uint8Array; | ||
sendToPeer(message: Uint8Array): void; |
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.
I didn't find these functions in secureSession.cpp to find result type. Where this function is declared?
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.
Removed. Thank you. I did not write tests for SecureSession.
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.
@Lagovas looks good for you?
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.
And I see, that you tried to add examples and update tests on CI but reverted changes. Did you met any problems with tests with new import
syntax?
@@ -0,0 +1,60 @@ | |||
export declare class KeyPair { |
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 -
void KeyPair::New(const Nan::FunctionCallbackInfo<v8::Value>& args) |
And not obvious that it constructed from public + private
token: Uint8Array; | ||
} | ||
|
||
export declare class SecureCellTokenProtect { |
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.
Looks like TokenProtect has constructor that expects key too -
if (args.Length() < 1) { |
or somehow used as WithKey.
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.
I've checked. We do not announce that we can do it, but construction with new SecureCellTokenProtect(masterkey)
will also work the same as SecureCellTokenProtect.withKey(masterKey)
. It wraps one function into a constructor.
I'm adding the constructor declaration.
Should we add tests for this file? |
Nope, I met the issues with node >= 18. Decided to provide it later because of OpenSSL 3 issues. |
can we test it for openssl1.0/node <= 18? |
added import_module.mjs and test
Typescript examples tests
docs/examples/ts/secure_cell.js
Outdated
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 this file here? looks like it's generated file from the .ts
run: | | ||
cd $GITHUB_WORKSPACE/docs/examples/js/ | ||
echo "Test import syntax..." | ||
node import_module.mjs |
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.
just to be sure, did you tried some failed script to check some failure case to be sure that it's not always echo ok
?
I found documentation for run where described that by default shell
used with -e
flag. But real world can be unsynchronized from documentation and we met situations when tests ran but didn't exit with errors on failures.
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.
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.
lgtm. merge after removing redundant .js file as discussed
import
syntax tojsthemis
Checklist