This repository has been archived by the owner on Nov 20, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
feat: replace micro-aes-gcm
with @noble/chipers
[SPMVP-6208]
#324
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
arielllin
commented
Feb 1, 2024
return storipress | ||
return storipress ?? storipressConfigCtx.use() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DanSnow
suggested changes
Feb 1, 2024
@@ -73,6 +73,7 @@ export interface RawArticleLike { | |||
export interface PaidContent { | |||
content: string | |||
key: string | |||
iv: number[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
這邊可以同樣做 base64 encode 與 decode 嗎?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
調整好了
const compactEncrypter = new CompactEncrypt( | ||
Buffer.from(JSON.stringify({ id, plan, key: Buffer.from(key).toString('base64') })), | ||
).setProtectedHeader({ enc: 'A256GCM', alg: 'dir' }) | ||
const encryptedKey = await compactEncrypter.encrypt(Buffer.from(storipress.encryptKey, 'base64')) | ||
paidContent = { | ||
key: encryptedKey, | ||
content: Buffer.from(content).toString('base64'), | ||
iv: Array.from(iv), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以參考 content 的方式做 base64 encode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
調整好了
DanSnow
approved these changes
Feb 2, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Jira
https://storipress-media.atlassian.net/browse/SPMVP-6208
Purpose
micro-aes-gcm
已經停止維護,更換為@noble/chipers
,並確認付費文章有正常加解密For who
How did you make it?
Production deployment notes
🎩 Tophat
Do a thorough 🎩. What is tophatting?
Consider testing:
🎩 Instructions
測試使用
D6RX98VXN
文章id381
這篇文章storipress-token
storipress-token
模擬已登入狀態Related PRs
Checklist before requesting review
priority:high
,priority:medium
, ...)// eslint-ignore-next-line <rule name>
on it)skipcq
comment)Emoji Guide
For reviewers: Emojis can be added to comments to call out blocking versus non-blocking feedback.
E.g: Praise, minor suggestions, or clarifying questions that don’t block merging the PR.
E.g: Blocking feedback must be addressed before merging.
Gif (optional)