Browse Source

fix declaration of did-eth-local-resolver & bump version to 1.2.1

master
Trent Larson 4 months ago
parent
commit
f4345fe2b9
  1. 2
      CHANGELOG.md
  2. 3
      Dockerfile
  3. 2
      package.json
  4. 2
      src/server.ts
  5. 4
      src/vc/did-eth-local-resolver.js
  6. 5
      src/vc/did-eth-local-resolver.ts
  7. 4
      src/vc/index.ts

2
CHANGELOG.md

@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Nothing
## [1.2.0]
## [1.2.1]
### Added
- Replacement of an existing file
- Local resolver for did:ethr

3
Dockerfile

@ -9,5 +9,6 @@ RUN git clone https://gitea.anomalistdesign.com/log-trade/image-api.git
WORKDIR image-api
RUN git checkout $IMAGE_API_VERSION
RUN pnpm install --prod
RUN pnpm build
CMD node src/server.js
CMD node dist/server.js

2
package.json

@ -1,6 +1,6 @@
{
"name": "Images for Trade",
"version": "1.2.0",
"version": "1.2.1",
"description": "",
"license": "UNLICENSED",
"dependencies": {

2
src/server.ts

@ -49,7 +49,7 @@ const uploadDir = 'uploads';
const uploadMulter = multer({ dest: uploadDir + '/' });
app.get('/ping', async (req, res) => {
res.send('pong - v 1.2.0'); // version
res.send('pong - v 1.2.1'); // version
});
app.get('/image-limits', async (req, res) => {

4
src/vc/did-eth-local-resolver.js

@ -10,7 +10,7 @@ const { DIDResolutionResult } = require('did-resolver');
*
* Similar code resides in endorser-ch
*/
const didEthLocalResolver = async(did) => {
export const didEthLocalResolver = async(did) => {
const didRegex = /^did:ethr:(0x[0-9a-fA-F]{40})$/;
const match = did.match(didRegex);
@ -43,5 +43,3 @@ const didEthLocalResolver = async(did) => {
throw new Error(`Unsupported DID format: ${did}`);
};
module.exports = { didEthLocalResolver };

5
src/vc/did-eth-local-resolver.ts

@ -1,8 +1,5 @@
import {DIDResolutionResult} from "did-resolver";
declare module './did-eth-local-resolver.js' {
const value: {
didEthLocalResolver: (jwt: string) => Promise<DIDResolutionResult>;
};
export default value;
export function didEthLocalResolver(jwt: string): Promise<DIDResolutionResult>;
}

4
src/vc/index.ts

@ -10,7 +10,7 @@ import base64url from "base64url";
import didJwt from "did-jwt";
import {Resolver} from "did-resolver";
import ethResolver from "./did-eth-local-resolver";
import {didEthLocalResolver} from "./did-eth-local-resolver";
import {verifyJwt as peerVerifyJwt} from "./passkeyDidPeer";
@ -21,7 +21,7 @@ export const JWT_VERIFY_FAILED_CODE = "JWT_VERIFY_FAILED_CODE"
export const UNSUPPORTED_DID_METHOD_CODE = "UNSUPPORTED_DID_METHOD"
const resolver = new Resolver({
'ethr': ethResolver.didEthLocalResolver
'ethr': didEthLocalResolver
});
// return Promise of at least { issuer, payload, verified boolean }

Loading…
Cancel
Save