Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync dc4eu-rome with wwWallet/master #2

Merged
merged 68 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
64be462
Send all necessary user data after success signup
gkatrakazas Jun 25, 2024
b7fe54a
Fix response on login-webauthn
gkatrakazas Jun 25, 2024
b39f272
add to init session the id of the user
gkatrakazas Jul 4, 2024
05c3e42
Use replacerBufferToTaggedBase64Url globally
emlun Mar 25, 2024
31a421d
Change type of privateData from string to Buffer
emlun Mar 25, 2024
a2fbc24
Add route to update user's private data
emlun Mar 22, 2024
b58e64e
Copy .editorconfig and GitHub Actions workflow from wallet-frontend
emlun Feb 21, 2024
845f29d
Fix insert_final_newline violations
emlun Jul 18, 2024
5c7f744
Fix trim_trailing_whitespace violations
emlun Jul 18, 2024
25b3a47
Fix indent_style violations
emlun Jul 18, 2024
c841848
Merge pull request #55 from wwWallet/editorconfig
emlun Jul 19, 2024
b42c222
Add scope on sendPushNotification
gkatrakazas Jul 22, 2024
db67cd6
Return WebAuthn RP ID in login success response
emlun Jul 22, 2024
8a11625
Merge pull request #1 from gunet/update-resp-signup
gkatrakazas Jul 24, 2024
dd9f518
Add type guard isResult
emlun Mar 22, 2024
234d7f2
Explicitly abort updateUserByDID transaction on exceptions
emlun Mar 22, 2024
ab57e6d
Return void instead of {} from deleteWebauthnCredential
emlun Mar 22, 2024
9a45009
Use runTransaction in deleteWebauthnCredential
emlun Mar 22, 2024
d17b095
Abort updateUserByDID transaction if update function returns Err
emlun Mar 25, 2024
ff4f550
Re-throw the given UpdateUserErr in deleteWebauthnCredential
emlun Jul 24, 2024
7f55c8e
Protect UserEntity.privateData update with ETag/If-Match headers
emlun Jul 24, 2024
aa114fa
Fix Trailing whitespace
gkatrakazas Jul 25, 2024
860edbe
Remove initSession and use only filterUserData
gkatrakazas Jul 29, 2024
4d7162f
Rename filterUserData to initSession
gkatrakazas Jul 29, 2024
5016d6e
Drop webauthnCredentials from initSession
gkatrakazas Jul 29, 2024
c69ce41
Merge pull request #59 from wwWallet/offline-wwwallet-user-data
gkatrakazas Jul 29, 2024
54978c9
Merge pull request #58 from wwWallet/offline-wwwallet
gkatrakazas Jul 29, 2024
6cf35f1
Merge branch 'master' into encrypt-asymmetric
emlun Jul 29, 2024
13aef0e
Remove unused UpdateUserErr.CONFLICT
emlun Jul 29, 2024
c8111e3
Merge pull request #56 from wwWallet/encrypt-asymmetric
emlun Jul 29, 2024
285f131
Merge branch 'master' into update-privatedata-etag
emlun Jul 29, 2024
07192d8
Merge pull request #57 from wwWallet/update-privatedata-etag
emlun Jul 29, 2024
a0703ce
Fix which privateData value is used to compute response ETag
emlun Jul 29, 2024
3e4a992
Accept already-applied changes in checkedUpdate
emlun Jul 29, 2024
e87e2d0
Merge pull request #60 from wwWallet/update-privatedata-etag
emlun Jul 30, 2024
5023c42
Move additional base64 encoding of WebAuthn responses to backend
emlun Aug 2, 2024
9dcc66b
Merge pull request #61 from wwWallet/webauthn-backend-base64
emlun Aug 5, 2024
463add2
Add update: false flag to readonly database columns
emlun Aug 2, 2024
292e33a
Delete unused function storeKeypair
emlun Aug 5, 2024
5d5cbb3
Delete commented-out code
emlun Aug 5, 2024
33e9830
Fix type error in isResult
emlun Aug 5, 2024
e850a2e
Delete unused function OpenidCredentialReceiving.getAvailableSupporte…
emlun Aug 5, 2024
12fb505
Add type annotations to storage.router handler function params
emlun Aug 5, 2024
f2432ae
Delete unused function getCookieDictionary
emlun Aug 5, 2024
6aafe20
Extract function createAppToken to auth.middleware module
emlun Aug 5, 2024
f95bc71
Merge req.user assignments in AuthMiddleware
emlun Aug 6, 2024
b5e67dd
removed id-token handled as deprecated
kkmanos Aug 6, 2024
98375bf
Invert userRes condition in AuthMiddleware
emlun Aug 6, 2024
d26a4d4
Use type annotations for appToken payload
emlun Aug 6, 2024
b65daaa
Eliminate redundant condition
emlun Aug 6, 2024
73ec958
Merge pull request #62 from wwWallet/remove-id-token-handling
kkmanos Aug 6, 2024
d100c61
Simplify Authorization header matching logic
emlun Aug 6, 2024
2757977
Merge branch 'master' into misc-refactor
emlun Aug 7, 2024
0dfbd7b
Add version number to token payload
emlun Aug 5, 2024
2b6d995
Rename UserEntity.webauthnUserHandle to uuid and make primary ID
emlun Aug 5, 2024
eaf5623
Use UserEntity.uuid instead of .did where possible
emlun Aug 6, 2024
92eca8f
Don't require keys prop on signup, don't parse it in /account-info
emlun Aug 8, 2024
2aa24dd
Merge pull request #63 from wwWallet/misc-refactor
emlun Aug 9, 2024
e0c4010
Merge pull request #64 from wwWallet/token-version
emlun Aug 9, 2024
d92de3c
Merge pull request #65 from wwWallet/user-uuid
emlun Aug 9, 2024
1012df6
Merge pull request #66 from wwWallet/credential-unique-keypair
emlun Aug 9, 2024
3902fb4
Delete unused OpenidForPresentationService methods
emlun Aug 13, 2024
74b53c0
Delete unused OpenidForPresentationService constructor param
emlun Aug 13, 2024
b49897f
Delete unused interface method createIdToken
emlun Aug 13, 2024
0a7cd1b
Delete unused interface method OpenidCredentialReceiving.getIssuerState
emlun Aug 13, 2024
ee9acf2
Remove unused import
emlun Aug 13, 2024
add1044
Delete unused local variable
emlun Aug 13, 2024
a7ce8cd
Merge pull request #67 from wwWallet/delete-createIdToken
emlun Aug 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ tsconfig.json
.buildignore
*.gz
*.tar
yarn.lock
yarn.lock
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# EditorConfig: https://EditorConfig.org

