hendt / ebay-api

eBay Node API in TypeScript for Node and Browser with RESTful and Traditional APIs. This library aims to implement all available eBay apis.
https://hendt.gitbook.io/ebay-api
MIT License
153 stars 41 forks source link

Feature Request: Digital Signatures for APIs #132

Closed derjones closed 1 year ago

derjones commented 1 year ago

Hey,

starting at 31.01.23 digital signatures are required for specific API calls in EU and UK. (https://developer.ebay.com/develop/guides/digital-signatures-for-apis) The keyManagement API calls are already implemented, but the signatures headers are not added to the specified API calls. Also a createSigningKey request and persisting the keys to a file would be nice.

Ebay created a lib to generate this signatures: https://github.com/ebay/digital-signature-nodejs-sdk

I just saw that you are working on a RC for 8.0.0, do you have plans to add this to this version?

Thanks Jonas

dantio commented 1 year ago

The RC does not include the digital signatures. I'll definitely work on this feature and hope to release it this year. Feel free to contribute!

derjones commented 1 year ago

Okay, sure. But lets wait till the version 8 is released to avoid conflicts.

dantio commented 1 year ago

@derjones I'll release version 8 probably this week after testing it under production env. The digital signature feature is already in review. I already had successfully calls with finance API and GetAccount.

derjones commented 1 year ago

@dantio Thats great news, thank you for implementing this feature!

dantio commented 1 year ago

@derjones Might you like to test the digital signature? npm i ebay-api@8.2.0-RC.0

let eBay = new eBayApi({ 
  appId: '...',
  certId: '...'
});
const signingKey = await eBay.developer.keyManagement.createSigningKey('ED25519');
// save the JSON somewhere

eBay = new eBayApi({
  appId: '...',
  certId: '...',
  signature: {
    jwe: signingKey.jwe,
    privateKey: signingKey.privateKey
  }
});

const summary = await eBay.sell.finances.sign.getSellerFundsSummary();
derjones commented 1 year ago

Yes! Sry that it took so long... I just testet to create a digital signature and do a request like you suggested, works like a charm. API endpoints I tested:

Thank you for implementing this features!

dantio commented 1 year ago

@derjones Thank you! I'll merge the feature and release it soon.

dantio commented 1 year ago

Released in 8.4.0