diff options
author | HampusM <hampus@hampusmat.com> | 2021-08-15 13:41:37 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-08-15 13:41:37 +0200 |
commit | c32094d0b1fc3aa5160087d71bff36ed1779bc3a (patch) | |
tree | 880b04bc207926a378fc7d5b30ee0fd421972fec /packages/server/src/routes/api/v1 | |
parent | ddcf71225226bc0929d5c6d609b13ff0489e5b94 (diff) |
Rewrote the commit author fingerprint function & implemented commit signature verification
Diffstat (limited to 'packages/server/src/routes/api/v1')
-rw-r--r-- | packages/server/src/routes/api/v1/repo/log.ts | 5 | ||||
-rw-r--r-- | packages/server/src/routes/api/v1/repo/map.ts | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/packages/server/src/routes/api/v1/repo/log.ts b/packages/server/src/routes/api/v1/repo/log.ts index cf53d6b..aaad042 100644 --- a/packages/server/src/routes/api/v1/repo/log.ts +++ b/packages/server/src/routes/api/v1/repo/log.ts @@ -43,6 +43,8 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do const stats = await commit.stats(); + const is_signed = await commit.isSigned(); + const data: APICommit = { message: commit.message, author: { @@ -50,7 +52,8 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do email: commit.author().email, fingerprint: await commit.author().fingerprint().catch(() => null) }, - isSigned: await commit.isSigned(), + isSigned: is_signed, + signatureVerified: is_signed ? await commit.verifySignature().catch(() => false) : null, date: commit.date, insertions: stats.insertions, deletions: stats.deletions, diff --git a/packages/server/src/routes/api/v1/repo/map.ts b/packages/server/src/routes/api/v1/repo/map.ts index 0544e4f..a544d1a 100644 --- a/packages/server/src/routes/api/v1/repo/map.ts +++ b/packages/server/src/routes/api/v1/repo/map.ts @@ -3,6 +3,9 @@ import { LogCommit } from "api"; export async function commitMap(commit: Commit): Promise<LogCommit> { const stats = await commit.stats(); + + const is_signed = await commit.isSigned(); + return <LogCommit>{ id: commit.id, author: { @@ -10,7 +13,8 @@ export async function commitMap(commit: Commit): Promise<LogCommit> { email: commit.author().email, fingerprint: await commit.author().fingerprint().catch(() => null) }, - isSigned: await commit.isSigned(), + isSigned: is_signed, + signatureVerified: is_signed ? await commit.verifySignature().catch(() => false) : null, message: commit.message, date: commit.date, insertions: stats.insertions, |