[*]
charset = utf-8
insert_final_newline = true # Type of newline is managed by git in .gitattributes
trim_trailing_whitespace = true

[{*.{Dockerfile,css,js,jsx,ts,tsx},Dockerfile}]
indent_style = tab

[*.{yml,yaml}] # YAML does not allow tab indentation
indent_style = space
indent_size = 2
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Auto-detect text files
* text=auto

# Always treat these as LF
*.sh text eol=lf

# Always treat these as CRLF
*.bat text eol=crlf
26 changes: 26 additions & 0 deletions .github/workflows/code-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This name is shown in status badges
name: code-formatting

on:
push:
branches-ignore:
- 'tmp**'
pull_request:
branches-ignore:
- 'tmp**'

jobs:
editorconfig:
name: Check EditorConfig compliance

runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v3

- name: Set up editorconfig-checker
uses: editorconfig-checker/action-editorconfig-checker@v2

- name: Check code formatting
run: editorconfig-checker
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"editor.tabSize": 2,
"editor.detectIndentation": false,
"editor.insertSpaces": false
}
}
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /app

COPY . .
RUN --mount=type=secret,id=npmrc,required=true,target=./.npmrc,uid=1000 \
apt-get update -y && apt-get install g++ python3 make -y && yarn cache clean && yarn install && yarn build
apt-get update -y && apt-get install g++ python3 make -y && yarn cache clean && yarn install && yarn build

# Production stage
FROM node:18-bullseye-slim AS production
Expand All @@ -17,10 +17,10 @@ COPY --from=builder /app/public ./public


