자격 증명

자격 증명은 솔라나 증명 시스템에서 증명 기관을 나타냅니다. 자격 증명은 누가 증명을 발급할 수 있는지와 어떤 유형의 증명을 발급할 수 있는지를 정의합니다. 각 자격 증명에는 해당 기관의 권한으로 증명을 생성할 수 있는 승인된 서명자 집합이 있습니다.

구조

Credential 구조체는 솔라나 증명 시스템의 자격 증명을 나타냅니다. 각 자격 증명은 증명을 발급할 수 있는 기관과 그렇게 할 권한이 있는 서명자를 정의합니다.

타입 정의

Credential

export type Credential = {
discriminator: number; // Internal discriminator
authority: Address; // Authority public key
name: ReadonlyUint8Array; // Credential name
authorizedSigners: Array<Address>; // List of authorized signers
};

메서드

자격 증명 가져오기

메서드설명매개변수반환값
fetchCredential주소로 단일 자격 증명을 가져옵니다rpc: RPC 컨텍스트, address: 자격 증명 주소, config?: 가져오기 구성Promise<Account<Credential>>
fetchMaybeCredential자격 증명을 안전하게 가져오며, 찾을 수 없으면 null을 반환합니다rpc: RPC 컨텍스트, address: 자격 증명 주소, config?: 가져오기 구성Promise<MaybeAccount<Credential>>
fetchAllCredential주소로 여러 자격 증명을 가져옵니다rpc: RPC 컨텍스트, addresses: 자격 증명 주소 배열, config?: 가져오기 구성Promise<Account<Credential>[]>
fetchAllMaybeCredential여러 자격 증명을 안전하게 가져오며, 찾을 수 없는 항목은 건너뜁니다rpc: RPC 컨텍스트, addresses: 자격 증명 주소 배열, config?: 가져오기 구성Promise<MaybeAccount<Credential>[]>

직렬화

메서드설명매개변수반환값
getCredentialEncoder자격 증명 데이터의 인코더를 가져옵니다없음Encoder<CredentialArgs>
getCredentialDecoder자격 증명 데이터의 디코더를 가져옵니다없음Decoder<Credential>
getCredentialCodec자격 증명 데이터의 코덱을 가져옵니다없음Codec<CredentialArgs, Credential>

사용 예시

단일 자격 증명 조회

const credential = await fetchCredential(rpc, credentialAddress);
console.log("Credential name:", credential.name);

여러 자격 증명 조회

const credentials = await fetchAllCredential(rpc, [
credential1Address,
credential2Address
]);
credentials.forEach((credential) =>
console.log("Credential:", credential.name)
);

안전한 조회

const credential = await fetchMaybeCredential(rpc, credentialAddress);
if (credential) {
console.log("Credential found:", credential.name);
} else {
console.log("Credential not found");
}

주요 참고사항

  • discriminator 필드는 내부적으로 사용되며 수정해서는 안 됩니다
  • authority 필드는 자격 증명에 대한 제어 권한을 가진 주체를 결정합니다
  • authorizedSigners는 해당 자격 증명 하에서 증명을 생성할 수 있도록 허가된 주소들의 배열입니다
  • name 필드는 바이트 배열로 저장되며, 애플리케이션의 요구사항에 따라 적절히 인코딩/디코딩되어야 합니다
  • 승인된 서명자만이 자격 증명 하에서 증명을 생성할 수 있습니다
  • 권한 보유자는 승인된 서명자 목록을 수정할 수 있습니다

Is this page helpful?

목차

페이지 편집

관리자

© 2026 솔라나 재단.
모든 권리 보유.
연결하기