I'm trying to get a remoteSigner To work with the did-jwt library...suggestions appreciated #258
Replies: 6 comments 1 reply
-
` (async function() {
})(); }) |
Beta Was this translation helpful? Give feedback.
-
This confuses me, because I've proven that createJWT works on a local machine index.ts. Unfortunately, this function, or something else is the culprit:
Functionally, I it supposed to look like this: `
return async (data: string | Uint8Array): Promise => { Obviously, I cannot use that one with a remote signer. Notice I call my remote one like this:
It is supposed to use the private key stored remotely and the data that is provided to:
but no bueno (edited) https://github.com/bshambaugh/key-did-provider-p256Test-remote is kind of a mess as a repo. I have multiple files each testing a part or merging multiple smaller parts. Things were breaking when trying to write a unified test file using beforeEach and Aftereach where I tried to spin up and spin down a socket server and flush the socket connections between each test. |
Beta Was this translation helpful? Give feedback.
-
A person commented that by invoking setInterval I'm invoking the function, but they weren't sure if the promise was being lost. |
Beta Was this translation helpful? Give feedback.
-
Here is a gist showing the output from running the script: https://gist.github.com/bshambaugh/a63fb0d68471f21ed86d98224d77824c |
Beta Was this translation helpful? Give feedback.
-
This is what it looks like on the side of the RPC, what JavaScript is calling over websockets: |
Beta Was this translation helpful? Give feedback.
-
Okay, this works. It appeared to be an issue with the network. Things were getting signed properly on the ESP32 side.
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
To be as plain as I can. I can construct a JWT using a signer on the local machine,, but I cannot construct a JWT using a signer on a remote machine.
I can send a crafted payload to the remote machine and get a correct signature.
I can get other responses too that a remote, but not JWTs.
Here is some link to code:
https://github.com/bshambaugh/key-did-provider-p256Test-remote/blob/master/src/index.ts (gives a JWT on local machine)
https://github.com/bshambaugh/key-did-provider-p256Test-remote/blob/master/src/remote-getPublicKey.ts (gets the public key )
https://github.com/bshambaugh/key-did-provider-p256Test-remote/blob/master/src/remote-getJWT-matchremoteDID.ts (gives the right response from remote with one await)
https://github.com/bshambaugh/key-did-provider-p256Test-remote/blob/master/src/remote-getJWT-matchremoteDID_multi.ts (gives the right response from remote with multiple awaits in the loop)
https://github.com/bshambaugh/key-did-provider-p256Test-remote/blob/master/src/remote-getSignature.ts (gives correct remote signatures for a given payload)
https://github.com/bshambaugh/key-did-provider-p256Test-remote/blob/master/src/remote-matchDIDKeyWRemoteT2-getJWT.ts(gives a failing signature for the JWT)
`const server = http.createServer();
const websocketServer = WebSocket.createServer({server: server})
DNS.lookup(OS.hostname(), function (err, add, fam) {
console.log('addr: '+add);
})
websocketServer.on('stream',function(stream,request) {
setInterval(function(){
(async function() {
})();
},250);
})
server.listen(3000);
function remoteP256Signer(stream): Signer {
return async (payload: string | Uint8Array): Promise => {
return await getSignature(stream,payload);
}
}`
That's the basic skeleton for getting a JWT.
Beta Was this translation helpful? Give feedback.
All reactions