extractSignature
서명된 Git 개체(커밋, 태그 등)에서 서명을 추출해요.
시그니처
ts
class Repository {
extractSignature(oid: string): ExtractedSignature | null;
}
파라미터
- oid필수 · string
서명을 추출할 서명된 개체의 ID(SHA1)예요.
반환 값
- ExtractedSignature | null
개체가 서명된 경우 서명과 서명된 데이터를 포함하는 ExtractedSignature 객체를 반환하고, 개체가 서명되지 않은 경우 null을 반환해요.
- signaturestring
Git 개체의 GPG 서명이에요.
- signedDatastring
Git 개체의 서명된 데이터예요.
- signaturestring
예제
ts
import { openRepository } from 'es-git';
const repo = await openRepository('.');
const commit = repo.getCommit('a01e9888e46729ef4aa68953ba19b02a7a64eb82');
// 커밋에서 서명 추출하기
const signatureInfo = repo.extractSignature(commit.id());
if (signatureInfo) {
console.log('서명된 커밋이예요!');
console.log('서명:', signatureInfo.signature);
console.log('서명된 데이터:', signatureInfo.signedData);
} else {
console.log('서명되지 않은 커밋이예요');
}