Namespace: SpawnDev.SpawnJS.JSObjects
Source: JSObjects/RelyingParty.cs
MDN Reference: RelyingParty on MDN
An object describing the relying party that requested the credential creation. Used for property CredentialCreatePublicKey.Rp https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/create#rp
| Property | Type | Access | Description |
|---|---|---|---|
RelyingParty |
class |
get | An object describing the relying party that requested the credential creation. Used for property CredentialCreatePublicKey.Rp https://developer.mozilla.org/en-US/docs/Web/API/CredentialsContainer/create#rp |
Id |
string? |
get |
| Method | Return Type | Description |
|---|---|---|
party(as identified by the publicKey.rpId in a navigator.credentials.get() |
key credential can only be used for authentication with the same relying |
SpawnDev.SpawnJS Mapping Note: The JavaScript examples below show the standard Web API usage. In SpawnDev.SpawnJS, the same API is available with C# conventions:
- Properties and methods use PascalCase (e.g.,
readyStatebecomesReadyState)- Events use ActionEvent with
+=/-=(e.g.,addEventListener("click", fn)becomesOnClick += handler)- Async methods return
Task<T>instead ofPromise<T>- Objects should be disposed with
usingstatements- Access via
JS.Get<RelyingParty>(...)or constructornew RelyingParty(...)
const credInit = {
id: "serpent1234", // "username" in a typical username/password pair
name: "Serpentina", // display name for credential
origin: "https://example.org",
password: "the last visible dog",
};
const makeCredential = document.querySelector("#make-credential");
makeCredential.addEventListener("click", async () => {
const cred = await navigator.credentials.create({
password: credInit,
});
console.log(cred.name);
// Serpentina
console.log(cred.id);
// serpent1234
console.log(cred.password);
// the last visible dog
});const credInit = {
id: "1234",
name: "Serpentina",
origin: "https://example.org",
protocol: "openidconnect",
provider: "https://provider.example.org",
};
const makeCredential = document.querySelector("#make-credential");
makeCredential.addEventListener("click", async () => {
const cred = await navigator.credentials.create({
federated: credInit,
});
console.log(cred.name);
console.log(cred.provider);
});const publicKey = {
challenge: challengeFromServer,
rp: { id: "acme.com", name: "ACME Corporation" },
user: {
id: new Uint8Array([79, 252, 83, 72, 214, 7, 89, 26]),
name: "jamiedoe",
displayName: "Jamie Doe",
},
pubKeyCredParams: [{ type: "public-key", alg: -7 }],
};
const publicKeyCredential = await navigator.credentials.create({ publicKey });