Giter Club home page Giter Club logo

Comments (1)

shansb-dev avatar shansb-dev commented on May 24, 2024

Okay after more debugging we could solve these Assertion issues.

It turned out that instead of a pointer a NSMutabledata Object was given, that caused the v8 runtime to fail.

TypeScript header definition objc!sodium.d.ts:271

declare function crypto_box_easy(c: string, m: string, mlen: number, n: string, pk: string, sk: string): number;

C header definition crypto_box.h:60

SODIUM_EXPORT
int crypto_box_easy(unsigned char *c, const unsigned char *m,
                    unsigned long long mlen, const unsigned char *n,
                    const unsigned char *pk, const unsigned char *sk)
            __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));

TypeScript call in index.ios.ts:370:392 - we had to return bytes pointer for the keys here

crypto_box_easy(outData.mutableBytes, rawMsg.bytes, rawMsg.length, rawNonce.bytes, public_key.bytes, private_key.bytes);

For the other assertions this applied as well and additionally we had to add the interop.Reference wrapper for the pointer.

TypeScript header definition objc!sodium.d.ts:177

declare function crypto_auth_keygen(k: interop.Reference<number>): void

C header definition crypto_auth.h:39

SODIUM_EXPORT
void crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES])
            __attribute__ ((nonnull));

TypeScript call in index.ios.ts:526 - we wrapped it in an interop.Reference and returned bytes

let rawKey = NSMutableData.dataWithLength(crypto_auth_keybytes());
crypto_auth_keygen(new interop.Reference(rawKey.mutableBytes));
crypto_auth(out.mutableBytes, rawMsg.bytes, rawMsg.length, rawKey.bytes);

from ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.