RUN --mount=type=secret,id=npmrc,required=true,target=./.npmrc,uid=1000 \
apt-get update -y && apt-get install g++ python3 make -y && yarn install --production
apt-get update -y && apt-get install g++ python3 make -y && yarn install --production

ENV NODE_ENV production

EXPOSE 8002

CMD ["node", "./dist/src/app.js"]
CMD ["node", "./dist/src/app.js"]
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn install
## Change configuration

Edit `config/config.dev.ts` file to change the configuration of the app.
## Run in dev mode
## Run in dev mode

```
yarn dev
Expand Down Expand Up @@ -70,7 +70,7 @@ rsync --rsh='ssh -p 65432' <snapshot_name>.tar.gz root@ip:/tmp
cd /tmp
rm -rf wallet-backend
mkdir wallet-backend
tar -xf <snapshot_name>.tar.gz -C wallet-backend
tar -xf <snapshot_name>.tar.gz -C wallet-backend
cd wallet-backend
chmod +x entrypoint.sh
./entrypoint.sh
Expand All @@ -80,5 +80,3 @@ Add `Listen 9002` below the `Listen 443` line on `/etc/apache2/ports.conf`
and restart apache

# 3 Logging


2 changes: 1 addition & 1 deletion cli/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ node_modules
combined.log
error.log
*.gz
./dist
./dist
2 changes: 1 addition & 1 deletion cli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ COPY . .
RUN yarn cache clean && yarn install


CMD ["tail", "-f", "/dev/null"]
CMD ["tail", "-f", "/dev/null"]
2 changes: 1 addition & 1 deletion config/config.template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ export = {
enabled: "NOTIFICATIONS_ENABLED",
serviceAccount: "firebaseConfig.json"
}
}
}
2 changes: 1 addition & 1 deletion config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ require('dotenv').config()

const env = process.env.NODE_ENV || 'development';
const config: any = require('./config.' + env);
export default config;
export default config;
4 changes: 2 additions & 2 deletions development.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WORKDIR /dependencies
# Install dependencies first so rebuild of these layers is only needed when dependencies change
COPY package.json yarn.lock ./
RUN --mount=type=secret,id=npmrc,required=true,target=./.npmrc,uid=1000 \
yarn cache clean && yarn install
yarn cache clean && yarn install


FROM node:16-bullseye-slim as cli-dependencies
Expand All @@ -15,7 +15,7 @@ WORKDIR /dependencies
# Install dependencies first so rebuild of these layers is only needed when dependencies change
COPY cli/package.json cli/yarn.lock ./
RUN --mount=type=secret,id=npmrc,required=true,target=./.npmrc,uid=1000 \
yarn cache clean && yarn install --frozen-lockfile
yarn cache clean && yarn install --frozen-lockfile


FROM node:16-bullseye-slim as development
Expand Down
2 changes: 1 addition & 1 deletion nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"."
],
"ext": "ts,js"
}
}
Binary file modified public/alt-vc-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 37 additions & 37 deletions samples/wallet-mock/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ app.get('/vp', async (req, res) => {
const payload = JSON.parse(base64url.decode(vpjwt.split('.')[1]));
return payload;
})


res.render('presentations', {
vp_list: vp_list
Expand Down Expand Up @@ -121,7 +121,7 @@ app.get('/vp/:vp_id', async (req, res) => {
console.dir(vp, { depth: null})
const vpjwt = vp.presentation;
const payload = base64url.decode(vpjwt.split('.')[1]);

res.render('vc', {
title: "Wallet Mock",
vc: payload
Expand All @@ -143,7 +143,7 @@ app.get('/init/issuance/:iss', async (req, res) => {
const selectedIssuerDID = iss == 'vid' ? vidTrustedIssuerDID : uoaTrustedIssuerDID;

try {
const issuanceInitiation = await axios.post(walletBackendUrl + '/issuance/generate/authorization/request',
const issuanceInitiation = await axios.post(walletBackendUrl + '/issuance/generate/authorization/request',
{ legal_person_did: selectedIssuerDID },
{ headers: { "Authorization": `Bearer ${global.user.appToken}` }}
);
Expand Down Expand Up @@ -172,11 +172,11 @@ app.get('/init/verification/vid', async (req, res) => {


/**
* For OpenID 4 VCI (Issuance)
* @param {*} req
* @param {*} res
* @param {*} next
*/
* For OpenID 4 VCI (Issuance)
* @param {*} req
* @param {*} res
* @param {*} next
*/
async function handleCredentialOffer(req, res, next) {
const url = `${req.protocol}://${req.hostname}${req.originalUrl}`;

