-
Notifications
You must be signed in to change notification settings - Fork 24
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
Provide hmac keys on the napi #1450
Conversation
bindings_node/src/conversations.rs
Outdated
@@ -97,6 +98,21 @@ impl From<ListConversationsOptions> for GroupQueryArgs { | |||
} | |||
} | |||
|
|||
#[napi(object)] | |||
pub struct NodeHMACKey { |
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.
can you make this just HmacKey
and alias the import as XmtpHmacKey
? it makes the generated types usable without having to rename them in the SDK.
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.
Done
bindings_node/src/conversations.rs
Outdated
#[napi(object)] | ||
pub struct NodeHMACKey { | ||
pub key: Vec<u8>, | ||
pub epoch: i64, |
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.
i64
will be typed as a number in javascript. not sure if that's desirable or an issue, just wanted to point it out. while the rust i64
type supports a range of −2^63 to 2^63 − 1
, the javascript type only supports -2^53 + 1 to 2^53 - 1
.
there's a BigInt
type in NAPI that should provide full precision, if necessary.
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.
Oh, the number will never get that large, but I can change it over for correctness. Thanks for letting me know.
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.
cool, yea, it's not a big deal to keep as is. we can always change in future if it becomes an issue.
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.
All good. Swapped it out for BigInt.
No description provided.