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

This commit is contained in:
2024-07-14 18:20:00 -06:00
parent deedbefcad
commit f4345fe2b9
7 changed files with 9 additions and 13 deletions

View File

@@ -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

View File

@@ -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

View File

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

View File

@@ -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) => {

View File

@@ -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 };

View File

@@ -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>;
}

View File

@@ -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 }