TsgcWSAPIServer_WebAuthn › Methods › AddCredential
Registers an existing credential in the server credential store so the user can authenticate later.
procedure AddCredential(const aCredential : TsgcWebAuthn_CredentialRecord);
| Name | Type | Description |
|---|---|---|
aCredential | const TsgcWebAuthn_CredentialRecord | Record that holds the user identifier, credential id, public key, sign counter and attestation data returned by the authenticator. |
Use this overload to restore credentials previously persisted by the application (for example from a database) into the in-memory store used by the Relying Party, typically during server startup.
var
oCred: TsgcWebAuthn_CredentialRecord;
begin
oCred.UserId := 'user@test.com';
oCred.CredId := vCredentialIdFromDB;
oCred.PublicKey := vPublicKeyFromDB;
oCred.SignCount := 0;
sgcWSAPIServer_WebAuthn1.AddCredential(oCred);
end;
procedure AddCredential(const aJSON: string);
| Name | Type | Description |
|---|---|---|
aJSON | const string | JSON string that describes the credential (user id, credential id, public key, sign counter) as serialized by a previous registration. |
This overload is a convenience when credentials are stored as JSON blobs. The JSON is parsed internally and converted to a TsgcWebAuthn_CredentialRecord before being added to the store.
sgcWSAPIServer_WebAuthn1.AddCredential(vJSONFromDB);