Sign In With QoreChain: sunucu doğrulaması
SIWQ, hesabın secp256k1 anahtarı (ADR-36) ve ML-DSA-87 anahtarı tarafından imzalanan, EIP-4361 tarzı bir oturum açma mesajıdır. Biçim: Sign In With QoreChain v1.
Akış
- Sunucu, oturum için tek kullanımlık bir nonce üretir.
- İstemci mesajı
createSiwqMessageile oluşturur ve cüzdansignSiwqile imzalar (veya klasik kısmısignArbitraryile, ML-DSA-87 kısmını isesiwqPqSignBytes(message)üzerindepqSignile üretir). - Sunucu
verifySiwqWithChainile doğrular; bu işlev mesajı, nonce'u, alan adını, zamanları, klasik anahtarın adresi kontrol ettiğini ve ML-DSA-87 imzasını adres için zincirde kayıtlı anahtara karşı denetler (bkz. Doğrulama).
TypeScript
import { verifySiwqWithChain } from "@qorechain/qoresign/network";
const fields = await verifySiwqWithChain({
rest: "https://api.qore.host",
address: body.address,
message: body.message,
signature: body.signature,
domain: "app.example.com", // the host the request came to
nonce: session.nonce, // single use; delete it now
chainId: "qorechain-vladi",
});
// fields.address is signed in; fields.possessionProven tells whether the key was registered with a proof of possession
Go
import (
qoresign "github.com/qorechain/qoresign/go"
"github.com/qorechain/qoresign/go/network"
)
// The network helpers are methods on a client.
client := network.NewClient("https://api.qore.host")
var sig qoresign.SiwqSignature
if err := json.Unmarshal(signatureJSON, &sig); err != nil {
return err
}
result, err := client.VerifySiwqWithChain(ctx, address, qoresign.VerifySiwqOptions{
Message: message,
Signature: sig,
Domain: "app.example.com", // the host the request came to
Nonce: issuedNonce, // the nonce your server issued
ChainID: "qorechain-vladi",
})
if qoresign.IsCode(err, qoresign.CodeSiwqExpired) {
// ask the user to sign in again
}
// result.Address signed in; result.PossessionProven reports how the key was registered.
Yalnızca klasik hesaplar
verifySiwq, requirePq: false verilmedikçe ML-DSA-87 kısmı olmayan bir oturum
açmayı reddeder. Yalnızca klasik oturum açmaları, ancak hizmetiniz kuantum sonrası
güvenceye ihtiyaç duymuyorsa kabul edin.
Çalıştırılabilir bir sunucu
examples/siwq-server
içindedir.