/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
go/libkb/social_assertion.go
33 строки
1 KB
Joshua Blum
Add generic proof support to assertion language (#13624)
14 сен 2018, 18:22
Не верифицирован
14 сен 2018, 18:22
db15304
Код
Авторство
О чём код?
// Copyright 2015 Keybase, Inc. All rights reserved. Use of // this source code is governed by the included BSD license. package libkb import ( keybase1 "github.com/keybase/client/go/protocol/keybase1" ) // IsSocialAssertion returns true for strings that are valid // social assertions. They do not need to be normalized, so // user@twitter and twitter:user will work, as will // USER@Twitter. func IsSocialAssertion(ctx AssertionContext, s string) bool { _, ok := NormalizeSocialAssertion(ctx, s) return ok } // NormalizeSocialAssertion creates a SocialAssertion from its // input and normalizes it. The service name will be lowercased. // If the service is case-insensitive, then the username will also // be lowercased. Colon assertions (twitter:user) will be // transformed to the user@twitter format. func NormalizeSocialAssertion(ctx AssertionContext, s string) (keybase1.SocialAssertion, bool) { url, err := ParseAssertionURL(ctx, s, true) if err != nil || !url.IsRemote() { return keybase1.SocialAssertion{}, false } return keybase1.SocialAssertion{ User: url.GetValue(), Service: keybase1.SocialAssertionService(url.GetKey()), }, true }