@oxy.so/core 1.13.0 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/crypto/identityLink.js +18 -0
- package/dist/cjs/i18n/locales/ar-SA.json +105 -85
- package/dist/cjs/i18n/locales/ca-ES.json +107 -87
- package/dist/cjs/i18n/locales/de-DE.json +105 -85
- package/dist/cjs/i18n/locales/en-US.json +105 -164
- package/dist/cjs/i18n/locales/es-ES.json +104 -163
- package/dist/cjs/i18n/locales/fr-FR.json +105 -85
- package/dist/cjs/i18n/locales/it-IT.json +105 -85
- package/dist/cjs/i18n/locales/ja-JP.json +105 -85
- package/dist/cjs/i18n/locales/ko-KR.json +105 -85
- package/dist/cjs/i18n/locales/locales/ar-SA.json +105 -85
- package/dist/cjs/i18n/locales/locales/ca-ES.json +107 -87
- package/dist/cjs/i18n/locales/locales/de-DE.json +105 -85
- package/dist/cjs/i18n/locales/locales/en-US.json +105 -164
- package/dist/cjs/i18n/locales/locales/es-ES.json +104 -163
- package/dist/cjs/i18n/locales/locales/fr-FR.json +105 -85
- package/dist/cjs/i18n/locales/locales/it-IT.json +105 -85
- package/dist/cjs/i18n/locales/locales/ja-JP.json +105 -85
- package/dist/cjs/i18n/locales/locales/ko-KR.json +105 -85
- package/dist/cjs/i18n/locales/locales/pt-PT.json +105 -85
- package/dist/cjs/i18n/locales/locales/zh-CN.json +106 -86
- package/dist/cjs/i18n/locales/pt-PT.json +105 -85
- package/dist/cjs/i18n/locales/zh-CN.json +106 -86
- package/dist/cjs/index.js +10 -43
- package/dist/cjs/mixins/OxyServices.auth.js +54 -16
- package/dist/cjs/mixins/OxyServices.identity.js +128 -8
- package/dist/cjs/mixins/OxyServices.user.js +42 -7
- package/dist/cjs/server/securityHeaders.js +19 -1
- package/dist/cjs/session/accountDialogController.js +37 -142
- package/dist/cjs/utils/authWebUrl.js +6 -6
- package/dist/cjs/utils/oauthPkce.js +5 -1
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/crypto/identityLink.js +15 -0
- package/dist/esm/i18n/locales/ar-SA.json +105 -85
- package/dist/esm/i18n/locales/ca-ES.json +107 -87
- package/dist/esm/i18n/locales/de-DE.json +105 -85
- package/dist/esm/i18n/locales/en-US.json +105 -164
- package/dist/esm/i18n/locales/es-ES.json +104 -163
- package/dist/esm/i18n/locales/fr-FR.json +105 -85
- package/dist/esm/i18n/locales/it-IT.json +105 -85
- package/dist/esm/i18n/locales/ja-JP.json +105 -85
- package/dist/esm/i18n/locales/ko-KR.json +105 -85
- package/dist/esm/i18n/locales/locales/ar-SA.json +105 -85
- package/dist/esm/i18n/locales/locales/ca-ES.json +107 -87
- package/dist/esm/i18n/locales/locales/de-DE.json +105 -85
- package/dist/esm/i18n/locales/locales/en-US.json +105 -164
- package/dist/esm/i18n/locales/locales/es-ES.json +104 -163
- package/dist/esm/i18n/locales/locales/fr-FR.json +105 -85
- package/dist/esm/i18n/locales/locales/it-IT.json +105 -85
- package/dist/esm/i18n/locales/locales/ja-JP.json +105 -85
- package/dist/esm/i18n/locales/locales/ko-KR.json +105 -85
- package/dist/esm/i18n/locales/locales/pt-PT.json +105 -85
- package/dist/esm/i18n/locales/locales/zh-CN.json +106 -86
- package/dist/esm/i18n/locales/pt-PT.json +105 -85
- package/dist/esm/i18n/locales/zh-CN.json +106 -86
- package/dist/esm/index.js +5 -5
- package/dist/esm/mixins/OxyServices.auth.js +55 -17
- package/dist/esm/mixins/OxyServices.identity.js +128 -8
- package/dist/esm/mixins/OxyServices.user.js +42 -7
- package/dist/esm/server/securityHeaders.js +19 -1
- package/dist/esm/session/accountDialogController.js +37 -142
- package/dist/esm/utils/authWebUrl.js +5 -5
- package/dist/esm/utils/oauthPkce.js +5 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/crypto/identityLink.d.ts +8 -0
- package/dist/types/index.d.ts +5 -8
- package/dist/types/mixins/OxyServices.auth.d.ts +35 -25
- package/dist/types/mixins/OxyServices.identity.d.ts +34 -34
- package/dist/types/mixins/OxyServices.user.d.ts +29 -6
- package/dist/types/models/interfaces.d.ts +46 -13
- package/dist/types/server/securityHeaders.d.ts +9 -12
- package/dist/types/session/accountDialogController.d.ts +29 -98
- package/dist/types/utils/authWebUrl.d.ts +5 -5
- package/dist/types/utils/oauthPkce.d.ts +10 -0
- package/package.json +3 -3
- package/src/crypto/__tests__/identityLink.test.ts +18 -0
- package/src/crypto/__tests__/identityProof.test.ts +6 -6
- package/src/crypto/identityLink.ts +18 -0
- package/src/i18n/locales/ar-SA.json +105 -85
- package/src/i18n/locales/ca-ES.json +107 -87
- package/src/i18n/locales/de-DE.json +105 -85
- package/src/i18n/locales/en-US.json +105 -164
- package/src/i18n/locales/es-ES.json +104 -163
- package/src/i18n/locales/fr-FR.json +105 -85
- package/src/i18n/locales/it-IT.json +105 -85
- package/src/i18n/locales/ja-JP.json +105 -85
- package/src/i18n/locales/ko-KR.json +105 -85
- package/src/i18n/locales/pt-PT.json +105 -85
- package/src/i18n/locales/zh-CN.json +106 -86
- package/src/index.ts +8 -51
- package/src/mixins/OxyServices.auth.ts +72 -24
- package/src/mixins/OxyServices.identity.ts +126 -8
- package/src/mixins/OxyServices.user.ts +51 -10
- package/src/mixins/__tests__/identityLink.test.ts +89 -0
- package/src/mixins/__tests__/notifications.read.test.ts +82 -0
- package/src/mixins/__tests__/preSessionSkipAuth.test.ts +1 -1
- package/src/mixins/__tests__/webauthnAuth.test.ts +75 -1
- package/src/models/interfaces.ts +46 -12
- package/src/server/__tests__/securityHeaders.test.ts +17 -0
- package/src/server/securityHeaders.ts +29 -1
- package/src/session/__tests__/accountDialogController.test.ts +42 -184
- package/src/session/accountDialogController.ts +50 -185
- package/src/utils/__tests__/oauthPkce.test.ts +7 -0
- package/src/utils/authWebUrl.ts +5 -5
- package/src/utils/oauthPkce.ts +16 -1
- package/dist/cjs/crypto/identityMove.js +0 -142
- package/dist/cjs/crypto/webIdentityCarrier.js +0 -325
- package/dist/esm/crypto/identityMove.js +0 -128
- package/dist/esm/crypto/webIdentityCarrier.js +0 -303
- package/dist/types/crypto/identityMove.d.ts +0 -75
- package/dist/types/crypto/webIdentityCarrier.d.ts +0 -150
- package/src/crypto/__tests__/identityMove.test.ts +0 -146
- package/src/crypto/__tests__/webIdentityCarrier.test.ts +0 -169
- package/src/crypto/__tests__/webIdentityRecoveryMaterial.test.ts +0 -117
- package/src/crypto/identityMove.ts +0 -167
- package/src/crypto/webIdentityCarrier.ts +0 -394
|
@@ -1,53 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"signin": {
|
|
3
3
|
"title": "登录",
|
|
4
|
-
"subtitle": "
|
|
5
|
-
"addAccountTitle": "
|
|
4
|
+
"subtitle": "使用你的 Oxy 账号",
|
|
5
|
+
"addAccountTitle": "添加其他账号",
|
|
6
6
|
"addAccountSubtitle": "使用另一个账户登录",
|
|
7
7
|
"username": {
|
|
8
8
|
"label": "用户名",
|
|
9
|
-
"placeholder": "
|
|
10
|
-
"
|
|
11
|
-
"required": "请输入您的用户名。",
|
|
12
|
-
"minLength": "用户名必须至少包含3个字符。"
|
|
13
|
-
},
|
|
14
|
-
"password": {
|
|
15
|
-
"label": "密码",
|
|
16
|
-
"placeholder": "输入您的密码",
|
|
17
|
-
"required": "请输入您的密码。",
|
|
18
|
-
"hint": "输入您的密码以登录"
|
|
9
|
+
"placeholder": "yourname",
|
|
10
|
+
"required": "请输入您的用户名。"
|
|
19
11
|
},
|
|
20
12
|
"actions": {
|
|
21
13
|
"continue": "继续",
|
|
22
|
-
"back": "返回"
|
|
23
|
-
"signIn": "登录",
|
|
24
|
-
"verify": "验证",
|
|
25
|
-
"openAccountSwitcher": "切换到另一个账户",
|
|
26
|
-
"openAccountSwitcherSubtitle": "{{count}}个其他账户可用",
|
|
27
|
-
"openAccountSwitcherSubtitle_singular": "1个其他账户可用",
|
|
28
|
-
"openAccountSwitcherSubtitle_zero": "查看您保存的账户",
|
|
29
|
-
"manageAccounts": "管理保存的账户",
|
|
30
|
-
"manageAccountsSubtitle": "查看会话、删除或登出",
|
|
31
|
-
"loadingOtherAccounts": "加载其他账户中…",
|
|
32
|
-
"switchAccountFailed": "无法切换账户。请重试。"
|
|
14
|
+
"back": "返回"
|
|
33
15
|
},
|
|
34
|
-
"forgotPrompt": "忘记密码?",
|
|
35
|
-
"security": {
|
|
36
|
-
"dataSecure": "您的数据已加密且安全"
|
|
37
|
-
},
|
|
38
|
-
"currentlySignedInAs": "当前登录为",
|
|
39
|
-
"alreadySignedInWith": "已登录",
|
|
40
|
-
"alreadySignedIn": "已登录",
|
|
41
|
-
"alreadySignedInMessage": "此账户已登录。继续使用此账户?",
|
|
42
|
-
"continueWithAccount": "继续",
|
|
43
|
-
"currentAccount": "当前",
|
|
44
|
-
"or": "或",
|
|
45
|
-
"viewAllAccounts": "查看更多{{count}}个",
|
|
46
16
|
"createAccountLink": "初次使用 Oxy?创建账户",
|
|
47
17
|
"status": {
|
|
48
|
-
"accountSwitched": "正在使用{{name}}",
|
|
49
18
|
"signingIn": "正在登录…"
|
|
50
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"subtitleToApp": "以继续前往 {{app}}",
|
|
21
|
+
"orContinueWith": "或使用以下方式继续",
|
|
22
|
+
"qr": {
|
|
23
|
+
"caption": "使用 Commons 扫码登录",
|
|
24
|
+
"renew": "显示新的二维码"
|
|
25
|
+
},
|
|
26
|
+
"methods": {
|
|
27
|
+
"passkey": "使用通行密钥登录"
|
|
28
|
+
},
|
|
29
|
+
"errors": {
|
|
30
|
+
"rateLimited": "尝试次数过多。请在 {{seconds}} 秒后重试。",
|
|
31
|
+
"passkeyCancelled": "通行密钥提示已关闭。准备好后请重试。",
|
|
32
|
+
"passkeyFailed": "无法完成通行密钥验证。请重试。"
|
|
33
|
+
},
|
|
34
|
+
"chooser": {
|
|
35
|
+
"subtitleToApp": "以继续前往 {{app}}"
|
|
36
|
+
},
|
|
37
|
+
"terms": {
|
|
38
|
+
"before": "继续即表示你同意我们的",
|
|
39
|
+
"termsLink": "服务条款",
|
|
40
|
+
"and": "和",
|
|
41
|
+
"privacyLink": "隐私政策"
|
|
42
|
+
},
|
|
43
|
+
"noAccount": "还没有账号?",
|
|
44
|
+
"createAccount": "创建账号",
|
|
45
|
+
"recoverLink": "丢失了通行密钥?恢复你的账号"
|
|
51
46
|
},
|
|
52
47
|
"signup": {
|
|
53
48
|
"title": "创建您的账户",
|
|
@@ -55,56 +50,28 @@
|
|
|
55
50
|
"createInCommons": "在 Commons 中创建您的身份",
|
|
56
51
|
"createAccount": "创建账户",
|
|
57
52
|
"backToSignInLink": "已有账户?登录",
|
|
58
|
-
"
|
|
59
|
-
"title": "欢迎使用Oxy!",
|
|
60
|
-
"subtitle": "只需几步即可创建您的账户",
|
|
61
|
-
"haveAccount": "已有账户?",
|
|
62
|
-
"signInCta": "登录"
|
|
63
|
-
},
|
|
64
|
-
"identity": {
|
|
65
|
-
"title": "您是谁?",
|
|
66
|
-
"subtitle": "选择您的用户名并输入您的电子邮件"
|
|
67
|
-
},
|
|
53
|
+
"webSubtitle": "无需密码:你的设备会创建一个通行密钥,丢失时可通过恢复邮箱重新进入。",
|
|
68
54
|
"username": {
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
55
|
+
"label": "用户名",
|
|
56
|
+
"placeholder": "yourname",
|
|
57
|
+
"required": "请选择用户名。",
|
|
58
|
+
"taken": "该用户名已被占用。"
|
|
72
59
|
},
|
|
73
60
|
"email": {
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"title": "保护您的账户",
|
|
80
|
-
"subtitle": "创建强密码以保护您的账户"
|
|
61
|
+
"title": "你的恢复邮箱",
|
|
62
|
+
"subtitle": "如果你丢失了通行密钥,我们会向这里发送验证码让你重新进入。它不作其他用途。",
|
|
63
|
+
"label": "邮箱",
|
|
64
|
+
"placeholder": "you@example.com",
|
|
65
|
+
"invalid": "请输入有效的邮箱地址。"
|
|
81
66
|
},
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"confirmRequired": "请确认您的密码",
|
|
87
|
-
"mismatch": "密码不匹配",
|
|
88
|
-
"confirmHint": "重新输入您的密码以确认"
|
|
67
|
+
"passkey": {
|
|
68
|
+
"title": "创建你的通行密钥",
|
|
69
|
+
"subtitle": "用指纹、面容或屏幕锁登录,无需记住任何东西。",
|
|
70
|
+
"action": "创建通行密钥"
|
|
89
71
|
},
|
|
90
|
-
"
|
|
91
|
-
"title": "快完成了!",
|
|
92
|
-
"subtitle": "查看您的信息并创建账户",
|
|
93
|
-
"sectionTitle": "账户信息",
|
|
94
|
-
"fields": {
|
|
95
|
-
"username": "用户名",
|
|
96
|
-
"email": "电子邮件",
|
|
97
|
-
"password": "密码"
|
|
98
|
-
},
|
|
99
|
-
"notSet": "未设置",
|
|
100
|
-
"securityTip": "为了更强的安全性,创建账户后,请在账户设置中启用生物识别身份验证。",
|
|
101
|
-
"legalReminder": "创建账户即表示您同意我们的服务条款和隐私政策。"
|
|
102
|
-
}
|
|
72
|
+
"commonsInstead": "想自己保管密钥?改用 Commons"
|
|
103
73
|
},
|
|
104
74
|
"accountSwitcher": {
|
|
105
|
-
"sections": {
|
|
106
|
-
"yourAccounts": "你的账户"
|
|
107
|
-
},
|
|
108
75
|
"loading": "正在加载账户...",
|
|
109
76
|
"qrHeadline": "使用您的 Oxy 身份登录",
|
|
110
77
|
"signInWithOxy": "使用 Oxy 登录",
|
|
@@ -136,10 +103,7 @@
|
|
|
136
103
|
"claimFailed": "登录已获批准,但未能完成。请重试。",
|
|
137
104
|
"generic": "登录失败,请重试。"
|
|
138
105
|
},
|
|
139
|
-
"linkOpenFailed": "无法打开链接,请重试。"
|
|
140
|
-
"continueWithPasskey": "继续",
|
|
141
|
-
"passkeyHint": "使用指纹、面容或设备 PIN 码。",
|
|
142
|
-
"otherDeviceCommons": "账号在其他设备上?用 Commons 扫码"
|
|
106
|
+
"linkOpenFailed": "无法打开链接,请重试。"
|
|
143
107
|
},
|
|
144
108
|
"common": {
|
|
145
109
|
"actions": {
|
|
@@ -280,7 +244,63 @@
|
|
|
280
244
|
"help": "帮助与反馈",
|
|
281
245
|
"signOut": "退出登录",
|
|
282
246
|
"privacy": "隐私政策",
|
|
283
|
-
"terms": "服务条款"
|
|
284
|
-
|
|
247
|
+
"terms": "服务条款"
|
|
248
|
+
},
|
|
249
|
+
"recover": {
|
|
250
|
+
"title": "恢复你的账户",
|
|
251
|
+
"subtitle": "输入你的用户名或恢复邮箱。我们会向该账户的恢复邮箱发送验证码。",
|
|
252
|
+
"identifier": {
|
|
253
|
+
"label": "用户名或邮箱",
|
|
254
|
+
"placeholder": "yourname",
|
|
255
|
+
"required": "请输入用户名或邮箱。"
|
|
256
|
+
},
|
|
257
|
+
"commonsNote": "你的账户使用 Commons?请在 Commons 中用恢复短语恢复。",
|
|
258
|
+
"passkey": {
|
|
259
|
+
"title": "添加新的通行密钥",
|
|
260
|
+
"subtitle": "用于 @{{username}}。丢失的通行密钥可稍后在账户安全设置中移除。",
|
|
261
|
+
"action": "创建通行密钥"
|
|
262
|
+
},
|
|
263
|
+
"backToSignIn": "返回登录"
|
|
264
|
+
},
|
|
265
|
+
"emailCode": {
|
|
266
|
+
"title": "查看你的邮箱",
|
|
267
|
+
"sentTo": "我们已向 {{email}} 发送了 6 位验证码。",
|
|
268
|
+
"sentIfAccount": "如果该账户有恢复邮箱,我们已向其发送 6 位验证码。",
|
|
269
|
+
"label": "验证码",
|
|
270
|
+
"resend": "发送新验证码",
|
|
271
|
+
"resent": "我们已发送新验证码。",
|
|
272
|
+
"changeEmail": "使用其他邮箱",
|
|
273
|
+
"errors": {
|
|
274
|
+
"codeInvalid": "验证码不正确或已过期。",
|
|
275
|
+
"tooManyAttempts": "错误次数过多,请重新获取验证码。",
|
|
276
|
+
"expired": "耗时过长,请重新开始。",
|
|
277
|
+
"unavailable": "Oxy 暂时无法发送邮件,请稍后再试。",
|
|
278
|
+
"rateLimited": "验证码请求过多,请稍后再试。"
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
"deleteAccount": {
|
|
282
|
+
"passkey": {
|
|
283
|
+
"subtitle": "请用通行密钥确认。@{{username}} 及其中的一切将被永久删除。",
|
|
284
|
+
"action": "用通行密钥删除",
|
|
285
|
+
"done": "你的账户已删除。",
|
|
286
|
+
"closeWindow": "你可以关闭此窗口。",
|
|
287
|
+
"commons": "此账户使用 Commons:请在 Oxy Commons 的“设置 > 删除账户”中用其密钥删除。"
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
"linkCommons": {
|
|
291
|
+
"title": "关联 Commons",
|
|
292
|
+
"subtitle": "自己保管密钥:关联 Commons 后,此账户只属于你。它的恢复邮箱会被删除,今后用 Commons 中的恢复短语找回账户。",
|
|
293
|
+
"scan": "在手机上打开 Commons,选择“我在网页上有 Oxy 账户”,然后扫描此码。",
|
|
294
|
+
"waiting": "正在等待 Commons…",
|
|
295
|
+
"compareTitle": "核对代码",
|
|
296
|
+
"compare": "Commons 会显示相同的代码。如果不同,请取消。",
|
|
297
|
+
"confirm": "是的,关联 Commons",
|
|
298
|
+
"cancel": "取消",
|
|
299
|
+
"doneTitle": "Commons 已关联",
|
|
300
|
+
"done": "此账户现在由你自己保管。它的恢复邮箱已删除:今后用 Commons 中的恢复短语找回账户。",
|
|
301
|
+
"already": "此账户已在使用 Commons。",
|
|
302
|
+
"expired": "此代码已过期。",
|
|
303
|
+
"renew": "显示新代码",
|
|
304
|
+
"failed": "无法关联 Commons,请重试。"
|
|
285
305
|
}
|
|
286
306
|
}
|
package/src/index.ts
CHANGED
|
@@ -344,55 +344,11 @@ export {
|
|
|
344
344
|
export type { AeadResult } from './crypto/aead';
|
|
345
345
|
export { deriveSharedSecret } from './crypto/ecdh';
|
|
346
346
|
|
|
347
|
-
//
|
|
348
|
-
//
|
|
349
|
-
export {
|
|
350
|
-
WEB_IDENTITY_PRF_INPUT,
|
|
351
|
-
WebIdentityUnlockError,
|
|
352
|
-
WEB_IDENTITY_PRF_OUTPUT_LENGTH,
|
|
353
|
-
addWrap,
|
|
354
|
-
deriveIdentityFromMnemonic,
|
|
355
|
-
deriveIdentityFromPrivateKey,
|
|
356
|
-
deriveIdentityFromRecoveryMaterial,
|
|
357
|
-
deriveKeyEncryptionKey,
|
|
358
|
-
generateDataKey,
|
|
359
|
-
generateWebIdentity,
|
|
360
|
-
isUsablePrfOutput,
|
|
361
|
-
markWrapVerified,
|
|
362
|
-
normalizeMnemonic,
|
|
363
|
-
openWebIdentity,
|
|
364
|
-
parseRecoveryMaterial,
|
|
365
|
-
removeWrap,
|
|
366
|
-
sealWebIdentity,
|
|
367
|
-
unlockWebIdentity,
|
|
368
|
-
unwrapDataKey,
|
|
369
|
-
wipeBytes,
|
|
370
|
-
wipeOpenedIdentity,
|
|
371
|
-
} from './crypto/webIdentityCarrier';
|
|
372
|
-
export type {
|
|
373
|
-
OpenedMnemonicIdentity,
|
|
374
|
-
OpenedRawKeyIdentity,
|
|
375
|
-
OpenedWebIdentity,
|
|
376
|
-
WebIdentityRecoveryMaterial,
|
|
377
|
-
WebIdentityUnlockFailure,
|
|
378
|
-
WrapInput,
|
|
379
|
-
} from './crypto/webIdentityCarrier';
|
|
347
|
+
// Identity proofs — the one signed format for operations on a personal root
|
|
348
|
+
// (docs/adr/0024-one-oxy-account-root-holders.md D7)
|
|
380
349
|
export { digestIdentityPayload, signIdentityProof } from './crypto/identityProof';
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
createMoveCommitment,
|
|
384
|
-
deriveMoveKey,
|
|
385
|
-
deriveMoveSas,
|
|
386
|
-
digestMoveCiphertext,
|
|
387
|
-
generateMoveEphemeralKeyPair,
|
|
388
|
-
openMovedIdentity,
|
|
389
|
-
parseMoveQrPayload,
|
|
390
|
-
sealIdentityForMove,
|
|
391
|
-
signMoveReceipt,
|
|
392
|
-
verifyMoveCommitment,
|
|
393
|
-
verifyMoveReceipt,
|
|
394
|
-
} from './crypto/identityMove';
|
|
395
|
-
export type { MoveReceiptClaims } from './crypto/identityMove';
|
|
350
|
+
// Linking Commons to a passkey account: the code both screens compare (ADR 0029 D3)
|
|
351
|
+
export { deriveIdentityLinkCode } from './crypto/identityLink';
|
|
396
352
|
|
|
397
353
|
// ---------------------------------------------------------------------------
|
|
398
354
|
// Devices
|
|
@@ -411,6 +367,8 @@ export type {
|
|
|
411
367
|
User,
|
|
412
368
|
LoginResponse,
|
|
413
369
|
Notification,
|
|
370
|
+
NotificationActor,
|
|
371
|
+
NotificationPage,
|
|
414
372
|
Wallet,
|
|
415
373
|
Transaction,
|
|
416
374
|
BlockedUser,
|
|
@@ -682,7 +640,7 @@ export type { QuickAccount, DisplayNameUserShape } from './utils/accountUtils';
|
|
|
682
640
|
// `*.oxy.so`).
|
|
683
641
|
// ---------------------------------------------------------------------------
|
|
684
642
|
export { registrableApex } from './utils/registrableApex';
|
|
685
|
-
export {
|
|
643
|
+
export { AUTH_WEB_ORIGIN, CENTRAL_IDP_APEX } from './utils/authWebUrl';
|
|
686
644
|
|
|
687
645
|
// WebAuthn relying-party origin guard (client side). Mirrors the server's
|
|
688
646
|
// `isOxyApexOrigin` so consumers can decide whether to offer passkey UI on the
|
|
@@ -722,7 +680,7 @@ export {
|
|
|
722
680
|
persistOAuthReturnPath,
|
|
723
681
|
consumeOAuthReturnPath,
|
|
724
682
|
} from './utils/oauthPkce';
|
|
725
|
-
export type { PkcePair, BuildOAuthAuthorizeUrlParams } from './utils/oauthPkce';
|
|
683
|
+
export type { PkcePair, BuildOAuthAuthorizeUrlParams, OxyAuthScreen } from './utils/oauthPkce';
|
|
726
684
|
|
|
727
685
|
export {
|
|
728
686
|
isLoopbackOrigin,
|
|
@@ -827,7 +785,6 @@ export type {
|
|
|
827
785
|
AccountDialogView,
|
|
828
786
|
CommonsAvailability,
|
|
829
787
|
ContextChoiceOutcome,
|
|
830
|
-
PopupWindowHandle,
|
|
831
788
|
SignInFailureReason,
|
|
832
789
|
SignInFlowPhase,
|
|
833
790
|
SignInFlowState,
|
|
@@ -9,7 +9,15 @@ import type {
|
|
|
9
9
|
LoginResult,
|
|
10
10
|
CommonsDenyReason,
|
|
11
11
|
} from '@oxy.so/contracts';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
emailVerificationConfirmResponseSchema,
|
|
14
|
+
emailVerificationStartResponseSchema,
|
|
15
|
+
loginResultSchema,
|
|
16
|
+
safeParseContract,
|
|
17
|
+
type EmailVerificationConfirmResponse,
|
|
18
|
+
type EmailVerificationStartRequest,
|
|
19
|
+
type EmailVerificationStartResponse,
|
|
20
|
+
} from '@oxy.so/contracts';
|
|
13
21
|
import type { SessionLoginResponse } from '../models/session';
|
|
14
22
|
import type { OxyServicesBase } from '../OxyServices.base';
|
|
15
23
|
import type { PublicApplication } from './OxyServices.connectedApps';
|
|
@@ -1692,12 +1700,43 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
1692
1700
|
}
|
|
1693
1701
|
|
|
1694
1702
|
/**
|
|
1695
|
-
*
|
|
1703
|
+
* Send a 6-digit code to an email (ADR 0029 D3): the recovery email of a
|
|
1704
|
+
* new passkey account (`purpose: 'signup'`), or — named by username or
|
|
1705
|
+
* email — the recovery email of an account being recovered
|
|
1706
|
+
* (`purpose: 'recovery'`). The answer is the same whether or not an
|
|
1707
|
+
* account exists; nothing is revealed about who has one.
|
|
1696
1708
|
*/
|
|
1697
|
-
async
|
|
1709
|
+
async startEmailVerification(request: EmailVerificationStartRequest): Promise<EmailVerificationStartResponse> {
|
|
1698
1710
|
try {
|
|
1699
|
-
|
|
1700
|
-
|
|
1711
|
+
const res = await this.makeRequest<unknown>('POST', '/auth/email/verify/start', request, {
|
|
1712
|
+
cache: false,
|
|
1713
|
+
skipAuth: true,
|
|
1714
|
+
});
|
|
1715
|
+
const parsed = safeParseContract(emailVerificationStartResponseSchema, res);
|
|
1716
|
+
if (!parsed) throw new Error('auth/email/verify/start returned an unexpected response shape');
|
|
1717
|
+
return parsed;
|
|
1718
|
+
} catch (error) {
|
|
1719
|
+
throw this.handleError(error);
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
/**
|
|
1724
|
+
* Confirm the code {@link startEmailVerification} sent. Resolves to a
|
|
1725
|
+
* short-lived one-use ticket: a sign-up passes it (with the email) to
|
|
1726
|
+
* {@link webauthnRegisterVerify}; a recovery passes it as `recoveryTicket`
|
|
1727
|
+
* to {@link webauthnRegisterOptions} and {@link webauthnRegisterVerify}.
|
|
1728
|
+
*/
|
|
1729
|
+
async confirmEmailVerification(verificationId: string, code: string): Promise<EmailVerificationConfirmResponse> {
|
|
1730
|
+
try {
|
|
1731
|
+
const res = await this.makeRequest<unknown>(
|
|
1732
|
+
'POST',
|
|
1733
|
+
'/auth/email/verify/confirm',
|
|
1734
|
+
{ verificationId, code },
|
|
1735
|
+
{ cache: false, skipAuth: true },
|
|
1736
|
+
);
|
|
1737
|
+
const parsed = safeParseContract(emailVerificationConfirmResponseSchema, res);
|
|
1738
|
+
if (!parsed) throw new Error('auth/email/verify/confirm returned an unexpected response shape');
|
|
1739
|
+
return parsed;
|
|
1701
1740
|
} catch (error) {
|
|
1702
1741
|
throw this.handleError(error);
|
|
1703
1742
|
}
|
|
@@ -1708,19 +1747,24 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
1708
1747
|
* `PublicKeyCredentialCreationOptions` the browser's `navigator.credentials
|
|
1709
1748
|
* .create()` (or `@simplewebauthn/browser`'s `startRegistration`) needs.
|
|
1710
1749
|
*
|
|
1711
|
-
* With a bearer token planted this
|
|
1712
|
-
*
|
|
1713
|
-
*
|
|
1714
|
-
*
|
|
1715
|
-
* as `unknown` for the caller
|
|
1750
|
+
* With a bearer token planted this adds a passkey to the signed-in account.
|
|
1751
|
+
* Without one, `username` is a prospective sign-up's handle, and
|
|
1752
|
+
* `recoveryTicket` a recovery's new passkey for the account it names. The
|
|
1753
|
+
* returned options are OPAQUE — Oxy does not own their shape (the browser /
|
|
1754
|
+
* `@simplewebauthn` does), so they pass through as `unknown` for the caller
|
|
1755
|
+
* to hand straight to the ceremony.
|
|
1716
1756
|
*/
|
|
1717
|
-
async webauthnRegisterOptions(username?: string): Promise<unknown> {
|
|
1757
|
+
async webauthnRegisterOptions(request: { username?: string; recoveryTicket?: string } = {}): Promise<unknown> {
|
|
1758
|
+
const signedOut = request.username !== undefined || request.recoveryTicket !== undefined;
|
|
1718
1759
|
try {
|
|
1719
1760
|
return await this.makeRequest<unknown>(
|
|
1720
1761
|
'POST',
|
|
1721
1762
|
'/auth/webauthn/register/options',
|
|
1722
|
-
{
|
|
1723
|
-
|
|
1763
|
+
{
|
|
1764
|
+
...(request.username !== undefined ? { username: request.username } : {}),
|
|
1765
|
+
...(request.recoveryTicket !== undefined ? { recoveryTicket: request.recoveryTicket } : {}),
|
|
1766
|
+
},
|
|
1767
|
+
{ cache: false, ...(signedOut ? { skipAuth: true } : {}) },
|
|
1724
1768
|
);
|
|
1725
1769
|
} catch (error) {
|
|
1726
1770
|
throw this.handleError(error);
|
|
@@ -1732,10 +1776,12 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
1732
1776
|
* browser `RegistrationResponseJSON` (`response`) alongside the Oxy envelope
|
|
1733
1777
|
* (desired `username` for signup + the device-session naming fields).
|
|
1734
1778
|
*
|
|
1735
|
-
*
|
|
1736
|
-
* - **
|
|
1737
|
-
*
|
|
1738
|
-
*
|
|
1779
|
+
* Server branches, disambiguated by the response shape:
|
|
1780
|
+
* - **Sign-up** (no bearer; `username`, `email`, `emailTicket`) and
|
|
1781
|
+
* **recovery** (no bearer; `recoveryTicket`): the account is created, or
|
|
1782
|
+
* gains the passkey, and a session is minted — the response carries
|
|
1783
|
+
* `sessionId`, is the SAME {@link LoginResult} contract as
|
|
1784
|
+
* `POST /auth/verify`, and its access token is planted here.
|
|
1739
1785
|
* - **Link** (bearer present): the passkey is attached to the signed-in
|
|
1740
1786
|
* account and the server returns `{ success, message }` with no session,
|
|
1741
1787
|
* which is returned verbatim (no token planting).
|
|
@@ -1744,14 +1790,13 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
1744
1790
|
response: unknown,
|
|
1745
1791
|
envelope: {
|
|
1746
1792
|
username?: string;
|
|
1793
|
+
/** Sign-up: the recovery email, confirmed with `emailTicket`. */
|
|
1794
|
+
email?: string;
|
|
1795
|
+
emailTicket?: string;
|
|
1796
|
+
/** Recovery: the ticket {@link confirmEmailVerification} returned. */
|
|
1797
|
+
recoveryTicket?: string;
|
|
1747
1798
|
deviceName?: string;
|
|
1748
1799
|
deviceFingerprint?: string;
|
|
1749
|
-
/**
|
|
1750
|
-
* Sign-up only: the root created on the holder before this call, sealed
|
|
1751
|
-
* under the passkey being registered, plus its `enroll_identity` proof
|
|
1752
|
-
* (ADR 0024 D4). The account is created WITH it or not at all.
|
|
1753
|
-
*/
|
|
1754
|
-
identity?: { envelope: WebIdentityEnvelope; proof: IdentityProof };
|
|
1755
1800
|
} = {},
|
|
1756
1801
|
): Promise<{ success: true; message: string } | LoginResult> {
|
|
1757
1802
|
try {
|
|
@@ -1759,7 +1804,10 @@ export function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T)
|
|
|
1759
1804
|
'POST',
|
|
1760
1805
|
'/auth/webauthn/register/verify',
|
|
1761
1806
|
{ response, ...envelope },
|
|
1762
|
-
{
|
|
1807
|
+
{
|
|
1808
|
+
cache: false,
|
|
1809
|
+
...(envelope.username !== undefined || envelope.recoveryTicket !== undefined ? { skipAuth: true } : {}),
|
|
1810
|
+
},
|
|
1763
1811
|
);
|
|
1764
1812
|
if (res && typeof res === 'object') {
|
|
1765
1813
|
const record = res as Record<string, unknown>;
|
|
@@ -23,8 +23,16 @@
|
|
|
23
23
|
* on-device identity and throw on web (where `KeyManager.getPublicKey()` is
|
|
24
24
|
* always `null`).
|
|
25
25
|
*/
|
|
26
|
+
import {
|
|
27
|
+
IDENTITY_PROOF_ACTIONS,
|
|
28
|
+
identityLinkCreateResponseSchema,
|
|
29
|
+
identityLinkStateSchema,
|
|
30
|
+
safeParseContract,
|
|
31
|
+
} from '@oxy.so/contracts';
|
|
26
32
|
import type {
|
|
27
33
|
AuthMethodsResponse,
|
|
34
|
+
IdentityLinkCreateResponse,
|
|
35
|
+
IdentityLinkState,
|
|
28
36
|
IdentityRootStatus,
|
|
29
37
|
DidDocument,
|
|
30
38
|
DomainVerificationInstructions,
|
|
@@ -38,6 +46,8 @@ import type {
|
|
|
38
46
|
import { signMessage } from '@oxy.so/protocol';
|
|
39
47
|
import type { OxyServicesBase } from '../OxyServices.base';
|
|
40
48
|
import { KeyManager } from '../crypto/keyManager';
|
|
49
|
+
import { deriveIdentityLinkCode } from '../crypto/identityLink';
|
|
50
|
+
import { signIdentityProof } from '../crypto/identityProof';
|
|
41
51
|
import { SignatureService } from '../crypto/signatureService';
|
|
42
52
|
import { RecoveryPhraseService, type PendingIdentityResult } from '../crypto/recoveryPhrase';
|
|
43
53
|
import { isWeb } from '../utils/platform';
|
|
@@ -219,11 +229,9 @@ export function OxyServicesIdentityMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
219
229
|
}
|
|
220
230
|
|
|
221
231
|
/**
|
|
222
|
-
*
|
|
223
|
-
* linked,
|
|
224
|
-
*
|
|
225
|
-
* nothing here can open the root — so any first-party surface may show a
|
|
226
|
-
* "save your recovery phrase" reminder from it.
|
|
232
|
+
* How the signed-in account is kept (ADR 0029 D3): whether Commons' root is
|
|
233
|
+
* linked (self-custody), or the recovery email of a passkey account. Any
|
|
234
|
+
* first-party surface may read it to recommend linking Commons.
|
|
227
235
|
*/
|
|
228
236
|
async getIdentityRootStatus(): Promise<IdentityRootStatus> {
|
|
229
237
|
try {
|
|
@@ -233,15 +241,125 @@ export function OxyServicesIdentityMixin<T extends typeof OxyServicesBase>(Base:
|
|
|
233
241
|
}
|
|
234
242
|
}
|
|
235
243
|
|
|
244
|
+
/**
|
|
245
|
+
* Open a request to link Commons to the signed-in passkey account (ADR 0029
|
|
246
|
+
* D3). auth.oxy.so shows its `qrPayload`; Commons scans it and signs with
|
|
247
|
+
* {@link signIdentityLink}.
|
|
248
|
+
*/
|
|
249
|
+
async createIdentityLink(): Promise<IdentityLinkCreateResponse> {
|
|
250
|
+
try {
|
|
251
|
+
const res = await this.makeRequest<unknown>('POST', '/identity/link', undefined, { cache: false });
|
|
252
|
+
const parsed = safeParseContract(identityLinkCreateResponseSchema, res);
|
|
253
|
+
if (!parsed) throw new Error('identity/link returned an unexpected response shape');
|
|
254
|
+
return parsed;
|
|
255
|
+
} catch (error) {
|
|
256
|
+
throw this.handleError(error);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** Where a link request stands. Both devices poll it; it needs no session. */
|
|
261
|
+
async getIdentityLink(linkId: string): Promise<IdentityLinkState> {
|
|
262
|
+
try {
|
|
263
|
+
const res = await this.makeRequest<unknown>('GET', `/identity/link/${encodeURIComponent(linkId)}`, undefined, {
|
|
264
|
+
cache: false,
|
|
265
|
+
skipAuth: true,
|
|
266
|
+
});
|
|
267
|
+
const parsed = safeParseContract(identityLinkStateSchema, res);
|
|
268
|
+
if (!parsed) throw new Error('identity/link returned an unexpected response shape');
|
|
269
|
+
return parsed;
|
|
270
|
+
} catch (error) {
|
|
271
|
+
throw this.handleError(error);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Commons' half: sign the scanned request's `link_identity` proof with THIS
|
|
277
|
+
* device's identity key and post it. NATIVE-ONLY (the key lives in native
|
|
278
|
+
* secure storage). Resolves to the key and the 6-digit code auth.oxy.so will
|
|
279
|
+
* show for it, for the person to compare.
|
|
280
|
+
*/
|
|
281
|
+
async signIdentityLink(linkId: string, challenge: string): Promise<{ publicKey: string; code: string; username: string | null }> {
|
|
282
|
+
try {
|
|
283
|
+
const [privateKey, publicKey] = await Promise.all([KeyManager.getPrivateKey(), KeyManager.getPublicKey()]);
|
|
284
|
+
if (!privateKey || !publicKey) {
|
|
285
|
+
throw new Error('No identity on this device to link');
|
|
286
|
+
}
|
|
287
|
+
const root = publicKey.trim().toLowerCase();
|
|
288
|
+
const state = await this.getIdentityLink(linkId);
|
|
289
|
+
const proof = await signIdentityProof(
|
|
290
|
+
{ privateKey, publicKey: root },
|
|
291
|
+
{
|
|
292
|
+
action: IDENTITY_PROOF_ACTIONS.link,
|
|
293
|
+
subject: state.userId,
|
|
294
|
+
actor: state.userId,
|
|
295
|
+
rootPublicKey: root,
|
|
296
|
+
payloadDigest: null,
|
|
297
|
+
expectedRevision: null,
|
|
298
|
+
audience: state.audience,
|
|
299
|
+
challenge,
|
|
300
|
+
expiresAt: state.expiresAt,
|
|
301
|
+
},
|
|
302
|
+
);
|
|
303
|
+
await this.makeRequest<unknown>(
|
|
304
|
+
'POST',
|
|
305
|
+
`/identity/link/${encodeURIComponent(linkId)}/proof`,
|
|
306
|
+
{ publicKey: root, proof },
|
|
307
|
+
{ cache: false, skipAuth: true },
|
|
308
|
+
);
|
|
309
|
+
return { publicKey: root, code: deriveIdentityLinkCode(linkId, root), username: state.username };
|
|
310
|
+
} catch (error) {
|
|
311
|
+
throw this.handleError(error);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** WebAuthn request options over the account's passkeys, whose challenge is the link's. Opaque. */
|
|
316
|
+
async getIdentityLinkAssertionOptions(linkId: string, challenge: string): Promise<unknown> {
|
|
317
|
+
try {
|
|
318
|
+
return await this.makeRequest<unknown>(
|
|
319
|
+
'POST',
|
|
320
|
+
`/identity/link/${encodeURIComponent(linkId)}/options`,
|
|
321
|
+
{ challenge },
|
|
322
|
+
{ cache: false },
|
|
323
|
+
);
|
|
324
|
+
} catch (error) {
|
|
325
|
+
throw this.handleError(error);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* auth.oxy.so's half: the passkey assertion over the link's challenge. The
|
|
331
|
+
* account gains Commons' root and loses its recovery email.
|
|
332
|
+
*/
|
|
333
|
+
async completeIdentityLink(linkId: string, assertion: unknown): Promise<{ success: true }> {
|
|
334
|
+
try {
|
|
335
|
+
const result = await this.makeRequest<{ success: true }>(
|
|
336
|
+
'POST',
|
|
337
|
+
`/identity/link/${encodeURIComponent(linkId)}/complete`,
|
|
338
|
+
{ assertion },
|
|
339
|
+
{ cache: false },
|
|
340
|
+
);
|
|
341
|
+
this._invalidateIdentityCaches(this.getCurrentUserId());
|
|
342
|
+
return result;
|
|
343
|
+
} catch (error) {
|
|
344
|
+
throw this.handleError(error);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** Withdraw a link request that has not completed. */
|
|
349
|
+
async cancelIdentityLink(linkId: string): Promise<void> {
|
|
350
|
+
try {
|
|
351
|
+
await this.makeRequest<unknown>('DELETE', `/identity/link/${encodeURIComponent(linkId)}`, undefined, { cache: false });
|
|
352
|
+
} catch (error) {
|
|
353
|
+
throw this.handleError(error);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
236
357
|
/**
|
|
237
358
|
* Remove ONE passkey (WebAuthn credential) from the current account.
|
|
238
359
|
*
|
|
239
360
|
* Passkeys are per-credential, so this targets a specific credential id.
|
|
240
361
|
* The server refuses to remove the last remaining auth method (the account
|
|
241
362
|
* would become inaccessible) and deletes the stored `WebauthnCredential`.
|
|
242
|
-
* A passkey that also opens the account's root on the web takes its wrap with
|
|
243
|
-
* it, and the ONLY such passkey is refused with
|
|
244
|
-
* `code: 'IDENTITY_LAST_WEB_HOLDER'` (ADR 0024 D6).
|
|
245
363
|
*
|
|
246
364
|
* @param credentialId - The passkey's public credential id
|
|
247
365
|
* (`AuthMethodEntry.credentialId`).
|