我想在我的网络应用程序中设置一个 firestore-redux 集成,但不是使用身份验证通过电子邮件进行身份验证并定义“用户”集合,而是想知道用户是否可以使用他的私钥签署消息并将哈希存储为firebase的“auth.uid”?示例:而不是像这样使用身份验证配置:
// react-redux-firebase config
const rrfConfig = {
userProfile: 'users'
UseFirestoreForProfile: true // Firestore for Profile instead of Realtime DB
}
而不是像这样设置安全规则:
// security rules
service cloud.firestore {
match /databases/{database}/documents {
// Allow only authenticated content owners access
match /some_collection/{userId}/{documents=**} {
allow read, write: if request.auth != null && request.auth.uid == userId
}
}
}
我们可以有一个自定义配置,其中文档密钥是用户的公钥,使用用户私钥的签名哈希在安全规则(用于读取和写入)中验证?
// react-redux-firebase config
const rrfConfig = {
userProfile: <<some public key or ethereum address of user>>
UseFirestoreForProfile: true // Firestore for Profile instead of Realtime DB
}
// security rules
service cloud.firestore {
match /databases/{database}/documents {
// Allow only authenticated content owners access
match /some_collection/{userPubKey}/{documents=**} {
allow read, write: if request.data.signHash!= null && request.data.signHash == resource.data.signHash
}
}
}
当使用基于以太坊(区块链)帐户的身份验证进行 Firebase 存储时,这将是相关的,而不是通常的基于电子邮件的。