Expand All @@ -192,13 +192,13 @@ async function handleCredentialOffer(req, res, next) {
}

/**
* For OpenID 4 VCI (Issuance)
* @param {*} req
* @param {*} res
* @param {*} next
*/
* For OpenID 4 VCI (Issuance)
* @param {*} req
* @param {*} res
* @param {*} next
*/
async function handleAuthorizationResponse(req, res, next) {
const url = `${req.protocol}://${req.hostname}${req.originalUrl}`;
const url = `${req.protocol}://${req.hostname}${req.originalUrl}`;

axios.post(walletBackendUrl + "/issuance/handle/authorization/response",
{ authorization_response_url: url },
Expand All @@ -214,13 +214,13 @@ async function handleAuthorizationResponse(req, res, next) {


/**
* For OpenID 4 VP (Verification)
* @param {*} req
* @param {*} res
* @param {*} next
*/
* For OpenID 4 VP (Verification)
* @param {*} req
* @param {*} res
* @param {*} next
*/
async function handleAuthorizationRequest(req, res, next) {
const url = `${req.protocol}://${req.hostname}${req.originalUrl}`;
const url = `${req.protocol}://${req.hostname}${req.originalUrl}`;
console.log("URL = ", url)
axios.post(walletBackendUrl + "/presentation/handle/authorization/request",
{ authorization_request: url },
Expand All @@ -246,33 +246,33 @@ async function handleAuthorizationRequest(req, res, next) {
app.post('/select-vc', async (req, res) => {
console.log("Req = ", req.body)
axios.post(walletBackendUrl + "/presentation/generate/authorization/response",
{ verifiable_credentials_map: req.body },
{ headers: { "Authorization": `Bearer ${global.user.appToken}` }}
).then(success => {
const { redirect_to } = success.data;
res.redirect(redirect_to);
}).catch(e => {
// console.error("Failed to generate authorization response")
// console.error(e.response.data);
res.render('error', { title: "Error", error: { status: 500 } })
});
{ verifiable_credentials_map: req.body },
{ headers: { "Authorization": `Bearer ${global.user.appToken}` }}
).then(success => {
const { redirect_to } = success.data;
res.redirect(redirect_to);
}).catch(e => {
// console.error("Failed to generate authorization response")
// console.error(e.response.data);
res.render('error', { title: "Error", error: { status: 500 } })
});
})

// catch 404 and forward to error handler
app.use(function(req, res, next) {
next(createError(404));
next(createError(404));
});


// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};

// render the error page
res.status(err.status || 500);
res.render('error');
// render the error page
res.status(err.status || 500);
res.render('error');
});

console.log("Started wallet mock server...")
Expand Down
2 changes: 1 addition & 1 deletion samples/wallet-mock/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module.exports = {
// trustedIssuerDID: "did:ebsi:zc6MhmU4NbKSAtAHx8XgpEW",
uoaTrustedIssuerDID: "did:ebsi:zpq1XFkNWgsGB6MuvJp21vA",
vidTrustedIssuerDID: "did:ebsi:zyhE5cJ7VVqYT4gZmoKadFt",
}
}
2 changes: 1 addition & 1 deletion samples/wallet-mock/development.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ ENV NODE_ENV development

RUN chown -R node:node /home/node/app/node_modules
USER node
CMD ["yarn", "dev"]
CMD ["yarn", "dev"]
2 changes: 1 addition & 1 deletion samples/wallet-mock/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ async function registerUser() {

module.exports = {
registerUser
}
}
2 changes: 1 addition & 1 deletion samples/wallet-mock/nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"."
],
"ext": "js"
}
}
Loading
Loading